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
aatarasoff/spring-thrift-starter
autoconfigure/src/main/java/info/developerblog/spring/thrift/annotation/ThriftClientsMap.java
// Path: autoconfigure/src/main/java/info/developerblog/spring/thrift/client/AbstractThriftClientKeyMapper.java // public abstract class AbstractThriftClientKeyMapper { // abstract public Map<String, ThriftClientKey> getMappings(); // }
import info.developerblog.spring.thrift.client.AbstractThriftClientKeyMapper; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target;
package info.developerblog.spring.thrift.annotation; /** * @author jihor (jihor@ya.ru) * Created on 2016-06-14 */ @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited public @interface ThriftClientsMap {
// Path: autoconfigure/src/main/java/info/developerblog/spring/thrift/client/AbstractThriftClientKeyMapper.java // public abstract class AbstractThriftClientKeyMapper { // abstract public Map<String, ThriftClientKey> getMappings(); // } // Path: autoconfigure/src/main/java/info/developerblog/spring/thrift/annotation/ThriftClientsMap.java import info.developerblog.spring.thrift.client.AbstractThriftClientKeyMapper; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; package info.developerblog.spring.thrift.annotation; /** * @author jihor (jihor@ya.ru) * Created on 2016-06-14 */ @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited public @interface ThriftClientsMap {
Class mapperClass() default AbstractThriftClientKeyMapper.class;
aatarasoff/spring-thrift-starter
examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/TGreetingServiceHandlerTests.java
// Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/configuration/CountingAspect.java // @Aspect // public class CountingAspect { // public AtomicInteger counter = new AtomicInteger(0); // // @Pointcut("execution(* org.springframework.cloud.client.loadbalancer.LoadBalancerClient.choose(..))") // private void loadBalancerServerChoice() {} // // @Before("loadBalancerServerChoice()") // public void before(){ // counter.incrementAndGet(); // } // } // // Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/configuration/TestAspectConfiguration.java // @TestConfiguration // @EnableAspectJAutoProxy // public class TestAspectConfiguration { // // @Bean // public CountingAspect countingAspect(){ // return new CountingAspect(); // } // // } // // Path: examples/simple-client/src/main/java/info/developerblog/examples/thirft/simpleclient/TGreetingServiceController.java // public static final String TIMEOUTEMULATOR = "timeoutemulator";
import info.developerblog.examples.thirft.simpleclient.configuration.CountingAspect; import info.developerblog.examples.thirft.simpleclient.configuration.TestAspectConfiguration; import org.apache.commons.pool2.impl.GenericKeyedObjectPool; import org.apache.thrift.transport.TTransportException; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.context.WebApplicationContext; import static info.developerblog.examples.thirft.simpleclient.TGreetingServiceController.TIMEOUTEMULATOR; import static org.junit.Assert.assertEquals; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
package info.developerblog.examples.thirft.simpleclient; /** * Created by aleksandr on 01.09.15. */ @RunWith(SpringRunner.class) @SpringBootTest(classes = { SimpleClientApplication.class,
// Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/configuration/CountingAspect.java // @Aspect // public class CountingAspect { // public AtomicInteger counter = new AtomicInteger(0); // // @Pointcut("execution(* org.springframework.cloud.client.loadbalancer.LoadBalancerClient.choose(..))") // private void loadBalancerServerChoice() {} // // @Before("loadBalancerServerChoice()") // public void before(){ // counter.incrementAndGet(); // } // } // // Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/configuration/TestAspectConfiguration.java // @TestConfiguration // @EnableAspectJAutoProxy // public class TestAspectConfiguration { // // @Bean // public CountingAspect countingAspect(){ // return new CountingAspect(); // } // // } // // Path: examples/simple-client/src/main/java/info/developerblog/examples/thirft/simpleclient/TGreetingServiceController.java // public static final String TIMEOUTEMULATOR = "timeoutemulator"; // Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/TGreetingServiceHandlerTests.java import info.developerblog.examples.thirft.simpleclient.configuration.CountingAspect; import info.developerblog.examples.thirft.simpleclient.configuration.TestAspectConfiguration; import org.apache.commons.pool2.impl.GenericKeyedObjectPool; import org.apache.thrift.transport.TTransportException; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.context.WebApplicationContext; import static info.developerblog.examples.thirft.simpleclient.TGreetingServiceController.TIMEOUTEMULATOR; import static org.junit.Assert.assertEquals; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; package info.developerblog.examples.thirft.simpleclient; /** * Created by aleksandr on 01.09.15. */ @RunWith(SpringRunner.class) @SpringBootTest(classes = { SimpleClientApplication.class,
TestAspectConfiguration.class
aatarasoff/spring-thrift-starter
examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/TGreetingServiceHandlerTests.java
// Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/configuration/CountingAspect.java // @Aspect // public class CountingAspect { // public AtomicInteger counter = new AtomicInteger(0); // // @Pointcut("execution(* org.springframework.cloud.client.loadbalancer.LoadBalancerClient.choose(..))") // private void loadBalancerServerChoice() {} // // @Before("loadBalancerServerChoice()") // public void before(){ // counter.incrementAndGet(); // } // } // // Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/configuration/TestAspectConfiguration.java // @TestConfiguration // @EnableAspectJAutoProxy // public class TestAspectConfiguration { // // @Bean // public CountingAspect countingAspect(){ // return new CountingAspect(); // } // // } // // Path: examples/simple-client/src/main/java/info/developerblog/examples/thirft/simpleclient/TGreetingServiceController.java // public static final String TIMEOUTEMULATOR = "timeoutemulator";
import info.developerblog.examples.thirft.simpleclient.configuration.CountingAspect; import info.developerblog.examples.thirft.simpleclient.configuration.TestAspectConfiguration; import org.apache.commons.pool2.impl.GenericKeyedObjectPool; import org.apache.thrift.transport.TTransportException; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.context.WebApplicationContext; import static info.developerblog.examples.thirft.simpleclient.TGreetingServiceController.TIMEOUTEMULATOR; import static org.junit.Assert.assertEquals; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
package info.developerblog.examples.thirft.simpleclient; /** * Created by aleksandr on 01.09.15. */ @RunWith(SpringRunner.class) @SpringBootTest(classes = { SimpleClientApplication.class, TestAspectConfiguration.class }, webEnvironment = RANDOM_PORT) public class TGreetingServiceHandlerTests { @Autowired private WebApplicationContext context; @Autowired GreetingService greetingService; @Autowired GenericKeyedObjectPool clientPool; @Autowired
// Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/configuration/CountingAspect.java // @Aspect // public class CountingAspect { // public AtomicInteger counter = new AtomicInteger(0); // // @Pointcut("execution(* org.springframework.cloud.client.loadbalancer.LoadBalancerClient.choose(..))") // private void loadBalancerServerChoice() {} // // @Before("loadBalancerServerChoice()") // public void before(){ // counter.incrementAndGet(); // } // } // // Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/configuration/TestAspectConfiguration.java // @TestConfiguration // @EnableAspectJAutoProxy // public class TestAspectConfiguration { // // @Bean // public CountingAspect countingAspect(){ // return new CountingAspect(); // } // // } // // Path: examples/simple-client/src/main/java/info/developerblog/examples/thirft/simpleclient/TGreetingServiceController.java // public static final String TIMEOUTEMULATOR = "timeoutemulator"; // Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/TGreetingServiceHandlerTests.java import info.developerblog.examples.thirft.simpleclient.configuration.CountingAspect; import info.developerblog.examples.thirft.simpleclient.configuration.TestAspectConfiguration; import org.apache.commons.pool2.impl.GenericKeyedObjectPool; import org.apache.thrift.transport.TTransportException; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.context.WebApplicationContext; import static info.developerblog.examples.thirft.simpleclient.TGreetingServiceController.TIMEOUTEMULATOR; import static org.junit.Assert.assertEquals; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; package info.developerblog.examples.thirft.simpleclient; /** * Created by aleksandr on 01.09.15. */ @RunWith(SpringRunner.class) @SpringBootTest(classes = { SimpleClientApplication.class, TestAspectConfiguration.class }, webEnvironment = RANDOM_PORT) public class TGreetingServiceHandlerTests { @Autowired private WebApplicationContext context; @Autowired GreetingService greetingService; @Autowired GenericKeyedObjectPool clientPool; @Autowired
CountingAspect countingAspect;
aatarasoff/spring-thrift-starter
examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/TGreetingServiceHandlerTests.java
// Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/configuration/CountingAspect.java // @Aspect // public class CountingAspect { // public AtomicInteger counter = new AtomicInteger(0); // // @Pointcut("execution(* org.springframework.cloud.client.loadbalancer.LoadBalancerClient.choose(..))") // private void loadBalancerServerChoice() {} // // @Before("loadBalancerServerChoice()") // public void before(){ // counter.incrementAndGet(); // } // } // // Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/configuration/TestAspectConfiguration.java // @TestConfiguration // @EnableAspectJAutoProxy // public class TestAspectConfiguration { // // @Bean // public CountingAspect countingAspect(){ // return new CountingAspect(); // } // // } // // Path: examples/simple-client/src/main/java/info/developerblog/examples/thirft/simpleclient/TGreetingServiceController.java // public static final String TIMEOUTEMULATOR = "timeoutemulator";
import info.developerblog.examples.thirft.simpleclient.configuration.CountingAspect; import info.developerblog.examples.thirft.simpleclient.configuration.TestAspectConfiguration; import org.apache.commons.pool2.impl.GenericKeyedObjectPool; import org.apache.thrift.transport.TTransportException; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.context.WebApplicationContext; import static info.developerblog.examples.thirft.simpleclient.TGreetingServiceController.TIMEOUTEMULATOR; import static org.junit.Assert.assertEquals; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
package info.developerblog.examples.thirft.simpleclient; /** * Created by aleksandr on 01.09.15. */ @RunWith(SpringRunner.class) @SpringBootTest(classes = { SimpleClientApplication.class, TestAspectConfiguration.class }, webEnvironment = RANDOM_PORT) public class TGreetingServiceHandlerTests { @Autowired private WebApplicationContext context; @Autowired GreetingService greetingService; @Autowired GenericKeyedObjectPool clientPool; @Autowired CountingAspect countingAspect; @Value("${thrift.client.max.threads}") private int maxThreads; @Value("${thrift.client.max.idle.threads:8}") private int maxIdleThreads; @Value("${thrift.client.max.total.threads:8}") private int maxTotalThreads; @Test public void testSimpleCall() throws Exception { assertEquals("Hello John Smith", greetingService.getGreeting("Smith", "John")); } @Test(expected = TTransportException.class) public void testCallWithTimeout() throws Exception {
// Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/configuration/CountingAspect.java // @Aspect // public class CountingAspect { // public AtomicInteger counter = new AtomicInteger(0); // // @Pointcut("execution(* org.springframework.cloud.client.loadbalancer.LoadBalancerClient.choose(..))") // private void loadBalancerServerChoice() {} // // @Before("loadBalancerServerChoice()") // public void before(){ // counter.incrementAndGet(); // } // } // // Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/configuration/TestAspectConfiguration.java // @TestConfiguration // @EnableAspectJAutoProxy // public class TestAspectConfiguration { // // @Bean // public CountingAspect countingAspect(){ // return new CountingAspect(); // } // // } // // Path: examples/simple-client/src/main/java/info/developerblog/examples/thirft/simpleclient/TGreetingServiceController.java // public static final String TIMEOUTEMULATOR = "timeoutemulator"; // Path: examples/simple-client/src/test/java/info/developerblog/examples/thirft/simpleclient/TGreetingServiceHandlerTests.java import info.developerblog.examples.thirft.simpleclient.configuration.CountingAspect; import info.developerblog.examples.thirft.simpleclient.configuration.TestAspectConfiguration; import org.apache.commons.pool2.impl.GenericKeyedObjectPool; import org.apache.thrift.transport.TTransportException; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.context.WebApplicationContext; import static info.developerblog.examples.thirft.simpleclient.TGreetingServiceController.TIMEOUTEMULATOR; import static org.junit.Assert.assertEquals; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; package info.developerblog.examples.thirft.simpleclient; /** * Created by aleksandr on 01.09.15. */ @RunWith(SpringRunner.class) @SpringBootTest(classes = { SimpleClientApplication.class, TestAspectConfiguration.class }, webEnvironment = RANDOM_PORT) public class TGreetingServiceHandlerTests { @Autowired private WebApplicationContext context; @Autowired GreetingService greetingService; @Autowired GenericKeyedObjectPool clientPool; @Autowired CountingAspect countingAspect; @Value("${thrift.client.max.threads}") private int maxThreads; @Value("${thrift.client.max.idle.threads:8}") private int maxIdleThreads; @Value("${thrift.client.max.total.threads:8}") private int maxTotalThreads; @Test public void testSimpleCall() throws Exception { assertEquals("Hello John Smith", greetingService.getGreeting("Smith", "John")); } @Test(expected = TTransportException.class) public void testCallWithTimeout() throws Exception {
greetingService.getGreetingWithTimeout(TIMEOUTEMULATOR, "John");
aatarasoff/spring-thrift-starter
examples/simple-client/src/main/java/info/developerblog/examples/thirft/simpleclient/SampleMapper.java
// Path: autoconfigure/src/main/java/info/developerblog/spring/thrift/client/AbstractThriftClientKeyMapper.java // public abstract class AbstractThriftClientKeyMapper { // abstract public Map<String, ThriftClientKey> getMappings(); // } // // Path: autoconfigure/src/main/java/info/developerblog/spring/thrift/client/pool/ThriftClientKey.java // @Builder // @EqualsAndHashCode // public class ThriftClientKey { // private Class<? extends TServiceClient> clazz; // private String serviceName; // private String path; // // public String getServiceName() { // if (StringUtils.isEmpty(serviceName)) // return WordUtils.uncapitalize(clazz.getEnclosingClass().getSimpleName()); // return serviceName; // } // // public Class<? extends TServiceClient> getClazz() { // return clazz; // } // // public String getPath() { // return path; // } // }
import example.TGreetingService; import info.developerblog.spring.thrift.client.AbstractThriftClientKeyMapper; import info.developerblog.spring.thrift.client.pool.ThriftClientKey; import java.util.HashMap; import java.util.Map; import javax.annotation.PostConstruct; import org.springframework.stereotype.Component;
package info.developerblog.examples.thirft.simpleclient; /** * @author jihor (jihor@ya.ru) * Created on 2016-06-14 */ @Component public class SampleMapper extends AbstractThriftClientKeyMapper {
// Path: autoconfigure/src/main/java/info/developerblog/spring/thrift/client/AbstractThriftClientKeyMapper.java // public abstract class AbstractThriftClientKeyMapper { // abstract public Map<String, ThriftClientKey> getMappings(); // } // // Path: autoconfigure/src/main/java/info/developerblog/spring/thrift/client/pool/ThriftClientKey.java // @Builder // @EqualsAndHashCode // public class ThriftClientKey { // private Class<? extends TServiceClient> clazz; // private String serviceName; // private String path; // // public String getServiceName() { // if (StringUtils.isEmpty(serviceName)) // return WordUtils.uncapitalize(clazz.getEnclosingClass().getSimpleName()); // return serviceName; // } // // public Class<? extends TServiceClient> getClazz() { // return clazz; // } // // public String getPath() { // return path; // } // } // Path: examples/simple-client/src/main/java/info/developerblog/examples/thirft/simpleclient/SampleMapper.java import example.TGreetingService; import info.developerblog.spring.thrift.client.AbstractThriftClientKeyMapper; import info.developerblog.spring.thrift.client.pool.ThriftClientKey; import java.util.HashMap; import java.util.Map; import javax.annotation.PostConstruct; import org.springframework.stereotype.Component; package info.developerblog.examples.thirft.simpleclient; /** * @author jihor (jihor@ya.ru) * Created on 2016-06-14 */ @Component public class SampleMapper extends AbstractThriftClientKeyMapper {
protected HashMap<String, ThriftClientKey> mappings = new HashMap<>();
aatarasoff/spring-thrift-starter
autoconfigure/src/main/java/ru/trylogic/spring/boot/thrift/ThriftAutoConfiguration.java
// Path: autoconfigure/src/main/java/ru/trylogic/spring/boot/thrift/aop/LoggingThriftMethodInterceptor.java // @Slf4j // public class LoggingThriftMethodInterceptor implements MethodBeforeAdvice, AfterReturningAdvice, ThrowsAdvice { // // @Override // public void before(Method method, Object[] args, Object target) throws Throwable { // log.info("Thrift method {}.{}() is called with args: {}", // target.getClass().getSimpleName(), // method.getName(), // args); // } // // @Override // public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable { // log.info("Thrift method {}.{}() returns this: {}", // target.getClass().getSimpleName(), // method.getName(), // returnValue); // } // // @SuppressWarnings("unused") // public void afterThrowing(Method method, Object[] args, Object target, Exception e) throws Throwable { // if (!(e instanceof TException)) { // log.warn("Unexpected exception in " + target.getClass().getCanonicalName() + "." + method.getName(), e); // throw new TApplicationException(TApplicationException.INTERNAL_ERROR, e.toString()); // } // log.warn("Exception in Thrift method {}.{}() when called with args: {}", target.getClass().getSimpleName(), method.getName(), args, e); // } // } // // Path: autoconfigure/src/main/java/ru/trylogic/spring/boot/thrift/aop/MetricsThriftMethodInterceptor.java // @RequiredArgsConstructor // public class MetricsThriftMethodInterceptor implements MethodInterceptor { // private static final String THRIFT_REQUEST_DURATION_METRIC = "thrift.request.duration"; // // private final MeterRegistry meterRegistry; // // @Override // public Object invoke(MethodInvocation invocation) throws Throwable { // final long startTime = System.nanoTime(); // // try { // final Object result = invocation.proceed(); // time(invocation, startTime); // return result; // } catch (Exception e) { // time(invocation, startTime, e); // throw e; // } finally { // meterRegistry.gauge("timer.thrift." + invocation.getThis().getClass().getCanonicalName() + "." + invocation.getMethod().getName(), System.currentTimeMillis() - startTime); // } // } // // private void time(MethodInvocation invocation, long startTime) { // time(invocation, startTime, null); // } // // private void time(MethodInvocation invocation, long startTime, Exception exception) { // Timer // .builder(THRIFT_REQUEST_DURATION_METRIC) // .publishPercentileHistogram() // .description("Thrift handler request duration") // .tags( // "handler", invocation.getThis().getClass().getCanonicalName(), // "method", invocation.getMethod().getName(), // "status", exception == null ? "ok" : exception.getClass().getCanonicalName() // ) // .register(meterRegistry) // .record(System.nanoTime() - startTime, TimeUnit.NANOSECONDS); // } // }
import io.micrometer.core.instrument.MeterRegistry; import lombok.Getter; import lombok.Setter; import lombok.SneakyThrows; import org.apache.thrift.TProcessor; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TProtocolFactory; import org.apache.thrift.server.TServlet; import org.springframework.aop.framework.ProxyFactory; import org.springframework.aop.target.SingletonTargetSource; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.web.servlet.RegistrationBean; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.util.ClassUtils; import ru.trylogic.spring.boot.thrift.annotation.ThriftController; import ru.trylogic.spring.boot.thrift.aop.LoggingThriftMethodInterceptor; import ru.trylogic.spring.boot.thrift.aop.MetricsThriftMethodInterceptor; import javax.servlet.ServletContext; import javax.servlet.ServletRegistration; import java.lang.reflect.Constructor;
package ru.trylogic.spring.boot.thrift; @Configuration @ConditionalOnClass({ThriftController.class}) @ConditionalOnWebApplication public class ThriftAutoConfiguration { public interface ThriftConfigurer { void configureProxyFactory(ProxyFactory proxyFactory); } @Bean @ConditionalOnMissingBean(ThriftConfigurer.class) ThriftConfigurer thriftConfigurer() { return new DefaultThriftConfigurer(); } @Bean @ConditionalOnMissingBean(TProtocolFactory.class) TProtocolFactory thriftProtocolFactory() { return new TBinaryProtocol.Factory(); } @Bean
// Path: autoconfigure/src/main/java/ru/trylogic/spring/boot/thrift/aop/LoggingThriftMethodInterceptor.java // @Slf4j // public class LoggingThriftMethodInterceptor implements MethodBeforeAdvice, AfterReturningAdvice, ThrowsAdvice { // // @Override // public void before(Method method, Object[] args, Object target) throws Throwable { // log.info("Thrift method {}.{}() is called with args: {}", // target.getClass().getSimpleName(), // method.getName(), // args); // } // // @Override // public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable { // log.info("Thrift method {}.{}() returns this: {}", // target.getClass().getSimpleName(), // method.getName(), // returnValue); // } // // @SuppressWarnings("unused") // public void afterThrowing(Method method, Object[] args, Object target, Exception e) throws Throwable { // if (!(e instanceof TException)) { // log.warn("Unexpected exception in " + target.getClass().getCanonicalName() + "." + method.getName(), e); // throw new TApplicationException(TApplicationException.INTERNAL_ERROR, e.toString()); // } // log.warn("Exception in Thrift method {}.{}() when called with args: {}", target.getClass().getSimpleName(), method.getName(), args, e); // } // } // // Path: autoconfigure/src/main/java/ru/trylogic/spring/boot/thrift/aop/MetricsThriftMethodInterceptor.java // @RequiredArgsConstructor // public class MetricsThriftMethodInterceptor implements MethodInterceptor { // private static final String THRIFT_REQUEST_DURATION_METRIC = "thrift.request.duration"; // // private final MeterRegistry meterRegistry; // // @Override // public Object invoke(MethodInvocation invocation) throws Throwable { // final long startTime = System.nanoTime(); // // try { // final Object result = invocation.proceed(); // time(invocation, startTime); // return result; // } catch (Exception e) { // time(invocation, startTime, e); // throw e; // } finally { // meterRegistry.gauge("timer.thrift." + invocation.getThis().getClass().getCanonicalName() + "." + invocation.getMethod().getName(), System.currentTimeMillis() - startTime); // } // } // // private void time(MethodInvocation invocation, long startTime) { // time(invocation, startTime, null); // } // // private void time(MethodInvocation invocation, long startTime, Exception exception) { // Timer // .builder(THRIFT_REQUEST_DURATION_METRIC) // .publishPercentileHistogram() // .description("Thrift handler request duration") // .tags( // "handler", invocation.getThis().getClass().getCanonicalName(), // "method", invocation.getMethod().getName(), // "status", exception == null ? "ok" : exception.getClass().getCanonicalName() // ) // .register(meterRegistry) // .record(System.nanoTime() - startTime, TimeUnit.NANOSECONDS); // } // } // Path: autoconfigure/src/main/java/ru/trylogic/spring/boot/thrift/ThriftAutoConfiguration.java import io.micrometer.core.instrument.MeterRegistry; import lombok.Getter; import lombok.Setter; import lombok.SneakyThrows; import org.apache.thrift.TProcessor; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TProtocolFactory; import org.apache.thrift.server.TServlet; import org.springframework.aop.framework.ProxyFactory; import org.springframework.aop.target.SingletonTargetSource; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.web.servlet.RegistrationBean; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.util.ClassUtils; import ru.trylogic.spring.boot.thrift.annotation.ThriftController; import ru.trylogic.spring.boot.thrift.aop.LoggingThriftMethodInterceptor; import ru.trylogic.spring.boot.thrift.aop.MetricsThriftMethodInterceptor; import javax.servlet.ServletContext; import javax.servlet.ServletRegistration; import java.lang.reflect.Constructor; package ru.trylogic.spring.boot.thrift; @Configuration @ConditionalOnClass({ThriftController.class}) @ConditionalOnWebApplication public class ThriftAutoConfiguration { public interface ThriftConfigurer { void configureProxyFactory(ProxyFactory proxyFactory); } @Bean @ConditionalOnMissingBean(ThriftConfigurer.class) ThriftConfigurer thriftConfigurer() { return new DefaultThriftConfigurer(); } @Bean @ConditionalOnMissingBean(TProtocolFactory.class) TProtocolFactory thriftProtocolFactory() { return new TBinaryProtocol.Factory(); } @Bean
@ConditionalOnMissingBean(LoggingThriftMethodInterceptor.class)
aatarasoff/spring-thrift-starter
autoconfigure/src/main/java/ru/trylogic/spring/boot/thrift/ThriftAutoConfiguration.java
// Path: autoconfigure/src/main/java/ru/trylogic/spring/boot/thrift/aop/LoggingThriftMethodInterceptor.java // @Slf4j // public class LoggingThriftMethodInterceptor implements MethodBeforeAdvice, AfterReturningAdvice, ThrowsAdvice { // // @Override // public void before(Method method, Object[] args, Object target) throws Throwable { // log.info("Thrift method {}.{}() is called with args: {}", // target.getClass().getSimpleName(), // method.getName(), // args); // } // // @Override // public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable { // log.info("Thrift method {}.{}() returns this: {}", // target.getClass().getSimpleName(), // method.getName(), // returnValue); // } // // @SuppressWarnings("unused") // public void afterThrowing(Method method, Object[] args, Object target, Exception e) throws Throwable { // if (!(e instanceof TException)) { // log.warn("Unexpected exception in " + target.getClass().getCanonicalName() + "." + method.getName(), e); // throw new TApplicationException(TApplicationException.INTERNAL_ERROR, e.toString()); // } // log.warn("Exception in Thrift method {}.{}() when called with args: {}", target.getClass().getSimpleName(), method.getName(), args, e); // } // } // // Path: autoconfigure/src/main/java/ru/trylogic/spring/boot/thrift/aop/MetricsThriftMethodInterceptor.java // @RequiredArgsConstructor // public class MetricsThriftMethodInterceptor implements MethodInterceptor { // private static final String THRIFT_REQUEST_DURATION_METRIC = "thrift.request.duration"; // // private final MeterRegistry meterRegistry; // // @Override // public Object invoke(MethodInvocation invocation) throws Throwable { // final long startTime = System.nanoTime(); // // try { // final Object result = invocation.proceed(); // time(invocation, startTime); // return result; // } catch (Exception e) { // time(invocation, startTime, e); // throw e; // } finally { // meterRegistry.gauge("timer.thrift." + invocation.getThis().getClass().getCanonicalName() + "." + invocation.getMethod().getName(), System.currentTimeMillis() - startTime); // } // } // // private void time(MethodInvocation invocation, long startTime) { // time(invocation, startTime, null); // } // // private void time(MethodInvocation invocation, long startTime, Exception exception) { // Timer // .builder(THRIFT_REQUEST_DURATION_METRIC) // .publishPercentileHistogram() // .description("Thrift handler request duration") // .tags( // "handler", invocation.getThis().getClass().getCanonicalName(), // "method", invocation.getMethod().getName(), // "status", exception == null ? "ok" : exception.getClass().getCanonicalName() // ) // .register(meterRegistry) // .record(System.nanoTime() - startTime, TimeUnit.NANOSECONDS); // } // }
import io.micrometer.core.instrument.MeterRegistry; import lombok.Getter; import lombok.Setter; import lombok.SneakyThrows; import org.apache.thrift.TProcessor; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TProtocolFactory; import org.apache.thrift.server.TServlet; import org.springframework.aop.framework.ProxyFactory; import org.springframework.aop.target.SingletonTargetSource; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.web.servlet.RegistrationBean; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.util.ClassUtils; import ru.trylogic.spring.boot.thrift.annotation.ThriftController; import ru.trylogic.spring.boot.thrift.aop.LoggingThriftMethodInterceptor; import ru.trylogic.spring.boot.thrift.aop.MetricsThriftMethodInterceptor; import javax.servlet.ServletContext; import javax.servlet.ServletRegistration; import java.lang.reflect.Constructor;
package ru.trylogic.spring.boot.thrift; @Configuration @ConditionalOnClass({ThriftController.class}) @ConditionalOnWebApplication public class ThriftAutoConfiguration { public interface ThriftConfigurer { void configureProxyFactory(ProxyFactory proxyFactory); } @Bean @ConditionalOnMissingBean(ThriftConfigurer.class) ThriftConfigurer thriftConfigurer() { return new DefaultThriftConfigurer(); } @Bean @ConditionalOnMissingBean(TProtocolFactory.class) TProtocolFactory thriftProtocolFactory() { return new TBinaryProtocol.Factory(); } @Bean @ConditionalOnMissingBean(LoggingThriftMethodInterceptor.class) LoggingThriftMethodInterceptor loggingThriftMethodInterceptor() { return new LoggingThriftMethodInterceptor(); } public static class DefaultThriftConfigurer implements ThriftConfigurer { @Autowired(required = false) private MeterRegistry meterRegistry; @Autowired private LoggingThriftMethodInterceptor loggingThriftMethodInterceptor; public void configureProxyFactory(ProxyFactory proxyFactory) { if (meterRegistry != null) {
// Path: autoconfigure/src/main/java/ru/trylogic/spring/boot/thrift/aop/LoggingThriftMethodInterceptor.java // @Slf4j // public class LoggingThriftMethodInterceptor implements MethodBeforeAdvice, AfterReturningAdvice, ThrowsAdvice { // // @Override // public void before(Method method, Object[] args, Object target) throws Throwable { // log.info("Thrift method {}.{}() is called with args: {}", // target.getClass().getSimpleName(), // method.getName(), // args); // } // // @Override // public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable { // log.info("Thrift method {}.{}() returns this: {}", // target.getClass().getSimpleName(), // method.getName(), // returnValue); // } // // @SuppressWarnings("unused") // public void afterThrowing(Method method, Object[] args, Object target, Exception e) throws Throwable { // if (!(e instanceof TException)) { // log.warn("Unexpected exception in " + target.getClass().getCanonicalName() + "." + method.getName(), e); // throw new TApplicationException(TApplicationException.INTERNAL_ERROR, e.toString()); // } // log.warn("Exception in Thrift method {}.{}() when called with args: {}", target.getClass().getSimpleName(), method.getName(), args, e); // } // } // // Path: autoconfigure/src/main/java/ru/trylogic/spring/boot/thrift/aop/MetricsThriftMethodInterceptor.java // @RequiredArgsConstructor // public class MetricsThriftMethodInterceptor implements MethodInterceptor { // private static final String THRIFT_REQUEST_DURATION_METRIC = "thrift.request.duration"; // // private final MeterRegistry meterRegistry; // // @Override // public Object invoke(MethodInvocation invocation) throws Throwable { // final long startTime = System.nanoTime(); // // try { // final Object result = invocation.proceed(); // time(invocation, startTime); // return result; // } catch (Exception e) { // time(invocation, startTime, e); // throw e; // } finally { // meterRegistry.gauge("timer.thrift." + invocation.getThis().getClass().getCanonicalName() + "." + invocation.getMethod().getName(), System.currentTimeMillis() - startTime); // } // } // // private void time(MethodInvocation invocation, long startTime) { // time(invocation, startTime, null); // } // // private void time(MethodInvocation invocation, long startTime, Exception exception) { // Timer // .builder(THRIFT_REQUEST_DURATION_METRIC) // .publishPercentileHistogram() // .description("Thrift handler request duration") // .tags( // "handler", invocation.getThis().getClass().getCanonicalName(), // "method", invocation.getMethod().getName(), // "status", exception == null ? "ok" : exception.getClass().getCanonicalName() // ) // .register(meterRegistry) // .record(System.nanoTime() - startTime, TimeUnit.NANOSECONDS); // } // } // Path: autoconfigure/src/main/java/ru/trylogic/spring/boot/thrift/ThriftAutoConfiguration.java import io.micrometer.core.instrument.MeterRegistry; import lombok.Getter; import lombok.Setter; import lombok.SneakyThrows; import org.apache.thrift.TProcessor; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TProtocolFactory; import org.apache.thrift.server.TServlet; import org.springframework.aop.framework.ProxyFactory; import org.springframework.aop.target.SingletonTargetSource; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.web.servlet.RegistrationBean; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.util.ClassUtils; import ru.trylogic.spring.boot.thrift.annotation.ThriftController; import ru.trylogic.spring.boot.thrift.aop.LoggingThriftMethodInterceptor; import ru.trylogic.spring.boot.thrift.aop.MetricsThriftMethodInterceptor; import javax.servlet.ServletContext; import javax.servlet.ServletRegistration; import java.lang.reflect.Constructor; package ru.trylogic.spring.boot.thrift; @Configuration @ConditionalOnClass({ThriftController.class}) @ConditionalOnWebApplication public class ThriftAutoConfiguration { public interface ThriftConfigurer { void configureProxyFactory(ProxyFactory proxyFactory); } @Bean @ConditionalOnMissingBean(ThriftConfigurer.class) ThriftConfigurer thriftConfigurer() { return new DefaultThriftConfigurer(); } @Bean @ConditionalOnMissingBean(TProtocolFactory.class) TProtocolFactory thriftProtocolFactory() { return new TBinaryProtocol.Factory(); } @Bean @ConditionalOnMissingBean(LoggingThriftMethodInterceptor.class) LoggingThriftMethodInterceptor loggingThriftMethodInterceptor() { return new LoggingThriftMethodInterceptor(); } public static class DefaultThriftConfigurer implements ThriftConfigurer { @Autowired(required = false) private MeterRegistry meterRegistry; @Autowired private LoggingThriftMethodInterceptor loggingThriftMethodInterceptor; public void configureProxyFactory(ProxyFactory proxyFactory) { if (meterRegistry != null) {
proxyFactory.addAdvice(new MetricsThriftMethodInterceptor(meterRegistry));
carrotsearch/hppc
hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/Empty.java
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // }
import com.carrotsearch.hppc.generator.TemplateOptions; import java.util.ArrayList; import java.util.regex.Matcher;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class Empty extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb,
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/Empty.java import com.carrotsearch.hppc.generator.TemplateOptions; import java.util.ArrayList; import java.util.regex.Matcher; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class Empty extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb,
TemplateOptions templateOptions,
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeCollection.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // }
import com.carrotsearch.hppc.predicates.KTypePredicate;
package com.carrotsearch.hppc; /** * A collection allows basic, efficient operations on sets of elements * (difference and intersection). */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeCollection<KType> extends KTypeContainer<KType> { /** * Removes all occurrences of <code>e</code> from this collection. * * @param e * Element to be removed from this collection, if present. * @return The number of removed elements as a result of this call. */ public int removeAll(KType e); /** * Removes all elements in this collection that are present in <code>c</code>. * * @return Returns the number of removed elements. */ public int removeAll(KTypeLookupContainer<? super KType> c); /** * Removes all elements in this collection for which the given predicate * returns <code>true</code>. * * @return Returns the number of removed elements. */
// Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/KTypeCollection.java import com.carrotsearch.hppc.predicates.KTypePredicate; package com.carrotsearch.hppc; /** * A collection allows basic, efficient operations on sets of elements * (difference and intersection). */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeCollection<KType> extends KTypeContainer<KType> { /** * Removes all occurrences of <code>e</code> from this collection. * * @param e * Element to be removed from this collection, if present. * @return The number of removed elements as a result of this call. */ public int removeAll(KType e); /** * Removes all elements in this collection that are present in <code>c</code>. * * @return Returns the number of removed elements. */ public int removeAll(KTypeLookupContainer<? super KType> c); /** * Removes all elements in this collection for which the given predicate * returns <code>true</code>. * * @return Returns the number of removed elements. */
public int removeAll(KTypePredicate<? super KType> predicate);
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/AbstractKTypeCollection.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // }
import java.util.Arrays; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate;
package com.carrotsearch.hppc; /** * Common superclass for collections. */ /*! #if ($TemplateOptions.KTypeGeneric) !*/ @SuppressWarnings("unchecked") /*! #end !*/ /*! ${TemplateOptions.generatedAnnotation} !*/ abstract class AbstractKTypeCollection<KType> implements /*! #if ($templateonly) !*/ Intrinsics.EqualityFunction, /*! #end !*/ KTypeCollection<KType> { /** * Default implementation uses a predicate for removal. */ @Override public int removeAll(final KTypeLookupContainer<? super KType> c) { return this.removeAll(c::contains); } /** * Default implementation uses a predicate for retaining. */ @Override public int retainAll(final KTypeLookupContainer<? super KType> c) { // We know c holds sub-types of KType and we're not modifying c, so go unchecked. return this.removeAll(k -> !c.contains(k)); } /** * Default implementation redirects to {@link #removeAll(KTypePredicate)} and * negates the predicate. */ @Override
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/AbstractKTypeCollection.java import java.util.Arrays; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; package com.carrotsearch.hppc; /** * Common superclass for collections. */ /*! #if ($TemplateOptions.KTypeGeneric) !*/ @SuppressWarnings("unchecked") /*! #end !*/ /*! ${TemplateOptions.generatedAnnotation} !*/ abstract class AbstractKTypeCollection<KType> implements /*! #if ($templateonly) !*/ Intrinsics.EqualityFunction, /*! #end !*/ KTypeCollection<KType> { /** * Default implementation uses a predicate for removal. */ @Override public int removeAll(final KTypeLookupContainer<? super KType> c) { return this.removeAll(c::contains); } /** * Default implementation uses a predicate for retaining. */ @Override public int retainAll(final KTypeLookupContainer<? super KType> c) { // We know c holds sub-types of KType and we're not modifying c, so go unchecked. return this.removeAll(k -> !c.contains(k)); } /** * Default implementation redirects to {@link #removeAll(KTypePredicate)} and * negates the predicate. */ @Override
public int retainAll(final KTypePredicate<? super KType> predicate) {
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/AbstractKTypeCollection.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // }
import java.util.Arrays; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate;
package com.carrotsearch.hppc; /** * Common superclass for collections. */ /*! #if ($TemplateOptions.KTypeGeneric) !*/ @SuppressWarnings("unchecked") /*! #end !*/ /*! ${TemplateOptions.generatedAnnotation} !*/ abstract class AbstractKTypeCollection<KType> implements /*! #if ($templateonly) !*/ Intrinsics.EqualityFunction, /*! #end !*/ KTypeCollection<KType> { /** * Default implementation uses a predicate for removal. */ @Override public int removeAll(final KTypeLookupContainer<? super KType> c) { return this.removeAll(c::contains); } /** * Default implementation uses a predicate for retaining. */ @Override public int retainAll(final KTypeLookupContainer<? super KType> c) { // We know c holds sub-types of KType and we're not modifying c, so go unchecked. return this.removeAll(k -> !c.contains(k)); } /** * Default implementation redirects to {@link #removeAll(KTypePredicate)} and * negates the predicate. */ @Override public int retainAll(final KTypePredicate<? super KType> predicate) { return removeAll(value -> !predicate.apply(value)); } /** * Default implementation of copying to an array. */ @Override /*!#if ($TemplateOptions.KTypePrimitive) public KType [] toArray() #else !*/ public Object[] toArray() /*! #end !*/ { KType[] array = Intrinsics.<KType> newArray(size()); int i = 0;
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/AbstractKTypeCollection.java import java.util.Arrays; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; package com.carrotsearch.hppc; /** * Common superclass for collections. */ /*! #if ($TemplateOptions.KTypeGeneric) !*/ @SuppressWarnings("unchecked") /*! #end !*/ /*! ${TemplateOptions.generatedAnnotation} !*/ abstract class AbstractKTypeCollection<KType> implements /*! #if ($templateonly) !*/ Intrinsics.EqualityFunction, /*! #end !*/ KTypeCollection<KType> { /** * Default implementation uses a predicate for removal. */ @Override public int removeAll(final KTypeLookupContainer<? super KType> c) { return this.removeAll(c::contains); } /** * Default implementation uses a predicate for retaining. */ @Override public int retainAll(final KTypeLookupContainer<? super KType> c) { // We know c holds sub-types of KType and we're not modifying c, so go unchecked. return this.removeAll(k -> !c.contains(k)); } /** * Default implementation redirects to {@link #removeAll(KTypePredicate)} and * negates the predicate. */ @Override public int retainAll(final KTypePredicate<? super KType> predicate) { return removeAll(value -> !predicate.apply(value)); } /** * Default implementation of copying to an array. */ @Override /*!#if ($TemplateOptions.KTypePrimitive) public KType [] toArray() #else !*/ public Object[] toArray() /*! #end !*/ { KType[] array = Intrinsics.<KType> newArray(size()); int i = 0;
for (KTypeCursor<KType> c : this) {
carrotsearch/hppc
hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/Cast.java
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // }
import com.carrotsearch.hppc.generator.TemplateOptions; import java.util.ArrayList; import java.util.regex.Matcher;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class Cast extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb,
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/Cast.java import com.carrotsearch.hppc.generator.TemplateOptions; import java.util.ArrayList; import java.util.regex.Matcher; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class Cast extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb,
TemplateOptions templateOptions,
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeDeque.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // }
import java.util.Deque; import java.util.Iterator; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure;
package com.carrotsearch.hppc; /** * A linear collection that supports element insertion and removal at both ends. * * @see Deque */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeDeque<KType> extends KTypeCollection<KType> { /** * Removes the first element that equals <code>e</code>. * * @return The deleted element's index or <code>-1</code> if the element * was not found. */ public int removeFirst(KType e); /** * Removes the last element that equals <code>e</code>. * * @return The deleted element's index or <code>-1</code> if the element * was not found. */ public int removeLast(KType e); /** * Inserts the specified element at the front of this deque. */ public void addFirst(KType e); /** * Inserts the specified element at the end of this deque. */ public void addLast(KType e); /** * Retrieves and removes the first element of this deque. * * @return the head (first) element of this deque. */ public KType removeFirst(); /** * Retrieves and removes the last element of this deque. * * @return the tail of this deque. */ public KType removeLast(); /** * Retrieves the first element of this deque but does not remove it. * * @return the head of this deque. */ public KType getFirst(); /** * Retrieves the last element of this deque but does not remove it. * * @return the head of this deque. */ public KType getLast(); /** * @return An iterator over elements in this deque in tail-to-head order. */
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/KTypeDeque.java import java.util.Deque; import java.util.Iterator; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure; package com.carrotsearch.hppc; /** * A linear collection that supports element insertion and removal at both ends. * * @see Deque */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeDeque<KType> extends KTypeCollection<KType> { /** * Removes the first element that equals <code>e</code>. * * @return The deleted element's index or <code>-1</code> if the element * was not found. */ public int removeFirst(KType e); /** * Removes the last element that equals <code>e</code>. * * @return The deleted element's index or <code>-1</code> if the element * was not found. */ public int removeLast(KType e); /** * Inserts the specified element at the front of this deque. */ public void addFirst(KType e); /** * Inserts the specified element at the end of this deque. */ public void addLast(KType e); /** * Retrieves and removes the first element of this deque. * * @return the head (first) element of this deque. */ public KType removeFirst(); /** * Retrieves and removes the last element of this deque. * * @return the tail of this deque. */ public KType removeLast(); /** * Retrieves the first element of this deque but does not remove it. * * @return the head of this deque. */ public KType getFirst(); /** * Retrieves the last element of this deque but does not remove it. * * @return the head of this deque. */ public KType getLast(); /** * @return An iterator over elements in this deque in tail-to-head order. */
public Iterator<KTypeCursor<KType>> descendingIterator();
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeDeque.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // }
import java.util.Deque; import java.util.Iterator; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure;
package com.carrotsearch.hppc; /** * A linear collection that supports element insertion and removal at both ends. * * @see Deque */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeDeque<KType> extends KTypeCollection<KType> { /** * Removes the first element that equals <code>e</code>. * * @return The deleted element's index or <code>-1</code> if the element * was not found. */ public int removeFirst(KType e); /** * Removes the last element that equals <code>e</code>. * * @return The deleted element's index or <code>-1</code> if the element * was not found. */ public int removeLast(KType e); /** * Inserts the specified element at the front of this deque. */ public void addFirst(KType e); /** * Inserts the specified element at the end of this deque. */ public void addLast(KType e); /** * Retrieves and removes the first element of this deque. * * @return the head (first) element of this deque. */ public KType removeFirst(); /** * Retrieves and removes the last element of this deque. * * @return the tail of this deque. */ public KType removeLast(); /** * Retrieves the first element of this deque but does not remove it. * * @return the head of this deque. */ public KType getFirst(); /** * Retrieves the last element of this deque but does not remove it. * * @return the head of this deque. */ public KType getLast(); /** * @return An iterator over elements in this deque in tail-to-head order. */ public Iterator<KTypeCursor<KType>> descendingIterator(); /** * Applies a <code>procedure</code> to all elements in tail-to-head order. */
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/KTypeDeque.java import java.util.Deque; import java.util.Iterator; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure; package com.carrotsearch.hppc; /** * A linear collection that supports element insertion and removal at both ends. * * @see Deque */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeDeque<KType> extends KTypeCollection<KType> { /** * Removes the first element that equals <code>e</code>. * * @return The deleted element's index or <code>-1</code> if the element * was not found. */ public int removeFirst(KType e); /** * Removes the last element that equals <code>e</code>. * * @return The deleted element's index or <code>-1</code> if the element * was not found. */ public int removeLast(KType e); /** * Inserts the specified element at the front of this deque. */ public void addFirst(KType e); /** * Inserts the specified element at the end of this deque. */ public void addLast(KType e); /** * Retrieves and removes the first element of this deque. * * @return the head (first) element of this deque. */ public KType removeFirst(); /** * Retrieves and removes the last element of this deque. * * @return the tail of this deque. */ public KType removeLast(); /** * Retrieves the first element of this deque but does not remove it. * * @return the head of this deque. */ public KType getFirst(); /** * Retrieves the last element of this deque but does not remove it. * * @return the head of this deque. */ public KType getLast(); /** * @return An iterator over elements in this deque in tail-to-head order. */ public Iterator<KTypeCursor<KType>> descendingIterator(); /** * Applies a <code>procedure</code> to all elements in tail-to-head order. */
public <T extends KTypeProcedure<? super KType>> T descendingForEach(T procedure);
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeDeque.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // }
import java.util.Deque; import java.util.Iterator; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure;
package com.carrotsearch.hppc; /** * A linear collection that supports element insertion and removal at both ends. * * @see Deque */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeDeque<KType> extends KTypeCollection<KType> { /** * Removes the first element that equals <code>e</code>. * * @return The deleted element's index or <code>-1</code> if the element * was not found. */ public int removeFirst(KType e); /** * Removes the last element that equals <code>e</code>. * * @return The deleted element's index or <code>-1</code> if the element * was not found. */ public int removeLast(KType e); /** * Inserts the specified element at the front of this deque. */ public void addFirst(KType e); /** * Inserts the specified element at the end of this deque. */ public void addLast(KType e); /** * Retrieves and removes the first element of this deque. * * @return the head (first) element of this deque. */ public KType removeFirst(); /** * Retrieves and removes the last element of this deque. * * @return the tail of this deque. */ public KType removeLast(); /** * Retrieves the first element of this deque but does not remove it. * * @return the head of this deque. */ public KType getFirst(); /** * Retrieves the last element of this deque but does not remove it. * * @return the head of this deque. */ public KType getLast(); /** * @return An iterator over elements in this deque in tail-to-head order. */ public Iterator<KTypeCursor<KType>> descendingIterator(); /** * Applies a <code>procedure</code> to all elements in tail-to-head order. */ public <T extends KTypeProcedure<? super KType>> T descendingForEach(T procedure); /** * Applies a <code>predicate</code> to container elements as long, as the * predicate returns <code>true</code>. The iteration is interrupted * otherwise. */
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/KTypeDeque.java import java.util.Deque; import java.util.Iterator; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure; package com.carrotsearch.hppc; /** * A linear collection that supports element insertion and removal at both ends. * * @see Deque */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeDeque<KType> extends KTypeCollection<KType> { /** * Removes the first element that equals <code>e</code>. * * @return The deleted element's index or <code>-1</code> if the element * was not found. */ public int removeFirst(KType e); /** * Removes the last element that equals <code>e</code>. * * @return The deleted element's index or <code>-1</code> if the element * was not found. */ public int removeLast(KType e); /** * Inserts the specified element at the front of this deque. */ public void addFirst(KType e); /** * Inserts the specified element at the end of this deque. */ public void addLast(KType e); /** * Retrieves and removes the first element of this deque. * * @return the head (first) element of this deque. */ public KType removeFirst(); /** * Retrieves and removes the last element of this deque. * * @return the tail of this deque. */ public KType removeLast(); /** * Retrieves the first element of this deque but does not remove it. * * @return the head of this deque. */ public KType getFirst(); /** * Retrieves the last element of this deque but does not remove it. * * @return the head of this deque. */ public KType getLast(); /** * @return An iterator over elements in this deque in tail-to-head order. */ public Iterator<KTypeCursor<KType>> descendingIterator(); /** * Applies a <code>procedure</code> to all elements in tail-to-head order. */ public <T extends KTypeProcedure<? super KType>> T descendingForEach(T procedure); /** * Applies a <code>predicate</code> to container elements as long, as the * predicate returns <code>true</code>. The iteration is interrupted * otherwise. */
public <T extends KTypePredicate<? super KType>> T descendingForEach(T predicate);
carrotsearch/hppc
hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B008_HashMap_Get_Random.java
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // }
import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; // To normalize the measure, run B009_Random to know how much time XorShift128P.nextInt() takes. @Fork(1) @Warmup(iterations = 5) @Measurement(iterations = 5) @State(Scope.Benchmark) public class B008_HashMap_Get_Random { @Param("0.75") public double loadFactor; @Param public Library library; @Param({"16"}) // {"16", "18", "20"} public int capacityPowerOf2; @Param({"0.45", "0.5", "0.55", "0.6", "0.65", "0.7", "0.74"}) public float load; public int keyCount; public IntIntMapOps ops;
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // } // Path: hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B008_HashMap_Get_Random.java import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; // To normalize the measure, run B009_Random to know how much time XorShift128P.nextInt() takes. @Fork(1) @Warmup(iterations = 5) @Measurement(iterations = 5) @State(Scope.Benchmark) public class B008_HashMap_Get_Random { @Param("0.75") public double loadFactor; @Param public Library library; @Param({"16"}) // {"16", "18", "20"} public int capacityPowerOf2; @Param({"0.45", "0.5", "0.55", "0.6", "0.65", "0.7", "0.74"}) public float load; public int keyCount; public IntIntMapOps ops;
public XorShift128P rnd;
carrotsearch/hppc
hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B002_HashSet_Add.java
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // }
import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Param; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; @Fork(1) @Warmup(iterations = 5) @Measurement(iterations = 5) @State(Scope.Benchmark) public class B002_HashSet_Add { public static interface Ops { Object addAll(int[] keys); } @Param("0.75") public double loadFactor; @Param public Library library; @Param({"200"}) public int mbOfKeys; public int[] keys; public IntSetOps ops; @Setup(Level.Iteration) public void prepareDelegate() { ops = library.newIntSet(keys.length, loadFactor); } @Setup(Level.Trial) public void prepare() { int keyCount = mbOfKeys * (1024 * 1024) / 4; keys = new int[keyCount];
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // } // Path: hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B002_HashSet_Add.java import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Param; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; @Fork(1) @Warmup(iterations = 5) @Measurement(iterations = 5) @State(Scope.Benchmark) public class B002_HashSet_Add { public static interface Ops { Object addAll(int[] keys); } @Param("0.75") public double loadFactor; @Param public Library library; @Param({"200"}) public int mbOfKeys; public int[] keys; public IntSetOps ops; @Setup(Level.Iteration) public void prepareDelegate() { ops = library.newIntSet(keys.length, loadFactor); } @Setup(Level.Trial) public void prepare() { int keyCount = mbOfKeys * (1024 * 1024) / 4; keys = new int[keyCount];
XorShift128P rnd = new XorShift128P(0xdeadbeefL);
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeVTypeMap.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeVTypeCursor.java // public final class KTypeVTypeCursor<KType, VType> { // /** // * The current key and value's index in the container this cursor belongs to. // * The meaning of this index is defined by the container (usually it will be // * an index in the underlying storage buffer). // */ // public int index; // // /** // * The current key. // */ // public KType key; // // /** // * The current value. // */ // public VType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", key: " + key + ", value: " + value + "]"; // } // }
import com.carrotsearch.hppc.cursors.KTypeVTypeCursor;
/*! #set($TemplateOptions.ignored = ($TemplateOptions.isKTypeAnyOf("DOUBLE", "FLOAT", "BYTE"))) !*/ package com.carrotsearch.hppc; /** * An associative container with unique binding from keys to a single value. */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeVTypeMap<KType, VType> extends KTypeVTypeAssociativeContainer<KType, VType> { /** * @return Returns the value associated with the given key or the default * value for the value type, if the key is not associated with any * value. For numeric value types, this default value is 0, for * object types it is {@code null}. */ public VType get(KType key); /** * @return Returns the value associated with the given key or the provided * default value if the key is not associated with any value. */ public VType getOrDefault(KType key, VType defaultValue); /** * Place a given key and value in the container. * * @return The value previously stored under the given key in the map is * returned. */ public VType put(KType key, VType value); /** * Puts all keys from another container to this map, replacing the values of * existing keys, if such keys are present. * * @return Returns the number of keys added to the map as a result of this * call (not previously present in the map). Values of existing keys * are overwritten. */ public int putAll(KTypeVTypeAssociativeContainer<? extends KType, ? extends VType> container); /** * Puts all keys from an iterable cursor to this map, replacing the values of * existing keys, if such keys are present. * * @return Returns the number of keys added to the map as a result of this * call (not previously present in the map). Values of existing keys * are overwritten. */
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeVTypeCursor.java // public final class KTypeVTypeCursor<KType, VType> { // /** // * The current key and value's index in the container this cursor belongs to. // * The meaning of this index is defined by the container (usually it will be // * an index in the underlying storage buffer). // */ // public int index; // // /** // * The current key. // */ // public KType key; // // /** // * The current value. // */ // public VType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", key: " + key + ", value: " + value + "]"; // } // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/KTypeVTypeMap.java import com.carrotsearch.hppc.cursors.KTypeVTypeCursor; /*! #set($TemplateOptions.ignored = ($TemplateOptions.isKTypeAnyOf("DOUBLE", "FLOAT", "BYTE"))) !*/ package com.carrotsearch.hppc; /** * An associative container with unique binding from keys to a single value. */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeVTypeMap<KType, VType> extends KTypeVTypeAssociativeContainer<KType, VType> { /** * @return Returns the value associated with the given key or the default * value for the value type, if the key is not associated with any * value. For numeric value types, this default value is 0, for * object types it is {@code null}. */ public VType get(KType key); /** * @return Returns the value associated with the given key or the provided * default value if the key is not associated with any value. */ public VType getOrDefault(KType key, VType defaultValue); /** * Place a given key and value in the container. * * @return The value previously stored under the given key in the map is * returned. */ public VType put(KType key, VType value); /** * Puts all keys from another container to this map, replacing the values of * existing keys, if such keys are present. * * @return Returns the number of keys added to the map as a result of this * call (not previously present in the map). Values of existing keys * are overwritten. */ public int putAll(KTypeVTypeAssociativeContainer<? extends KType, ? extends VType> container); /** * Puts all keys from an iterable cursor to this map, replacing the values of * existing keys, if such keys are present. * * @return Returns the number of keys added to the map as a result of this * call (not previously present in the map). Values of existing keys * are overwritten. */
public int putAll(Iterable<? extends KTypeVTypeCursor<? extends KType, ? extends VType>> iterable);
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayList.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/java/com/carrotsearch/hppc/Containers.java // public final class Containers { // /** The default number of expected elements for containers. */ // public static final int DEFAULT_EXPECTED_ELEMENTS = 4; // // /** // * External initial seed value. We do not care about multiple assignments so not volatile. // * // * @see #randomSeed64() // */ // private static String testsSeedProperty; // // /** Unique marker for {@link #testsSeedProperty}. */ // private static final String NOT_AVAILABLE = new String(); // // private Containers() {} // // /** // * Provides a (possibly) random initial seed for randomized stuff. // * // * <p>If <code>tests.seed</code> property is available and accessible, the returned value will be // * derived from the value of that property and will be constant to ensure reproducibility in // * presence of the randomized testing package. // * // * @see "https://github.com/carrotsearch/randomizedtesting" // */ // @SuppressForbidden // public static long randomSeed64() { // if (testsSeedProperty == null) { // try { // testsSeedProperty = // java.security.AccessController.doPrivileged( // new PrivilegedAction<String>() { // @Override // public String run() { // return System.getProperty("tests.seed", NOT_AVAILABLE); // } // }); // } catch (SecurityException e) { // // If failed on security exception, don't panic. // testsSeedProperty = NOT_AVAILABLE; // Logger.getLogger(Containers.class.getName()) // .log(Level.INFO, "Failed to read 'tests.seed' property for initial random seed.", e); // } // } // // long initialSeed; // if (testsSeedProperty != NOT_AVAILABLE) { // initialSeed = testsSeedProperty.hashCode(); // } else { // // Mix something that is changing over time (nanoTime) // // ... with something that is thread-local and relatively unique // // even for very short time-spans (new Object's address from a TLAB). // initialSeed = System.nanoTime() ^ System.identityHashCode(new Object()); // } // return BitMixer.mix64(initialSeed); // } // // /** Reset state for tests. */ // static void test$reset() { // testsSeedProperty = null; // } // }
import java.util.*; import com.carrotsearch.hppc.cursors.*; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.*; import static com.carrotsearch.hppc.Containers.*;
public <T extends KTypeProcedure<? super KType>> T forEach(T procedure) { return forEach(procedure, 0, size()); } /** * Applies <code>procedure</code> to a slice of the list, * <code>fromIndex</code>, inclusive, to <code>toIndex</code>, exclusive. */ public <T extends KTypeProcedure<? super KType>> T forEach(T procedure, int fromIndex, final int toIndex) { assert (fromIndex >= 0 && fromIndex <= size()) : "Index " + fromIndex + " out of bounds [" + 0 + ", " + size() + ")."; assert (toIndex >= 0 && toIndex <= size()) : "Index " + toIndex + " out of bounds [" + 0 + ", " + size() + "]."; assert fromIndex <= toIndex : "fromIndex must be <= toIndex: " + fromIndex + ", " + toIndex; final KType [] buffer = Intrinsics.<KType[]> cast(this.buffer); for (int i = fromIndex; i < toIndex; i++) { procedure.apply(buffer[i]); } return procedure; } /** * {@inheritDoc} */ @Override
// Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/java/com/carrotsearch/hppc/Containers.java // public final class Containers { // /** The default number of expected elements for containers. */ // public static final int DEFAULT_EXPECTED_ELEMENTS = 4; // // /** // * External initial seed value. We do not care about multiple assignments so not volatile. // * // * @see #randomSeed64() // */ // private static String testsSeedProperty; // // /** Unique marker for {@link #testsSeedProperty}. */ // private static final String NOT_AVAILABLE = new String(); // // private Containers() {} // // /** // * Provides a (possibly) random initial seed for randomized stuff. // * // * <p>If <code>tests.seed</code> property is available and accessible, the returned value will be // * derived from the value of that property and will be constant to ensure reproducibility in // * presence of the randomized testing package. // * // * @see "https://github.com/carrotsearch/randomizedtesting" // */ // @SuppressForbidden // public static long randomSeed64() { // if (testsSeedProperty == null) { // try { // testsSeedProperty = // java.security.AccessController.doPrivileged( // new PrivilegedAction<String>() { // @Override // public String run() { // return System.getProperty("tests.seed", NOT_AVAILABLE); // } // }); // } catch (SecurityException e) { // // If failed on security exception, don't panic. // testsSeedProperty = NOT_AVAILABLE; // Logger.getLogger(Containers.class.getName()) // .log(Level.INFO, "Failed to read 'tests.seed' property for initial random seed.", e); // } // } // // long initialSeed; // if (testsSeedProperty != NOT_AVAILABLE) { // initialSeed = testsSeedProperty.hashCode(); // } else { // // Mix something that is changing over time (nanoTime) // // ... with something that is thread-local and relatively unique // // even for very short time-spans (new Object's address from a TLAB). // initialSeed = System.nanoTime() ^ System.identityHashCode(new Object()); // } // return BitMixer.mix64(initialSeed); // } // // /** Reset state for tests. */ // static void test$reset() { // testsSeedProperty = null; // } // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayList.java import java.util.*; import com.carrotsearch.hppc.cursors.*; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.*; import static com.carrotsearch.hppc.Containers.*; public <T extends KTypeProcedure<? super KType>> T forEach(T procedure) { return forEach(procedure, 0, size()); } /** * Applies <code>procedure</code> to a slice of the list, * <code>fromIndex</code>, inclusive, to <code>toIndex</code>, exclusive. */ public <T extends KTypeProcedure<? super KType>> T forEach(T procedure, int fromIndex, final int toIndex) { assert (fromIndex >= 0 && fromIndex <= size()) : "Index " + fromIndex + " out of bounds [" + 0 + ", " + size() + ")."; assert (toIndex >= 0 && toIndex <= size()) : "Index " + toIndex + " out of bounds [" + 0 + ", " + size() + "]."; assert fromIndex <= toIndex : "fromIndex must be <= toIndex: " + fromIndex + ", " + toIndex; final KType [] buffer = Intrinsics.<KType[]> cast(this.buffer); for (int i = fromIndex; i < toIndex; i++) { procedure.apply(buffer[i]); } return procedure; } /** * {@inheritDoc} */ @Override
public int removeAll(KTypePredicate<? super KType> predicate) {
carrotsearch/hppc
hppc/src/test/java/com/carrotsearch/hppc/sorting/IndirectSortTest.java
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // }
import static org.junit.Assert.*; import com.carrotsearch.hppc.XorShift128P; import java.util.Arrays; import java.util.Random; import java.util.function.IntBinaryOperator; import org.junit.*;
assertOrder(order, length, intBinaryOperator); } } /** Randomized input, ascending double comparator. */ @Test public void testAscDouble() { final int maxSize = 1000; final int rounds = 1000; final Random rnd = new Random(0x11223344); for (int round = 0; round < rounds; round++) { final double[] input = generateRandom(maxSize, rnd); final IntBinaryOperator comparator = (a, b) -> Double.compare(input[a], input[b]); final int start = rnd.nextInt(input.length - 1); final int length = (input.length - start); int[] order = IndirectSort.mergesort(start, length, comparator); assertOrder(order, length, comparator); } } /** * Sort random integers from the range 0..0xff based on their 4 upper bits. The relative order of * 0xf0-masked integers should be preserved from the input. */ @Test public void testMergeSortIsStable() {
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // } // Path: hppc/src/test/java/com/carrotsearch/hppc/sorting/IndirectSortTest.java import static org.junit.Assert.*; import com.carrotsearch.hppc.XorShift128P; import java.util.Arrays; import java.util.Random; import java.util.function.IntBinaryOperator; import org.junit.*; assertOrder(order, length, intBinaryOperator); } } /** Randomized input, ascending double comparator. */ @Test public void testAscDouble() { final int maxSize = 1000; final int rounds = 1000; final Random rnd = new Random(0x11223344); for (int round = 0; round < rounds; round++) { final double[] input = generateRandom(maxSize, rnd); final IntBinaryOperator comparator = (a, b) -> Double.compare(input[a], input[b]); final int start = rnd.nextInt(input.length - 1); final int length = (input.length - start); int[] order = IndirectSort.mergesort(start, length, comparator); assertOrder(order, length, comparator); } } /** * Sort random integers from the range 0..0xff based on their 4 upper bits. The relative order of * 0xf0-masked integers should be preserved from the input. */ @Test public void testMergeSortIsStable() {
final XorShift128P rnd = new XorShift128P(0xdeadbeefL);
carrotsearch/hppc
hppc/src/test/templates/com/carrotsearch/hppc/KTypeVTypeWormMapTest.java
// Path: hppc/src/test/java/com/carrotsearch/hppc/TestUtils.java // public static void assertEquals2(double a, double b) { // org.junit.Assert.assertEquals(a, b, delta); // } // // Path: hppc/src/test/java/com/carrotsearch/hppc/TestUtils.java // public static void assertSortedListEquals(Object[] array, Object... elements) { // assertEquals(elements.length, array.length); // Arrays.sort(array); // assertArrayEquals(elements, array); // }
import com.carrotsearch.hppc.cursors.*; import com.carrotsearch.hppc.predicates.*; import com.carrotsearch.hppc.procedures.*; import org.assertj.core.api.Assertions; import org.junit.After; import org.junit.Test; import java.util.*; import static com.carrotsearch.hppc.TestUtils.assertEquals2; import static com.carrotsearch.hppc.TestUtils.assertSortedListEquals; import static org.junit.Assert.*;
/*! #set($TemplateOptions.ignored = ($TemplateOptions.isKTypeAnyOf("DOUBLE", "FLOAT", "BYTE"))) !*/ package com.carrotsearch.hppc; /** * Tests for {@link KTypeVTypeWormMap}. */ /* ! ${TemplateOptions.generatedAnnotation} ! */ public class KTypeVTypeWormMapTest<KType, VType> extends AbstractKTypeVTypeTest<KType, VType> { /** * Per-test fresh initialized instance. */ public KTypeVTypeWormMap<KType, VType> map = newInstance(); protected KTypeVTypeWormMap<KType, VType> newInstance() { return new KTypeVTypeWormMap<>(); } @After public void checkEmptySlotsUninitialized() { if (map != null) { int occupied = 0; int max = map.keys.length; for (int i = 0; i < max; i++) { if (map.next[i] == 0) { /*! #if ($TemplateOptions.KTypeGeneric) !*/
// Path: hppc/src/test/java/com/carrotsearch/hppc/TestUtils.java // public static void assertEquals2(double a, double b) { // org.junit.Assert.assertEquals(a, b, delta); // } // // Path: hppc/src/test/java/com/carrotsearch/hppc/TestUtils.java // public static void assertSortedListEquals(Object[] array, Object... elements) { // assertEquals(elements.length, array.length); // Arrays.sort(array); // assertArrayEquals(elements, array); // } // Path: hppc/src/test/templates/com/carrotsearch/hppc/KTypeVTypeWormMapTest.java import com.carrotsearch.hppc.cursors.*; import com.carrotsearch.hppc.predicates.*; import com.carrotsearch.hppc.procedures.*; import org.assertj.core.api.Assertions; import org.junit.After; import org.junit.Test; import java.util.*; import static com.carrotsearch.hppc.TestUtils.assertEquals2; import static com.carrotsearch.hppc.TestUtils.assertSortedListEquals; import static org.junit.Assert.*; /*! #set($TemplateOptions.ignored = ($TemplateOptions.isKTypeAnyOf("DOUBLE", "FLOAT", "BYTE"))) !*/ package com.carrotsearch.hppc; /** * Tests for {@link KTypeVTypeWormMap}. */ /* ! ${TemplateOptions.generatedAnnotation} ! */ public class KTypeVTypeWormMapTest<KType, VType> extends AbstractKTypeVTypeTest<KType, VType> { /** * Per-test fresh initialized instance. */ public KTypeVTypeWormMap<KType, VType> map = newInstance(); protected KTypeVTypeWormMap<KType, VType> newInstance() { return new KTypeVTypeWormMap<>(); } @After public void checkEmptySlotsUninitialized() { if (map != null) { int occupied = 0; int max = map.keys.length; for (int i = 0; i < max; i++) { if (map.next[i] == 0) { /*! #if ($TemplateOptions.KTypeGeneric) !*/
TestUtils.assertEquals2(Intrinsics.<KType> empty(), map.keys[i]);
carrotsearch/hppc
hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/IsEmpty.java
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // }
import com.carrotsearch.hppc.generator.TemplateOptions; import java.util.ArrayList; import java.util.regex.Matcher;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class IsEmpty extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb,
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/IsEmpty.java import com.carrotsearch.hppc.generator.TemplateOptions; import java.util.ArrayList; import java.util.regex.Matcher; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class IsEmpty extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb,
TemplateOptions templateOptions,
carrotsearch/hppc
hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/parser/SignatureReplacementVisitor.java
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // }
import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import com.carrotsearch.hppc.generator.parser.JavaParser.ClassDeclarationContext; import com.carrotsearch.hppc.generator.parser.JavaParser.ClassOrInterfaceTypeContext; import com.carrotsearch.hppc.generator.parser.JavaParser.ConstructorDeclarationContext; import com.carrotsearch.hppc.generator.parser.JavaParser.CreatedNameContext; import com.carrotsearch.hppc.generator.parser.JavaParser.GenericMethodDeclarationContext; import com.carrotsearch.hppc.generator.parser.JavaParser.InterfaceDeclarationContext; import com.carrotsearch.hppc.generator.parser.JavaParser.MethodDeclarationContext; import com.carrotsearch.hppc.generator.parser.JavaParser.PrimaryContext; import com.carrotsearch.hppc.generator.parser.JavaParser.QualifiedNameContext; import com.carrotsearch.hppc.generator.parser.JavaParser.TypeArgumentContext; import com.carrotsearch.hppc.generator.parser.JavaParser.TypeArgumentsContext; import com.carrotsearch.hppc.generator.parser.JavaParser.TypeBoundContext; import com.carrotsearch.hppc.generator.parser.JavaParser.TypeParameterContext; import java.io.IOException; import java.io.StringWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Deque; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.stream.Collectors; import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.misc.Interval; import org.antlr.v4.runtime.tree.TerminalNode;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.parser; class SignatureReplacementVisitor extends JavaParserBaseVisitor<List<Replacement>> { private static final List<Replacement> NONE = Collections.emptyList();
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // } // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/parser/SignatureReplacementVisitor.java import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import com.carrotsearch.hppc.generator.parser.JavaParser.ClassDeclarationContext; import com.carrotsearch.hppc.generator.parser.JavaParser.ClassOrInterfaceTypeContext; import com.carrotsearch.hppc.generator.parser.JavaParser.ConstructorDeclarationContext; import com.carrotsearch.hppc.generator.parser.JavaParser.CreatedNameContext; import com.carrotsearch.hppc.generator.parser.JavaParser.GenericMethodDeclarationContext; import com.carrotsearch.hppc.generator.parser.JavaParser.InterfaceDeclarationContext; import com.carrotsearch.hppc.generator.parser.JavaParser.MethodDeclarationContext; import com.carrotsearch.hppc.generator.parser.JavaParser.PrimaryContext; import com.carrotsearch.hppc.generator.parser.JavaParser.QualifiedNameContext; import com.carrotsearch.hppc.generator.parser.JavaParser.TypeArgumentContext; import com.carrotsearch.hppc.generator.parser.JavaParser.TypeArgumentsContext; import com.carrotsearch.hppc.generator.parser.JavaParser.TypeBoundContext; import com.carrotsearch.hppc.generator.parser.JavaParser.TypeParameterContext; import java.io.IOException; import java.io.StringWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Deque; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.stream.Collectors; import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.misc.Interval; import org.antlr.v4.runtime.tree.TerminalNode; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.parser; class SignatureReplacementVisitor extends JavaParserBaseVisitor<List<Replacement>> { private static final List<Replacement> NONE = Collections.emptyList();
private final TemplateOptions templateOptions;
carrotsearch/hppc
hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/Add.java
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // }
import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.Locale; import java.util.regex.Matcher;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class Add extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb,
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // } // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/Add.java import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.Locale; import java.util.regex.Matcher; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class Add extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb,
TemplateOptions templateOptions,
carrotsearch/hppc
hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/Add.java
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // }
import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.Locale; import java.util.regex.Matcher;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class Add extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb, TemplateOptions templateOptions, String genericCast, ArrayList<String> params) { expectArgumentCount(m, params, 2);
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // } // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/Add.java import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.Locale; import java.util.regex.Matcher; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class Add extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb, TemplateOptions templateOptions, String genericCast, ArrayList<String> params) { expectArgumentCount(m, params, 2);
Type type = inferTemplateType(m, templateOptions, genericCast);
carrotsearch/hppc
hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/Equals.java
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // }
import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.regex.Matcher;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class Equals extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb,
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // } // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/Equals.java import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.regex.Matcher; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class Equals extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb,
TemplateOptions templateOptions,
carrotsearch/hppc
hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/Equals.java
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // }
import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.regex.Matcher;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class Equals extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb, TemplateOptions templateOptions, String genericCast, ArrayList<String> arguments) { if (arguments.size() != 2 && arguments.size() != 3) { throw new RuntimeException( format( "Expected exactly 2 or 3 arguments but was %d: %s(%s)", arguments.size(), m.group(), arguments)); } String v2 = arguments.remove(arguments.size() - 1); String v1 = arguments.remove(arguments.size() - 1);
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // } // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/Equals.java import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.regex.Matcher; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class Equals extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb, TemplateOptions templateOptions, String genericCast, ArrayList<String> arguments) { if (arguments.size() != 2 && arguments.size() != 3) { throw new RuntimeException( format( "Expected exactly 2 or 3 arguments but was %d: %s(%s)", arguments.size(), m.group(), arguments)); } String v2 = arguments.remove(arguments.size() - 1); String v1 = arguments.remove(arguments.size() - 1);
Type type = inferTemplateType(m, templateOptions, genericCast);
carrotsearch/hppc
hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B003_HashSet_Contains.java
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // }
import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Param; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; @Fork(1) @Warmup(iterations = 5) @Measurement(iterations = 5) @State(Scope.Benchmark) public class B003_HashSet_Contains { @Param("0.75") public double loadFactor; @Param public Library library; @Param({"200"}) public int mbOfKeys; public int[] keys; public IntSetOps ops; @Setup(Level.Trial) public void prepare() { int keyCount = mbOfKeys * (1024 * 1024) / 4; keys = new int[keyCount];
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // } // Path: hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B003_HashSet_Contains.java import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Param; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; @Fork(1) @Warmup(iterations = 5) @Measurement(iterations = 5) @State(Scope.Benchmark) public class B003_HashSet_Contains { @Param("0.75") public double loadFactor; @Param public Library library; @Param({"200"}) public int mbOfKeys; public int[] keys; public IntSetOps ops; @Setup(Level.Trial) public void prepare() { int keyCount = mbOfKeys * (1024 * 1024) / 4; keys = new int[keyCount];
XorShift128P rnd = new XorShift128P(0xdeadbeefL);
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeContainer.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // }
import java.util.Iterator; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure;
package com.carrotsearch.hppc; /** * A generic container holding <code>KType</code>s. */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeContainer<KType> extends Iterable<KTypeCursor<KType>> { /** * Returns an iterator to a cursor traversing the collection. The order of * traversal is not defined. More than one cursor may be active at a time. The * behavior of iterators is undefined if structural changes are made to the * underlying collection. * * <p> * The iterator is implemented as a cursor and it returns <b>the same cursor * instance</b> on every call to {@link Iterator#next()} (to avoid boxing of * primitive types). To read the current list's value (or index in the list) * use the cursor's public fields. An example is shown below. * </p> * * <pre> * for (KTypeCursor&lt;KType&gt; c : container) { * System.out.println(&quot;index=&quot; + c.index + &quot; value=&quot; + c.value); * } * </pre> */ public Iterator<KTypeCursor<KType>> iterator(); /** * Lookup a given element in the container. This operation has no speed * guarantees (may be linear with respect to the size of this container). * * @return Returns <code>true</code> if this container has an element equal to * <code>e</code>. */ public boolean contains(KType e); /** * Return the current number of elements in this container. The time for * calculating the container's size may take <code>O(n)</code> time, although * implementing classes should try to maintain the current size and return in * constant time. */ public int size(); /** * Shortcut for <code>size() == 0</code>. */ public boolean isEmpty(); /** * Copies all elements of this container to an array. * * The returned array is always a copy, regardless of the storage used by the * container. */ /*! #if ($TemplateOptions.KTypePrimitive) public KType [] toArray(); #else !*/ public Object[] toArray(); /*! #end !*/ /* #if ($TemplateOptions.KTypeGeneric) */ /** * Copies all elements of this container to a dynamically created array of the * given component type. * * @throws ArrayStoreException Thrown if this container's elements are not * assignable to the array's component type. */ public <T> T[] toArray(Class<T> componentClass); /* #end */ /** * Applies a <code>procedure</code> to all container elements. Returns the * argument (any subclass of {@link KTypeProcedure}. This lets the caller to * call methods of the argument by chaining the call (even if the argument is * an anonymous type) to retrieve computed values, for example (IntContainer): * * <pre> * int count = container.forEach(new IntProcedure() { * int count; // this is a field declaration in an anonymous class. * * public void apply(int value) { * count++; * } * }).count; * </pre> */
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/KTypeContainer.java import java.util.Iterator; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure; package com.carrotsearch.hppc; /** * A generic container holding <code>KType</code>s. */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeContainer<KType> extends Iterable<KTypeCursor<KType>> { /** * Returns an iterator to a cursor traversing the collection. The order of * traversal is not defined. More than one cursor may be active at a time. The * behavior of iterators is undefined if structural changes are made to the * underlying collection. * * <p> * The iterator is implemented as a cursor and it returns <b>the same cursor * instance</b> on every call to {@link Iterator#next()} (to avoid boxing of * primitive types). To read the current list's value (or index in the list) * use the cursor's public fields. An example is shown below. * </p> * * <pre> * for (KTypeCursor&lt;KType&gt; c : container) { * System.out.println(&quot;index=&quot; + c.index + &quot; value=&quot; + c.value); * } * </pre> */ public Iterator<KTypeCursor<KType>> iterator(); /** * Lookup a given element in the container. This operation has no speed * guarantees (may be linear with respect to the size of this container). * * @return Returns <code>true</code> if this container has an element equal to * <code>e</code>. */ public boolean contains(KType e); /** * Return the current number of elements in this container. The time for * calculating the container's size may take <code>O(n)</code> time, although * implementing classes should try to maintain the current size and return in * constant time. */ public int size(); /** * Shortcut for <code>size() == 0</code>. */ public boolean isEmpty(); /** * Copies all elements of this container to an array. * * The returned array is always a copy, regardless of the storage used by the * container. */ /*! #if ($TemplateOptions.KTypePrimitive) public KType [] toArray(); #else !*/ public Object[] toArray(); /*! #end !*/ /* #if ($TemplateOptions.KTypeGeneric) */ /** * Copies all elements of this container to a dynamically created array of the * given component type. * * @throws ArrayStoreException Thrown if this container's elements are not * assignable to the array's component type. */ public <T> T[] toArray(Class<T> componentClass); /* #end */ /** * Applies a <code>procedure</code> to all container elements. Returns the * argument (any subclass of {@link KTypeProcedure}. This lets the caller to * call methods of the argument by chaining the call (even if the argument is * an anonymous type) to retrieve computed values, for example (IntContainer): * * <pre> * int count = container.forEach(new IntProcedure() { * int count; // this is a field declaration in an anonymous class. * * public void apply(int value) { * count++; * } * }).count; * </pre> */
public <T extends KTypeProcedure<? super KType>> T forEach(T procedure);
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeContainer.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // }
import java.util.Iterator; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure;
package com.carrotsearch.hppc; /** * A generic container holding <code>KType</code>s. */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeContainer<KType> extends Iterable<KTypeCursor<KType>> { /** * Returns an iterator to a cursor traversing the collection. The order of * traversal is not defined. More than one cursor may be active at a time. The * behavior of iterators is undefined if structural changes are made to the * underlying collection. * * <p> * The iterator is implemented as a cursor and it returns <b>the same cursor * instance</b> on every call to {@link Iterator#next()} (to avoid boxing of * primitive types). To read the current list's value (or index in the list) * use the cursor's public fields. An example is shown below. * </p> * * <pre> * for (KTypeCursor&lt;KType&gt; c : container) { * System.out.println(&quot;index=&quot; + c.index + &quot; value=&quot; + c.value); * } * </pre> */ public Iterator<KTypeCursor<KType>> iterator(); /** * Lookup a given element in the container. This operation has no speed * guarantees (may be linear with respect to the size of this container). * * @return Returns <code>true</code> if this container has an element equal to * <code>e</code>. */ public boolean contains(KType e); /** * Return the current number of elements in this container. The time for * calculating the container's size may take <code>O(n)</code> time, although * implementing classes should try to maintain the current size and return in * constant time. */ public int size(); /** * Shortcut for <code>size() == 0</code>. */ public boolean isEmpty(); /** * Copies all elements of this container to an array. * * The returned array is always a copy, regardless of the storage used by the * container. */ /*! #if ($TemplateOptions.KTypePrimitive) public KType [] toArray(); #else !*/ public Object[] toArray(); /*! #end !*/ /* #if ($TemplateOptions.KTypeGeneric) */ /** * Copies all elements of this container to a dynamically created array of the * given component type. * * @throws ArrayStoreException Thrown if this container's elements are not * assignable to the array's component type. */ public <T> T[] toArray(Class<T> componentClass); /* #end */ /** * Applies a <code>procedure</code> to all container elements. Returns the * argument (any subclass of {@link KTypeProcedure}. This lets the caller to * call methods of the argument by chaining the call (even if the argument is * an anonymous type) to retrieve computed values, for example (IntContainer): * * <pre> * int count = container.forEach(new IntProcedure() { * int count; // this is a field declaration in an anonymous class. * * public void apply(int value) { * count++; * } * }).count; * </pre> */ public <T extends KTypeProcedure<? super KType>> T forEach(T procedure); /** * Applies a <code>predicate</code> to container elements as long, as the * predicate returns <code>true</code>. The iteration is interrupted * otherwise. */
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/KTypeContainer.java import java.util.Iterator; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure; package com.carrotsearch.hppc; /** * A generic container holding <code>KType</code>s. */ /*! ${TemplateOptions.generatedAnnotation} !*/ public interface KTypeContainer<KType> extends Iterable<KTypeCursor<KType>> { /** * Returns an iterator to a cursor traversing the collection. The order of * traversal is not defined. More than one cursor may be active at a time. The * behavior of iterators is undefined if structural changes are made to the * underlying collection. * * <p> * The iterator is implemented as a cursor and it returns <b>the same cursor * instance</b> on every call to {@link Iterator#next()} (to avoid boxing of * primitive types). To read the current list's value (or index in the list) * use the cursor's public fields. An example is shown below. * </p> * * <pre> * for (KTypeCursor&lt;KType&gt; c : container) { * System.out.println(&quot;index=&quot; + c.index + &quot; value=&quot; + c.value); * } * </pre> */ public Iterator<KTypeCursor<KType>> iterator(); /** * Lookup a given element in the container. This operation has no speed * guarantees (may be linear with respect to the size of this container). * * @return Returns <code>true</code> if this container has an element equal to * <code>e</code>. */ public boolean contains(KType e); /** * Return the current number of elements in this container. The time for * calculating the container's size may take <code>O(n)</code> time, although * implementing classes should try to maintain the current size and return in * constant time. */ public int size(); /** * Shortcut for <code>size() == 0</code>. */ public boolean isEmpty(); /** * Copies all elements of this container to an array. * * The returned array is always a copy, regardless of the storage used by the * container. */ /*! #if ($TemplateOptions.KTypePrimitive) public KType [] toArray(); #else !*/ public Object[] toArray(); /*! #end !*/ /* #if ($TemplateOptions.KTypeGeneric) */ /** * Copies all elements of this container to a dynamically created array of the * given component type. * * @throws ArrayStoreException Thrown if this container's elements are not * assignable to the array's component type. */ public <T> T[] toArray(Class<T> componentClass); /* #end */ /** * Applies a <code>procedure</code> to all container elements. Returns the * argument (any subclass of {@link KTypeProcedure}. This lets the caller to * call methods of the argument by chaining the call (even if the argument is * an anonymous type) to retrieve computed values, for example (IntContainer): * * <pre> * int count = container.forEach(new IntProcedure() { * int count; // this is a field declaration in an anonymous class. * * public void apply(int value) { * count++; * } * }).count; * </pre> */ public <T extends KTypeProcedure<? super KType>> T forEach(T procedure); /** * Applies a <code>predicate</code> to container elements as long, as the * predicate returns <code>true</code>. The iteration is interrupted * otherwise. */
public <T extends KTypePredicate<? super KType>> T forEach(T predicate);
carrotsearch/hppc
hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B006_HashSet_Contains_Random.java
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // }
import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; // To normalize the measure, run B009_Random to know how much time XorShift128P.nextInt() takes. @Fork(1) @Warmup(iterations = 5) @Measurement(iterations = 5) @State(Scope.Benchmark) public class B006_HashSet_Contains_Random { @Param("0.75") public double loadFactor; @Param public Library library; @Param({"16"}) // {"16", "18", "20"} public int capacityPowerOf2; @Param({"0.45", "0.5", "0.55", "0.6", "0.65", "0.7", "0.74"}) public float load; public int keyCount; public IntSetOps ops;
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // } // Path: hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B006_HashSet_Contains_Random.java import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; // To normalize the measure, run B009_Random to know how much time XorShift128P.nextInt() takes. @Fork(1) @Warmup(iterations = 5) @Measurement(iterations = 5) @State(Scope.Benchmark) public class B006_HashSet_Contains_Random { @Param("0.75") public double loadFactor; @Param public Library library; @Param({"16"}) // {"16", "18", "20"} public int capacityPowerOf2; @Param({"0.45", "0.5", "0.55", "0.6", "0.65", "0.7", "0.74"}) public float load; public int keyCount; public IntSetOps ops;
public XorShift128P rnd;
carrotsearch/hppc
hppc/src/test/templates/com/carrotsearch/hppc/KTypeWormSetTest.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // } // // Path: hppc/src/test/java/com/carrotsearch/hppc/TestUtils.java // public static void assertSortedListEquals(Object[] array, Object... elements) { // assertEquals(elements.length, array.length); // Arrays.sort(array); // assertArrayEquals(elements, array); // }
import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure; import com.carrotsearch.randomizedtesting.RandomizedTest; import org.assertj.core.api.Assertions; import org.junit.Before; import org.junit.Test; import java.util.concurrent.atomic.AtomicInteger; import static com.carrotsearch.hppc.TestUtils.assertSortedListEquals; import static org.junit.Assert.*;
KTypeWormSet<KType> l3 = new Sub(); l2.addAll(l1); l3.addAll(l1); Assertions.assertThat(l2).isEqualTo(l3); Assertions.assertThat(l1).isNotEqualTo(l2); } /* */ @Test public void testForEachPredicate() { final KTypeWormSet<KType> set = KTypeWormSet.from(keyE, k1, k2, k3); final KTypeWormSet<KType> other = new KTypeWormSet<>(); set.forEach(new KTypePredicate<KType>() { @Override public boolean apply(KType value) { other.add(value); return true; } }); Assertions.assertThat(other).isEqualTo(set); } /* */ @Test public void testForEachProcedure() { final KTypeWormSet<KType> set = KTypeWormSet.from(keyE, k1, k2, k3); final KTypeWormSet<KType> other = new KTypeWormSet<>();
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // } // // Path: hppc/src/test/java/com/carrotsearch/hppc/TestUtils.java // public static void assertSortedListEquals(Object[] array, Object... elements) { // assertEquals(elements.length, array.length); // Arrays.sort(array); // assertArrayEquals(elements, array); // } // Path: hppc/src/test/templates/com/carrotsearch/hppc/KTypeWormSetTest.java import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure; import com.carrotsearch.randomizedtesting.RandomizedTest; import org.assertj.core.api.Assertions; import org.junit.Before; import org.junit.Test; import java.util.concurrent.atomic.AtomicInteger; import static com.carrotsearch.hppc.TestUtils.assertSortedListEquals; import static org.junit.Assert.*; KTypeWormSet<KType> l3 = new Sub(); l2.addAll(l1); l3.addAll(l1); Assertions.assertThat(l2).isEqualTo(l3); Assertions.assertThat(l1).isNotEqualTo(l2); } /* */ @Test public void testForEachPredicate() { final KTypeWormSet<KType> set = KTypeWormSet.from(keyE, k1, k2, k3); final KTypeWormSet<KType> other = new KTypeWormSet<>(); set.forEach(new KTypePredicate<KType>() { @Override public boolean apply(KType value) { other.add(value); return true; } }); Assertions.assertThat(other).isEqualTo(set); } /* */ @Test public void testForEachProcedure() { final KTypeWormSet<KType> set = KTypeWormSet.from(keyE, k1, k2, k3); final KTypeWormSet<KType> other = new KTypeWormSet<>();
set.forEach(new KTypeProcedure<KType>() {
carrotsearch/hppc
hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/AbstractIntrinsicMethod.java
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/IntrinsicMethod.java // public interface IntrinsicMethod { // void invoke( // Matcher m, // StringBuilder sb, // TemplateOptions templateOptions, // String genericCast, // ArrayList<String> params); // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // }
import com.carrotsearch.hppc.generator.IntrinsicMethod; import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.Locale; import java.util.regex.Matcher;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; abstract class AbstractIntrinsicMethod implements IntrinsicMethod { protected static Type inferTemplateType(
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/IntrinsicMethod.java // public interface IntrinsicMethod { // void invoke( // Matcher m, // StringBuilder sb, // TemplateOptions templateOptions, // String genericCast, // ArrayList<String> params); // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // } // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/AbstractIntrinsicMethod.java import com.carrotsearch.hppc.generator.IntrinsicMethod; import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.Locale; import java.util.regex.Matcher; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; abstract class AbstractIntrinsicMethod implements IntrinsicMethod { protected static Type inferTemplateType(
Matcher m, TemplateOptions templateOptions, String templateCast) {
carrotsearch/hppc
hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B007_HashMap_Put_Random.java
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // }
import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; // To normalize the measure, run B009_Random to know how much time XorShift128P.nextInt() takes. @Fork(1) @Warmup(iterations = 5) @Measurement(iterations = 5) @State(Scope.Benchmark) public class B007_HashMap_Put_Random { @Param("0.75") public double loadFactor; @Param public Library library; @Param({"3", "6", "12", "24"}) public int mbOfKeys; public int keyCount; public IntIntMapOps[] ops;
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // } // Path: hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B007_HashMap_Put_Random.java import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; // To normalize the measure, run B009_Random to know how much time XorShift128P.nextInt() takes. @Fork(1) @Warmup(iterations = 5) @Measurement(iterations = 5) @State(Scope.Benchmark) public class B007_HashMap_Put_Random { @Param("0.75") public double loadFactor; @Param public Library library; @Param({"3", "6", "12", "24"}) public int mbOfKeys; public int keyCount; public IntIntMapOps[] ops;
public XorShift128P rnd;
carrotsearch/hppc
hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/NewArray.java
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // }
import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.regex.Matcher;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class NewArray extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb,
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // } // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/NewArray.java import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.regex.Matcher; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class NewArray extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb,
TemplateOptions templateOptions,
carrotsearch/hppc
hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/NewArray.java
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // }
import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.regex.Matcher;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class NewArray extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb, TemplateOptions templateOptions, String genericCast, ArrayList<String> params) { expectArgumentCount(m, params, 1); genericCast = inferTemplateCastName(m, templateOptions, genericCast);
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // } // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/intrinsics/NewArray.java import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import java.util.ArrayList; import java.util.regex.Matcher; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.intrinsics; public class NewArray extends AbstractIntrinsicMethod { @Override public void invoke( Matcher m, StringBuilder sb, TemplateOptions templateOptions, String genericCast, ArrayList<String> params) { expectArgumentCount(m, params, 1); genericCast = inferTemplateCastName(m, templateOptions, genericCast);
Type type = inferTemplateType(m, templateOptions, genericCast);
carrotsearch/hppc
hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B005_HashSet_Add_Random.java
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // }
import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; // To normalize the measure, run B009_Random to know how much time XorShift128P.nextInt() takes. @Fork(1) @Warmup(iterations = 5) @Measurement(iterations = 5) @State(Scope.Benchmark) public class B005_HashSet_Add_Random { @Param("0.75") public double loadFactor; @Param public Library library; @Param({"3", "6", "12", "24"}) public int mbOfKeys; public int keyCount; public IntSetOps[] ops;
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // } // Path: hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B005_HashSet_Add_Random.java import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; // To normalize the measure, run B009_Random to know how much time XorShift128P.nextInt() takes. @Fork(1) @Warmup(iterations = 5) @Measurement(iterations = 5) @State(Scope.Benchmark) public class B005_HashSet_Add_Random { @Param("0.75") public double loadFactor; @Param public Library library; @Param({"3", "6", "12", "24"}) public int mbOfKeys; public int keyCount; public IntSetOps[] ops;
public XorShift128P rnd;
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // } // // Path: hppc/src/main/java/com/carrotsearch/hppc/Containers.java // public final class Containers { // /** The default number of expected elements for containers. */ // public static final int DEFAULT_EXPECTED_ELEMENTS = 4; // // /** // * External initial seed value. We do not care about multiple assignments so not volatile. // * // * @see #randomSeed64() // */ // private static String testsSeedProperty; // // /** Unique marker for {@link #testsSeedProperty}. */ // private static final String NOT_AVAILABLE = new String(); // // private Containers() {} // // /** // * Provides a (possibly) random initial seed for randomized stuff. // * // * <p>If <code>tests.seed</code> property is available and accessible, the returned value will be // * derived from the value of that property and will be constant to ensure reproducibility in // * presence of the randomized testing package. // * // * @see "https://github.com/carrotsearch/randomizedtesting" // */ // @SuppressForbidden // public static long randomSeed64() { // if (testsSeedProperty == null) { // try { // testsSeedProperty = // java.security.AccessController.doPrivileged( // new PrivilegedAction<String>() { // @Override // public String run() { // return System.getProperty("tests.seed", NOT_AVAILABLE); // } // }); // } catch (SecurityException e) { // // If failed on security exception, don't panic. // testsSeedProperty = NOT_AVAILABLE; // Logger.getLogger(Containers.class.getName()) // .log(Level.INFO, "Failed to read 'tests.seed' property for initial random seed.", e); // } // } // // long initialSeed; // if (testsSeedProperty != NOT_AVAILABLE) { // initialSeed = testsSeedProperty.hashCode(); // } else { // // Mix something that is changing over time (nanoTime) // // ... with something that is thread-local and relatively unique // // even for very short time-spans (new Object's address from a TLAB). // initialSeed = System.nanoTime() ^ System.identityHashCode(new Object()); // } // return BitMixer.mix64(initialSeed); // } // // /** Reset state for tests. */ // static void test$reset() { // testsSeedProperty = null; // } // }
import java.util.*; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure; import static com.carrotsearch.hppc.Containers.*;
/** * Vararg-signature method for adding elements at the front of this deque. * * <p><b>This method is handy, but costly if used in tight loops (anonymous * array passing)</b></p> * * @param elements The elements to add. */ /* #if ($TemplateOptions.KTypeGeneric) */ @SafeVarargs /* #end */ public final void addFirst(KType... elements) { ensureBufferSpace(elements.length); for (KType k : elements) { addFirst(k); } } /** * Inserts all elements from the given container to the front of this deque. * * @param container The container to iterate over. * * @return Returns the number of elements actually added as a result of this * call. */ public int addFirst(KTypeContainer<? extends KType> container) { int size = container.size(); ensureBufferSpace(size);
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // } // // Path: hppc/src/main/java/com/carrotsearch/hppc/Containers.java // public final class Containers { // /** The default number of expected elements for containers. */ // public static final int DEFAULT_EXPECTED_ELEMENTS = 4; // // /** // * External initial seed value. We do not care about multiple assignments so not volatile. // * // * @see #randomSeed64() // */ // private static String testsSeedProperty; // // /** Unique marker for {@link #testsSeedProperty}. */ // private static final String NOT_AVAILABLE = new String(); // // private Containers() {} // // /** // * Provides a (possibly) random initial seed for randomized stuff. // * // * <p>If <code>tests.seed</code> property is available and accessible, the returned value will be // * derived from the value of that property and will be constant to ensure reproducibility in // * presence of the randomized testing package. // * // * @see "https://github.com/carrotsearch/randomizedtesting" // */ // @SuppressForbidden // public static long randomSeed64() { // if (testsSeedProperty == null) { // try { // testsSeedProperty = // java.security.AccessController.doPrivileged( // new PrivilegedAction<String>() { // @Override // public String run() { // return System.getProperty("tests.seed", NOT_AVAILABLE); // } // }); // } catch (SecurityException e) { // // If failed on security exception, don't panic. // testsSeedProperty = NOT_AVAILABLE; // Logger.getLogger(Containers.class.getName()) // .log(Level.INFO, "Failed to read 'tests.seed' property for initial random seed.", e); // } // } // // long initialSeed; // if (testsSeedProperty != NOT_AVAILABLE) { // initialSeed = testsSeedProperty.hashCode(); // } else { // // Mix something that is changing over time (nanoTime) // // ... with something that is thread-local and relatively unique // // even for very short time-spans (new Object's address from a TLAB). // initialSeed = System.nanoTime() ^ System.identityHashCode(new Object()); // } // return BitMixer.mix64(initialSeed); // } // // /** Reset state for tests. */ // static void test$reset() { // testsSeedProperty = null; // } // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java import java.util.*; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure; import static com.carrotsearch.hppc.Containers.*; /** * Vararg-signature method for adding elements at the front of this deque. * * <p><b>This method is handy, but costly if used in tight loops (anonymous * array passing)</b></p> * * @param elements The elements to add. */ /* #if ($TemplateOptions.KTypeGeneric) */ @SafeVarargs /* #end */ public final void addFirst(KType... elements) { ensureBufferSpace(elements.length); for (KType k : elements) { addFirst(k); } } /** * Inserts all elements from the given container to the front of this deque. * * @param container The container to iterate over. * * @return Returns the number of elements actually added as a result of this * call. */ public int addFirst(KTypeContainer<? extends KType> container) { int size = container.size(); ensureBufferSpace(size);
for (KTypeCursor<? extends KType> cursor : container) {
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // } // // Path: hppc/src/main/java/com/carrotsearch/hppc/Containers.java // public final class Containers { // /** The default number of expected elements for containers. */ // public static final int DEFAULT_EXPECTED_ELEMENTS = 4; // // /** // * External initial seed value. We do not care about multiple assignments so not volatile. // * // * @see #randomSeed64() // */ // private static String testsSeedProperty; // // /** Unique marker for {@link #testsSeedProperty}. */ // private static final String NOT_AVAILABLE = new String(); // // private Containers() {} // // /** // * Provides a (possibly) random initial seed for randomized stuff. // * // * <p>If <code>tests.seed</code> property is available and accessible, the returned value will be // * derived from the value of that property and will be constant to ensure reproducibility in // * presence of the randomized testing package. // * // * @see "https://github.com/carrotsearch/randomizedtesting" // */ // @SuppressForbidden // public static long randomSeed64() { // if (testsSeedProperty == null) { // try { // testsSeedProperty = // java.security.AccessController.doPrivileged( // new PrivilegedAction<String>() { // @Override // public String run() { // return System.getProperty("tests.seed", NOT_AVAILABLE); // } // }); // } catch (SecurityException e) { // // If failed on security exception, don't panic. // testsSeedProperty = NOT_AVAILABLE; // Logger.getLogger(Containers.class.getName()) // .log(Level.INFO, "Failed to read 'tests.seed' property for initial random seed.", e); // } // } // // long initialSeed; // if (testsSeedProperty != NOT_AVAILABLE) { // initialSeed = testsSeedProperty.hashCode(); // } else { // // Mix something that is changing over time (nanoTime) // // ... with something that is thread-local and relatively unique // // even for very short time-spans (new Object's address from a TLAB). // initialSeed = System.nanoTime() ^ System.identityHashCode(new Object()); // } // return BitMixer.mix64(initialSeed); // } // // /** Reset state for tests. */ // static void test$reset() { // testsSeedProperty = null; // } // }
import java.util.*; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure; import static com.carrotsearch.hppc.Containers.*;
* System.out.println(&quot;buffer index=&quot; + c.index + &quot; value=&quot; + c.value); * } * </pre> */ public Iterator<KTypeCursor<KType>> iterator() { return new ValueIterator(); } /** * Returns a cursor over the values of this deque (in tail to head order). The * iterator is implemented as a cursor and it returns <b>the same cursor * instance</b> on every call to {@link Iterator#next()} (to avoid boxing of * primitive types). To read the current value (or index in the deque's * buffer) use the cursor's public fields. An example is shown below. * * <pre> * for (Iterator&lt;IntCursor&gt; i = intDeque.descendingIterator(); i.hasNext();) { * final IntCursor c = i.next(); * System.out.println(&quot;buffer index=&quot; + c.index + &quot; value=&quot; + c.value); * } * </pre> */ public Iterator<KTypeCursor<KType>> descendingIterator() { return new DescendingValueIterator(); } /** * {@inheritDoc} */ @Override
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // } // // Path: hppc/src/main/java/com/carrotsearch/hppc/Containers.java // public final class Containers { // /** The default number of expected elements for containers. */ // public static final int DEFAULT_EXPECTED_ELEMENTS = 4; // // /** // * External initial seed value. We do not care about multiple assignments so not volatile. // * // * @see #randomSeed64() // */ // private static String testsSeedProperty; // // /** Unique marker for {@link #testsSeedProperty}. */ // private static final String NOT_AVAILABLE = new String(); // // private Containers() {} // // /** // * Provides a (possibly) random initial seed for randomized stuff. // * // * <p>If <code>tests.seed</code> property is available and accessible, the returned value will be // * derived from the value of that property and will be constant to ensure reproducibility in // * presence of the randomized testing package. // * // * @see "https://github.com/carrotsearch/randomizedtesting" // */ // @SuppressForbidden // public static long randomSeed64() { // if (testsSeedProperty == null) { // try { // testsSeedProperty = // java.security.AccessController.doPrivileged( // new PrivilegedAction<String>() { // @Override // public String run() { // return System.getProperty("tests.seed", NOT_AVAILABLE); // } // }); // } catch (SecurityException e) { // // If failed on security exception, don't panic. // testsSeedProperty = NOT_AVAILABLE; // Logger.getLogger(Containers.class.getName()) // .log(Level.INFO, "Failed to read 'tests.seed' property for initial random seed.", e); // } // } // // long initialSeed; // if (testsSeedProperty != NOT_AVAILABLE) { // initialSeed = testsSeedProperty.hashCode(); // } else { // // Mix something that is changing over time (nanoTime) // // ... with something that is thread-local and relatively unique // // even for very short time-spans (new Object's address from a TLAB). // initialSeed = System.nanoTime() ^ System.identityHashCode(new Object()); // } // return BitMixer.mix64(initialSeed); // } // // /** Reset state for tests. */ // static void test$reset() { // testsSeedProperty = null; // } // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java import java.util.*; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure; import static com.carrotsearch.hppc.Containers.*; * System.out.println(&quot;buffer index=&quot; + c.index + &quot; value=&quot; + c.value); * } * </pre> */ public Iterator<KTypeCursor<KType>> iterator() { return new ValueIterator(); } /** * Returns a cursor over the values of this deque (in tail to head order). The * iterator is implemented as a cursor and it returns <b>the same cursor * instance</b> on every call to {@link Iterator#next()} (to avoid boxing of * primitive types). To read the current value (or index in the deque's * buffer) use the cursor's public fields. An example is shown below. * * <pre> * for (Iterator&lt;IntCursor&gt; i = intDeque.descendingIterator(); i.hasNext();) { * final IntCursor c = i.next(); * System.out.println(&quot;buffer index=&quot; + c.index + &quot; value=&quot; + c.value); * } * </pre> */ public Iterator<KTypeCursor<KType>> descendingIterator() { return new DescendingValueIterator(); } /** * {@inheritDoc} */ @Override
public <T extends KTypeProcedure<? super KType>> T forEach(T procedure) {
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // } // // Path: hppc/src/main/java/com/carrotsearch/hppc/Containers.java // public final class Containers { // /** The default number of expected elements for containers. */ // public static final int DEFAULT_EXPECTED_ELEMENTS = 4; // // /** // * External initial seed value. We do not care about multiple assignments so not volatile. // * // * @see #randomSeed64() // */ // private static String testsSeedProperty; // // /** Unique marker for {@link #testsSeedProperty}. */ // private static final String NOT_AVAILABLE = new String(); // // private Containers() {} // // /** // * Provides a (possibly) random initial seed for randomized stuff. // * // * <p>If <code>tests.seed</code> property is available and accessible, the returned value will be // * derived from the value of that property and will be constant to ensure reproducibility in // * presence of the randomized testing package. // * // * @see "https://github.com/carrotsearch/randomizedtesting" // */ // @SuppressForbidden // public static long randomSeed64() { // if (testsSeedProperty == null) { // try { // testsSeedProperty = // java.security.AccessController.doPrivileged( // new PrivilegedAction<String>() { // @Override // public String run() { // return System.getProperty("tests.seed", NOT_AVAILABLE); // } // }); // } catch (SecurityException e) { // // If failed on security exception, don't panic. // testsSeedProperty = NOT_AVAILABLE; // Logger.getLogger(Containers.class.getName()) // .log(Level.INFO, "Failed to read 'tests.seed' property for initial random seed.", e); // } // } // // long initialSeed; // if (testsSeedProperty != NOT_AVAILABLE) { // initialSeed = testsSeedProperty.hashCode(); // } else { // // Mix something that is changing over time (nanoTime) // // ... with something that is thread-local and relatively unique // // even for very short time-spans (new Object's address from a TLAB). // initialSeed = System.nanoTime() ^ System.identityHashCode(new Object()); // } // return BitMixer.mix64(initialSeed); // } // // /** Reset state for tests. */ // static void test$reset() { // testsSeedProperty = null; // } // }
import java.util.*; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure; import static com.carrotsearch.hppc.Containers.*;
* </pre> */ public Iterator<KTypeCursor<KType>> descendingIterator() { return new DescendingValueIterator(); } /** * {@inheritDoc} */ @Override public <T extends KTypeProcedure<? super KType>> T forEach(T procedure) { forEach(procedure, head, tail); return procedure; } /** * Applies <code>procedure</code> to a slice of the deque, * <code>fromIndex</code>, inclusive, to <code>toIndex</code>, exclusive. */ private void forEach(KTypeProcedure<? super KType> procedure, int fromIndex, final int toIndex) { final KType[] buffer = Intrinsics.<KType[]> cast(this.buffer); for (int i = fromIndex; i != toIndex; i = oneRight(i, buffer.length)) { procedure.apply(buffer[i]); } } /** * {@inheritDoc} */ @Override
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java // public interface KTypePredicate<KType> { // public boolean apply(KType value); // } // // Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java // public interface KTypeProcedure<KType> { // public void apply(KType value); // } // // Path: hppc/src/main/java/com/carrotsearch/hppc/Containers.java // public final class Containers { // /** The default number of expected elements for containers. */ // public static final int DEFAULT_EXPECTED_ELEMENTS = 4; // // /** // * External initial seed value. We do not care about multiple assignments so not volatile. // * // * @see #randomSeed64() // */ // private static String testsSeedProperty; // // /** Unique marker for {@link #testsSeedProperty}. */ // private static final String NOT_AVAILABLE = new String(); // // private Containers() {} // // /** // * Provides a (possibly) random initial seed for randomized stuff. // * // * <p>If <code>tests.seed</code> property is available and accessible, the returned value will be // * derived from the value of that property and will be constant to ensure reproducibility in // * presence of the randomized testing package. // * // * @see "https://github.com/carrotsearch/randomizedtesting" // */ // @SuppressForbidden // public static long randomSeed64() { // if (testsSeedProperty == null) { // try { // testsSeedProperty = // java.security.AccessController.doPrivileged( // new PrivilegedAction<String>() { // @Override // public String run() { // return System.getProperty("tests.seed", NOT_AVAILABLE); // } // }); // } catch (SecurityException e) { // // If failed on security exception, don't panic. // testsSeedProperty = NOT_AVAILABLE; // Logger.getLogger(Containers.class.getName()) // .log(Level.INFO, "Failed to read 'tests.seed' property for initial random seed.", e); // } // } // // long initialSeed; // if (testsSeedProperty != NOT_AVAILABLE) { // initialSeed = testsSeedProperty.hashCode(); // } else { // // Mix something that is changing over time (nanoTime) // // ... with something that is thread-local and relatively unique // // even for very short time-spans (new Object's address from a TLAB). // initialSeed = System.nanoTime() ^ System.identityHashCode(new Object()); // } // return BitMixer.mix64(initialSeed); // } // // /** Reset state for tests. */ // static void test$reset() { // testsSeedProperty = null; // } // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java import java.util.*; import com.carrotsearch.hppc.cursors.KTypeCursor; import com.carrotsearch.hppc.predicates.KTypePredicate; import com.carrotsearch.hppc.procedures.KTypeProcedure; import static com.carrotsearch.hppc.Containers.*; * </pre> */ public Iterator<KTypeCursor<KType>> descendingIterator() { return new DescendingValueIterator(); } /** * {@inheritDoc} */ @Override public <T extends KTypeProcedure<? super KType>> T forEach(T procedure) { forEach(procedure, head, tail); return procedure; } /** * Applies <code>procedure</code> to a slice of the deque, * <code>fromIndex</code>, inclusive, to <code>toIndex</code>, exclusive. */ private void forEach(KTypeProcedure<? super KType> procedure, int fromIndex, final int toIndex) { final KType[] buffer = Intrinsics.<KType[]> cast(this.buffer); for (int i = fromIndex; i != toIndex; i = oneRight(i, buffer.length)) { procedure.apply(buffer[i]); } } /** * {@inheritDoc} */ @Override
public <T extends KTypePredicate<? super KType>> T forEach(T predicate) {
carrotsearch/hppc
hppc-template-processor/src/test/java/com/carrotsearch/hppc/generator/parser/TestSignatureProcessor.java
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // }
import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import com.carrotsearch.randomizedtesting.RandomizedRunner; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; import org.assertj.core.api.Assertions; import org.junit.Test; import org.junit.runner.RunWith;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.parser; @RunWith(RandomizedRunner.class) public class TestSignatureProcessor { @Test public void testComplexClassInterfaceDeclaration() throws IOException { checkResource(
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // } // Path: hppc-template-processor/src/test/java/com/carrotsearch/hppc/generator/parser/TestSignatureProcessor.java import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import com.carrotsearch.randomizedtesting.RandomizedRunner; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; import org.assertj.core.api.Assertions; import org.junit.Test; import org.junit.runner.RunWith; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.parser; @RunWith(RandomizedRunner.class) public class TestSignatureProcessor { @Test public void testComplexClassInterfaceDeclaration() throws IOException { checkResource(
new TemplateOptions(Type.GENERIC, Type.GENERIC),
carrotsearch/hppc
hppc-template-processor/src/test/java/com/carrotsearch/hppc/generator/parser/TestSignatureProcessor.java
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // }
import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import com.carrotsearch.randomizedtesting.RandomizedRunner; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; import org.assertj.core.api.Assertions; import org.junit.Test; import org.junit.runner.RunWith;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.parser; @RunWith(RandomizedRunner.class) public class TestSignatureProcessor { @Test public void testComplexClassInterfaceDeclaration() throws IOException { checkResource(
// Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/TemplateOptions.java // public class TemplateOptions { // public static final String TEMPLATE_FILE_TOKEN = "__TEMPLATE_SOURCE__"; // // private boolean ignore; // // public Type ktype; // public Type vtype; // // public Path templateFile; // // public TemplateOptions(Type ktype) { // this(ktype, null); // } // // public TemplateOptions(Type ktype, Type vtype) { // this.ktype = ktype; // this.vtype = vtype; // } // // public void setIgnored(boolean ignore) { // this.ignore = ignore; // } // // public boolean isIgnored() { // return ignore; // } // // public boolean isKTypeAnyOf(String... typeNames) { // for (String type : typeNames) { // Type t = Type.valueOf(type); // if (ktype == t) { // return true; // } // } // return false; // } // // public boolean isKTypePrimitive() { // return ktype != Type.GENERIC; // } // // public boolean isVTypePrimitive() { // return getVType() != Type.GENERIC; // } // // public boolean isKTypeGeneric() { // return ktype == Type.GENERIC; // } // // public boolean isVTypeGeneric() { // return getVType() == Type.GENERIC; // } // // public boolean isAllGeneric() { // return isKTypeGeneric() && isVTypeGeneric(); // } // // public boolean isAnyPrimitive() { // return isKTypePrimitive() || isVTypePrimitive(); // } // // public boolean isAnyGeneric() { // return isKTypeGeneric() || (hasVType() && isVTypeGeneric()); // } // // public boolean hasVType() { // return vtype != null; // } // // public boolean hasKType() { // return true; // } // // public Type getKType() { // if (!hasKType()) { // throw new IllegalArgumentException("Template does not specify KType."); // } // return ktype; // } // // public Type getVType() { // if (!hasVType()) { // throw new IllegalArgumentException("Template does not specify VType."); // } // return vtype; // } // // /* // * Returns the current time in ISO format. // */ // public String getTimeNow() { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ROOT); // return format.format(new Date()); // } // // public String getTemplateFile() { // return templateFile.getFileName().toString(); // } // // public String getGeneratedAnnotation() { // return String.format( // Locale.ROOT, // "@com.carrotsearch.hppc.Generated(\n" + " date = \"%s\",\n" + " value = \"%s\")", // getTimeNow(), // TEMPLATE_FILE_TOKEN); // } // } // // Path: hppc-template-processor/src/main/java/com/carrotsearch/hppc/generator/Type.java // public enum Type { // GENERIC, // BYTE, // CHAR, // SHORT, // INT, // FLOAT, // LONG, // DOUBLE; // // public String getBoxedType() { // if (this == GENERIC) { // return "Object"; // } else { // String boxed = name().toLowerCase(Locale.ROOT); // return Character.toUpperCase(boxed.charAt(0)) + boxed.substring(1); // } // } // // public String getType() { // if (this == GENERIC) { // return "Object"; // } else { // return name().toLowerCase(Locale.ROOT); // } // } // // public boolean isGeneric() { // return this == GENERIC; // } // } // Path: hppc-template-processor/src/test/java/com/carrotsearch/hppc/generator/parser/TestSignatureProcessor.java import com.carrotsearch.hppc.generator.TemplateOptions; import com.carrotsearch.hppc.generator.Type; import com.carrotsearch.randomizedtesting.RandomizedRunner; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; import org.assertj.core.api.Assertions; import org.junit.Test; import org.junit.runner.RunWith; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.generator.parser; @RunWith(RandomizedRunner.class) public class TestSignatureProcessor { @Test public void testComplexClassInterfaceDeclaration() throws IOException { checkResource(
new TemplateOptions(Type.GENERIC, Type.GENERIC),
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeStack.java
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // }
import java.util.Arrays; import com.carrotsearch.hppc.cursors.KTypeCursor;
ensureBufferSpace(len); System.arraycopy(elements, start, buffer, elementsCount, len); elementsCount += len; } /** * Vararg-signature method for pushing elements at the top of the stack. * <p> * <b>This method is handy, but costly if used in tight loops (anonymous array * passing)</b> * </p> */ /* #if ($TemplateOptions.KTypeGeneric) */ @SafeVarargs /* #end */ public final void push(KType... elements) { push(elements, 0, elements.length); } /** * Pushes all elements from another container to the top of the stack. */ public int pushAll(KTypeContainer<? extends KType> container) { return addAll(container); } /** * Pushes all elements from another iterable to the top of the stack. */
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java // public final class KTypeCursor<KType> { // /** // * The current value's index in the container this cursor belongs to. The // * meaning of this index is defined by the container (usually it will be an // * index in the underlying storage buffer). // */ // public int index; // // /** // * The current value. // */ // public KType value; // // @Override // public String toString() { // return "[cursor, index: " + index + ", value: " + value + "]"; // } // } // Path: hppc/src/main/templates/com/carrotsearch/hppc/KTypeStack.java import java.util.Arrays; import com.carrotsearch.hppc.cursors.KTypeCursor; ensureBufferSpace(len); System.arraycopy(elements, start, buffer, elementsCount, len); elementsCount += len; } /** * Vararg-signature method for pushing elements at the top of the stack. * <p> * <b>This method is handy, but costly if used in tight loops (anonymous array * passing)</b> * </p> */ /* #if ($TemplateOptions.KTypeGeneric) */ @SafeVarargs /* #end */ public final void push(KType... elements) { push(elements, 0, elements.length); } /** * Pushes all elements from another container to the top of the stack. */ public int pushAll(KTypeContainer<? extends KType> container) { return addAll(container); } /** * Pushes all elements from another iterable to the top of the stack. */
public int pushAll(Iterable<? extends KTypeCursor<? extends KType>> iterable) {
carrotsearch/hppc
hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B009_Random.java
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // }
import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder;
/* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; @Fork(1) @Warmup(iterations = 10) @Measurement(iterations = 10) @State(Scope.Benchmark) public class B009_Random { @Param({"50000000"}) public int numLoops;
// Path: hppc/src/main/java/com/carrotsearch/hppc/XorShift128P.java // public class XorShift128P { // /* // * 128 bits of state. // */ // private long state0, state1; // // public XorShift128P(long seed) { // state0 = notZero(BitMixer.mix64(seed)); // state1 = notZero(BitMixer.mix64(seed + 1)); // } // // public XorShift128P() { // this(Containers.randomSeed64()); // } // // public long nextLong() { // long s1 = state0; // long s0 = state1; // state0 = s0; // s1 ^= s1 << 23; // return (state1 = (s1 ^ s0 ^ (s1 >>> 17) ^ (s0 >>> 26))) + s0; // } // // public int nextInt() { // return (int) nextLong(); // } // // private static long notZero(long value) { // return value == 0 ? 0xdeadbeefbabeL : value; // } // // public int nextInt(int bound) { // if (bound <= 0) { // throw new IllegalArgumentException(); // } // // int r = (nextInt() >>> 1); // int m = bound - 1; // if ((bound & m) == 0) { // r = (int) ((bound * (long) r) >> 31); // } else { // for (int u = r; u - (r = u % bound) + m < 0; u = nextInt() >>> 1) {} // } // // return r; // } // } // Path: hppc-benchmarks/src/jmh/java/com/carrotsearch/hppc/benchmarks/B009_Random.java import com.carrotsearch.hppc.XorShift128P; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; /* * HPPC * * Copyright (C) 2010-2020 Carrot Search s.c. * All rights reserved. * * Refer to the full license file "LICENSE.txt": * https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt */ package com.carrotsearch.hppc.benchmarks; @Fork(1) @Warmup(iterations = 10) @Measurement(iterations = 10) @State(Scope.Benchmark) public class B009_Random { @Param({"50000000"}) public int numLoops;
public XorShift128P rnd;
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/Main.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error;
package com.jaeckel.geth; public class Main { public static void main(String[] args) throws Exception { System.out.println("main()"); GethConnector gethConnector = new GethConnector();
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // Path: geth-connector/src/main/java/com/jaeckel/geth/Main.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; package com.jaeckel.geth; public class Main { public static void main(String[] args) throws Exception { System.out.println("main()"); GethConnector gethConnector = new GethConnector();
gethConnector.netPeerCount(new EthereumJsonRpc.Callback<NetPeerCountResponse>() {
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/Main.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error;
package com.jaeckel.geth; public class Main { public static void main(String[] args) throws Exception { System.out.println("main()"); GethConnector gethConnector = new GethConnector(); gethConnector.netPeerCount(new EthereumJsonRpc.Callback<NetPeerCountResponse>() { @Override public void onResult(NetPeerCountResponse netPeerCountResponse) { System.out.println("netPeerCountResponse: " + netPeerCountResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } });
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // Path: geth-connector/src/main/java/com/jaeckel/geth/Main.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; package com.jaeckel.geth; public class Main { public static void main(String[] args) throws Exception { System.out.println("main()"); GethConnector gethConnector = new GethConnector(); gethConnector.netPeerCount(new EthereumJsonRpc.Callback<NetPeerCountResponse>() { @Override public void onResult(NetPeerCountResponse netPeerCountResponse) { System.out.println("netPeerCountResponse: " + netPeerCountResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } });
gethConnector.ethSyncing(new EthereumJsonRpc.Callback<EthSyncingResponse>() {
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/Main.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error;
package com.jaeckel.geth; public class Main { public static void main(String[] args) throws Exception { System.out.println("main()"); GethConnector gethConnector = new GethConnector(); gethConnector.netPeerCount(new EthereumJsonRpc.Callback<NetPeerCountResponse>() { @Override public void onResult(NetPeerCountResponse netPeerCountResponse) { System.out.println("netPeerCountResponse: " + netPeerCountResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } }); gethConnector.ethSyncing(new EthereumJsonRpc.Callback<EthSyncingResponse>() { @Override public void onResult(EthSyncingResponse ethSyncingResponse) { System.out.println("EthSyncingResult: " + ethSyncingResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } });
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // Path: geth-connector/src/main/java/com/jaeckel/geth/Main.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; package com.jaeckel.geth; public class Main { public static void main(String[] args) throws Exception { System.out.println("main()"); GethConnector gethConnector = new GethConnector(); gethConnector.netPeerCount(new EthereumJsonRpc.Callback<NetPeerCountResponse>() { @Override public void onResult(NetPeerCountResponse netPeerCountResponse) { System.out.println("netPeerCountResponse: " + netPeerCountResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } }); gethConnector.ethSyncing(new EthereumJsonRpc.Callback<EthSyncingResponse>() { @Override public void onResult(EthSyncingResponse ethSyncingResponse) { System.out.println("EthSyncingResult: " + ethSyncingResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } });
gethConnector.ethAccounts(new EthereumJsonRpc.Callback<EthAccountsResponse>() {
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/Main.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error;
@Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } }); gethConnector.ethSyncing(new EthereumJsonRpc.Callback<EthSyncingResponse>() { @Override public void onResult(EthSyncingResponse ethSyncingResponse) { System.out.println("EthSyncingResult: " + ethSyncingResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } }); gethConnector.ethAccounts(new EthereumJsonRpc.Callback<EthAccountsResponse>() { @Override public void onResult(EthAccountsResponse ethAccountsResponse) { System.out.println("ethAccountsResult: " + ethAccountsResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } });
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // Path: geth-connector/src/main/java/com/jaeckel/geth/Main.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } }); gethConnector.ethSyncing(new EthereumJsonRpc.Callback<EthSyncingResponse>() { @Override public void onResult(EthSyncingResponse ethSyncingResponse) { System.out.println("EthSyncingResult: " + ethSyncingResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } }); gethConnector.ethAccounts(new EthereumJsonRpc.Callback<EthAccountsResponse>() { @Override public void onResult(EthAccountsResponse ethAccountsResponse) { System.out.println("ethAccountsResult: " + ethAccountsResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } });
gethConnector.personalListAccounts(new EthereumJsonRpc.Callback<PersonalListAccountsResponse>() {
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/Main.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error;
@Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } }); gethConnector.ethAccounts(new EthereumJsonRpc.Callback<EthAccountsResponse>() { @Override public void onResult(EthAccountsResponse ethAccountsResponse) { System.out.println("ethAccountsResult: " + ethAccountsResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } }); gethConnector.personalListAccounts(new EthereumJsonRpc.Callback<PersonalListAccountsResponse>() { @Override public void onResult(PersonalListAccountsResponse personalListAccountsResponse) { System.out.println("personalListAccountsResponse: " + personalListAccountsResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } });
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // Path: geth-connector/src/main/java/com/jaeckel/geth/Main.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } }); gethConnector.ethAccounts(new EthereumJsonRpc.Callback<EthAccountsResponse>() { @Override public void onResult(EthAccountsResponse ethAccountsResponse) { System.out.println("ethAccountsResult: " + ethAccountsResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } }); gethConnector.personalListAccounts(new EthereumJsonRpc.Callback<PersonalListAccountsResponse>() { @Override public void onResult(PersonalListAccountsResponse personalListAccountsResponse) { System.out.println("personalListAccountsResponse: " + personalListAccountsResponse); } @Override public void onError(JSONRPC2Error error) { System.out.println("error: " + error); } });
gethConnector.personalNewAccount("", new EthereumJsonRpc.Callback<PersonalNewAccountResponse>() {
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException;
package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException;
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException; package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException;
void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException;
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException;
package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException; void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException;
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException; package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException; void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException;
void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException;
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException;
package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException; void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException; void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException;
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException; package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException; void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException; void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException;
void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException;
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException;
package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException; void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException; void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException; void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException;
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException; package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException; void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException; void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException; void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException;
void personalListAccounts(Callback<PersonalListAccountsResponse> callback) throws IOException;
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException;
package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException; void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException; void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException; void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException; void personalListAccounts(Callback<PersonalListAccountsResponse> callback) throws IOException;
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException; package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException; void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException; void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException; void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException; void personalListAccounts(Callback<PersonalListAccountsResponse> callback) throws IOException;
void personalNewAccount(String password, Callback<PersonalNewAccountResponse> callback) throws IOException;
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException;
package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException; void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException; void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException; void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException; void personalListAccounts(Callback<PersonalListAccountsResponse> callback) throws IOException; void personalNewAccount(String password, Callback<PersonalNewAccountResponse> callback) throws IOException;
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException; package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException; void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException; void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException; void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException; void personalListAccounts(Callback<PersonalListAccountsResponse> callback) throws IOException; void personalNewAccount(String password, Callback<PersonalNewAccountResponse> callback) throws IOException;
void personalUnlockAccount(String address, String password, int timeInSeconds, Callback<PersonalUnlockAccountResponse> callback) throws IOException;
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException;
package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException; void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException; void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException; void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException; void personalListAccounts(Callback<PersonalListAccountsResponse> callback) throws IOException; void personalNewAccount(String password, Callback<PersonalNewAccountResponse> callback) throws IOException; void personalUnlockAccount(String address, String password, int timeInSeconds, Callback<PersonalUnlockAccountResponse> callback) throws IOException;
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/EthereumJsonRpc.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; import java.io.IOException; package com.jaeckel.geth; public interface EthereumJsonRpc { void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException; void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException; void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException; void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException; void personalListAccounts(Callback<PersonalListAccountsResponse> callback) throws IOException; void personalNewAccount(String password, Callback<PersonalNewAccountResponse> callback) throws IOException; void personalUnlockAccount(String address, String password, int timeInSeconds, Callback<PersonalUnlockAccountResponse> callback) throws IOException;
void ethGetBalance(String address, String blockParameter, Callback<EthGetBalanceResponse> ethGetBalanceCallback) throws IOException;
biafra23/EtherWallet
app/src/main/java/com/jaeckel/etherwallet/EtherApp.java
// Path: app/src/main/java/com/jaeckel/etherwallet/util/DebugTree.java // public class DebugTree extends Timber.Tree { // private static final int MAX_LOG_LENGTH = 4000; // private static final int CALL_STACK_INDEX = 5; // private static final Pattern ANONYMOUS_CLASS = Pattern.compile("(\\$\\d+)+$"); // public static final int STACK_DEPTH = 7; // public static final int DOT_CLASS = 5; // // /** // * Break up {@code message} into maximum-length chunks (if needed) and send to either // * {@link Log#println(int, String, String) Log.println()} or // * {@link Log#wtf(String, String) Log.wtf()} for logging. // * <p/> // * {@inheritDoc} // */ // @Override // @SuppressLint(value="LogNotTimber") // protected void log(int priority, String tag, String message, Throwable t) { // // Thread currentThread = Thread.currentThread(); // final StackTraceElement trace = currentThread.getStackTrace()[STACK_DEPTH]; // final String filename = trace.getFileName(); // final String linkableSourcePosition = String.format(Locale.GERMAN, "(%s.java:%d)", filename.substring(0, filename.length() - DOT_CLASS), trace.getLineNumber()); // final String logPrefix = String.format("[%s][%s.%s] ", currentThread.getName(), linkableSourcePosition, trace.getMethodName()); // // message = logPrefix + message; // // if (message.length() < MAX_LOG_LENGTH) { // if (priority == Log.ASSERT) { // Log.wtf(tag, message); // } else { // Log.println(priority, tag, message); // } // return; // } // // // Split by line, then ensure each line can fit into Log's maximum length. // for (int i = 0, length = message.length(); i < length; i++) { // int newline = message.indexOf('\n', i); // newline = newline != -1 ? newline : length; // do { // int end = Math.min(newline, i + MAX_LOG_LENGTH); // String part = message.substring(i, end); // if (priority == Log.ASSERT) { // Log.wtf(tag, part); // } else { // Log.println(priority, tag, part); // } // i = end; // } while (i < newline); // } // } // }
import android.app.Application; import com.jaeckel.etherwallet.util.DebugTree; import timber.log.Timber;
package com.jaeckel.etherwallet; public class EtherApp extends Application { @Override public void onCreate() { super.onCreate();
// Path: app/src/main/java/com/jaeckel/etherwallet/util/DebugTree.java // public class DebugTree extends Timber.Tree { // private static final int MAX_LOG_LENGTH = 4000; // private static final int CALL_STACK_INDEX = 5; // private static final Pattern ANONYMOUS_CLASS = Pattern.compile("(\\$\\d+)+$"); // public static final int STACK_DEPTH = 7; // public static final int DOT_CLASS = 5; // // /** // * Break up {@code message} into maximum-length chunks (if needed) and send to either // * {@link Log#println(int, String, String) Log.println()} or // * {@link Log#wtf(String, String) Log.wtf()} for logging. // * <p/> // * {@inheritDoc} // */ // @Override // @SuppressLint(value="LogNotTimber") // protected void log(int priority, String tag, String message, Throwable t) { // // Thread currentThread = Thread.currentThread(); // final StackTraceElement trace = currentThread.getStackTrace()[STACK_DEPTH]; // final String filename = trace.getFileName(); // final String linkableSourcePosition = String.format(Locale.GERMAN, "(%s.java:%d)", filename.substring(0, filename.length() - DOT_CLASS), trace.getLineNumber()); // final String logPrefix = String.format("[%s][%s.%s] ", currentThread.getName(), linkableSourcePosition, trace.getMethodName()); // // message = logPrefix + message; // // if (message.length() < MAX_LOG_LENGTH) { // if (priority == Log.ASSERT) { // Log.wtf(tag, message); // } else { // Log.println(priority, tag, message); // } // return; // } // // // Split by line, then ensure each line can fit into Log's maximum length. // for (int i = 0, length = message.length(); i < length; i++) { // int newline = message.indexOf('\n', i); // newline = newline != -1 ? newline : length; // do { // int end = Math.min(newline, i + MAX_LOG_LENGTH); // String part = message.substring(i, end); // if (priority == Log.ASSERT) { // Log.wtf(tag, part); // } else { // Log.println(priority, tag, part); // } // i = end; // } while (i < newline); // } // } // } // Path: app/src/main/java/com/jaeckel/etherwallet/EtherApp.java import android.app.Application; import com.jaeckel.etherwallet.util.DebugTree; import timber.log.Timber; package com.jaeckel.etherwallet; public class EtherApp extends Application { @Override public void onCreate() { super.onCreate();
Timber.plant(new DebugTree());
biafra23/EtherWallet
geth-connector/src/test/java/com/jaeckel/geth/json/PersonalNewAccountResponseTest.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/MoshiFactory.java // public class MoshiFactory { // // public static Moshi createMoshi() { // return new Moshi.Builder() // .add(new HexAdapter()) // .add(new FalseToNullFactory()) // .add(new EthSyncingResultAdapter()) // // .add(new AccountListAdapter()) // .build(); // } // }
import com.jaeckel.geth.MoshiFactory; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import java.io.IOException; import java.io.InputStream; import org.junit.Before; import org.junit.Test; import okio.BufferedSource; import okio.Okio; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertNotNull;
package com.jaeckel.geth.json; public class PersonalNewAccountResponseTest { Moshi moshi; @Before public void setUp() {
// Path: geth-connector/src/main/java/com/jaeckel/geth/MoshiFactory.java // public class MoshiFactory { // // public static Moshi createMoshi() { // return new Moshi.Builder() // .add(new HexAdapter()) // .add(new FalseToNullFactory()) // .add(new EthSyncingResultAdapter()) // // .add(new AccountListAdapter()) // .build(); // } // } // Path: geth-connector/src/test/java/com/jaeckel/geth/json/PersonalNewAccountResponseTest.java import com.jaeckel.geth.MoshiFactory; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import java.io.IOException; import java.io.InputStream; import org.junit.Before; import org.junit.Test; import okio.BufferedSource; import okio.Okio; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertNotNull; package com.jaeckel.geth.json; public class PersonalNewAccountResponseTest { Moshi moshi; @Before public void setUp() {
moshi = MoshiFactory.createMoshi();
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/MoshiFactory.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResultAdapter.java // public class EthSyncingResultAdapter { // // @ToJson // EthSyncingResultJson toJson(@FalseToNull EthSyncingResult in) { // EthSyncingResultJson out = new EthSyncingResultJson(); // out.currentBlock = in.currentBlock; // out.highestBlock = in.highestBlock; // out.knownStates = in.knownStates; // out.pulledStates = in.pulledStates; // out.startingBlock = in.startingBlock; // return out; // } // // @FromJson // @FalseToNull // EthSyncingResult fromJson(EthSyncingResultJson in) { // EthSyncingResult result = new EthSyncingResult(); // result.currentBlock = in.currentBlock; // result.highestBlock = in.highestBlock; // result.knownStates = in.knownStates; // result.pulledStates = in.pulledStates; // result.startingBlock = in.startingBlock; // return result; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/FalseToNullFactory.java // public final class FalseToNullFactory implements JsonAdapter.Factory { // // @Retention(RetentionPolicy.RUNTIME) // @JsonQualifier // public @interface FalseToNull { // } // // @Override // public JsonAdapter<?> create(Type type, Set<? extends Annotation> annotations, Moshi moshi) { // for (Annotation annotation : annotations) { // if (annotation instanceof FalseToNull) { // JsonAdapter<Object> delegate = moshi.nextAdapter(this, type, annotations); // return new FalseToNullAdapter<>(delegate); // } // } // return null; // } // // static class FalseToNullAdapter<T> extends JsonAdapter<T> { // private final JsonAdapter<T> delegate; // // FalseToNullAdapter(JsonAdapter<T> delegate) { // this.delegate = delegate; // } // // @Override // public T fromJson(JsonReader reader) throws IOException { // if (reader.peek() == JsonReader.Token.BOOLEAN) { // if (reader.nextBoolean()) { // throw new IllegalStateException("Expected false or object."); // } // return null; // } // return delegate.fromJson(reader); // } // // @Override // public void toJson(JsonWriter writer, T value) throws IOException { // delegate.toJson(writer, value); // } // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/HexAdapter.java // public class HexAdapter { // @ToJson // String toJson(@Hex long number) { // return String.format("0x%x", number); // } // // @Hex // @FromJson // long fromJson(String hexString) { // return Long.parseLong(hexString.substring(2), 16); // } // }
import com.jaeckel.geth.json.EthSyncingResultAdapter; import com.jaeckel.geth.json.FalseToNullFactory; import com.jaeckel.geth.json.HexAdapter; import com.squareup.moshi.Moshi;
package com.jaeckel.geth; public class MoshiFactory { public static Moshi createMoshi() { return new Moshi.Builder()
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResultAdapter.java // public class EthSyncingResultAdapter { // // @ToJson // EthSyncingResultJson toJson(@FalseToNull EthSyncingResult in) { // EthSyncingResultJson out = new EthSyncingResultJson(); // out.currentBlock = in.currentBlock; // out.highestBlock = in.highestBlock; // out.knownStates = in.knownStates; // out.pulledStates = in.pulledStates; // out.startingBlock = in.startingBlock; // return out; // } // // @FromJson // @FalseToNull // EthSyncingResult fromJson(EthSyncingResultJson in) { // EthSyncingResult result = new EthSyncingResult(); // result.currentBlock = in.currentBlock; // result.highestBlock = in.highestBlock; // result.knownStates = in.knownStates; // result.pulledStates = in.pulledStates; // result.startingBlock = in.startingBlock; // return result; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/FalseToNullFactory.java // public final class FalseToNullFactory implements JsonAdapter.Factory { // // @Retention(RetentionPolicy.RUNTIME) // @JsonQualifier // public @interface FalseToNull { // } // // @Override // public JsonAdapter<?> create(Type type, Set<? extends Annotation> annotations, Moshi moshi) { // for (Annotation annotation : annotations) { // if (annotation instanceof FalseToNull) { // JsonAdapter<Object> delegate = moshi.nextAdapter(this, type, annotations); // return new FalseToNullAdapter<>(delegate); // } // } // return null; // } // // static class FalseToNullAdapter<T> extends JsonAdapter<T> { // private final JsonAdapter<T> delegate; // // FalseToNullAdapter(JsonAdapter<T> delegate) { // this.delegate = delegate; // } // // @Override // public T fromJson(JsonReader reader) throws IOException { // if (reader.peek() == JsonReader.Token.BOOLEAN) { // if (reader.nextBoolean()) { // throw new IllegalStateException("Expected false or object."); // } // return null; // } // return delegate.fromJson(reader); // } // // @Override // public void toJson(JsonWriter writer, T value) throws IOException { // delegate.toJson(writer, value); // } // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/HexAdapter.java // public class HexAdapter { // @ToJson // String toJson(@Hex long number) { // return String.format("0x%x", number); // } // // @Hex // @FromJson // long fromJson(String hexString) { // return Long.parseLong(hexString.substring(2), 16); // } // } // Path: geth-connector/src/main/java/com/jaeckel/geth/MoshiFactory.java import com.jaeckel.geth.json.EthSyncingResultAdapter; import com.jaeckel.geth.json.FalseToNullFactory; import com.jaeckel.geth.json.HexAdapter; import com.squareup.moshi.Moshi; package com.jaeckel.geth; public class MoshiFactory { public static Moshi createMoshi() { return new Moshi.Builder()
.add(new HexAdapter())
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/MoshiFactory.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResultAdapter.java // public class EthSyncingResultAdapter { // // @ToJson // EthSyncingResultJson toJson(@FalseToNull EthSyncingResult in) { // EthSyncingResultJson out = new EthSyncingResultJson(); // out.currentBlock = in.currentBlock; // out.highestBlock = in.highestBlock; // out.knownStates = in.knownStates; // out.pulledStates = in.pulledStates; // out.startingBlock = in.startingBlock; // return out; // } // // @FromJson // @FalseToNull // EthSyncingResult fromJson(EthSyncingResultJson in) { // EthSyncingResult result = new EthSyncingResult(); // result.currentBlock = in.currentBlock; // result.highestBlock = in.highestBlock; // result.knownStates = in.knownStates; // result.pulledStates = in.pulledStates; // result.startingBlock = in.startingBlock; // return result; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/FalseToNullFactory.java // public final class FalseToNullFactory implements JsonAdapter.Factory { // // @Retention(RetentionPolicy.RUNTIME) // @JsonQualifier // public @interface FalseToNull { // } // // @Override // public JsonAdapter<?> create(Type type, Set<? extends Annotation> annotations, Moshi moshi) { // for (Annotation annotation : annotations) { // if (annotation instanceof FalseToNull) { // JsonAdapter<Object> delegate = moshi.nextAdapter(this, type, annotations); // return new FalseToNullAdapter<>(delegate); // } // } // return null; // } // // static class FalseToNullAdapter<T> extends JsonAdapter<T> { // private final JsonAdapter<T> delegate; // // FalseToNullAdapter(JsonAdapter<T> delegate) { // this.delegate = delegate; // } // // @Override // public T fromJson(JsonReader reader) throws IOException { // if (reader.peek() == JsonReader.Token.BOOLEAN) { // if (reader.nextBoolean()) { // throw new IllegalStateException("Expected false or object."); // } // return null; // } // return delegate.fromJson(reader); // } // // @Override // public void toJson(JsonWriter writer, T value) throws IOException { // delegate.toJson(writer, value); // } // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/HexAdapter.java // public class HexAdapter { // @ToJson // String toJson(@Hex long number) { // return String.format("0x%x", number); // } // // @Hex // @FromJson // long fromJson(String hexString) { // return Long.parseLong(hexString.substring(2), 16); // } // }
import com.jaeckel.geth.json.EthSyncingResultAdapter; import com.jaeckel.geth.json.FalseToNullFactory; import com.jaeckel.geth.json.HexAdapter; import com.squareup.moshi.Moshi;
package com.jaeckel.geth; public class MoshiFactory { public static Moshi createMoshi() { return new Moshi.Builder() .add(new HexAdapter())
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResultAdapter.java // public class EthSyncingResultAdapter { // // @ToJson // EthSyncingResultJson toJson(@FalseToNull EthSyncingResult in) { // EthSyncingResultJson out = new EthSyncingResultJson(); // out.currentBlock = in.currentBlock; // out.highestBlock = in.highestBlock; // out.knownStates = in.knownStates; // out.pulledStates = in.pulledStates; // out.startingBlock = in.startingBlock; // return out; // } // // @FromJson // @FalseToNull // EthSyncingResult fromJson(EthSyncingResultJson in) { // EthSyncingResult result = new EthSyncingResult(); // result.currentBlock = in.currentBlock; // result.highestBlock = in.highestBlock; // result.knownStates = in.knownStates; // result.pulledStates = in.pulledStates; // result.startingBlock = in.startingBlock; // return result; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/FalseToNullFactory.java // public final class FalseToNullFactory implements JsonAdapter.Factory { // // @Retention(RetentionPolicy.RUNTIME) // @JsonQualifier // public @interface FalseToNull { // } // // @Override // public JsonAdapter<?> create(Type type, Set<? extends Annotation> annotations, Moshi moshi) { // for (Annotation annotation : annotations) { // if (annotation instanceof FalseToNull) { // JsonAdapter<Object> delegate = moshi.nextAdapter(this, type, annotations); // return new FalseToNullAdapter<>(delegate); // } // } // return null; // } // // static class FalseToNullAdapter<T> extends JsonAdapter<T> { // private final JsonAdapter<T> delegate; // // FalseToNullAdapter(JsonAdapter<T> delegate) { // this.delegate = delegate; // } // // @Override // public T fromJson(JsonReader reader) throws IOException { // if (reader.peek() == JsonReader.Token.BOOLEAN) { // if (reader.nextBoolean()) { // throw new IllegalStateException("Expected false or object."); // } // return null; // } // return delegate.fromJson(reader); // } // // @Override // public void toJson(JsonWriter writer, T value) throws IOException { // delegate.toJson(writer, value); // } // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/HexAdapter.java // public class HexAdapter { // @ToJson // String toJson(@Hex long number) { // return String.format("0x%x", number); // } // // @Hex // @FromJson // long fromJson(String hexString) { // return Long.parseLong(hexString.substring(2), 16); // } // } // Path: geth-connector/src/main/java/com/jaeckel/geth/MoshiFactory.java import com.jaeckel.geth.json.EthSyncingResultAdapter; import com.jaeckel.geth.json.FalseToNullFactory; import com.jaeckel.geth.json.HexAdapter; import com.squareup.moshi.Moshi; package com.jaeckel.geth; public class MoshiFactory { public static Moshi createMoshi() { return new Moshi.Builder() .add(new HexAdapter())
.add(new FalseToNullFactory())
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/MoshiFactory.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResultAdapter.java // public class EthSyncingResultAdapter { // // @ToJson // EthSyncingResultJson toJson(@FalseToNull EthSyncingResult in) { // EthSyncingResultJson out = new EthSyncingResultJson(); // out.currentBlock = in.currentBlock; // out.highestBlock = in.highestBlock; // out.knownStates = in.knownStates; // out.pulledStates = in.pulledStates; // out.startingBlock = in.startingBlock; // return out; // } // // @FromJson // @FalseToNull // EthSyncingResult fromJson(EthSyncingResultJson in) { // EthSyncingResult result = new EthSyncingResult(); // result.currentBlock = in.currentBlock; // result.highestBlock = in.highestBlock; // result.knownStates = in.knownStates; // result.pulledStates = in.pulledStates; // result.startingBlock = in.startingBlock; // return result; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/FalseToNullFactory.java // public final class FalseToNullFactory implements JsonAdapter.Factory { // // @Retention(RetentionPolicy.RUNTIME) // @JsonQualifier // public @interface FalseToNull { // } // // @Override // public JsonAdapter<?> create(Type type, Set<? extends Annotation> annotations, Moshi moshi) { // for (Annotation annotation : annotations) { // if (annotation instanceof FalseToNull) { // JsonAdapter<Object> delegate = moshi.nextAdapter(this, type, annotations); // return new FalseToNullAdapter<>(delegate); // } // } // return null; // } // // static class FalseToNullAdapter<T> extends JsonAdapter<T> { // private final JsonAdapter<T> delegate; // // FalseToNullAdapter(JsonAdapter<T> delegate) { // this.delegate = delegate; // } // // @Override // public T fromJson(JsonReader reader) throws IOException { // if (reader.peek() == JsonReader.Token.BOOLEAN) { // if (reader.nextBoolean()) { // throw new IllegalStateException("Expected false or object."); // } // return null; // } // return delegate.fromJson(reader); // } // // @Override // public void toJson(JsonWriter writer, T value) throws IOException { // delegate.toJson(writer, value); // } // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/HexAdapter.java // public class HexAdapter { // @ToJson // String toJson(@Hex long number) { // return String.format("0x%x", number); // } // // @Hex // @FromJson // long fromJson(String hexString) { // return Long.parseLong(hexString.substring(2), 16); // } // }
import com.jaeckel.geth.json.EthSyncingResultAdapter; import com.jaeckel.geth.json.FalseToNullFactory; import com.jaeckel.geth.json.HexAdapter; import com.squareup.moshi.Moshi;
package com.jaeckel.geth; public class MoshiFactory { public static Moshi createMoshi() { return new Moshi.Builder() .add(new HexAdapter()) .add(new FalseToNullFactory())
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResultAdapter.java // public class EthSyncingResultAdapter { // // @ToJson // EthSyncingResultJson toJson(@FalseToNull EthSyncingResult in) { // EthSyncingResultJson out = new EthSyncingResultJson(); // out.currentBlock = in.currentBlock; // out.highestBlock = in.highestBlock; // out.knownStates = in.knownStates; // out.pulledStates = in.pulledStates; // out.startingBlock = in.startingBlock; // return out; // } // // @FromJson // @FalseToNull // EthSyncingResult fromJson(EthSyncingResultJson in) { // EthSyncingResult result = new EthSyncingResult(); // result.currentBlock = in.currentBlock; // result.highestBlock = in.highestBlock; // result.knownStates = in.knownStates; // result.pulledStates = in.pulledStates; // result.startingBlock = in.startingBlock; // return result; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/FalseToNullFactory.java // public final class FalseToNullFactory implements JsonAdapter.Factory { // // @Retention(RetentionPolicy.RUNTIME) // @JsonQualifier // public @interface FalseToNull { // } // // @Override // public JsonAdapter<?> create(Type type, Set<? extends Annotation> annotations, Moshi moshi) { // for (Annotation annotation : annotations) { // if (annotation instanceof FalseToNull) { // JsonAdapter<Object> delegate = moshi.nextAdapter(this, type, annotations); // return new FalseToNullAdapter<>(delegate); // } // } // return null; // } // // static class FalseToNullAdapter<T> extends JsonAdapter<T> { // private final JsonAdapter<T> delegate; // // FalseToNullAdapter(JsonAdapter<T> delegate) { // this.delegate = delegate; // } // // @Override // public T fromJson(JsonReader reader) throws IOException { // if (reader.peek() == JsonReader.Token.BOOLEAN) { // if (reader.nextBoolean()) { // throw new IllegalStateException("Expected false or object."); // } // return null; // } // return delegate.fromJson(reader); // } // // @Override // public void toJson(JsonWriter writer, T value) throws IOException { // delegate.toJson(writer, value); // } // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/HexAdapter.java // public class HexAdapter { // @ToJson // String toJson(@Hex long number) { // return String.format("0x%x", number); // } // // @Hex // @FromJson // long fromJson(String hexString) { // return Long.parseLong(hexString.substring(2), 16); // } // } // Path: geth-connector/src/main/java/com/jaeckel/geth/MoshiFactory.java import com.jaeckel.geth.json.EthSyncingResultAdapter; import com.jaeckel.geth.json.FalseToNullFactory; import com.jaeckel.geth.json.HexAdapter; import com.squareup.moshi.Moshi; package com.jaeckel.geth; public class MoshiFactory { public static Moshi createMoshi() { return new Moshi.Builder() .add(new HexAdapter()) .add(new FalseToNullFactory())
.add(new EthSyncingResultAdapter())
biafra23/EtherWallet
geth-connector/src/test/java/com/jaeckel/geth/json/EthSyncingResponseTest.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/MoshiFactory.java // public class MoshiFactory { // // public static Moshi createMoshi() { // return new Moshi.Builder() // .add(new HexAdapter()) // .add(new FalseToNullFactory()) // .add(new EthSyncingResultAdapter()) // // .add(new AccountListAdapter()) // .build(); // } // }
import com.jaeckel.geth.MoshiFactory; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import java.io.IOException; import java.io.InputStream; import org.junit.Before; import org.junit.Test; import okio.BufferedSource; import okio.Okio; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull;
package com.jaeckel.geth.json; public class EthSyncingResponseTest { Moshi moshi; @Before public void setUp() {
// Path: geth-connector/src/main/java/com/jaeckel/geth/MoshiFactory.java // public class MoshiFactory { // // public static Moshi createMoshi() { // return new Moshi.Builder() // .add(new HexAdapter()) // .add(new FalseToNullFactory()) // .add(new EthSyncingResultAdapter()) // // .add(new AccountListAdapter()) // .build(); // } // } // Path: geth-connector/src/test/java/com/jaeckel/geth/json/EthSyncingResponseTest.java import com.jaeckel.geth.MoshiFactory; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import java.io.IOException; import java.io.InputStream; import org.junit.Before; import org.junit.Test; import okio.BufferedSource; import okio.Okio; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; package com.jaeckel.geth.json; public class EthSyncingResponseTest { Moshi moshi; @Before public void setUp() {
moshi = MoshiFactory.createMoshi();
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor;
package com.jaeckel.geth; public class GethConnector implements EthereumJsonRpc { private static final String METHOD_NET_PEER_COUNT = "net_peerCount"; private static final String METHOD_ETH_BLOCK_NUMBER = "eth_blockNumber"; private static final String METHOD_ETH_GET_BALANCE = "eth_getBalance"; private static final String METHOD_ETH_SYNCING = "eth_syncing"; private static final String JSON_RPC_ENDPOINT = "http://localhost:8545/"; private static final String METHOD_ETH_ACCOUNTS = "eth_accounts"; private static Integer requestId = 1; private Moshi moshi = MoshiFactory.createMoshi(); public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8"); private static OkHttpClient httpClient; public GethConnector() { HttpLoggingInterceptor logging = new HttpLoggingInterceptor(); logging.setLevel(HttpLoggingInterceptor.Level.BODY); httpClient = new OkHttpClient.Builder() .addInterceptor(logging) .build(); }
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; package com.jaeckel.geth; public class GethConnector implements EthereumJsonRpc { private static final String METHOD_NET_PEER_COUNT = "net_peerCount"; private static final String METHOD_ETH_BLOCK_NUMBER = "eth_blockNumber"; private static final String METHOD_ETH_GET_BALANCE = "eth_getBalance"; private static final String METHOD_ETH_SYNCING = "eth_syncing"; private static final String JSON_RPC_ENDPOINT = "http://localhost:8545/"; private static final String METHOD_ETH_ACCOUNTS = "eth_accounts"; private static Integer requestId = 1; private Moshi moshi = MoshiFactory.createMoshi(); public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8"); private static OkHttpClient httpClient; public GethConnector() { HttpLoggingInterceptor logging = new HttpLoggingInterceptor(); logging.setLevel(HttpLoggingInterceptor.Level.BODY); httpClient = new OkHttpClient.Builder() .addInterceptor(logging) .build(); }
public void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException {
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor;
package com.jaeckel.geth; public class GethConnector implements EthereumJsonRpc { private static final String METHOD_NET_PEER_COUNT = "net_peerCount"; private static final String METHOD_ETH_BLOCK_NUMBER = "eth_blockNumber"; private static final String METHOD_ETH_GET_BALANCE = "eth_getBalance"; private static final String METHOD_ETH_SYNCING = "eth_syncing"; private static final String JSON_RPC_ENDPOINT = "http://localhost:8545/"; private static final String METHOD_ETH_ACCOUNTS = "eth_accounts"; private static Integer requestId = 1; private Moshi moshi = MoshiFactory.createMoshi(); public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8"); private static OkHttpClient httpClient; public GethConnector() { HttpLoggingInterceptor logging = new HttpLoggingInterceptor(); logging.setLevel(HttpLoggingInterceptor.Level.BODY); httpClient = new OkHttpClient.Builder() .addInterceptor(logging) .build(); } public void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_NET_PEER_COUNT))) .build()).execute(); JsonAdapter<NetPeerCountResponse> jsonAdapter = moshi.adapter(NetPeerCountResponse.class); NetPeerCountResponse netPeerCountResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(netPeerCountResponse); // try { // personalListAccounts(new Callback<EthAccountsResponse>() { // @Override // public void onResult(EthAccountsResponse ethAccountsResponse) { // // } // // @Override // public void onError(JSONRPC2Error error) { // // } // }); // } catch (IOException e) { // e.printStackTrace(); // } }
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; package com.jaeckel.geth; public class GethConnector implements EthereumJsonRpc { private static final String METHOD_NET_PEER_COUNT = "net_peerCount"; private static final String METHOD_ETH_BLOCK_NUMBER = "eth_blockNumber"; private static final String METHOD_ETH_GET_BALANCE = "eth_getBalance"; private static final String METHOD_ETH_SYNCING = "eth_syncing"; private static final String JSON_RPC_ENDPOINT = "http://localhost:8545/"; private static final String METHOD_ETH_ACCOUNTS = "eth_accounts"; private static Integer requestId = 1; private Moshi moshi = MoshiFactory.createMoshi(); public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8"); private static OkHttpClient httpClient; public GethConnector() { HttpLoggingInterceptor logging = new HttpLoggingInterceptor(); logging.setLevel(HttpLoggingInterceptor.Level.BODY); httpClient = new OkHttpClient.Builder() .addInterceptor(logging) .build(); } public void netPeerCount(Callback<NetPeerCountResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_NET_PEER_COUNT))) .build()).execute(); JsonAdapter<NetPeerCountResponse> jsonAdapter = moshi.adapter(NetPeerCountResponse.class); NetPeerCountResponse netPeerCountResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(netPeerCountResponse); // try { // personalListAccounts(new Callback<EthAccountsResponse>() { // @Override // public void onResult(EthAccountsResponse ethAccountsResponse) { // // } // // @Override // public void onError(JSONRPC2Error error) { // // } // }); // } catch (IOException e) { // e.printStackTrace(); // } }
public void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException {
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor;
// try { // personalListAccounts(new Callback<EthAccountsResponse>() { // @Override // public void onResult(EthAccountsResponse ethAccountsResponse) { // // } // // @Override // public void onError(JSONRPC2Error error) { // // } // }); // } catch (IOException e) { // e.printStackTrace(); // } } public void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException { Response response = httpClient.newCall( new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_SYNCING))) .build()) .execute(); JsonAdapter<EthSyncingResponse> jsonAdapter = moshi.adapter(EthSyncingResponse.class); EthSyncingResponse ethSyncingResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethSyncingResponse); }
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; // try { // personalListAccounts(new Callback<EthAccountsResponse>() { // @Override // public void onResult(EthAccountsResponse ethAccountsResponse) { // // } // // @Override // public void onError(JSONRPC2Error error) { // // } // }); // } catch (IOException e) { // e.printStackTrace(); // } } public void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException { Response response = httpClient.newCall( new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_SYNCING))) .build()) .execute(); JsonAdapter<EthSyncingResponse> jsonAdapter = moshi.adapter(EthSyncingResponse.class); EthSyncingResponse ethSyncingResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethSyncingResponse); }
public void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException {
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor;
// // } // }); // } catch (IOException e) { // e.printStackTrace(); // } } public void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException { Response response = httpClient.newCall( new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_SYNCING))) .build()) .execute(); JsonAdapter<EthSyncingResponse> jsonAdapter = moshi.adapter(EthSyncingResponse.class); EthSyncingResponse ethSyncingResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethSyncingResponse); } public void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_BLOCK_NUMBER))) .build()).execute(); JsonAdapter<EthBlockNumberResponse> jsonAdapter = moshi.adapter(EthBlockNumberResponse.class); EthBlockNumberResponse ethBlockNumberResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethBlockNumberResponse); }
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; // // } // }); // } catch (IOException e) { // e.printStackTrace(); // } } public void ethSyncing(Callback<EthSyncingResponse> callback) throws IOException { Response response = httpClient.newCall( new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_SYNCING))) .build()) .execute(); JsonAdapter<EthSyncingResponse> jsonAdapter = moshi.adapter(EthSyncingResponse.class); EthSyncingResponse ethSyncingResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethSyncingResponse); } public void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_BLOCK_NUMBER))) .build()).execute(); JsonAdapter<EthBlockNumberResponse> jsonAdapter = moshi.adapter(EthBlockNumberResponse.class); EthBlockNumberResponse ethBlockNumberResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethBlockNumberResponse); }
public void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException {
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor;
.post(RequestBody.create(JSON, createRequest(METHOD_ETH_SYNCING))) .build()) .execute(); JsonAdapter<EthSyncingResponse> jsonAdapter = moshi.adapter(EthSyncingResponse.class); EthSyncingResponse ethSyncingResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethSyncingResponse); } public void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_BLOCK_NUMBER))) .build()).execute(); JsonAdapter<EthBlockNumberResponse> jsonAdapter = moshi.adapter(EthBlockNumberResponse.class); EthBlockNumberResponse ethBlockNumberResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethBlockNumberResponse); } public void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_ACCOUNTS))) .build()).execute(); JsonAdapter<EthAccountsResponse> jsonAdapter = moshi.adapter(EthAccountsResponse.class); EthAccountsResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethAccountsResponse); }
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; .post(RequestBody.create(JSON, createRequest(METHOD_ETH_SYNCING))) .build()) .execute(); JsonAdapter<EthSyncingResponse> jsonAdapter = moshi.adapter(EthSyncingResponse.class); EthSyncingResponse ethSyncingResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethSyncingResponse); } public void ethBlockNumber(Callback<EthBlockNumberResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_BLOCK_NUMBER))) .build()).execute(); JsonAdapter<EthBlockNumberResponse> jsonAdapter = moshi.adapter(EthBlockNumberResponse.class); EthBlockNumberResponse ethBlockNumberResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethBlockNumberResponse); } public void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_ACCOUNTS))) .build()).execute(); JsonAdapter<EthAccountsResponse> jsonAdapter = moshi.adapter(EthAccountsResponse.class); EthAccountsResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethAccountsResponse); }
public void ethGetBalance(String address, String blockParamter, Callback<EthGetBalanceResponse> callback) throws IOException {
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor;
Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_BLOCK_NUMBER))) .build()).execute(); JsonAdapter<EthBlockNumberResponse> jsonAdapter = moshi.adapter(EthBlockNumberResponse.class); EthBlockNumberResponse ethBlockNumberResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethBlockNumberResponse); } public void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_ACCOUNTS))) .build()).execute(); JsonAdapter<EthAccountsResponse> jsonAdapter = moshi.adapter(EthAccountsResponse.class); EthAccountsResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethAccountsResponse); } public void ethGetBalance(String address, String blockParamter, Callback<EthGetBalanceResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createBalanceRequest(address, blockParamter, METHOD_ETH_GET_BALANCE))) .build()).execute(); JsonAdapter<EthGetBalanceResponse> jsonAdapter = moshi.adapter(EthGetBalanceResponse.class); EthGetBalanceResponse ethGetBalanceResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethGetBalanceResponse); } @Override
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_BLOCK_NUMBER))) .build()).execute(); JsonAdapter<EthBlockNumberResponse> jsonAdapter = moshi.adapter(EthBlockNumberResponse.class); EthBlockNumberResponse ethBlockNumberResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethBlockNumberResponse); } public void ethAccounts(Callback<EthAccountsResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createRequest(METHOD_ETH_ACCOUNTS))) .build()).execute(); JsonAdapter<EthAccountsResponse> jsonAdapter = moshi.adapter(EthAccountsResponse.class); EthAccountsResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethAccountsResponse); } public void ethGetBalance(String address, String blockParamter, Callback<EthGetBalanceResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createBalanceRequest(address, blockParamter, METHOD_ETH_GET_BALANCE))) .build()).execute(); JsonAdapter<EthGetBalanceResponse> jsonAdapter = moshi.adapter(EthGetBalanceResponse.class); EthGetBalanceResponse ethGetBalanceResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethGetBalanceResponse); } @Override
public void personalNewAccount(String password, Callback<PersonalNewAccountResponse> callback) throws IOException {
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor;
JsonAdapter<EthAccountsResponse> jsonAdapter = moshi.adapter(EthAccountsResponse.class); EthAccountsResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethAccountsResponse); } public void ethGetBalance(String address, String blockParamter, Callback<EthGetBalanceResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createBalanceRequest(address, blockParamter, METHOD_ETH_GET_BALANCE))) .build()).execute(); JsonAdapter<EthGetBalanceResponse> jsonAdapter = moshi.adapter(EthGetBalanceResponse.class); EthGetBalanceResponse ethGetBalanceResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethGetBalanceResponse); } @Override public void personalNewAccount(String password, Callback<PersonalNewAccountResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createNewAccountRequest("personal_newAccount", password))) .build()).execute(); JsonAdapter<PersonalNewAccountResponse> jsonAdapter = moshi.adapter(PersonalNewAccountResponse.class); PersonalNewAccountResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethAccountsResponse); } @Override
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; JsonAdapter<EthAccountsResponse> jsonAdapter = moshi.adapter(EthAccountsResponse.class); EthAccountsResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethAccountsResponse); } public void ethGetBalance(String address, String blockParamter, Callback<EthGetBalanceResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createBalanceRequest(address, blockParamter, METHOD_ETH_GET_BALANCE))) .build()).execute(); JsonAdapter<EthGetBalanceResponse> jsonAdapter = moshi.adapter(EthGetBalanceResponse.class); EthGetBalanceResponse ethGetBalanceResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethGetBalanceResponse); } @Override public void personalNewAccount(String password, Callback<PersonalNewAccountResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create(JSON, createNewAccountRequest("personal_newAccount", password))) .build()).execute(); JsonAdapter<PersonalNewAccountResponse> jsonAdapter = moshi.adapter(PersonalNewAccountResponse.class); PersonalNewAccountResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethAccountsResponse); } @Override
public void personalListAccounts(Callback<PersonalListAccountsResponse> callback) throws IOException {
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor;
.build()).execute(); JsonAdapter<PersonalNewAccountResponse> jsonAdapter = moshi.adapter(PersonalNewAccountResponse.class); PersonalNewAccountResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethAccountsResponse); } @Override public void personalListAccounts(Callback<PersonalListAccountsResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create( JSON, createListAccountRequest("personal_listAccounts") ) ) .build() ).execute(); JsonAdapter<PersonalListAccountsResponse> jsonAdapter = moshi.adapter(PersonalListAccountsResponse.class); // PersonalListAccountsResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); String string = response.body().string(); System.out.println("personal_listAccounts: " + string); PersonalListAccountsResponse ethAccountsResponse = jsonAdapter.fromJson(string); callback.onResult(ethAccountsResponse); } @Override
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; .build()).execute(); JsonAdapter<PersonalNewAccountResponse> jsonAdapter = moshi.adapter(PersonalNewAccountResponse.class); PersonalNewAccountResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethAccountsResponse); } @Override public void personalListAccounts(Callback<PersonalListAccountsResponse> callback) throws IOException { Response response = httpClient.newCall(new Request.Builder().url(JSON_RPC_ENDPOINT) .post(RequestBody.create( JSON, createListAccountRequest("personal_listAccounts") ) ) .build() ).execute(); JsonAdapter<PersonalListAccountsResponse> jsonAdapter = moshi.adapter(PersonalListAccountsResponse.class); // PersonalListAccountsResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); String string = response.body().string(); System.out.println("personal_listAccounts: " + string); PersonalListAccountsResponse ethAccountsResponse = jsonAdapter.fromJson(string); callback.onResult(ethAccountsResponse); } @Override
public void personalUnlockAccount(String address, String password, int timeInSeconds, Callback<PersonalUnlockAccountResponse> callback) throws IOException {
biafra23/EtherWallet
geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // }
import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor;
createUnlockAccountRequest( "personal_unlockAccount", address, password, timeInSeconds ) ) ).build() ).execute(); JsonAdapter<PersonalUnlockAccountResponse> jsonAdapter = moshi.adapter(PersonalUnlockAccountResponse.class); PersonalUnlockAccountResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethAccountsResponse); } // public long ethGetBalance(String account) { // JsonRpcRequest jsonRpcRequest = new JsonRpcRequest(Collections.singletonList(account)); // Response response = httpClient.newCall( // new Request.Builder().url(JSON_RPC_ENDPOINT) // .post(RequestBody.create(JSON, createGetBalanceRequest(account))) // .build() // ).execute(); // // // } // // private String createGetBalanceRequest(String account) { // return // }
// Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthAccountsResponse.java // public class EthAccountsResponse { // // public List<String> result; // // @Override // public String toString() { // return "EthAccountsResponse{" + // // "id='" + id + '\'' + // // ", jsonrpc='" + jsonrpc + '\'' + // ", result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthBlockNumberResponse.java // public class EthBlockNumberResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "EthBlockNumberResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthGetBalanceResponse.java // public class EthGetBalanceResponse { // @Hex // public long result; // // @Override // public String toString() { // return "EthGetBalanceResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/EthSyncingResponse.java // public class EthSyncingResponse { // // @FalseToNull // public EthSyncingResult result; // // @Override // public String toString() { // return "EthSyncingResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/NetPeerCountResponse.java // public class NetPeerCountResponse { // // @Hex // public long result; // // @Override // public String toString() { // return "NetPeerCountResponse{" + // "result=" + result + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalListAccountsResponse.java // public class PersonalListAccountsResponse { // // @Json(name = "result") // public List<String> accounts; // public PersonalListAccountsError error; // // @Override // public String toString() { // return "PersonalListAccountsResponse{" + // "result=" + accounts + // ", error=" + error + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalNewAccountResponse.java // public class PersonalNewAccountResponse { // // {"jsonrpc":"2.0","id":5,"result":"0x36605dbfe30b25acd05a21884d19483be54de6fd"} // // public String result; // // @Override // public String toString() { // return "PersonalNewAccountResponse{" + // "result='" + result + '\'' + // '}'; // } // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/PersonalUnlockAccountResponse.java // public class PersonalUnlockAccountResponse { // } // // Path: geth-connector/src/main/java/com/jaeckel/geth/json/SendTransactionresult.java // public class SendTransactionresult { // } // Path: geth-connector/src/main/java/com/jaeckel/geth/GethConnector.java import com.jaeckel.geth.json.EthAccountsResponse; import com.jaeckel.geth.json.EthBlockNumberResponse; import com.jaeckel.geth.json.EthGetBalanceResponse; import com.jaeckel.geth.json.EthSyncingResponse; import com.jaeckel.geth.json.NetPeerCountResponse; import com.jaeckel.geth.json.PersonalListAccountsResponse; import com.jaeckel.geth.json.PersonalNewAccountResponse; import com.jaeckel.geth.json.PersonalUnlockAccountResponse; import com.jaeckel.geth.json.SendTransactionresult; import com.squareup.moshi.JsonAdapter; import com.squareup.moshi.Moshi; import com.thetransactioncompany.jsonrpc2.JSONRPC2Request; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; createUnlockAccountRequest( "personal_unlockAccount", address, password, timeInSeconds ) ) ).build() ).execute(); JsonAdapter<PersonalUnlockAccountResponse> jsonAdapter = moshi.adapter(PersonalUnlockAccountResponse.class); PersonalUnlockAccountResponse ethAccountsResponse = jsonAdapter.fromJson(response.body().source()); callback.onResult(ethAccountsResponse); } // public long ethGetBalance(String account) { // JsonRpcRequest jsonRpcRequest = new JsonRpcRequest(Collections.singletonList(account)); // Response response = httpClient.newCall( // new Request.Builder().url(JSON_RPC_ENDPOINT) // .post(RequestBody.create(JSON, createGetBalanceRequest(account))) // .build() // ).execute(); // // // } // // private String createGetBalanceRequest(String account) { // return // }
public static String sendTransaction(String from, String to, long wei, Callback<SendTransactionresult> callback) throws IOException {
udevbe/wayland-javafx
src/main/java/com/sun/glass/ui/monocle/WaylandScreen.java
// Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_OP_OVER = 0x03; // // Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_OP_SRC = 0x01; // // Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32, // PIXMAN_TYPE_ARGB, // 8, // 8, // 8, // 8);
import com.sun.glass.ui.Pixels; import org.freedesktop.jaccall.JNI; import org.freedesktop.jaccall.Pointer; import org.freedesktop.wayland.client.WlBufferProxy; import org.freedesktop.wayland.client.WlCallbackProxy; import org.freedesktop.wayland.client.WlCompositorProxy; import org.freedesktop.wayland.client.WlDisplayProxy; import org.freedesktop.wayland.client.WlOutputProxy; import org.freedesktop.wayland.client.WlShellProxy; import org.freedesktop.wayland.client.WlShellSurfaceEvents; import org.freedesktop.wayland.client.WlShellSurfaceProxy; import org.freedesktop.wayland.client.WlSurfaceEventsV4; import org.freedesktop.wayland.client.WlSurfaceProxy; import org.freedesktop.wayland.shared.WlShellSurfaceFullscreenMethod; import org.freedesktop.wayland.shared.WlShmFormat; import javax.annotation.Nonnull; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.concurrent.CountDownLatch; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_OVER; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_SRC; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_a8r8g8b8;
} else { if (b instanceof ByteBuffer) { final ByteBuffer bb = (ByteBuffer) b; final byte[] array; if (bb.hasArray()) { array = bb.array(); } else { array = new byte[bb.capacity()]; bb.rewind(); bb.get(array); } pixels = Pointer.nref(array).address; } else { final IntBuffer ib = ((IntBuffer) b); final int[] array; if (ib.hasArray()) { array = ib.array(); } else { array = new int[ib.capacity()]; ib.rewind(); ib.get(array); } pixels = Pointer.nref(array).address; } }
// Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_OP_OVER = 0x03; // // Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_OP_SRC = 0x01; // // Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32, // PIXMAN_TYPE_ARGB, // 8, // 8, // 8, // 8); // Path: src/main/java/com/sun/glass/ui/monocle/WaylandScreen.java import com.sun.glass.ui.Pixels; import org.freedesktop.jaccall.JNI; import org.freedesktop.jaccall.Pointer; import org.freedesktop.wayland.client.WlBufferProxy; import org.freedesktop.wayland.client.WlCallbackProxy; import org.freedesktop.wayland.client.WlCompositorProxy; import org.freedesktop.wayland.client.WlDisplayProxy; import org.freedesktop.wayland.client.WlOutputProxy; import org.freedesktop.wayland.client.WlShellProxy; import org.freedesktop.wayland.client.WlShellSurfaceEvents; import org.freedesktop.wayland.client.WlShellSurfaceProxy; import org.freedesktop.wayland.client.WlSurfaceEventsV4; import org.freedesktop.wayland.client.WlSurfaceProxy; import org.freedesktop.wayland.shared.WlShellSurfaceFullscreenMethod; import org.freedesktop.wayland.shared.WlShmFormat; import javax.annotation.Nonnull; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.concurrent.CountDownLatch; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_OVER; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_SRC; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_a8r8g8b8; } else { if (b instanceof ByteBuffer) { final ByteBuffer bb = (ByteBuffer) b; final byte[] array; if (bb.hasArray()) { array = bb.array(); } else { array = new byte[bb.capacity()]; bb.rewind(); bb.get(array); } pixels = Pointer.nref(array).address; } else { final IntBuffer ib = ((IntBuffer) b); final int[] array; if (ib.hasArray()) { array = ib.array(); } else { array = new int[ib.capacity()]; ib.rewind(); ib.get(array); } pixels = Pointer.nref(array).address; } }
final long src = Libpixman1.pixman_image_create_bits_no_clear(PIXMAN_a8r8g8b8,
udevbe/wayland-javafx
src/main/java/com/sun/glass/ui/monocle/WaylandScreen.java
// Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_OP_OVER = 0x03; // // Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_OP_SRC = 0x01; // // Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32, // PIXMAN_TYPE_ARGB, // 8, // 8, // 8, // 8);
import com.sun.glass.ui.Pixels; import org.freedesktop.jaccall.JNI; import org.freedesktop.jaccall.Pointer; import org.freedesktop.wayland.client.WlBufferProxy; import org.freedesktop.wayland.client.WlCallbackProxy; import org.freedesktop.wayland.client.WlCompositorProxy; import org.freedesktop.wayland.client.WlDisplayProxy; import org.freedesktop.wayland.client.WlOutputProxy; import org.freedesktop.wayland.client.WlShellProxy; import org.freedesktop.wayland.client.WlShellSurfaceEvents; import org.freedesktop.wayland.client.WlShellSurfaceProxy; import org.freedesktop.wayland.client.WlSurfaceEventsV4; import org.freedesktop.wayland.client.WlSurfaceProxy; import org.freedesktop.wayland.shared.WlShellSurfaceFullscreenMethod; import org.freedesktop.wayland.shared.WlShmFormat; import javax.annotation.Nonnull; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.concurrent.CountDownLatch; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_OVER; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_SRC; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_a8r8g8b8;
} else { array = new byte[bb.capacity()]; bb.rewind(); bb.get(array); } pixels = Pointer.nref(array).address; } else { final IntBuffer ib = ((IntBuffer) b); final int[] array; if (ib.hasArray()) { array = ib.array(); } else { array = new int[ib.capacity()]; ib.rewind(); ib.get(array); } pixels = Pointer.nref(array).address; } } final long src = Libpixman1.pixman_image_create_bits_no_clear(PIXMAN_a8r8g8b8, width, height, pixels, width * 4); final long dst = waylandBuffer.getPixmanImage();
// Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_OP_OVER = 0x03; // // Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_OP_SRC = 0x01; // // Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32, // PIXMAN_TYPE_ARGB, // 8, // 8, // 8, // 8); // Path: src/main/java/com/sun/glass/ui/monocle/WaylandScreen.java import com.sun.glass.ui.Pixels; import org.freedesktop.jaccall.JNI; import org.freedesktop.jaccall.Pointer; import org.freedesktop.wayland.client.WlBufferProxy; import org.freedesktop.wayland.client.WlCallbackProxy; import org.freedesktop.wayland.client.WlCompositorProxy; import org.freedesktop.wayland.client.WlDisplayProxy; import org.freedesktop.wayland.client.WlOutputProxy; import org.freedesktop.wayland.client.WlShellProxy; import org.freedesktop.wayland.client.WlShellSurfaceEvents; import org.freedesktop.wayland.client.WlShellSurfaceProxy; import org.freedesktop.wayland.client.WlSurfaceEventsV4; import org.freedesktop.wayland.client.WlSurfaceProxy; import org.freedesktop.wayland.shared.WlShellSurfaceFullscreenMethod; import org.freedesktop.wayland.shared.WlShmFormat; import javax.annotation.Nonnull; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.concurrent.CountDownLatch; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_OVER; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_SRC; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_a8r8g8b8; } else { array = new byte[bb.capacity()]; bb.rewind(); bb.get(array); } pixels = Pointer.nref(array).address; } else { final IntBuffer ib = ((IntBuffer) b); final int[] array; if (ib.hasArray()) { array = ib.array(); } else { array = new int[ib.capacity()]; ib.rewind(); ib.get(array); } pixels = Pointer.nref(array).address; } } final long src = Libpixman1.pixman_image_create_bits_no_clear(PIXMAN_a8r8g8b8, width, height, pixels, width * 4); final long dst = waylandBuffer.getPixmanImage();
Libpixman1.pixman_image_composite(alpha == 1.0f ? PIXMAN_OP_SRC : PIXMAN_OP_OVER,
udevbe/wayland-javafx
src/main/java/com/sun/glass/ui/monocle/WaylandScreen.java
// Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_OP_OVER = 0x03; // // Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_OP_SRC = 0x01; // // Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32, // PIXMAN_TYPE_ARGB, // 8, // 8, // 8, // 8);
import com.sun.glass.ui.Pixels; import org.freedesktop.jaccall.JNI; import org.freedesktop.jaccall.Pointer; import org.freedesktop.wayland.client.WlBufferProxy; import org.freedesktop.wayland.client.WlCallbackProxy; import org.freedesktop.wayland.client.WlCompositorProxy; import org.freedesktop.wayland.client.WlDisplayProxy; import org.freedesktop.wayland.client.WlOutputProxy; import org.freedesktop.wayland.client.WlShellProxy; import org.freedesktop.wayland.client.WlShellSurfaceEvents; import org.freedesktop.wayland.client.WlShellSurfaceProxy; import org.freedesktop.wayland.client.WlSurfaceEventsV4; import org.freedesktop.wayland.client.WlSurfaceProxy; import org.freedesktop.wayland.shared.WlShellSurfaceFullscreenMethod; import org.freedesktop.wayland.shared.WlShmFormat; import javax.annotation.Nonnull; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.concurrent.CountDownLatch; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_OVER; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_SRC; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_a8r8g8b8;
} else { array = new byte[bb.capacity()]; bb.rewind(); bb.get(array); } pixels = Pointer.nref(array).address; } else { final IntBuffer ib = ((IntBuffer) b); final int[] array; if (ib.hasArray()) { array = ib.array(); } else { array = new int[ib.capacity()]; ib.rewind(); ib.get(array); } pixels = Pointer.nref(array).address; } } final long src = Libpixman1.pixman_image_create_bits_no_clear(PIXMAN_a8r8g8b8, width, height, pixels, width * 4); final long dst = waylandBuffer.getPixmanImage();
// Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_OP_OVER = 0x03; // // Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_OP_SRC = 0x01; // // Path: src/main/java/com/sun/glass/ui/monocle/Libpixman1.java // public static final int PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32, // PIXMAN_TYPE_ARGB, // 8, // 8, // 8, // 8); // Path: src/main/java/com/sun/glass/ui/monocle/WaylandScreen.java import com.sun.glass.ui.Pixels; import org.freedesktop.jaccall.JNI; import org.freedesktop.jaccall.Pointer; import org.freedesktop.wayland.client.WlBufferProxy; import org.freedesktop.wayland.client.WlCallbackProxy; import org.freedesktop.wayland.client.WlCompositorProxy; import org.freedesktop.wayland.client.WlDisplayProxy; import org.freedesktop.wayland.client.WlOutputProxy; import org.freedesktop.wayland.client.WlShellProxy; import org.freedesktop.wayland.client.WlShellSurfaceEvents; import org.freedesktop.wayland.client.WlShellSurfaceProxy; import org.freedesktop.wayland.client.WlSurfaceEventsV4; import org.freedesktop.wayland.client.WlSurfaceProxy; import org.freedesktop.wayland.shared.WlShellSurfaceFullscreenMethod; import org.freedesktop.wayland.shared.WlShmFormat; import javax.annotation.Nonnull; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.concurrent.CountDownLatch; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_OVER; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_OP_SRC; import static com.sun.glass.ui.monocle.Libpixman1.PIXMAN_a8r8g8b8; } else { array = new byte[bb.capacity()]; bb.rewind(); bb.get(array); } pixels = Pointer.nref(array).address; } else { final IntBuffer ib = ((IntBuffer) b); final int[] array; if (ib.hasArray()) { array = ib.array(); } else { array = new int[ib.capacity()]; ib.rewind(); ib.get(array); } pixels = Pointer.nref(array).address; } } final long src = Libpixman1.pixman_image_create_bits_no_clear(PIXMAN_a8r8g8b8, width, height, pixels, width * 4); final long dst = waylandBuffer.getPixmanImage();
Libpixman1.pixman_image_composite(alpha == 1.0f ? PIXMAN_OP_SRC : PIXMAN_OP_OVER,
Frank-Zhu/AndroidAppCodeFramework
CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/gson/GsonParse.java
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/app/AppServerConfig.java // public class AppServerConfig { // public static final int CODE_SERVER_ERROR = -1;//服务器错误 // public static final int CODE_FAIL = 0;//验证失败 // public static final int CODE_SUCCESS = 1;//验证成功 // // public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 // public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 // // /***************网络错误字符串常量定义**********************/ // public static final String NET_404_STR = "请求链接无效,404错误"; // public static final String NET_500_STR = "服务器端程序出错,500错误"; // public static final String NET_900_STR = "网络传输协议出错,900错误"; // public static final String NET_901_STR = "连接超时,901错误"; // public static final String NET_902_STR = "网络中断,902错误"; // public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; // public static final String NET_UNKNOWN_STR = "未知错误"; // public static final String NET_ERROR_STR = "网络错误"; // // public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; // // } // // Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/entity/ErrorBaseBean.java // public class ErrorBaseBean extends BaseBean implements Serializable { // protected Object data; // // public Object getData() { // return data; // } // // public void setData(Object data) { // this.data = data; // } // }
import com.ecloud.androidcodeframework.codeframework.app.AppServerConfig; import com.ecloud.androidcodeframework.codeframework.entity.ErrorBaseBean; import com.google.gson.Gson;
package com.ecloud.androidcodeframework.codeframework.gson; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-15 下午9:46 * Description: 数据解析类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-15 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GsonParse extends GsonBaseParse { private Object bean; public GsonParse(String content) throws Exception { super(content); } /** * 数据解析函数 * @param className 返回数据结构类名 * @throws Exception */ @Override protected void parse(Class<?> className) throws Exception {
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/app/AppServerConfig.java // public class AppServerConfig { // public static final int CODE_SERVER_ERROR = -1;//服务器错误 // public static final int CODE_FAIL = 0;//验证失败 // public static final int CODE_SUCCESS = 1;//验证成功 // // public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 // public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 // // /***************网络错误字符串常量定义**********************/ // public static final String NET_404_STR = "请求链接无效,404错误"; // public static final String NET_500_STR = "服务器端程序出错,500错误"; // public static final String NET_900_STR = "网络传输协议出错,900错误"; // public static final String NET_901_STR = "连接超时,901错误"; // public static final String NET_902_STR = "网络中断,902错误"; // public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; // public static final String NET_UNKNOWN_STR = "未知错误"; // public static final String NET_ERROR_STR = "网络错误"; // // public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; // // } // // Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/entity/ErrorBaseBean.java // public class ErrorBaseBean extends BaseBean implements Serializable { // protected Object data; // // public Object getData() { // return data; // } // // public void setData(Object data) { // this.data = data; // } // } // Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/gson/GsonParse.java import com.ecloud.androidcodeframework.codeframework.app.AppServerConfig; import com.ecloud.androidcodeframework.codeframework.entity.ErrorBaseBean; import com.google.gson.Gson; package com.ecloud.androidcodeframework.codeframework.gson; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-15 下午9:46 * Description: 数据解析类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-15 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GsonParse extends GsonBaseParse { private Object bean; public GsonParse(String content) throws Exception { super(content); } /** * 数据解析函数 * @param className 返回数据结构类名 * @throws Exception */ @Override protected void parse(Class<?> className) throws Exception {
ErrorBaseBean mErrorBaseBean;
Frank-Zhu/AndroidAppCodeFramework
CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/gson/GsonParse.java
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/app/AppServerConfig.java // public class AppServerConfig { // public static final int CODE_SERVER_ERROR = -1;//服务器错误 // public static final int CODE_FAIL = 0;//验证失败 // public static final int CODE_SUCCESS = 1;//验证成功 // // public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 // public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 // // /***************网络错误字符串常量定义**********************/ // public static final String NET_404_STR = "请求链接无效,404错误"; // public static final String NET_500_STR = "服务器端程序出错,500错误"; // public static final String NET_900_STR = "网络传输协议出错,900错误"; // public static final String NET_901_STR = "连接超时,901错误"; // public static final String NET_902_STR = "网络中断,902错误"; // public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; // public static final String NET_UNKNOWN_STR = "未知错误"; // public static final String NET_ERROR_STR = "网络错误"; // // public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; // // } // // Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/entity/ErrorBaseBean.java // public class ErrorBaseBean extends BaseBean implements Serializable { // protected Object data; // // public Object getData() { // return data; // } // // public void setData(Object data) { // this.data = data; // } // }
import com.ecloud.androidcodeframework.codeframework.app.AppServerConfig; import com.ecloud.androidcodeframework.codeframework.entity.ErrorBaseBean; import com.google.gson.Gson;
package com.ecloud.androidcodeframework.codeframework.gson; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-15 下午9:46 * Description: 数据解析类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-15 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GsonParse extends GsonBaseParse { private Object bean; public GsonParse(String content) throws Exception { super(content); } /** * 数据解析函数 * @param className 返回数据结构类名 * @throws Exception */ @Override protected void parse(Class<?> className) throws Exception { ErrorBaseBean mErrorBaseBean; mErrorBaseBean = GsonErrorParse.parse(content);
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/app/AppServerConfig.java // public class AppServerConfig { // public static final int CODE_SERVER_ERROR = -1;//服务器错误 // public static final int CODE_FAIL = 0;//验证失败 // public static final int CODE_SUCCESS = 1;//验证成功 // // public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 // public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 // // /***************网络错误字符串常量定义**********************/ // public static final String NET_404_STR = "请求链接无效,404错误"; // public static final String NET_500_STR = "服务器端程序出错,500错误"; // public static final String NET_900_STR = "网络传输协议出错,900错误"; // public static final String NET_901_STR = "连接超时,901错误"; // public static final String NET_902_STR = "网络中断,902错误"; // public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; // public static final String NET_UNKNOWN_STR = "未知错误"; // public static final String NET_ERROR_STR = "网络错误"; // // public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; // // } // // Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/entity/ErrorBaseBean.java // public class ErrorBaseBean extends BaseBean implements Serializable { // protected Object data; // // public Object getData() { // return data; // } // // public void setData(Object data) { // this.data = data; // } // } // Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/gson/GsonParse.java import com.ecloud.androidcodeframework.codeframework.app.AppServerConfig; import com.ecloud.androidcodeframework.codeframework.entity.ErrorBaseBean; import com.google.gson.Gson; package com.ecloud.androidcodeframework.codeframework.gson; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-15 下午9:46 * Description: 数据解析类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-15 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GsonParse extends GsonBaseParse { private Object bean; public GsonParse(String content) throws Exception { super(content); } /** * 数据解析函数 * @param className 返回数据结构类名 * @throws Exception */ @Override protected void parse(Class<?> className) throws Exception { ErrorBaseBean mErrorBaseBean; mErrorBaseBean = GsonErrorParse.parse(content);
if(mErrorBaseBean.getCode() == AppServerConfig.CODE_SUCCESS){
Frank-Zhu/AndroidAppCodeFramework
CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/encryption/DesEncryptionHelper.java
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/utils/LogHelper.java // public class LogHelper { // private static final boolean DEBUG_V = true; // private static final boolean DEBUG_D = true; // private static final boolean DEBUG_I = true; // private static final boolean DEBUG_W = true; // private static final boolean DEBUG_E = true; // // public static void v(String tag, String msg) { // if(DEBUG_V) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_V && isFeatureDebug) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, Throwable tr) { // if(DEBUG_V) { // android.util.Log.v(tag, msg, tr); // } // } // // public static void d(String tag, String msg) { // if(DEBUG_D) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_D && isFeatureDebug) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, Throwable tr) { // if(DEBUG_D) { // android.util.Log.d(tag, msg, tr); // } // } // // public static void i(String tag, String msg) { // if(DEBUG_I) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_I && isFeatureDebug) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, Throwable tr) { // if(DEBUG_I) { // android.util.Log.i(tag, msg, tr); // } // } // // public static void w(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_W && isFeatureDebug) { // android.util.Log.w(tag, msg); // } // } // // public static void w(String tag, String msg, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, msg, tr); // } // } // // public static void w(String tag, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, tr); // } // } // // public static void e(String tag, String msg) { // if(DEBUG_E) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_E && isFeatureDebug) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, Throwable tr) { // if(DEBUG_E) { // android.util.Log.e(tag, msg, tr); // } // } // }
import com.ecloud.androidcodeframework.codeframework.utils.LogHelper; import org.apache.http.util.EncodingUtils;
package com.ecloud.androidcodeframework.codeframework.encryption; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-16 下午4:59 * Description: DES加解密工具类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-16 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class DesEncryptionHelper { private final static String TAG = DesEncryptionHelper.class.getSimpleName(); /** * 解密字符串 * @param msg 需要解密的字符串 * @return String 解密之后的字符串 */ public static String DesDecryption(String msg) { DesEncryption m = new DesEncryption();
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/utils/LogHelper.java // public class LogHelper { // private static final boolean DEBUG_V = true; // private static final boolean DEBUG_D = true; // private static final boolean DEBUG_I = true; // private static final boolean DEBUG_W = true; // private static final boolean DEBUG_E = true; // // public static void v(String tag, String msg) { // if(DEBUG_V) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_V && isFeatureDebug) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, Throwable tr) { // if(DEBUG_V) { // android.util.Log.v(tag, msg, tr); // } // } // // public static void d(String tag, String msg) { // if(DEBUG_D) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_D && isFeatureDebug) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, Throwable tr) { // if(DEBUG_D) { // android.util.Log.d(tag, msg, tr); // } // } // // public static void i(String tag, String msg) { // if(DEBUG_I) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_I && isFeatureDebug) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, Throwable tr) { // if(DEBUG_I) { // android.util.Log.i(tag, msg, tr); // } // } // // public static void w(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_W && isFeatureDebug) { // android.util.Log.w(tag, msg); // } // } // // public static void w(String tag, String msg, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, msg, tr); // } // } // // public static void w(String tag, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, tr); // } // } // // public static void e(String tag, String msg) { // if(DEBUG_E) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_E && isFeatureDebug) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, Throwable tr) { // if(DEBUG_E) { // android.util.Log.e(tag, msg, tr); // } // } // } // Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/encryption/DesEncryptionHelper.java import com.ecloud.androidcodeframework.codeframework.utils.LogHelper; import org.apache.http.util.EncodingUtils; package com.ecloud.androidcodeframework.codeframework.encryption; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-16 下午4:59 * Description: DES加解密工具类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-16 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class DesEncryptionHelper { private final static String TAG = DesEncryptionHelper.class.getSimpleName(); /** * 解密字符串 * @param msg 需要解密的字符串 * @return String 解密之后的字符串 */ public static String DesDecryption(String msg) { DesEncryption m = new DesEncryption();
LogHelper.d(TAG, "msg = " + msg);
Frank-Zhu/AndroidAppCodeFramework
CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/thread/GetDataRequestThread.java
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/gson/GsonParse.java // public class GsonParse extends GsonBaseParse { // // private Object bean; // // public GsonParse(String content) throws Exception { // super(content); // } // // /** // * 数据解析函数 // * @param className 返回数据结构类名 // * @throws Exception // */ // @Override // protected void parse(Class<?> className) throws Exception { // ErrorBaseBean mErrorBaseBean; // mErrorBaseBean = GsonErrorParse.parse(content); // if(mErrorBaseBean.getCode() == AppServerConfig.CODE_SUCCESS){ // Gson gson = new Gson(); // bean = gson.fromJson(content, className); // }else{ // bean = mErrorBaseBean; // } // } // // /** // * 获取HTTP返回数据结构 // * @param className 返回数据结构类名 // * @return Object // * @throws Exception // */ // public Object getBean(Class<?> className) throws Exception { // parse(className); // return bean; // } // }
import android.os.Handler; import com.ecloud.androidcodeframework.codeframework.gson.GsonParse; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import java.util.List;
package com.ecloud.androidcodeframework.codeframework.thread; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-16 下午7:42 * Description: * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-16 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GetDataRequestThread extends BaseThread { private Class<?> className; public GetDataRequestThread(Handler handler, int what, String url, List<BasicNameValuePair> param, Class<?> className,boolean isPost) { super(handler, what); this.className = className; setParams(url,param,isPost); } @Override public void run() { super.run(); try {
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/gson/GsonParse.java // public class GsonParse extends GsonBaseParse { // // private Object bean; // // public GsonParse(String content) throws Exception { // super(content); // } // // /** // * 数据解析函数 // * @param className 返回数据结构类名 // * @throws Exception // */ // @Override // protected void parse(Class<?> className) throws Exception { // ErrorBaseBean mErrorBaseBean; // mErrorBaseBean = GsonErrorParse.parse(content); // if(mErrorBaseBean.getCode() == AppServerConfig.CODE_SUCCESS){ // Gson gson = new Gson(); // bean = gson.fromJson(content, className); // }else{ // bean = mErrorBaseBean; // } // } // // /** // * 获取HTTP返回数据结构 // * @param className 返回数据结构类名 // * @return Object // * @throws Exception // */ // public Object getBean(Class<?> className) throws Exception { // parse(className); // return bean; // } // } // Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/thread/GetDataRequestThread.java import android.os.Handler; import com.ecloud.androidcodeframework.codeframework.gson.GsonParse; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import java.util.List; package com.ecloud.androidcodeframework.codeframework.thread; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-16 下午7:42 * Description: * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-16 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GetDataRequestThread extends BaseThread { private Class<?> className; public GetDataRequestThread(Handler handler, int what, String url, List<BasicNameValuePair> param, Class<?> className,boolean isPost) { super(handler, what); this.className = className; setParams(url,param,isPost); } @Override public void run() { super.run(); try {
Object bean = new GsonParse(result).getBean(className);
Frank-Zhu/AndroidAppCodeFramework
CodeFramework/src/main/java/com/ecloud/collection/clothes/encryption/AesEncryptionHelper.java
// Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/utils/LogHelper.java // public class LogHelper { // private static final boolean DEBUG_V = true; // private static final boolean DEBUG_D = true; // private static final boolean DEBUG_I = true; // private static final boolean DEBUG_W = true; // private static final boolean DEBUG_E = true; // // public static void v(String tag, String msg) { // if(DEBUG_V) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_V && isFeatureDebug) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, Throwable tr) { // if(DEBUG_V) { // android.util.Log.v(tag, msg, tr); // } // } // // public static void d(String tag, String msg) { // if(DEBUG_D) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_D && isFeatureDebug) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, Throwable tr) { // if(DEBUG_D) { // android.util.Log.d(tag, msg, tr); // } // } // // public static void i(String tag, String msg) { // if(DEBUG_I) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_I && isFeatureDebug) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, Throwable tr) { // if(DEBUG_I) { // android.util.Log.i(tag, msg, tr); // } // } // // public static void w(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_W && isFeatureDebug) { // android.util.Log.w(tag, msg); // } // } // // public static void w(String tag, String msg, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, msg, tr); // } // } // // public static void w(String tag, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, tr); // } // } // // public static void e(String tag, String msg) { // if(DEBUG_E) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_E && isFeatureDebug) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, Throwable tr) { // if(DEBUG_E) { // android.util.Log.e(tag, msg, tr); // } // } // }
import com.ecloud.collection.clothes.utils.LogHelper;
package com.ecloud.collection.clothes.encryption; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-16 下午4:52 * Description: AES加解密工具类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-16 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class AesEncryptionHelper { private final static String TAG = "DesUntils"; private final static String masterPassword = "abcd";//密钥 private final static byte[] masterPasswordByte = {'a','b','c','d'};//密钥 /** * 解密字符串 * @param msg 需要解密的字符串 * @return String 解密之后的字符串 */ public static String AesDecryption(String msg) {
// Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/utils/LogHelper.java // public class LogHelper { // private static final boolean DEBUG_V = true; // private static final boolean DEBUG_D = true; // private static final boolean DEBUG_I = true; // private static final boolean DEBUG_W = true; // private static final boolean DEBUG_E = true; // // public static void v(String tag, String msg) { // if(DEBUG_V) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_V && isFeatureDebug) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, Throwable tr) { // if(DEBUG_V) { // android.util.Log.v(tag, msg, tr); // } // } // // public static void d(String tag, String msg) { // if(DEBUG_D) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_D && isFeatureDebug) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, Throwable tr) { // if(DEBUG_D) { // android.util.Log.d(tag, msg, tr); // } // } // // public static void i(String tag, String msg) { // if(DEBUG_I) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_I && isFeatureDebug) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, Throwable tr) { // if(DEBUG_I) { // android.util.Log.i(tag, msg, tr); // } // } // // public static void w(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_W && isFeatureDebug) { // android.util.Log.w(tag, msg); // } // } // // public static void w(String tag, String msg, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, msg, tr); // } // } // // public static void w(String tag, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, tr); // } // } // // public static void e(String tag, String msg) { // if(DEBUG_E) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_E && isFeatureDebug) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, Throwable tr) { // if(DEBUG_E) { // android.util.Log.e(tag, msg, tr); // } // } // } // Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/encryption/AesEncryptionHelper.java import com.ecloud.collection.clothes.utils.LogHelper; package com.ecloud.collection.clothes.encryption; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-16 下午4:52 * Description: AES加解密工具类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-16 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class AesEncryptionHelper { private final static String TAG = "DesUntils"; private final static String masterPassword = "abcd";//密钥 private final static byte[] masterPasswordByte = {'a','b','c','d'};//密钥 /** * 解密字符串 * @param msg 需要解密的字符串 * @return String 解密之后的字符串 */ public static String AesDecryption(String msg) {
LogHelper.d(TAG, "msg = " + msg);
Frank-Zhu/AndroidAppCodeFramework
CodeFramework/src/main/java/com/ecloud/collection/clothes/encryption/DesEncryptionHelper.java
// Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/utils/LogHelper.java // public class LogHelper { // private static final boolean DEBUG_V = true; // private static final boolean DEBUG_D = true; // private static final boolean DEBUG_I = true; // private static final boolean DEBUG_W = true; // private static final boolean DEBUG_E = true; // // public static void v(String tag, String msg) { // if(DEBUG_V) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_V && isFeatureDebug) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, Throwable tr) { // if(DEBUG_V) { // android.util.Log.v(tag, msg, tr); // } // } // // public static void d(String tag, String msg) { // if(DEBUG_D) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_D && isFeatureDebug) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, Throwable tr) { // if(DEBUG_D) { // android.util.Log.d(tag, msg, tr); // } // } // // public static void i(String tag, String msg) { // if(DEBUG_I) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_I && isFeatureDebug) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, Throwable tr) { // if(DEBUG_I) { // android.util.Log.i(tag, msg, tr); // } // } // // public static void w(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_W && isFeatureDebug) { // android.util.Log.w(tag, msg); // } // } // // public static void w(String tag, String msg, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, msg, tr); // } // } // // public static void w(String tag, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, tr); // } // } // // public static void e(String tag, String msg) { // if(DEBUG_E) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_E && isFeatureDebug) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, Throwable tr) { // if(DEBUG_E) { // android.util.Log.e(tag, msg, tr); // } // } // }
import com.ecloud.collection.clothes.utils.LogHelper; import org.apache.http.util.EncodingUtils;
package com.ecloud.collection.clothes.encryption; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-16 下午4:59 * Description: DES加解密工具类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-16 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class DesEncryptionHelper { private final static String TAG = DesEncryptionHelper.class.getSimpleName(); /** * 解密字符串 * @param msg 需要解密的字符串 * @return String 解密之后的字符串 */ public static String DesDecryption(String msg) { DesEncryption m = new DesEncryption();
// Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/utils/LogHelper.java // public class LogHelper { // private static final boolean DEBUG_V = true; // private static final boolean DEBUG_D = true; // private static final boolean DEBUG_I = true; // private static final boolean DEBUG_W = true; // private static final boolean DEBUG_E = true; // // public static void v(String tag, String msg) { // if(DEBUG_V) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_V && isFeatureDebug) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, Throwable tr) { // if(DEBUG_V) { // android.util.Log.v(tag, msg, tr); // } // } // // public static void d(String tag, String msg) { // if(DEBUG_D) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_D && isFeatureDebug) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, Throwable tr) { // if(DEBUG_D) { // android.util.Log.d(tag, msg, tr); // } // } // // public static void i(String tag, String msg) { // if(DEBUG_I) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_I && isFeatureDebug) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, Throwable tr) { // if(DEBUG_I) { // android.util.Log.i(tag, msg, tr); // } // } // // public static void w(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_W && isFeatureDebug) { // android.util.Log.w(tag, msg); // } // } // // public static void w(String tag, String msg, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, msg, tr); // } // } // // public static void w(String tag, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, tr); // } // } // // public static void e(String tag, String msg) { // if(DEBUG_E) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_E && isFeatureDebug) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, Throwable tr) { // if(DEBUG_E) { // android.util.Log.e(tag, msg, tr); // } // } // } // Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/encryption/DesEncryptionHelper.java import com.ecloud.collection.clothes.utils.LogHelper; import org.apache.http.util.EncodingUtils; package com.ecloud.collection.clothes.encryption; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-16 下午4:59 * Description: DES加解密工具类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-16 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class DesEncryptionHelper { private final static String TAG = DesEncryptionHelper.class.getSimpleName(); /** * 解密字符串 * @param msg 需要解密的字符串 * @return String 解密之后的字符串 */ public static String DesDecryption(String msg) { DesEncryption m = new DesEncryption();
LogHelper.d(TAG, "msg = " + msg);
Frank-Zhu/AndroidAppCodeFramework
CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/encryption/AesEncryptionHelper.java
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/utils/LogHelper.java // public class LogHelper { // private static final boolean DEBUG_V = true; // private static final boolean DEBUG_D = true; // private static final boolean DEBUG_I = true; // private static final boolean DEBUG_W = true; // private static final boolean DEBUG_E = true; // // public static void v(String tag, String msg) { // if(DEBUG_V) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_V && isFeatureDebug) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, Throwable tr) { // if(DEBUG_V) { // android.util.Log.v(tag, msg, tr); // } // } // // public static void d(String tag, String msg) { // if(DEBUG_D) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_D && isFeatureDebug) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, Throwable tr) { // if(DEBUG_D) { // android.util.Log.d(tag, msg, tr); // } // } // // public static void i(String tag, String msg) { // if(DEBUG_I) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_I && isFeatureDebug) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, Throwable tr) { // if(DEBUG_I) { // android.util.Log.i(tag, msg, tr); // } // } // // public static void w(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_W && isFeatureDebug) { // android.util.Log.w(tag, msg); // } // } // // public static void w(String tag, String msg, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, msg, tr); // } // } // // public static void w(String tag, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, tr); // } // } // // public static void e(String tag, String msg) { // if(DEBUG_E) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_E && isFeatureDebug) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, Throwable tr) { // if(DEBUG_E) { // android.util.Log.e(tag, msg, tr); // } // } // }
import com.ecloud.androidcodeframework.codeframework.utils.LogHelper;
package com.ecloud.androidcodeframework.codeframework.encryption; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-16 下午4:52 * Description: AES加解密工具类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-16 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class AesEncryptionHelper { private final static String TAG = "DesUntils"; private final static String masterPassword = "abcd";//密钥 private final static byte[] masterPasswordByte = {'a','b','c','d'};//密钥 /** * 解密字符串 * @param msg 需要解密的字符串 * @return String 解密之后的字符串 */ public static String AesDecryption(String msg) {
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/utils/LogHelper.java // public class LogHelper { // private static final boolean DEBUG_V = true; // private static final boolean DEBUG_D = true; // private static final boolean DEBUG_I = true; // private static final boolean DEBUG_W = true; // private static final boolean DEBUG_E = true; // // public static void v(String tag, String msg) { // if(DEBUG_V) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_V && isFeatureDebug) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, Throwable tr) { // if(DEBUG_V) { // android.util.Log.v(tag, msg, tr); // } // } // // public static void d(String tag, String msg) { // if(DEBUG_D) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_D && isFeatureDebug) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, Throwable tr) { // if(DEBUG_D) { // android.util.Log.d(tag, msg, tr); // } // } // // public static void i(String tag, String msg) { // if(DEBUG_I) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_I && isFeatureDebug) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, Throwable tr) { // if(DEBUG_I) { // android.util.Log.i(tag, msg, tr); // } // } // // public static void w(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_W && isFeatureDebug) { // android.util.Log.w(tag, msg); // } // } // // public static void w(String tag, String msg, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, msg, tr); // } // } // // public static void w(String tag, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, tr); // } // } // // public static void e(String tag, String msg) { // if(DEBUG_E) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_E && isFeatureDebug) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, Throwable tr) { // if(DEBUG_E) { // android.util.Log.e(tag, msg, tr); // } // } // } // Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/encryption/AesEncryptionHelper.java import com.ecloud.androidcodeframework.codeframework.utils.LogHelper; package com.ecloud.androidcodeframework.codeframework.encryption; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-16 下午4:52 * Description: AES加解密工具类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-16 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class AesEncryptionHelper { private final static String TAG = "DesUntils"; private final static String masterPassword = "abcd";//密钥 private final static byte[] masterPasswordByte = {'a','b','c','d'};//密钥 /** * 解密字符串 * @param msg 需要解密的字符串 * @return String 解密之后的字符串 */ public static String AesDecryption(String msg) {
LogHelper.d(TAG, "msg = " + msg);
Frank-Zhu/AndroidAppCodeFramework
CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/ui/LoginActivity.java
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/utils/LogHelper.java // public class LogHelper { // private static final boolean DEBUG_V = true; // private static final boolean DEBUG_D = true; // private static final boolean DEBUG_I = true; // private static final boolean DEBUG_W = true; // private static final boolean DEBUG_E = true; // // public static void v(String tag, String msg) { // if(DEBUG_V) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_V && isFeatureDebug) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, Throwable tr) { // if(DEBUG_V) { // android.util.Log.v(tag, msg, tr); // } // } // // public static void d(String tag, String msg) { // if(DEBUG_D) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_D && isFeatureDebug) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, Throwable tr) { // if(DEBUG_D) { // android.util.Log.d(tag, msg, tr); // } // } // // public static void i(String tag, String msg) { // if(DEBUG_I) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_I && isFeatureDebug) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, Throwable tr) { // if(DEBUG_I) { // android.util.Log.i(tag, msg, tr); // } // } // // public static void w(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_W && isFeatureDebug) { // android.util.Log.w(tag, msg); // } // } // // public static void w(String tag, String msg, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, msg, tr); // } // } // // public static void w(String tag, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, tr); // } // } // // public static void e(String tag, String msg) { // if(DEBUG_E) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_E && isFeatureDebug) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, Throwable tr) { // if(DEBUG_E) { // android.util.Log.e(tag, msg, tr); // } // } // }
import android.os.Bundle; import com.ecloud.androidcodeframework.codeframework.R; import com.ecloud.androidcodeframework.codeframework.utils.LogHelper;
package com.ecloud.androidcodeframework.codeframework.ui; public class LoginActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login);
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/utils/LogHelper.java // public class LogHelper { // private static final boolean DEBUG_V = true; // private static final boolean DEBUG_D = true; // private static final boolean DEBUG_I = true; // private static final boolean DEBUG_W = true; // private static final boolean DEBUG_E = true; // // public static void v(String tag, String msg) { // if(DEBUG_V) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_V && isFeatureDebug) { // android.util.Log.v(tag, msg); // } // } // // public static void v(String tag, String msg, Throwable tr) { // if(DEBUG_V) { // android.util.Log.v(tag, msg, tr); // } // } // // public static void d(String tag, String msg) { // if(DEBUG_D) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_D && isFeatureDebug) { // android.util.Log.d(tag, msg); // } // } // // public static void d(String tag, String msg, Throwable tr) { // if(DEBUG_D) { // android.util.Log.d(tag, msg, tr); // } // } // // public static void i(String tag, String msg) { // if(DEBUG_I) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_I && isFeatureDebug) { // android.util.Log.i(tag, msg); // } // } // // public static void i(String tag, String msg, Throwable tr) { // if(DEBUG_I) { // android.util.Log.i(tag, msg, tr); // } // } // // public static void w(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_W && isFeatureDebug) { // android.util.Log.w(tag, msg); // } // } // // public static void w(String tag, String msg, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, msg, tr); // } // } // // public static void w(String tag, Throwable tr) { // if(DEBUG_W) { // android.util.Log.w(tag, tr); // } // } // // public static void e(String tag, String msg) { // if(DEBUG_E) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, boolean isFeatureDebug) { // if(DEBUG_E && isFeatureDebug) { // android.util.Log.e(tag, msg); // } // } // // public static void e(String tag, String msg, Throwable tr) { // if(DEBUG_E) { // android.util.Log.e(tag, msg, tr); // } // } // } // Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/ui/LoginActivity.java import android.os.Bundle; import com.ecloud.androidcodeframework.codeframework.R; import com.ecloud.androidcodeframework.codeframework.utils.LogHelper; package com.ecloud.androidcodeframework.codeframework.ui; public class LoginActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login);
LogHelper.d(TAG,"--> onCreate");
Frank-Zhu/AndroidAppCodeFramework
CodeFramework/src/main/java/com/ecloud/collection/clothes/gson/GsonParse.java
// Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/app/AppServerConfig.java // public class AppServerConfig { // public static final int CODE_SERVER_ERROR = -1;//服务器错误 // public static final int CODE_FAIL = 0;//验证失败 // public static final int CODE_SUCCESS = 1;//验证成功 // // public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 // public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 // // /***************网络错误字符串常量定义**********************/ // public static final String NET_404_STR = "请求链接无效,404错误"; // public static final String NET_500_STR = "服务器端程序出错,500错误"; // public static final String NET_900_STR = "网络传输协议出错,900错误"; // public static final String NET_901_STR = "连接超时,901错误"; // public static final String NET_902_STR = "网络中断,902错误"; // public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; // public static final String NET_UNKNOWN_STR = "未知错误"; // public static final String NET_ERROR_STR = "网络错误"; // // public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; // // } // // Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/entity/ErrorBaseBean.java // public class ErrorBaseBean extends BaseBean implements Serializable { // protected Object data; // // public Object getData() { // return data; // } // // public void setData(Object data) { // this.data = data; // } // }
import com.ecloud.collection.clothes.app.AppServerConfig; import com.ecloud.collection.clothes.entity.ErrorBaseBean; import com.google.gson.Gson;
package com.ecloud.collection.clothes.gson; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-15 下午9:46 * Description: 数据解析类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-15 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GsonParse extends GsonBaseParse { private Object bean; public GsonParse(String content) throws Exception { super(content); } /** * 数据解析函数 * @param className 返回数据结构类名 * @throws Exception */ @Override protected void parse(Class<?> className) throws Exception {
// Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/app/AppServerConfig.java // public class AppServerConfig { // public static final int CODE_SERVER_ERROR = -1;//服务器错误 // public static final int CODE_FAIL = 0;//验证失败 // public static final int CODE_SUCCESS = 1;//验证成功 // // public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 // public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 // // /***************网络错误字符串常量定义**********************/ // public static final String NET_404_STR = "请求链接无效,404错误"; // public static final String NET_500_STR = "服务器端程序出错,500错误"; // public static final String NET_900_STR = "网络传输协议出错,900错误"; // public static final String NET_901_STR = "连接超时,901错误"; // public static final String NET_902_STR = "网络中断,902错误"; // public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; // public static final String NET_UNKNOWN_STR = "未知错误"; // public static final String NET_ERROR_STR = "网络错误"; // // public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; // // } // // Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/entity/ErrorBaseBean.java // public class ErrorBaseBean extends BaseBean implements Serializable { // protected Object data; // // public Object getData() { // return data; // } // // public void setData(Object data) { // this.data = data; // } // } // Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/gson/GsonParse.java import com.ecloud.collection.clothes.app.AppServerConfig; import com.ecloud.collection.clothes.entity.ErrorBaseBean; import com.google.gson.Gson; package com.ecloud.collection.clothes.gson; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-15 下午9:46 * Description: 数据解析类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-15 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GsonParse extends GsonBaseParse { private Object bean; public GsonParse(String content) throws Exception { super(content); } /** * 数据解析函数 * @param className 返回数据结构类名 * @throws Exception */ @Override protected void parse(Class<?> className) throws Exception {
ErrorBaseBean mErrorBaseBean;
Frank-Zhu/AndroidAppCodeFramework
CodeFramework/src/main/java/com/ecloud/collection/clothes/gson/GsonParse.java
// Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/app/AppServerConfig.java // public class AppServerConfig { // public static final int CODE_SERVER_ERROR = -1;//服务器错误 // public static final int CODE_FAIL = 0;//验证失败 // public static final int CODE_SUCCESS = 1;//验证成功 // // public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 // public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 // // /***************网络错误字符串常量定义**********************/ // public static final String NET_404_STR = "请求链接无效,404错误"; // public static final String NET_500_STR = "服务器端程序出错,500错误"; // public static final String NET_900_STR = "网络传输协议出错,900错误"; // public static final String NET_901_STR = "连接超时,901错误"; // public static final String NET_902_STR = "网络中断,902错误"; // public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; // public static final String NET_UNKNOWN_STR = "未知错误"; // public static final String NET_ERROR_STR = "网络错误"; // // public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; // // } // // Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/entity/ErrorBaseBean.java // public class ErrorBaseBean extends BaseBean implements Serializable { // protected Object data; // // public Object getData() { // return data; // } // // public void setData(Object data) { // this.data = data; // } // }
import com.ecloud.collection.clothes.app.AppServerConfig; import com.ecloud.collection.clothes.entity.ErrorBaseBean; import com.google.gson.Gson;
package com.ecloud.collection.clothes.gson; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-15 下午9:46 * Description: 数据解析类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-15 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GsonParse extends GsonBaseParse { private Object bean; public GsonParse(String content) throws Exception { super(content); } /** * 数据解析函数 * @param className 返回数据结构类名 * @throws Exception */ @Override protected void parse(Class<?> className) throws Exception { ErrorBaseBean mErrorBaseBean; mErrorBaseBean = GsonErrorParse.parse(content);
// Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/app/AppServerConfig.java // public class AppServerConfig { // public static final int CODE_SERVER_ERROR = -1;//服务器错误 // public static final int CODE_FAIL = 0;//验证失败 // public static final int CODE_SUCCESS = 1;//验证成功 // // public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 // public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 // // /***************网络错误字符串常量定义**********************/ // public static final String NET_404_STR = "请求链接无效,404错误"; // public static final String NET_500_STR = "服务器端程序出错,500错误"; // public static final String NET_900_STR = "网络传输协议出错,900错误"; // public static final String NET_901_STR = "连接超时,901错误"; // public static final String NET_902_STR = "网络中断,902错误"; // public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; // public static final String NET_UNKNOWN_STR = "未知错误"; // public static final String NET_ERROR_STR = "网络错误"; // // public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; // // } // // Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/entity/ErrorBaseBean.java // public class ErrorBaseBean extends BaseBean implements Serializable { // protected Object data; // // public Object getData() { // return data; // } // // public void setData(Object data) { // this.data = data; // } // } // Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/gson/GsonParse.java import com.ecloud.collection.clothes.app.AppServerConfig; import com.ecloud.collection.clothes.entity.ErrorBaseBean; import com.google.gson.Gson; package com.ecloud.collection.clothes.gson; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-15 下午9:46 * Description: 数据解析类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-15 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GsonParse extends GsonBaseParse { private Object bean; public GsonParse(String content) throws Exception { super(content); } /** * 数据解析函数 * @param className 返回数据结构类名 * @throws Exception */ @Override protected void parse(Class<?> className) throws Exception { ErrorBaseBean mErrorBaseBean; mErrorBaseBean = GsonErrorParse.parse(content);
if(mErrorBaseBean.getCode() == AppServerConfig.CODE_SUCCESS){
Frank-Zhu/AndroidAppCodeFramework
CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/gson/GsonErrorParse.java
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/app/AppServerConfig.java // public class AppServerConfig { // public static final int CODE_SERVER_ERROR = -1;//服务器错误 // public static final int CODE_FAIL = 0;//验证失败 // public static final int CODE_SUCCESS = 1;//验证成功 // // public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 // public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 // // /***************网络错误字符串常量定义**********************/ // public static final String NET_404_STR = "请求链接无效,404错误"; // public static final String NET_500_STR = "服务器端程序出错,500错误"; // public static final String NET_900_STR = "网络传输协议出错,900错误"; // public static final String NET_901_STR = "连接超时,901错误"; // public static final String NET_902_STR = "网络中断,902错误"; // public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; // public static final String NET_UNKNOWN_STR = "未知错误"; // public static final String NET_ERROR_STR = "网络错误"; // // public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; // // } // // Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/entity/ErrorBaseBean.java // public class ErrorBaseBean extends BaseBean implements Serializable { // protected Object data; // // public Object getData() { // return data; // } // // public void setData(Object data) { // this.data = data; // } // }
import com.ecloud.androidcodeframework.codeframework.app.AppServerConfig; import com.ecloud.androidcodeframework.codeframework.entity.ErrorBaseBean; import org.json.JSONException; import org.json.JSONObject;
package com.ecloud.androidcodeframework.codeframework.gson; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-15 下午9:50 * Description: 数据请求失败Or成功解析类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-15 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GsonErrorParse { public static ErrorBaseBean mErrorBaseBean; /** * 解析HTTP返回数据是否成功 * @param content 返回数据字符串 * @return ErrorBaseBean */ public static ErrorBaseBean parse(String content){ mErrorBaseBean = new ErrorBaseBean(); JSONObject json; try { json = new JSONObject(content); if(json.has("code")){ mErrorBaseBean.setCode(json.getInt("status")); }else{
// Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/app/AppServerConfig.java // public class AppServerConfig { // public static final int CODE_SERVER_ERROR = -1;//服务器错误 // public static final int CODE_FAIL = 0;//验证失败 // public static final int CODE_SUCCESS = 1;//验证成功 // // public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 // public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 // // /***************网络错误字符串常量定义**********************/ // public static final String NET_404_STR = "请求链接无效,404错误"; // public static final String NET_500_STR = "服务器端程序出错,500错误"; // public static final String NET_900_STR = "网络传输协议出错,900错误"; // public static final String NET_901_STR = "连接超时,901错误"; // public static final String NET_902_STR = "网络中断,902错误"; // public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; // public static final String NET_UNKNOWN_STR = "未知错误"; // public static final String NET_ERROR_STR = "网络错误"; // // public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; // // } // // Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/entity/ErrorBaseBean.java // public class ErrorBaseBean extends BaseBean implements Serializable { // protected Object data; // // public Object getData() { // return data; // } // // public void setData(Object data) { // this.data = data; // } // } // Path: CodeFrameworkDemo/CodeFramework/src/main/java/com/ecloud/androidcodeframework/codeframework/gson/GsonErrorParse.java import com.ecloud.androidcodeframework.codeframework.app.AppServerConfig; import com.ecloud.androidcodeframework.codeframework.entity.ErrorBaseBean; import org.json.JSONException; import org.json.JSONObject; package com.ecloud.androidcodeframework.codeframework.gson; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-15 下午9:50 * Description: 数据请求失败Or成功解析类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-15 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GsonErrorParse { public static ErrorBaseBean mErrorBaseBean; /** * 解析HTTP返回数据是否成功 * @param content 返回数据字符串 * @return ErrorBaseBean */ public static ErrorBaseBean parse(String content){ mErrorBaseBean = new ErrorBaseBean(); JSONObject json; try { json = new JSONObject(content); if(json.has("code")){ mErrorBaseBean.setCode(json.getInt("status")); }else{
mErrorBaseBean.setCode(AppServerConfig.CODE_SERVER_ERROR);
Frank-Zhu/AndroidAppCodeFramework
CodeFramework/src/main/java/com/ecloud/collection/clothes/gson/GsonErrorParse.java
// Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/app/AppServerConfig.java // public class AppServerConfig { // public static final int CODE_SERVER_ERROR = -1;//服务器错误 // public static final int CODE_FAIL = 0;//验证失败 // public static final int CODE_SUCCESS = 1;//验证成功 // // public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 // public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 // // /***************网络错误字符串常量定义**********************/ // public static final String NET_404_STR = "请求链接无效,404错误"; // public static final String NET_500_STR = "服务器端程序出错,500错误"; // public static final String NET_900_STR = "网络传输协议出错,900错误"; // public static final String NET_901_STR = "连接超时,901错误"; // public static final String NET_902_STR = "网络中断,902错误"; // public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; // public static final String NET_UNKNOWN_STR = "未知错误"; // public static final String NET_ERROR_STR = "网络错误"; // // public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; // // } // // Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/entity/ErrorBaseBean.java // public class ErrorBaseBean extends BaseBean implements Serializable { // protected Object data; // // public Object getData() { // return data; // } // // public void setData(Object data) { // this.data = data; // } // }
import com.ecloud.collection.clothes.app.AppServerConfig; import com.ecloud.collection.clothes.entity.ErrorBaseBean; import org.json.JSONException; import org.json.JSONObject;
package com.ecloud.collection.clothes.gson; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-15 下午9:50 * Description: 数据请求失败Or成功解析类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-15 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GsonErrorParse { public static ErrorBaseBean mErrorBaseBean; /** * 解析HTTP返回数据是否成功 * @param content 返回数据字符串 * @return ErrorBaseBean */ public static ErrorBaseBean parse(String content){ mErrorBaseBean = new ErrorBaseBean(); JSONObject json; try { json = new JSONObject(content); if(json.has("code")){ mErrorBaseBean.setCode(json.getInt("status")); }else{
// Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/app/AppServerConfig.java // public class AppServerConfig { // public static final int CODE_SERVER_ERROR = -1;//服务器错误 // public static final int CODE_FAIL = 0;//验证失败 // public static final int CODE_SUCCESS = 1;//验证成功 // // public static final int REQUEST_TIMEOUT = 30*1000;//设置请求超时10秒钟 // public static final int DATA_TIMEOUT = 30*1000; //设置等待数据超时时间10秒钟 // // /***************网络错误字符串常量定义**********************/ // public static final String NET_404_STR = "请求链接无效,404错误"; // public static final String NET_500_STR = "服务器端程序出错,500错误"; // public static final String NET_900_STR = "网络传输协议出错,900错误"; // public static final String NET_901_STR = "连接超时,901错误"; // public static final String NET_902_STR = "网络中断,902错误"; // public static final String NET_903_STR = "网络数据流传输出错,903错误,IO异常"; // public static final String NET_UNKNOWN_STR = "未知错误"; // public static final String NET_ERROR_STR = "网络错误"; // // public static final String HTTP_ERROR_BASE_CONTENT = "{\"code\":0,\"msg\":\"网络错误\",\"total\":0,\"data\":[]}"; // // } // // Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/entity/ErrorBaseBean.java // public class ErrorBaseBean extends BaseBean implements Serializable { // protected Object data; // // public Object getData() { // return data; // } // // public void setData(Object data) { // this.data = data; // } // } // Path: CodeFramework/src/main/java/com/ecloud/collection/clothes/gson/GsonErrorParse.java import com.ecloud.collection.clothes.app.AppServerConfig; import com.ecloud.collection.clothes.entity.ErrorBaseBean; import org.json.JSONException; import org.json.JSONObject; package com.ecloud.collection.clothes.gson; /** * Author: ZhuWenWu * Version V1.0 * Date: 14-3-15 下午9:50 * Description: 数据请求失败Or成功解析类 * Modification History: * Date Author Version Discription * ----------------------------------------------------------------------------------- * 14-3-15 ZhuWenWu 1.0 1.0 * Why & What is modified: */ public class GsonErrorParse { public static ErrorBaseBean mErrorBaseBean; /** * 解析HTTP返回数据是否成功 * @param content 返回数据字符串 * @return ErrorBaseBean */ public static ErrorBaseBean parse(String content){ mErrorBaseBean = new ErrorBaseBean(); JSONObject json; try { json = new JSONObject(content); if(json.has("code")){ mErrorBaseBean.setCode(json.getInt("status")); }else{
mErrorBaseBean.setCode(AppServerConfig.CODE_SERVER_ERROR);
uli-heller/uli-gradle
110-springboot/src/main/java/org/uli/web/SampleController.java
// Path: 110-springboot/src/main/java/org/uli/service/HelloWorldService.java // @Component // public class HelloWorldService { // // @Value("${name:World}") // private String name; // // public String getHelloMessage() { // return "Hello " + this.name; // } // // }
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.uli.service.HelloWorldService;
/* * Copyright 2012-2013 the original author or authors. * * 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 under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.uli.web; @Controller public class SampleController { @Autowired
// Path: 110-springboot/src/main/java/org/uli/service/HelloWorldService.java // @Component // public class HelloWorldService { // // @Value("${name:World}") // private String name; // // public String getHelloMessage() { // return "Hello " + this.name; // } // // } // Path: 110-springboot/src/main/java/org/uli/web/SampleController.java import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.uli.service.HelloWorldService; /* * Copyright 2012-2013 the original author or authors. * * 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 under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.uli.web; @Controller public class SampleController { @Autowired
private HelloWorldService helloWorldService;
lukeweber/webrtc-jingle-client
android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceAvailable.java // public enum XmppPresenceAvailable // { // XMPP_PRESENCE_UNAVAILABLE, // XMPP_PRESENCE_AVAILABLE, // XMPP_PRESENCE_ERROR; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceAvailable[] values = XmppPresenceAvailable.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceAvailable fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceShow.java // public enum XmppPresenceShow // { // XMPP_PRESENCE_CHAT, // XMPP_PRESENCE_DEFAULT, // XMPP_PRESENCE_AWAY, // XMPP_PRESENCE_XA, // XMPP_PRESENCE_DND; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceShow[] values = XmppPresenceShow.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceShow fromInteger( int i ) // { // return values[i]; // } // }
import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import com.tuenti.voice.core.XmppPresenceAvailable; import com.tuenti.voice.core.XmppPresenceShow;
package com.tuenti.voice.core.data; public class Buddy implements Parcelable { // ------------------------------ FIELDS ------------------------------ public static final Creator<Buddy> CREATOR = new Creator<Buddy>() { public Buddy createFromParcel( Parcel in ) { return new Buddy( in ); } public Buddy[] newArray( int size ) { return new Buddy[size]; } };
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceAvailable.java // public enum XmppPresenceAvailable // { // XMPP_PRESENCE_UNAVAILABLE, // XMPP_PRESENCE_AVAILABLE, // XMPP_PRESENCE_ERROR; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceAvailable[] values = XmppPresenceAvailable.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceAvailable fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceShow.java // public enum XmppPresenceShow // { // XMPP_PRESENCE_CHAT, // XMPP_PRESENCE_DEFAULT, // XMPP_PRESENCE_AWAY, // XMPP_PRESENCE_XA, // XMPP_PRESENCE_DND; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceShow[] values = XmppPresenceShow.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceShow fromInteger( int i ) // { // return values[i]; // } // } // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import com.tuenti.voice.core.XmppPresenceAvailable; import com.tuenti.voice.core.XmppPresenceShow; package com.tuenti.voice.core.data; public class Buddy implements Parcelable { // ------------------------------ FIELDS ------------------------------ public static final Creator<Buddy> CREATOR = new Creator<Buddy>() { public Buddy createFromParcel( Parcel in ) { return new Buddy( in ); } public Buddy[] newArray( int size ) { return new Buddy[size]; } };
private XmppPresenceAvailable available;
lukeweber/webrtc-jingle-client
android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceAvailable.java // public enum XmppPresenceAvailable // { // XMPP_PRESENCE_UNAVAILABLE, // XMPP_PRESENCE_AVAILABLE, // XMPP_PRESENCE_ERROR; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceAvailable[] values = XmppPresenceAvailable.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceAvailable fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceShow.java // public enum XmppPresenceShow // { // XMPP_PRESENCE_CHAT, // XMPP_PRESENCE_DEFAULT, // XMPP_PRESENCE_AWAY, // XMPP_PRESENCE_XA, // XMPP_PRESENCE_DND; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceShow[] values = XmppPresenceShow.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceShow fromInteger( int i ) // { // return values[i]; // } // }
import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import com.tuenti.voice.core.XmppPresenceAvailable; import com.tuenti.voice.core.XmppPresenceShow;
package com.tuenti.voice.core.data; public class Buddy implements Parcelable { // ------------------------------ FIELDS ------------------------------ public static final Creator<Buddy> CREATOR = new Creator<Buddy>() { public Buddy createFromParcel( Parcel in ) { return new Buddy( in ); } public Buddy[] newArray( int size ) { return new Buddy[size]; } }; private XmppPresenceAvailable available; private String nick; private String remoteJid;
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceAvailable.java // public enum XmppPresenceAvailable // { // XMPP_PRESENCE_UNAVAILABLE, // XMPP_PRESENCE_AVAILABLE, // XMPP_PRESENCE_ERROR; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceAvailable[] values = XmppPresenceAvailable.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceAvailable fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceShow.java // public enum XmppPresenceShow // { // XMPP_PRESENCE_CHAT, // XMPP_PRESENCE_DEFAULT, // XMPP_PRESENCE_AWAY, // XMPP_PRESENCE_XA, // XMPP_PRESENCE_DND; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceShow[] values = XmppPresenceShow.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceShow fromInteger( int i ) // { // return values[i]; // } // } // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import com.tuenti.voice.core.XmppPresenceAvailable; import com.tuenti.voice.core.XmppPresenceShow; package com.tuenti.voice.core.data; public class Buddy implements Parcelable { // ------------------------------ FIELDS ------------------------------ public static final Creator<Buddy> CREATOR = new Creator<Buddy>() { public Buddy createFromParcel( Parcel in ) { return new Buddy( in ); } public Buddy[] newArray( int size ) { return new Buddy[size]; } }; private XmppPresenceAvailable available; private String nick; private String remoteJid;
private XmppPresenceShow show;
lukeweber/webrtc-jingle-client
android/voice-client-example/src/main/java/com/tuenti/voice/example/service/AccountAuthenticator.java
// Path: android/voice-client-example/src/main/java/com/tuenti/voice/example/ui/connection/AddConnectionActivity.java // public class AddConnectionActivity // extends SherlockActivity // { // // ------------------------------ FIELDS ------------------------------ // // private EditText mPasswordText; // // private EditText mStunHost; // // private EditText mStunPort; // // private EditText mUsernameText; // // private EditText mXmppHost; // // private EditText mXmppPort; // // private EditText mXmppUseSsl; // // @Override // protected void onCreate( Bundle savedInstanceState ) // { // super.onCreate( savedInstanceState ); // setContentView( R.layout.add_connection_activity ); // // mUsernameText = (EditText) findViewById( R.id.username ); // mPasswordText = (EditText) findViewById( R.id.password ); // mXmppHost = setValue( R.id.xmpp_host, R.string.xmpp_host_value ); // mXmppPort = setValue( R.id.xmpp_port, R.string.xmpp_port_value ); // mXmppUseSsl = setValue( R.id.xmpp_use_ssl, R.string.xmpp_use_ssl_value ); // mStunHost = setValue( R.id.stun_host, R.string.stun_host_value ); // mStunPort = setValue( R.id.stun_port, R.string.stun_port_value ); // setValue( R.id.turn_host, R.string.turn_host_value ); // setValue( R.id.turn_username, R.string.turn_username_value ); // setValue( R.id.turn_password, R.string.turn_password_value ); // setValue( R.id.relay_host, R.string.relay_host_value ); // // findViewById( R.id.login_button ).setOnClickListener( new View.OnClickListener() // { // @Override // public void onClick( View v ) // { // if ( TextUtils.isEmpty( mUsernameText.getText() ) || TextUtils.isEmpty( mPasswordText.getText() ) ) // { // Toaster.showLong( AddConnectionActivity.this, R.string.required_username_and_password ); // } // else // { // handleLogin(); // } // } // } ); // } // // private void handleLogin() // { // final Connection connection = new Connection(); // connection.setUsername( mUsernameText.getText().toString() ); // connection.setPassword( mPasswordText.getText().toString() ); // connection.setXmppHost( mXmppHost.getText().toString() ); // connection.setXmppPort( Integer.valueOf( mXmppPort.getText().toString() ) ); // connection.setXmppUseSsl( Boolean.valueOf( mXmppUseSsl.getText().toString() ) ); // connection.setStunHost( mStunHost.getText().toString() ); // connection.setStunPort( Integer.valueOf( mStunPort.getText().toString() ) ); // connection.setIsGtalk( true ); // // AuthenticationTask mAuthenticationTask = new AuthenticationTask( this ) // { // @Override // public void onException( Exception e ) // { // } // // @Override // public void onSuccess( Account account ) // { // setResult( RESULT_OK ); // finish(); // } // }; // mAuthenticationTask.execute( connection ); // } // // private EditText setValue( int viewId, int valueId ) // { // EditText input = (EditText) findViewById( viewId ); // input.setText( valueId ); // return input; // } // }
import android.accounts.AbstractAccountAuthenticator; import android.accounts.Account; import android.accounts.AccountAuthenticatorResponse; import android.accounts.AccountManager; import android.accounts.NetworkErrorException; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import com.tuenti.voice.example.ui.connection.AddConnectionActivity; import static android.accounts.AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE; import static android.accounts.AccountManager.KEY_BOOLEAN_RESULT; import static android.accounts.AccountManager.KEY_INTENT; import static com.tuenti.voice.example.ui.connection.AccountConstants.ACCOUNT_TYPE;
package com.tuenti.voice.example.service; class AccountAuthenticator extends AbstractAccountAuthenticator { // ------------------------------ FIELDS ------------------------------ private static final String TAG = "AccountAuthenticator"; private Context mContext; // --------------------------- CONSTRUCTORS --------------------------- public AccountAuthenticator( final Context context ) { super( context ); mContext = context; } // -------------------------- OTHER METHODS -------------------------- @Override public Bundle addAccount( final AccountAuthenticatorResponse response, final String accountType, final String authTokenType, final String[] requiredFeatures, final Bundle options ) throws NetworkErrorException { Log.d( TAG, "addAccount" );
// Path: android/voice-client-example/src/main/java/com/tuenti/voice/example/ui/connection/AddConnectionActivity.java // public class AddConnectionActivity // extends SherlockActivity // { // // ------------------------------ FIELDS ------------------------------ // // private EditText mPasswordText; // // private EditText mStunHost; // // private EditText mStunPort; // // private EditText mUsernameText; // // private EditText mXmppHost; // // private EditText mXmppPort; // // private EditText mXmppUseSsl; // // @Override // protected void onCreate( Bundle savedInstanceState ) // { // super.onCreate( savedInstanceState ); // setContentView( R.layout.add_connection_activity ); // // mUsernameText = (EditText) findViewById( R.id.username ); // mPasswordText = (EditText) findViewById( R.id.password ); // mXmppHost = setValue( R.id.xmpp_host, R.string.xmpp_host_value ); // mXmppPort = setValue( R.id.xmpp_port, R.string.xmpp_port_value ); // mXmppUseSsl = setValue( R.id.xmpp_use_ssl, R.string.xmpp_use_ssl_value ); // mStunHost = setValue( R.id.stun_host, R.string.stun_host_value ); // mStunPort = setValue( R.id.stun_port, R.string.stun_port_value ); // setValue( R.id.turn_host, R.string.turn_host_value ); // setValue( R.id.turn_username, R.string.turn_username_value ); // setValue( R.id.turn_password, R.string.turn_password_value ); // setValue( R.id.relay_host, R.string.relay_host_value ); // // findViewById( R.id.login_button ).setOnClickListener( new View.OnClickListener() // { // @Override // public void onClick( View v ) // { // if ( TextUtils.isEmpty( mUsernameText.getText() ) || TextUtils.isEmpty( mPasswordText.getText() ) ) // { // Toaster.showLong( AddConnectionActivity.this, R.string.required_username_and_password ); // } // else // { // handleLogin(); // } // } // } ); // } // // private void handleLogin() // { // final Connection connection = new Connection(); // connection.setUsername( mUsernameText.getText().toString() ); // connection.setPassword( mPasswordText.getText().toString() ); // connection.setXmppHost( mXmppHost.getText().toString() ); // connection.setXmppPort( Integer.valueOf( mXmppPort.getText().toString() ) ); // connection.setXmppUseSsl( Boolean.valueOf( mXmppUseSsl.getText().toString() ) ); // connection.setStunHost( mStunHost.getText().toString() ); // connection.setStunPort( Integer.valueOf( mStunPort.getText().toString() ) ); // connection.setIsGtalk( true ); // // AuthenticationTask mAuthenticationTask = new AuthenticationTask( this ) // { // @Override // public void onException( Exception e ) // { // } // // @Override // public void onSuccess( Account account ) // { // setResult( RESULT_OK ); // finish(); // } // }; // mAuthenticationTask.execute( connection ); // } // // private EditText setValue( int viewId, int valueId ) // { // EditText input = (EditText) findViewById( viewId ); // input.setText( valueId ); // return input; // } // } // Path: android/voice-client-example/src/main/java/com/tuenti/voice/example/service/AccountAuthenticator.java import android.accounts.AbstractAccountAuthenticator; import android.accounts.Account; import android.accounts.AccountAuthenticatorResponse; import android.accounts.AccountManager; import android.accounts.NetworkErrorException; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import com.tuenti.voice.example.ui.connection.AddConnectionActivity; import static android.accounts.AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE; import static android.accounts.AccountManager.KEY_BOOLEAN_RESULT; import static android.accounts.AccountManager.KEY_INTENT; import static com.tuenti.voice.example.ui.connection.AccountConstants.ACCOUNT_TYPE; package com.tuenti.voice.example.service; class AccountAuthenticator extends AbstractAccountAuthenticator { // ------------------------------ FIELDS ------------------------------ private static final String TAG = "AccountAuthenticator"; private Context mContext; // --------------------------- CONSTRUCTORS --------------------------- public AccountAuthenticator( final Context context ) { super( context ); mContext = context; } // -------------------------- OTHER METHODS -------------------------- @Override public Bundle addAccount( final AccountAuthenticatorResponse response, final String accountType, final String authTokenType, final String[] requiredFeatures, final Bundle options ) throws NetworkErrorException { Log.d( TAG, "addAccount" );
final Intent intent = new Intent( mContext, AddConnectionActivity.class );
lukeweber/webrtc-jingle-client
android/voice-client-aidl/src/main/java/com/tuenti/voice/core/BuddyCallback.java
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java // public class Buddy // implements Parcelable // { // // ------------------------------ FIELDS ------------------------------ // // public static final Creator<Buddy> CREATOR = new Creator<Buddy>() // { // public Buddy createFromParcel( Parcel in ) // { // return new Buddy( in ); // } // // public Buddy[] newArray( int size ) // { // return new Buddy[size]; // } // }; // // private XmppPresenceAvailable available; // // private String nick; // // private String remoteJid; // // private XmppPresenceShow show; // // // --------------------------- CONSTRUCTORS --------------------------- // // public Buddy() // { // } // // public Buddy( Parcel in ) // { // nick = in.readString(); // remoteJid = in.readString(); // available = XmppPresenceAvailable.fromInteger( in.readInt() ); // show = XmppPresenceShow.fromInteger( in.readInt() ); // } // // // --------------------- GETTER / SETTER METHODS --------------------- // // public XmppPresenceAvailable getAvailable() // { // return available; // } // // public void setAvailable( XmppPresenceAvailable available ) // { // this.available = available; // } // // public String getNick() // { // return nick; // } // // public void setNick( String nick ) // { // this.nick = nick; // } // // public String getRemoteJid() // { // return remoteJid; // } // // public void setRemoteJid( String remoteJid ) // { // this.remoteJid = remoteJid; // } // // public XmppPresenceShow getShow() // { // return show; // } // // public void setShow( XmppPresenceShow show ) // { // this.show = show; // } // // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Parcelable --------------------- // // @Override // public int describeContents() // { // return 0; // } // // @Override // public void writeToParcel( Parcel out, int flags ) // { // out.writeString( nick ); // out.writeString( remoteJid ); // out.writeInt( available.ordinal() ); // out.writeInt( show.ordinal() ); // } // // // -------------------------- OTHER METHODS -------------------------- // // public String getName() // { // if ( !TextUtils.isEmpty( nick ) ) // { // return nick; // } // return remoteJid; // } // }
import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; import android.os.RemoteException; import android.util.Log; import com.tuenti.voice.core.data.Buddy; import com.tuenti.voice.core.service.IBuddyService; import com.tuenti.voice.core.service.IBuddyServiceCallback;
} } @Override public void onServiceDisconnected( ComponentName name ) { try { mService.unregisterCallback( BuddyCallback.this ); mService = null; } catch ( RemoteException e ) { Log.e( TAG, "Error on ServiceConnection.onServiceDisconnected", e ); } } }; // --------------------------- CONSTRUCTORS --------------------------- public BuddyCallback( final Activity activity ) { mActivity = activity; } // ------------------------ INTERFACE METHODS ------------------------ // --------------------- Interface IBuddyServiceCallback --------------------- @Override
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java // public class Buddy // implements Parcelable // { // // ------------------------------ FIELDS ------------------------------ // // public static final Creator<Buddy> CREATOR = new Creator<Buddy>() // { // public Buddy createFromParcel( Parcel in ) // { // return new Buddy( in ); // } // // public Buddy[] newArray( int size ) // { // return new Buddy[size]; // } // }; // // private XmppPresenceAvailable available; // // private String nick; // // private String remoteJid; // // private XmppPresenceShow show; // // // --------------------------- CONSTRUCTORS --------------------------- // // public Buddy() // { // } // // public Buddy( Parcel in ) // { // nick = in.readString(); // remoteJid = in.readString(); // available = XmppPresenceAvailable.fromInteger( in.readInt() ); // show = XmppPresenceShow.fromInteger( in.readInt() ); // } // // // --------------------- GETTER / SETTER METHODS --------------------- // // public XmppPresenceAvailable getAvailable() // { // return available; // } // // public void setAvailable( XmppPresenceAvailable available ) // { // this.available = available; // } // // public String getNick() // { // return nick; // } // // public void setNick( String nick ) // { // this.nick = nick; // } // // public String getRemoteJid() // { // return remoteJid; // } // // public void setRemoteJid( String remoteJid ) // { // this.remoteJid = remoteJid; // } // // public XmppPresenceShow getShow() // { // return show; // } // // public void setShow( XmppPresenceShow show ) // { // this.show = show; // } // // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Parcelable --------------------- // // @Override // public int describeContents() // { // return 0; // } // // @Override // public void writeToParcel( Parcel out, int flags ) // { // out.writeString( nick ); // out.writeString( remoteJid ); // out.writeInt( available.ordinal() ); // out.writeInt( show.ordinal() ); // } // // // -------------------------- OTHER METHODS -------------------------- // // public String getName() // { // if ( !TextUtils.isEmpty( nick ) ) // { // return nick; // } // return remoteJid; // } // } // Path: android/voice-client-aidl/src/main/java/com/tuenti/voice/core/BuddyCallback.java import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; import android.os.RemoteException; import android.util.Log; import com.tuenti.voice.core.data.Buddy; import com.tuenti.voice.core.service.IBuddyService; import com.tuenti.voice.core.service.IBuddyServiceCallback; } } @Override public void onServiceDisconnected( ComponentName name ) { try { mService.unregisterCallback( BuddyCallback.this ); mService = null; } catch ( RemoteException e ) { Log.e( TAG, "Error on ServiceConnection.onServiceDisconnected", e ); } } }; // --------------------------- CONSTRUCTORS --------------------------- public BuddyCallback( final Activity activity ) { mActivity = activity; } // ------------------------ INTERFACE METHODS ------------------------ // --------------------- Interface IBuddyServiceCallback --------------------- @Override
public void handleBuddyUpdated( Buddy[] buddies )
lukeweber/webrtc-jingle-client
android/voice-client-aidl/src/main/java/com/tuenti/voice/core/manager/BuddyManagerImpl.java
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/BuddyListState.java // public enum BuddyListState // { // ADD, // REMOVE, // RESET; // // // ------------------------------ FIELDS ------------------------------ // // private static final BuddyListState[] buddyListStateValues = BuddyListState.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static BuddyListState fromInteger( int i ) // { // return buddyListStateValues[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceAvailable.java // public enum XmppPresenceAvailable // { // XMPP_PRESENCE_UNAVAILABLE, // XMPP_PRESENCE_AVAILABLE, // XMPP_PRESENCE_ERROR; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceAvailable[] values = XmppPresenceAvailable.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceAvailable fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceShow.java // public enum XmppPresenceShow // { // XMPP_PRESENCE_CHAT, // XMPP_PRESENCE_DEFAULT, // XMPP_PRESENCE_AWAY, // XMPP_PRESENCE_XA, // XMPP_PRESENCE_DND; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceShow[] values = XmppPresenceShow.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceShow fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java // public class Buddy // implements Parcelable // { // // ------------------------------ FIELDS ------------------------------ // // public static final Creator<Buddy> CREATOR = new Creator<Buddy>() // { // public Buddy createFromParcel( Parcel in ) // { // return new Buddy( in ); // } // // public Buddy[] newArray( int size ) // { // return new Buddy[size]; // } // }; // // private XmppPresenceAvailable available; // // private String nick; // // private String remoteJid; // // private XmppPresenceShow show; // // // --------------------------- CONSTRUCTORS --------------------------- // // public Buddy() // { // } // // public Buddy( Parcel in ) // { // nick = in.readString(); // remoteJid = in.readString(); // available = XmppPresenceAvailable.fromInteger( in.readInt() ); // show = XmppPresenceShow.fromInteger( in.readInt() ); // } // // // --------------------- GETTER / SETTER METHODS --------------------- // // public XmppPresenceAvailable getAvailable() // { // return available; // } // // public void setAvailable( XmppPresenceAvailable available ) // { // this.available = available; // } // // public String getNick() // { // return nick; // } // // public void setNick( String nick ) // { // this.nick = nick; // } // // public String getRemoteJid() // { // return remoteJid; // } // // public void setRemoteJid( String remoteJid ) // { // this.remoteJid = remoteJid; // } // // public XmppPresenceShow getShow() // { // return show; // } // // public void setShow( XmppPresenceShow show ) // { // this.show = show; // } // // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Parcelable --------------------- // // @Override // public int describeContents() // { // return 0; // } // // @Override // public void writeToParcel( Parcel out, int flags ) // { // out.writeString( nick ); // out.writeString( remoteJid ); // out.writeInt( available.ordinal() ); // out.writeInt( show.ordinal() ); // } // // // -------------------------- OTHER METHODS -------------------------- // // public String getName() // { // if ( !TextUtils.isEmpty( nick ) ) // { // return nick; // } // return remoteJid; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/BuddyComparator.java // public class BuddyComparator // implements Comparator<Buddy> // { // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Comparator --------------------- // // @Override // public int compare( Buddy b1, Buddy b2 ) // { // return b1.getRemoteJid().compareTo( b2.getRemoteJid() ); // } // }
import android.os.IBinder; import android.os.RemoteCallbackList; import android.os.RemoteException; import android.util.Log; import com.tuenti.voice.core.BuddyListState; import com.tuenti.voice.core.VoiceClient; import com.tuenti.voice.core.XmppPresenceAvailable; import com.tuenti.voice.core.XmppPresenceShow; import com.tuenti.voice.core.data.Buddy; import com.tuenti.voice.core.data.BuddyComparator; import com.tuenti.voice.core.service.IBuddyService; import com.tuenti.voice.core.service.IBuddyServiceCallback; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List;
package com.tuenti.voice.core.manager; public class BuddyManagerImpl implements BuddyManager { // ------------------------------ FIELDS ------------------------------ private static final Object mLock = new Object(); private static final String TAG = "BuddyManager";
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/BuddyListState.java // public enum BuddyListState // { // ADD, // REMOVE, // RESET; // // // ------------------------------ FIELDS ------------------------------ // // private static final BuddyListState[] buddyListStateValues = BuddyListState.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static BuddyListState fromInteger( int i ) // { // return buddyListStateValues[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceAvailable.java // public enum XmppPresenceAvailable // { // XMPP_PRESENCE_UNAVAILABLE, // XMPP_PRESENCE_AVAILABLE, // XMPP_PRESENCE_ERROR; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceAvailable[] values = XmppPresenceAvailable.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceAvailable fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceShow.java // public enum XmppPresenceShow // { // XMPP_PRESENCE_CHAT, // XMPP_PRESENCE_DEFAULT, // XMPP_PRESENCE_AWAY, // XMPP_PRESENCE_XA, // XMPP_PRESENCE_DND; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceShow[] values = XmppPresenceShow.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceShow fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java // public class Buddy // implements Parcelable // { // // ------------------------------ FIELDS ------------------------------ // // public static final Creator<Buddy> CREATOR = new Creator<Buddy>() // { // public Buddy createFromParcel( Parcel in ) // { // return new Buddy( in ); // } // // public Buddy[] newArray( int size ) // { // return new Buddy[size]; // } // }; // // private XmppPresenceAvailable available; // // private String nick; // // private String remoteJid; // // private XmppPresenceShow show; // // // --------------------------- CONSTRUCTORS --------------------------- // // public Buddy() // { // } // // public Buddy( Parcel in ) // { // nick = in.readString(); // remoteJid = in.readString(); // available = XmppPresenceAvailable.fromInteger( in.readInt() ); // show = XmppPresenceShow.fromInteger( in.readInt() ); // } // // // --------------------- GETTER / SETTER METHODS --------------------- // // public XmppPresenceAvailable getAvailable() // { // return available; // } // // public void setAvailable( XmppPresenceAvailable available ) // { // this.available = available; // } // // public String getNick() // { // return nick; // } // // public void setNick( String nick ) // { // this.nick = nick; // } // // public String getRemoteJid() // { // return remoteJid; // } // // public void setRemoteJid( String remoteJid ) // { // this.remoteJid = remoteJid; // } // // public XmppPresenceShow getShow() // { // return show; // } // // public void setShow( XmppPresenceShow show ) // { // this.show = show; // } // // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Parcelable --------------------- // // @Override // public int describeContents() // { // return 0; // } // // @Override // public void writeToParcel( Parcel out, int flags ) // { // out.writeString( nick ); // out.writeString( remoteJid ); // out.writeInt( available.ordinal() ); // out.writeInt( show.ordinal() ); // } // // // -------------------------- OTHER METHODS -------------------------- // // public String getName() // { // if ( !TextUtils.isEmpty( nick ) ) // { // return nick; // } // return remoteJid; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/BuddyComparator.java // public class BuddyComparator // implements Comparator<Buddy> // { // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Comparator --------------------- // // @Override // public int compare( Buddy b1, Buddy b2 ) // { // return b1.getRemoteJid().compareTo( b2.getRemoteJid() ); // } // } // Path: android/voice-client-aidl/src/main/java/com/tuenti/voice/core/manager/BuddyManagerImpl.java import android.os.IBinder; import android.os.RemoteCallbackList; import android.os.RemoteException; import android.util.Log; import com.tuenti.voice.core.BuddyListState; import com.tuenti.voice.core.VoiceClient; import com.tuenti.voice.core.XmppPresenceAvailable; import com.tuenti.voice.core.XmppPresenceShow; import com.tuenti.voice.core.data.Buddy; import com.tuenti.voice.core.data.BuddyComparator; import com.tuenti.voice.core.service.IBuddyService; import com.tuenti.voice.core.service.IBuddyServiceCallback; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; package com.tuenti.voice.core.manager; public class BuddyManagerImpl implements BuddyManager { // ------------------------------ FIELDS ------------------------------ private static final Object mLock = new Object(); private static final String TAG = "BuddyManager";
private BuddyComparator comparator = new BuddyComparator();
lukeweber/webrtc-jingle-client
android/voice-client-example/src/main/java/com/tuenti/voice/example/ui/buddy/BuddyListAdapter.java
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceAvailable.java // public enum XmppPresenceAvailable // { // XMPP_PRESENCE_UNAVAILABLE, // XMPP_PRESENCE_AVAILABLE, // XMPP_PRESENCE_ERROR; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceAvailable[] values = XmppPresenceAvailable.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceAvailable fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceShow.java // public enum XmppPresenceShow // { // XMPP_PRESENCE_CHAT, // XMPP_PRESENCE_DEFAULT, // XMPP_PRESENCE_AWAY, // XMPP_PRESENCE_XA, // XMPP_PRESENCE_DND; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceShow[] values = XmppPresenceShow.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceShow fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java // public class Buddy // implements Parcelable // { // // ------------------------------ FIELDS ------------------------------ // // public static final Creator<Buddy> CREATOR = new Creator<Buddy>() // { // public Buddy createFromParcel( Parcel in ) // { // return new Buddy( in ); // } // // public Buddy[] newArray( int size ) // { // return new Buddy[size]; // } // }; // // private XmppPresenceAvailable available; // // private String nick; // // private String remoteJid; // // private XmppPresenceShow show; // // // --------------------------- CONSTRUCTORS --------------------------- // // public Buddy() // { // } // // public Buddy( Parcel in ) // { // nick = in.readString(); // remoteJid = in.readString(); // available = XmppPresenceAvailable.fromInteger( in.readInt() ); // show = XmppPresenceShow.fromInteger( in.readInt() ); // } // // // --------------------- GETTER / SETTER METHODS --------------------- // // public XmppPresenceAvailable getAvailable() // { // return available; // } // // public void setAvailable( XmppPresenceAvailable available ) // { // this.available = available; // } // // public String getNick() // { // return nick; // } // // public void setNick( String nick ) // { // this.nick = nick; // } // // public String getRemoteJid() // { // return remoteJid; // } // // public void setRemoteJid( String remoteJid ) // { // this.remoteJid = remoteJid; // } // // public XmppPresenceShow getShow() // { // return show; // } // // public void setShow( XmppPresenceShow show ) // { // this.show = show; // } // // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Parcelable --------------------- // // @Override // public int describeContents() // { // return 0; // } // // @Override // public void writeToParcel( Parcel out, int flags ) // { // out.writeString( nick ); // out.writeString( remoteJid ); // out.writeInt( available.ordinal() ); // out.writeInt( show.ordinal() ); // } // // // -------------------------- OTHER METHODS -------------------------- // // public String getName() // { // if ( !TextUtils.isEmpty( nick ) ) // { // return nick; // } // return remoteJid; // } // }
import android.view.LayoutInflater; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.tuenti.voice.core.XmppPresenceAvailable; import com.tuenti.voice.core.XmppPresenceShow; import com.tuenti.voice.core.data.Buddy; import com.tuenti.voice.example.R;
package com.tuenti.voice.example.ui.buddy; public class BuddyListAdapter extends SingleTypeAdapter<Buddy> { // --------------------------- CONSTRUCTORS --------------------------- public BuddyListAdapter( final LayoutInflater inflater, final Buddy[] buddies ) { super( inflater, R.layout.buddy_item ); setItems( buddies ); } @Override protected int[] getChildViewIds() { return new int[]{R.id.buddy_name, R.id.buddy_presence, R.id.buddy_status}; } @Override protected void update( final int position, final Buddy buddy ) { setText( 0, buddy.getName() ); imageView( 1 ).setImageResource( getImageResource( buddy ) ); setText( 2, getAvailable( buddy ) ); } private int getAvailable( final Buddy buddy ) {
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceAvailable.java // public enum XmppPresenceAvailable // { // XMPP_PRESENCE_UNAVAILABLE, // XMPP_PRESENCE_AVAILABLE, // XMPP_PRESENCE_ERROR; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceAvailable[] values = XmppPresenceAvailable.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceAvailable fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceShow.java // public enum XmppPresenceShow // { // XMPP_PRESENCE_CHAT, // XMPP_PRESENCE_DEFAULT, // XMPP_PRESENCE_AWAY, // XMPP_PRESENCE_XA, // XMPP_PRESENCE_DND; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceShow[] values = XmppPresenceShow.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceShow fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java // public class Buddy // implements Parcelable // { // // ------------------------------ FIELDS ------------------------------ // // public static final Creator<Buddy> CREATOR = new Creator<Buddy>() // { // public Buddy createFromParcel( Parcel in ) // { // return new Buddy( in ); // } // // public Buddy[] newArray( int size ) // { // return new Buddy[size]; // } // }; // // private XmppPresenceAvailable available; // // private String nick; // // private String remoteJid; // // private XmppPresenceShow show; // // // --------------------------- CONSTRUCTORS --------------------------- // // public Buddy() // { // } // // public Buddy( Parcel in ) // { // nick = in.readString(); // remoteJid = in.readString(); // available = XmppPresenceAvailable.fromInteger( in.readInt() ); // show = XmppPresenceShow.fromInteger( in.readInt() ); // } // // // --------------------- GETTER / SETTER METHODS --------------------- // // public XmppPresenceAvailable getAvailable() // { // return available; // } // // public void setAvailable( XmppPresenceAvailable available ) // { // this.available = available; // } // // public String getNick() // { // return nick; // } // // public void setNick( String nick ) // { // this.nick = nick; // } // // public String getRemoteJid() // { // return remoteJid; // } // // public void setRemoteJid( String remoteJid ) // { // this.remoteJid = remoteJid; // } // // public XmppPresenceShow getShow() // { // return show; // } // // public void setShow( XmppPresenceShow show ) // { // this.show = show; // } // // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Parcelable --------------------- // // @Override // public int describeContents() // { // return 0; // } // // @Override // public void writeToParcel( Parcel out, int flags ) // { // out.writeString( nick ); // out.writeString( remoteJid ); // out.writeInt( available.ordinal() ); // out.writeInt( show.ordinal() ); // } // // // -------------------------- OTHER METHODS -------------------------- // // public String getName() // { // if ( !TextUtils.isEmpty( nick ) ) // { // return nick; // } // return remoteJid; // } // } // Path: android/voice-client-example/src/main/java/com/tuenti/voice/example/ui/buddy/BuddyListAdapter.java import android.view.LayoutInflater; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.tuenti.voice.core.XmppPresenceAvailable; import com.tuenti.voice.core.XmppPresenceShow; import com.tuenti.voice.core.data.Buddy; import com.tuenti.voice.example.R; package com.tuenti.voice.example.ui.buddy; public class BuddyListAdapter extends SingleTypeAdapter<Buddy> { // --------------------------- CONSTRUCTORS --------------------------- public BuddyListAdapter( final LayoutInflater inflater, final Buddy[] buddies ) { super( inflater, R.layout.buddy_item ); setItems( buddies ); } @Override protected int[] getChildViewIds() { return new int[]{R.id.buddy_name, R.id.buddy_presence, R.id.buddy_status}; } @Override protected void update( final int position, final Buddy buddy ) { setText( 0, buddy.getName() ); imageView( 1 ).setImageResource( getImageResource( buddy ) ); setText( 2, getAvailable( buddy ) ); } private int getAvailable( final Buddy buddy ) {
if ( XmppPresenceAvailable.XMPP_PRESENCE_AVAILABLE.equals( buddy.getAvailable() ) )
lukeweber/webrtc-jingle-client
android/voice-client-example/src/main/java/com/tuenti/voice/example/ui/buddy/BuddyListAdapter.java
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceAvailable.java // public enum XmppPresenceAvailable // { // XMPP_PRESENCE_UNAVAILABLE, // XMPP_PRESENCE_AVAILABLE, // XMPP_PRESENCE_ERROR; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceAvailable[] values = XmppPresenceAvailable.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceAvailable fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceShow.java // public enum XmppPresenceShow // { // XMPP_PRESENCE_CHAT, // XMPP_PRESENCE_DEFAULT, // XMPP_PRESENCE_AWAY, // XMPP_PRESENCE_XA, // XMPP_PRESENCE_DND; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceShow[] values = XmppPresenceShow.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceShow fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java // public class Buddy // implements Parcelable // { // // ------------------------------ FIELDS ------------------------------ // // public static final Creator<Buddy> CREATOR = new Creator<Buddy>() // { // public Buddy createFromParcel( Parcel in ) // { // return new Buddy( in ); // } // // public Buddy[] newArray( int size ) // { // return new Buddy[size]; // } // }; // // private XmppPresenceAvailable available; // // private String nick; // // private String remoteJid; // // private XmppPresenceShow show; // // // --------------------------- CONSTRUCTORS --------------------------- // // public Buddy() // { // } // // public Buddy( Parcel in ) // { // nick = in.readString(); // remoteJid = in.readString(); // available = XmppPresenceAvailable.fromInteger( in.readInt() ); // show = XmppPresenceShow.fromInteger( in.readInt() ); // } // // // --------------------- GETTER / SETTER METHODS --------------------- // // public XmppPresenceAvailable getAvailable() // { // return available; // } // // public void setAvailable( XmppPresenceAvailable available ) // { // this.available = available; // } // // public String getNick() // { // return nick; // } // // public void setNick( String nick ) // { // this.nick = nick; // } // // public String getRemoteJid() // { // return remoteJid; // } // // public void setRemoteJid( String remoteJid ) // { // this.remoteJid = remoteJid; // } // // public XmppPresenceShow getShow() // { // return show; // } // // public void setShow( XmppPresenceShow show ) // { // this.show = show; // } // // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Parcelable --------------------- // // @Override // public int describeContents() // { // return 0; // } // // @Override // public void writeToParcel( Parcel out, int flags ) // { // out.writeString( nick ); // out.writeString( remoteJid ); // out.writeInt( available.ordinal() ); // out.writeInt( show.ordinal() ); // } // // // -------------------------- OTHER METHODS -------------------------- // // public String getName() // { // if ( !TextUtils.isEmpty( nick ) ) // { // return nick; // } // return remoteJid; // } // }
import android.view.LayoutInflater; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.tuenti.voice.core.XmppPresenceAvailable; import com.tuenti.voice.core.XmppPresenceShow; import com.tuenti.voice.core.data.Buddy; import com.tuenti.voice.example.R;
package com.tuenti.voice.example.ui.buddy; public class BuddyListAdapter extends SingleTypeAdapter<Buddy> { // --------------------------- CONSTRUCTORS --------------------------- public BuddyListAdapter( final LayoutInflater inflater, final Buddy[] buddies ) { super( inflater, R.layout.buddy_item ); setItems( buddies ); } @Override protected int[] getChildViewIds() { return new int[]{R.id.buddy_name, R.id.buddy_presence, R.id.buddy_status}; } @Override protected void update( final int position, final Buddy buddy ) { setText( 0, buddy.getName() ); imageView( 1 ).setImageResource( getImageResource( buddy ) ); setText( 2, getAvailable( buddy ) ); } private int getAvailable( final Buddy buddy ) { if ( XmppPresenceAvailable.XMPP_PRESENCE_AVAILABLE.equals( buddy.getAvailable() ) ) {
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceAvailable.java // public enum XmppPresenceAvailable // { // XMPP_PRESENCE_UNAVAILABLE, // XMPP_PRESENCE_AVAILABLE, // XMPP_PRESENCE_ERROR; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceAvailable[] values = XmppPresenceAvailable.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceAvailable fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/XmppPresenceShow.java // public enum XmppPresenceShow // { // XMPP_PRESENCE_CHAT, // XMPP_PRESENCE_DEFAULT, // XMPP_PRESENCE_AWAY, // XMPP_PRESENCE_XA, // XMPP_PRESENCE_DND; // // // ------------------------------ FIELDS ------------------------------ // // private static final XmppPresenceShow[] values = XmppPresenceShow.values(); // // // -------------------------- STATIC METHODS -------------------------- // // public static XmppPresenceShow fromInteger( int i ) // { // return values[i]; // } // } // // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java // public class Buddy // implements Parcelable // { // // ------------------------------ FIELDS ------------------------------ // // public static final Creator<Buddy> CREATOR = new Creator<Buddy>() // { // public Buddy createFromParcel( Parcel in ) // { // return new Buddy( in ); // } // // public Buddy[] newArray( int size ) // { // return new Buddy[size]; // } // }; // // private XmppPresenceAvailable available; // // private String nick; // // private String remoteJid; // // private XmppPresenceShow show; // // // --------------------------- CONSTRUCTORS --------------------------- // // public Buddy() // { // } // // public Buddy( Parcel in ) // { // nick = in.readString(); // remoteJid = in.readString(); // available = XmppPresenceAvailable.fromInteger( in.readInt() ); // show = XmppPresenceShow.fromInteger( in.readInt() ); // } // // // --------------------- GETTER / SETTER METHODS --------------------- // // public XmppPresenceAvailable getAvailable() // { // return available; // } // // public void setAvailable( XmppPresenceAvailable available ) // { // this.available = available; // } // // public String getNick() // { // return nick; // } // // public void setNick( String nick ) // { // this.nick = nick; // } // // public String getRemoteJid() // { // return remoteJid; // } // // public void setRemoteJid( String remoteJid ) // { // this.remoteJid = remoteJid; // } // // public XmppPresenceShow getShow() // { // return show; // } // // public void setShow( XmppPresenceShow show ) // { // this.show = show; // } // // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Parcelable --------------------- // // @Override // public int describeContents() // { // return 0; // } // // @Override // public void writeToParcel( Parcel out, int flags ) // { // out.writeString( nick ); // out.writeString( remoteJid ); // out.writeInt( available.ordinal() ); // out.writeInt( show.ordinal() ); // } // // // -------------------------- OTHER METHODS -------------------------- // // public String getName() // { // if ( !TextUtils.isEmpty( nick ) ) // { // return nick; // } // return remoteJid; // } // } // Path: android/voice-client-example/src/main/java/com/tuenti/voice/example/ui/buddy/BuddyListAdapter.java import android.view.LayoutInflater; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import com.tuenti.voice.core.XmppPresenceAvailable; import com.tuenti.voice.core.XmppPresenceShow; import com.tuenti.voice.core.data.Buddy; import com.tuenti.voice.example.R; package com.tuenti.voice.example.ui.buddy; public class BuddyListAdapter extends SingleTypeAdapter<Buddy> { // --------------------------- CONSTRUCTORS --------------------------- public BuddyListAdapter( final LayoutInflater inflater, final Buddy[] buddies ) { super( inflater, R.layout.buddy_item ); setItems( buddies ); } @Override protected int[] getChildViewIds() { return new int[]{R.id.buddy_name, R.id.buddy_presence, R.id.buddy_status}; } @Override protected void update( final int position, final Buddy buddy ) { setText( 0, buddy.getName() ); imageView( 1 ).setImageResource( getImageResource( buddy ) ); setText( 2, getAvailable( buddy ) ); } private int getAvailable( final Buddy buddy ) { if ( XmppPresenceAvailable.XMPP_PRESENCE_AVAILABLE.equals( buddy.getAvailable() ) ) {
if ( XmppPresenceShow.XMPP_PRESENCE_DND.equals( buddy.getShow() ) )
lukeweber/webrtc-jingle-client
android/voice-client-core/src/main/java/com/tuenti/voice/core/OnBuddyListener.java
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java // public class Buddy // implements Parcelable // { // // ------------------------------ FIELDS ------------------------------ // // public static final Creator<Buddy> CREATOR = new Creator<Buddy>() // { // public Buddy createFromParcel( Parcel in ) // { // return new Buddy( in ); // } // // public Buddy[] newArray( int size ) // { // return new Buddy[size]; // } // }; // // private XmppPresenceAvailable available; // // private String nick; // // private String remoteJid; // // private XmppPresenceShow show; // // // --------------------------- CONSTRUCTORS --------------------------- // // public Buddy() // { // } // // public Buddy( Parcel in ) // { // nick = in.readString(); // remoteJid = in.readString(); // available = XmppPresenceAvailable.fromInteger( in.readInt() ); // show = XmppPresenceShow.fromInteger( in.readInt() ); // } // // // --------------------- GETTER / SETTER METHODS --------------------- // // public XmppPresenceAvailable getAvailable() // { // return available; // } // // public void setAvailable( XmppPresenceAvailable available ) // { // this.available = available; // } // // public String getNick() // { // return nick; // } // // public void setNick( String nick ) // { // this.nick = nick; // } // // public String getRemoteJid() // { // return remoteJid; // } // // public void setRemoteJid( String remoteJid ) // { // this.remoteJid = remoteJid; // } // // public XmppPresenceShow getShow() // { // return show; // } // // public void setShow( XmppPresenceShow show ) // { // this.show = show; // } // // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Parcelable --------------------- // // @Override // public int describeContents() // { // return 0; // } // // @Override // public void writeToParcel( Parcel out, int flags ) // { // out.writeString( nick ); // out.writeString( remoteJid ); // out.writeInt( available.ordinal() ); // out.writeInt( show.ordinal() ); // } // // // -------------------------- OTHER METHODS -------------------------- // // public String getName() // { // if ( !TextUtils.isEmpty( nick ) ) // { // return nick; // } // return remoteJid; // } // }
import com.tuenti.voice.core.data.Buddy;
package com.tuenti.voice.core; public interface OnBuddyListener { // -------------------------- OTHER METHODS --------------------------
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Buddy.java // public class Buddy // implements Parcelable // { // // ------------------------------ FIELDS ------------------------------ // // public static final Creator<Buddy> CREATOR = new Creator<Buddy>() // { // public Buddy createFromParcel( Parcel in ) // { // return new Buddy( in ); // } // // public Buddy[] newArray( int size ) // { // return new Buddy[size]; // } // }; // // private XmppPresenceAvailable available; // // private String nick; // // private String remoteJid; // // private XmppPresenceShow show; // // // --------------------------- CONSTRUCTORS --------------------------- // // public Buddy() // { // } // // public Buddy( Parcel in ) // { // nick = in.readString(); // remoteJid = in.readString(); // available = XmppPresenceAvailable.fromInteger( in.readInt() ); // show = XmppPresenceShow.fromInteger( in.readInt() ); // } // // // --------------------- GETTER / SETTER METHODS --------------------- // // public XmppPresenceAvailable getAvailable() // { // return available; // } // // public void setAvailable( XmppPresenceAvailable available ) // { // this.available = available; // } // // public String getNick() // { // return nick; // } // // public void setNick( String nick ) // { // this.nick = nick; // } // // public String getRemoteJid() // { // return remoteJid; // } // // public void setRemoteJid( String remoteJid ) // { // this.remoteJid = remoteJid; // } // // public XmppPresenceShow getShow() // { // return show; // } // // public void setShow( XmppPresenceShow show ) // { // this.show = show; // } // // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Parcelable --------------------- // // @Override // public int describeContents() // { // return 0; // } // // @Override // public void writeToParcel( Parcel out, int flags ) // { // out.writeString( nick ); // out.writeString( remoteJid ); // out.writeInt( available.ordinal() ); // out.writeInt( show.ordinal() ); // } // // // -------------------------- OTHER METHODS -------------------------- // // public String getName() // { // if ( !TextUtils.isEmpty( nick ) ) // { // return nick; // } // return remoteJid; // } // } // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/OnBuddyListener.java import com.tuenti.voice.core.data.Buddy; package com.tuenti.voice.core; public interface OnBuddyListener { // -------------------------- OTHER METHODS --------------------------
void onBuddyUpdated( Buddy[] buddies );
lukeweber/webrtc-jingle-client
android/voice-client-core/src/main/java/com/tuenti/voice/core/OnCallListener.java
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Call.java // public class Call // implements Parcelable // { // // ------------------------------ FIELDS ------------------------------ // // public static final Creator<Call> CREATOR = new Creator<Call>() // { // public Call createFromParcel( Parcel in ) // { // return new Call( in ); // } // // public Call[] newArray( int size ) // { // return new Call[size]; // } // }; // // private long callId; // // private long callStartTime; // // private boolean hold; // // private boolean incoming; // // private boolean mute; // // private String remoteJid; // // // --------------------------- CONSTRUCTORS --------------------------- // // public Call( Parcel in ) // { // callId = in.readLong(); // hold = in.readByte() == 1; // incoming = in.readByte() == 1; // mute = in.readByte() == 1; // remoteJid = in.readString(); // callStartTime = in.readLong(); // } // // public Call( long callId, String remoteJid, boolean incoming ) // { // this.callId = callId; // this.remoteJid = remoteJid; // this.hold = false; // this.incoming = incoming; // this.mute = false; // } // // // --------------------- GETTER / SETTER METHODS --------------------- // // public long getCallId() // { // return callId; // } // // public void setCallId( long callId ) // { // this.callId = callId; // } // // public long getCallStartTime() // { // return callStartTime; // } // // public void setCallStartTime( long callStartTime ) // { // this.callStartTime = callStartTime; // } // // public String getRemoteJid() // { // return remoteJid; // } // // public void setRemoteJid( String remoteJid ) // { // this.remoteJid = remoteJid; // } // // public boolean isHold() // { // return hold; // } // // public void setHold( boolean hold ) // { // this.hold = hold; // } // // public boolean isIncoming() // { // return incoming; // } // // public void setIncoming( boolean incoming ) // { // this.incoming = incoming; // } // // public boolean isMute() // { // return mute; // } // // public void setMute( boolean mute ) // { // this.mute = mute; // } // // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Parcelable --------------------- // // @Override // public int describeContents() // { // return 0; // } // // @Override // public void writeToParcel( Parcel out, int flags ) // { // out.writeLong( callId ); // out.writeByte( (byte) ( hold ? 1 : 0 ) ); // out.writeByte( (byte) ( incoming ? 1 : 0 ) ); // out.writeByte( ( (byte) ( mute ? 1 : 0 ) ) ); // out.writeString( remoteJid ); // out.writeLong( callStartTime ); // } // }
import com.tuenti.voice.core.data.Call;
package com.tuenti.voice.core; public interface OnCallListener { // -------------------------- OTHER METHODS -------------------------- void acceptCall( long callId ); void call( String remoteJid ); void declineCall( long callId, boolean busy ); void endCall( long callId ); void onCallInProgress();
// Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/data/Call.java // public class Call // implements Parcelable // { // // ------------------------------ FIELDS ------------------------------ // // public static final Creator<Call> CREATOR = new Creator<Call>() // { // public Call createFromParcel( Parcel in ) // { // return new Call( in ); // } // // public Call[] newArray( int size ) // { // return new Call[size]; // } // }; // // private long callId; // // private long callStartTime; // // private boolean hold; // // private boolean incoming; // // private boolean mute; // // private String remoteJid; // // // --------------------------- CONSTRUCTORS --------------------------- // // public Call( Parcel in ) // { // callId = in.readLong(); // hold = in.readByte() == 1; // incoming = in.readByte() == 1; // mute = in.readByte() == 1; // remoteJid = in.readString(); // callStartTime = in.readLong(); // } // // public Call( long callId, String remoteJid, boolean incoming ) // { // this.callId = callId; // this.remoteJid = remoteJid; // this.hold = false; // this.incoming = incoming; // this.mute = false; // } // // // --------------------- GETTER / SETTER METHODS --------------------- // // public long getCallId() // { // return callId; // } // // public void setCallId( long callId ) // { // this.callId = callId; // } // // public long getCallStartTime() // { // return callStartTime; // } // // public void setCallStartTime( long callStartTime ) // { // this.callStartTime = callStartTime; // } // // public String getRemoteJid() // { // return remoteJid; // } // // public void setRemoteJid( String remoteJid ) // { // this.remoteJid = remoteJid; // } // // public boolean isHold() // { // return hold; // } // // public void setHold( boolean hold ) // { // this.hold = hold; // } // // public boolean isIncoming() // { // return incoming; // } // // public void setIncoming( boolean incoming ) // { // this.incoming = incoming; // } // // public boolean isMute() // { // return mute; // } // // public void setMute( boolean mute ) // { // this.mute = mute; // } // // // ------------------------ INTERFACE METHODS ------------------------ // // // --------------------- Interface Parcelable --------------------- // // @Override // public int describeContents() // { // return 0; // } // // @Override // public void writeToParcel( Parcel out, int flags ) // { // out.writeLong( callId ); // out.writeByte( (byte) ( hold ? 1 : 0 ) ); // out.writeByte( (byte) ( incoming ? 1 : 0 ) ); // out.writeByte( ( (byte) ( mute ? 1 : 0 ) ) ); // out.writeString( remoteJid ); // out.writeLong( callStartTime ); // } // } // Path: android/voice-client-core/src/main/java/com/tuenti/voice/core/OnCallListener.java import com.tuenti.voice.core.data.Call; package com.tuenti.voice.core; public interface OnCallListener { // -------------------------- OTHER METHODS -------------------------- void acceptCall( long callId ); void call( String remoteJid ); void declineCall( long callId, boolean busy ); void endCall( long callId ); void onCallInProgress();
void onIncomingCall( Call call );
teocci/YouTube-In-Background
app/src/main/java/com/teocci/ytinbg/JsonAsyncTask.java
// Path: app/src/main/java/com/teocci/ytinbg/interfaces/JsonAsyncResponse.java // public interface JsonAsyncResponse // { // void processFinish(ArrayList<String> result); // } // // Path: app/src/main/java/com/teocci/ytinbg/utils/LogHelper.java // public class LogHelper // { // private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length(); // private static final int MAX_LOG_TAG_LENGTH = 23; // private static final int RESERVED_LENGTH = MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 2; // // public static String makeLogTag(String str) // { // return LOG_PREFIX // + '[' // + (str.length() > RESERVED_LENGTH ? str.substring(0, RESERVED_LENGTH - 1) : str) // + ']'; // } // // /** // * Don't use this when obfuscating class names! // */ // public static String makeLogTag(Class cls) // { // return makeLogTag(cls.getSimpleName()); // } // // // public static void v(String tag, Object... messages) // { // // Only log VERBOSE if build type is DEBUG // if (BuildConfig.DEBUG) { // log(tag, Log.VERBOSE, null, messages); // } // } // // public static void d(String tag, Object... messages) // { // // Only log DEBUG if build type is DEBUG // if (BuildConfig.DEBUG) { // log(tag, Log.DEBUG, null, messages); // } // } // // public static void i(String tag, Object... messages) // { // log(tag, Log.INFO, null, messages); // } // // public static void w(String tag, Object... messages) // { // log(tag, Log.WARN, null, messages); // } // // public static void w(String tag, Throwable t, Object... messages) // { // log(tag, Log.WARN, t, messages); // } // // public static void e(String tag, Object... messages) // { // log(tag, Log.ERROR, null, messages); // } // // public static void e(String tag, Throwable t, Object... messages) // { // log(tag, Log.ERROR, t, messages); // } // // public static void log(String tag, int level, Throwable t, Object... messages) // { // if (Log.isLoggable(tag, level)) { // String message; // if (t == null && messages != null && messages.length == 1) { // // Handle this common case without the extra cost of creating a StringBuffer: // message = messages[0].toString(); // } else { // StringBuilder sb = new StringBuilder(); // if (messages != null) for (Object m : messages) { // sb.append(m); // } // if (t != null) { // sb.append("\n").append(Log.getStackTraceString(t)); // } // message = sb.toString(); // } // // Log.println(level, tag, message); // } // } // }
import android.os.AsyncTask; import com.teocci.ytinbg.interfaces.JsonAsyncResponse; import com.teocci.ytinbg.utils.LogHelper; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList;
package com.teocci.ytinbg; /** * AsyncTask for acquiring search suggestion in action bar * Created by Teocci on 19.2.16.. */ public class JsonAsyncTask extends AsyncTask<String, Void, ArrayList<String>> {
// Path: app/src/main/java/com/teocci/ytinbg/interfaces/JsonAsyncResponse.java // public interface JsonAsyncResponse // { // void processFinish(ArrayList<String> result); // } // // Path: app/src/main/java/com/teocci/ytinbg/utils/LogHelper.java // public class LogHelper // { // private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length(); // private static final int MAX_LOG_TAG_LENGTH = 23; // private static final int RESERVED_LENGTH = MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 2; // // public static String makeLogTag(String str) // { // return LOG_PREFIX // + '[' // + (str.length() > RESERVED_LENGTH ? str.substring(0, RESERVED_LENGTH - 1) : str) // + ']'; // } // // /** // * Don't use this when obfuscating class names! // */ // public static String makeLogTag(Class cls) // { // return makeLogTag(cls.getSimpleName()); // } // // // public static void v(String tag, Object... messages) // { // // Only log VERBOSE if build type is DEBUG // if (BuildConfig.DEBUG) { // log(tag, Log.VERBOSE, null, messages); // } // } // // public static void d(String tag, Object... messages) // { // // Only log DEBUG if build type is DEBUG // if (BuildConfig.DEBUG) { // log(tag, Log.DEBUG, null, messages); // } // } // // public static void i(String tag, Object... messages) // { // log(tag, Log.INFO, null, messages); // } // // public static void w(String tag, Object... messages) // { // log(tag, Log.WARN, null, messages); // } // // public static void w(String tag, Throwable t, Object... messages) // { // log(tag, Log.WARN, t, messages); // } // // public static void e(String tag, Object... messages) // { // log(tag, Log.ERROR, null, messages); // } // // public static void e(String tag, Throwable t, Object... messages) // { // log(tag, Log.ERROR, t, messages); // } // // public static void log(String tag, int level, Throwable t, Object... messages) // { // if (Log.isLoggable(tag, level)) { // String message; // if (t == null && messages != null && messages.length == 1) { // // Handle this common case without the extra cost of creating a StringBuffer: // message = messages[0].toString(); // } else { // StringBuilder sb = new StringBuilder(); // if (messages != null) for (Object m : messages) { // sb.append(m); // } // if (t != null) { // sb.append("\n").append(Log.getStackTraceString(t)); // } // message = sb.toString(); // } // // Log.println(level, tag, message); // } // } // } // Path: app/src/main/java/com/teocci/ytinbg/JsonAsyncTask.java import android.os.AsyncTask; import com.teocci.ytinbg.interfaces.JsonAsyncResponse; import com.teocci.ytinbg.utils.LogHelper; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList; package com.teocci.ytinbg; /** * AsyncTask for acquiring search suggestion in action bar * Created by Teocci on 19.2.16.. */ public class JsonAsyncTask extends AsyncTask<String, Void, ArrayList<String>> {
private static final String TAG = LogHelper.makeLogTag(JsonAsyncTask.class);
teocci/YouTube-In-Background
app/src/main/java/com/teocci/ytinbg/JsonAsyncTask.java
// Path: app/src/main/java/com/teocci/ytinbg/interfaces/JsonAsyncResponse.java // public interface JsonAsyncResponse // { // void processFinish(ArrayList<String> result); // } // // Path: app/src/main/java/com/teocci/ytinbg/utils/LogHelper.java // public class LogHelper // { // private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length(); // private static final int MAX_LOG_TAG_LENGTH = 23; // private static final int RESERVED_LENGTH = MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 2; // // public static String makeLogTag(String str) // { // return LOG_PREFIX // + '[' // + (str.length() > RESERVED_LENGTH ? str.substring(0, RESERVED_LENGTH - 1) : str) // + ']'; // } // // /** // * Don't use this when obfuscating class names! // */ // public static String makeLogTag(Class cls) // { // return makeLogTag(cls.getSimpleName()); // } // // // public static void v(String tag, Object... messages) // { // // Only log VERBOSE if build type is DEBUG // if (BuildConfig.DEBUG) { // log(tag, Log.VERBOSE, null, messages); // } // } // // public static void d(String tag, Object... messages) // { // // Only log DEBUG if build type is DEBUG // if (BuildConfig.DEBUG) { // log(tag, Log.DEBUG, null, messages); // } // } // // public static void i(String tag, Object... messages) // { // log(tag, Log.INFO, null, messages); // } // // public static void w(String tag, Object... messages) // { // log(tag, Log.WARN, null, messages); // } // // public static void w(String tag, Throwable t, Object... messages) // { // log(tag, Log.WARN, t, messages); // } // // public static void e(String tag, Object... messages) // { // log(tag, Log.ERROR, null, messages); // } // // public static void e(String tag, Throwable t, Object... messages) // { // log(tag, Log.ERROR, t, messages); // } // // public static void log(String tag, int level, Throwable t, Object... messages) // { // if (Log.isLoggable(tag, level)) { // String message; // if (t == null && messages != null && messages.length == 1) { // // Handle this common case without the extra cost of creating a StringBuffer: // message = messages[0].toString(); // } else { // StringBuilder sb = new StringBuilder(); // if (messages != null) for (Object m : messages) { // sb.append(m); // } // if (t != null) { // sb.append("\n").append(Log.getStackTraceString(t)); // } // message = sb.toString(); // } // // Log.println(level, tag, message); // } // } // }
import android.os.AsyncTask; import com.teocci.ytinbg.interfaces.JsonAsyncResponse; import com.teocci.ytinbg.utils.LogHelper; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList;
package com.teocci.ytinbg; /** * AsyncTask for acquiring search suggestion in action bar * Created by Teocci on 19.2.16.. */ public class JsonAsyncTask extends AsyncTask<String, Void, ArrayList<String>> { private static final String TAG = LogHelper.makeLogTag(JsonAsyncTask.class); private final int JSON_ERROR = 0; private final int JSON_ARRAY = 1; private final int JSON_OBJECT = 2;
// Path: app/src/main/java/com/teocci/ytinbg/interfaces/JsonAsyncResponse.java // public interface JsonAsyncResponse // { // void processFinish(ArrayList<String> result); // } // // Path: app/src/main/java/com/teocci/ytinbg/utils/LogHelper.java // public class LogHelper // { // private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length(); // private static final int MAX_LOG_TAG_LENGTH = 23; // private static final int RESERVED_LENGTH = MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 2; // // public static String makeLogTag(String str) // { // return LOG_PREFIX // + '[' // + (str.length() > RESERVED_LENGTH ? str.substring(0, RESERVED_LENGTH - 1) : str) // + ']'; // } // // /** // * Don't use this when obfuscating class names! // */ // public static String makeLogTag(Class cls) // { // return makeLogTag(cls.getSimpleName()); // } // // // public static void v(String tag, Object... messages) // { // // Only log VERBOSE if build type is DEBUG // if (BuildConfig.DEBUG) { // log(tag, Log.VERBOSE, null, messages); // } // } // // public static void d(String tag, Object... messages) // { // // Only log DEBUG if build type is DEBUG // if (BuildConfig.DEBUG) { // log(tag, Log.DEBUG, null, messages); // } // } // // public static void i(String tag, Object... messages) // { // log(tag, Log.INFO, null, messages); // } // // public static void w(String tag, Object... messages) // { // log(tag, Log.WARN, null, messages); // } // // public static void w(String tag, Throwable t, Object... messages) // { // log(tag, Log.WARN, t, messages); // } // // public static void e(String tag, Object... messages) // { // log(tag, Log.ERROR, null, messages); // } // // public static void e(String tag, Throwable t, Object... messages) // { // log(tag, Log.ERROR, t, messages); // } // // public static void log(String tag, int level, Throwable t, Object... messages) // { // if (Log.isLoggable(tag, level)) { // String message; // if (t == null && messages != null && messages.length == 1) { // // Handle this common case without the extra cost of creating a StringBuffer: // message = messages[0].toString(); // } else { // StringBuilder sb = new StringBuilder(); // if (messages != null) for (Object m : messages) { // sb.append(m); // } // if (t != null) { // sb.append("\n").append(Log.getStackTraceString(t)); // } // message = sb.toString(); // } // // Log.println(level, tag, message); // } // } // } // Path: app/src/main/java/com/teocci/ytinbg/JsonAsyncTask.java import android.os.AsyncTask; import com.teocci.ytinbg.interfaces.JsonAsyncResponse; import com.teocci.ytinbg.utils.LogHelper; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.ArrayList; package com.teocci.ytinbg; /** * AsyncTask for acquiring search suggestion in action bar * Created by Teocci on 19.2.16.. */ public class JsonAsyncTask extends AsyncTask<String, Void, ArrayList<String>> { private static final String TAG = LogHelper.makeLogTag(JsonAsyncTask.class); private final int JSON_ERROR = 0; private final int JSON_ARRAY = 1; private final int JSON_OBJECT = 2;
private JsonAsyncResponse delegate = null;
teocci/YouTube-In-Background
app/src/main/java/com/teocci/ytinbg/receivers/DownloadFinishedReceiver.java
// Path: app/src/main/java/com/teocci/ytinbg/utils/LogHelper.java // public class LogHelper // { // private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length(); // private static final int MAX_LOG_TAG_LENGTH = 23; // private static final int RESERVED_LENGTH = MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 2; // // public static String makeLogTag(String str) // { // return LOG_PREFIX // + '[' // + (str.length() > RESERVED_LENGTH ? str.substring(0, RESERVED_LENGTH - 1) : str) // + ']'; // } // // /** // * Don't use this when obfuscating class names! // */ // public static String makeLogTag(Class cls) // { // return makeLogTag(cls.getSimpleName()); // } // // // public static void v(String tag, Object... messages) // { // // Only log VERBOSE if build type is DEBUG // if (BuildConfig.DEBUG) { // log(tag, Log.VERBOSE, null, messages); // } // } // // public static void d(String tag, Object... messages) // { // // Only log DEBUG if build type is DEBUG // if (BuildConfig.DEBUG) { // log(tag, Log.DEBUG, null, messages); // } // } // // public static void i(String tag, Object... messages) // { // log(tag, Log.INFO, null, messages); // } // // public static void w(String tag, Object... messages) // { // log(tag, Log.WARN, null, messages); // } // // public static void w(String tag, Throwable t, Object... messages) // { // log(tag, Log.WARN, t, messages); // } // // public static void e(String tag, Object... messages) // { // log(tag, Log.ERROR, null, messages); // } // // public static void e(String tag, Throwable t, Object... messages) // { // log(tag, Log.ERROR, t, messages); // } // // public static void log(String tag, int level, Throwable t, Object... messages) // { // if (Log.isLoggable(tag, level)) { // String message; // if (t == null && messages != null && messages.length == 1) { // // Handle this common case without the extra cost of creating a StringBuffer: // message = messages[0].toString(); // } else { // StringBuilder sb = new StringBuilder(); // if (messages != null) for (Object m : messages) { // sb.append(m); // } // if (t != null) { // sb.append("\n").append(Log.getStackTraceString(t)); // } // message = sb.toString(); // } // // Log.println(level, tag, message); // } // } // }
import android.app.DownloadManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.widget.Toast; import com.coremedia.iso.boxes.Box; import com.coremedia.iso.boxes.ChunkOffsetBox; import com.coremedia.iso.boxes.Container; import com.coremedia.iso.boxes.HandlerBox; import com.coremedia.iso.boxes.MetaBox; import com.coremedia.iso.boxes.MovieBox; import com.coremedia.iso.boxes.StaticChunkOffsetBox; import com.coremedia.iso.boxes.UserDataBox; import com.coremedia.iso.boxes.apple.AppleItemListBox; import com.googlecode.mp4parser.authoring.Movie; import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder; import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator; import com.googlecode.mp4parser.boxes.apple.AppleArtist2Box; import com.googlecode.mp4parser.boxes.apple.AppleArtistBox; import com.googlecode.mp4parser.boxes.apple.AppleNameBox; import com.googlecode.mp4parser.util.Path; import com.teocci.ytinbg.utils.LogHelper; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.LinkedList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern;
package com.teocci.ytinbg.receivers; public class DownloadFinishedReceiver extends BroadcastReceiver {
// Path: app/src/main/java/com/teocci/ytinbg/utils/LogHelper.java // public class LogHelper // { // private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length(); // private static final int MAX_LOG_TAG_LENGTH = 23; // private static final int RESERVED_LENGTH = MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 2; // // public static String makeLogTag(String str) // { // return LOG_PREFIX // + '[' // + (str.length() > RESERVED_LENGTH ? str.substring(0, RESERVED_LENGTH - 1) : str) // + ']'; // } // // /** // * Don't use this when obfuscating class names! // */ // public static String makeLogTag(Class cls) // { // return makeLogTag(cls.getSimpleName()); // } // // // public static void v(String tag, Object... messages) // { // // Only log VERBOSE if build type is DEBUG // if (BuildConfig.DEBUG) { // log(tag, Log.VERBOSE, null, messages); // } // } // // public static void d(String tag, Object... messages) // { // // Only log DEBUG if build type is DEBUG // if (BuildConfig.DEBUG) { // log(tag, Log.DEBUG, null, messages); // } // } // // public static void i(String tag, Object... messages) // { // log(tag, Log.INFO, null, messages); // } // // public static void w(String tag, Object... messages) // { // log(tag, Log.WARN, null, messages); // } // // public static void w(String tag, Throwable t, Object... messages) // { // log(tag, Log.WARN, t, messages); // } // // public static void e(String tag, Object... messages) // { // log(tag, Log.ERROR, null, messages); // } // // public static void e(String tag, Throwable t, Object... messages) // { // log(tag, Log.ERROR, t, messages); // } // // public static void log(String tag, int level, Throwable t, Object... messages) // { // if (Log.isLoggable(tag, level)) { // String message; // if (t == null && messages != null && messages.length == 1) { // // Handle this common case without the extra cost of creating a StringBuffer: // message = messages[0].toString(); // } else { // StringBuilder sb = new StringBuilder(); // if (messages != null) for (Object m : messages) { // sb.append(m); // } // if (t != null) { // sb.append("\n").append(Log.getStackTraceString(t)); // } // message = sb.toString(); // } // // Log.println(level, tag, message); // } // } // } // Path: app/src/main/java/com/teocci/ytinbg/receivers/DownloadFinishedReceiver.java import android.app.DownloadManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.widget.Toast; import com.coremedia.iso.boxes.Box; import com.coremedia.iso.boxes.ChunkOffsetBox; import com.coremedia.iso.boxes.Container; import com.coremedia.iso.boxes.HandlerBox; import com.coremedia.iso.boxes.MetaBox; import com.coremedia.iso.boxes.MovieBox; import com.coremedia.iso.boxes.StaticChunkOffsetBox; import com.coremedia.iso.boxes.UserDataBox; import com.coremedia.iso.boxes.apple.AppleItemListBox; import com.googlecode.mp4parser.authoring.Movie; import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder; import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator; import com.googlecode.mp4parser.boxes.apple.AppleArtist2Box; import com.googlecode.mp4parser.boxes.apple.AppleArtistBox; import com.googlecode.mp4parser.boxes.apple.AppleNameBox; import com.googlecode.mp4parser.util.Path; import com.teocci.ytinbg.utils.LogHelper; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.LinkedList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; package com.teocci.ytinbg.receivers; public class DownloadFinishedReceiver extends BroadcastReceiver {
private static final String TAG = LogHelper.makeLogTag(DownloadFinishedReceiver.class);
teocci/YouTube-In-Background
app/src/main/java/com/teocci/ytinbg/model/YouTubeFragmentedVideo.java
// Path: youtubeExtractor/src/main/java/at/huber/youtubeExtractor/YtFile.java // public class YtFile { // // private Format format; // private String url = ""; // // YtFile(Format format, String url) { // this.format = format; // this.url = url; // } // // /** // * The url to download the file. // */ // public String getUrl() { // return url; // } // // /** // * Format data for the specific file. // */ // public Format getFormat() { // return format; // } // // /** // * Format data for the specific file. // */ // @Deprecated // public Format getMeta() { // return format; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // YtFile ytFile = (YtFile) o; // // if (format != null ? !format.equals(ytFile.format) : ytFile.format != null) return false; // return url != null ? url.equals(ytFile.url) : ytFile.url == null; // } // // @Override // public int hashCode() { // int result = format != null ? format.hashCode() : 0; // result = 31 * result + (url != null ? url.hashCode() : 0); // return result; // } // // @Override // public String toString() { // return "YtFile{" + // "format=" + format + // ", url='" + url + '\'' + // '}'; // } // }
import at.huber.youtubeExtractor.YtFile;
package com.teocci.ytinbg.model; /** * Created by teocci. * * @author teocci@yandex.com on 2017-May-18 */ public class YouTubeFragmentedVideo { public int height;
// Path: youtubeExtractor/src/main/java/at/huber/youtubeExtractor/YtFile.java // public class YtFile { // // private Format format; // private String url = ""; // // YtFile(Format format, String url) { // this.format = format; // this.url = url; // } // // /** // * The url to download the file. // */ // public String getUrl() { // return url; // } // // /** // * Format data for the specific file. // */ // public Format getFormat() { // return format; // } // // /** // * Format data for the specific file. // */ // @Deprecated // public Format getMeta() { // return format; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // YtFile ytFile = (YtFile) o; // // if (format != null ? !format.equals(ytFile.format) : ytFile.format != null) return false; // return url != null ? url.equals(ytFile.url) : ytFile.url == null; // } // // @Override // public int hashCode() { // int result = format != null ? format.hashCode() : 0; // result = 31 * result + (url != null ? url.hashCode() : 0); // return result; // } // // @Override // public String toString() { // return "YtFile{" + // "format=" + format + // ", url='" + url + '\'' + // '}'; // } // } // Path: app/src/main/java/com/teocci/ytinbg/model/YouTubeFragmentedVideo.java import at.huber.youtubeExtractor.YtFile; package com.teocci.ytinbg.model; /** * Created by teocci. * * @author teocci@yandex.com on 2017-May-18 */ public class YouTubeFragmentedVideo { public int height;
public YtFile audioFile;