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
andrus/bootique-graphql
bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/GraphiQLRestQueryReader.java
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/GraphQLRestQuery.java // public class GraphQLRestQuery { // // private String query; // private String variables; // // public String getQuery() { // return query; // } // // public void setQuery(String query) { // this.query = query; // } // // public String getVariables() { // return variables; // } // // public void setVariables(String variables) { // this.variables = variables; // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/json/JsonReader.java // public interface JsonReader { // // <T> T read(Class<T> type, InputStream jsonStream); // }
import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.inject.Singleton; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; import org.objectstyle.bootique.graphql.jaxrs.GraphQLRestQuery; import org.objectstyle.bootique.graphql.json.JsonReader; import com.google.inject.Inject;
package org.objectstyle.bootique.graphql.jaxrs.provider; @Singleton @Provider
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/GraphQLRestQuery.java // public class GraphQLRestQuery { // // private String query; // private String variables; // // public String getQuery() { // return query; // } // // public void setQuery(String query) { // this.query = query; // } // // public String getVariables() { // return variables; // } // // public void setVariables(String variables) { // this.variables = variables; // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/json/JsonReader.java // public interface JsonReader { // // <T> T read(Class<T> type, InputStream jsonStream); // } // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/GraphiQLRestQueryReader.java import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.inject.Singleton; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; import org.objectstyle.bootique.graphql.jaxrs.GraphQLRestQuery; import org.objectstyle.bootique.graphql.json.JsonReader; import com.google.inject.Inject; package org.objectstyle.bootique.graphql.jaxrs.provider; @Singleton @Provider
public class GraphiQLRestQueryReader implements MessageBodyReader<GraphQLRestQuery> {
andrus/bootique-graphql
bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/GraphiQLRestQueryReader.java
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/GraphQLRestQuery.java // public class GraphQLRestQuery { // // private String query; // private String variables; // // public String getQuery() { // return query; // } // // public void setQuery(String query) { // this.query = query; // } // // public String getVariables() { // return variables; // } // // public void setVariables(String variables) { // this.variables = variables; // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/json/JsonReader.java // public interface JsonReader { // // <T> T read(Class<T> type, InputStream jsonStream); // }
import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.inject.Singleton; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; import org.objectstyle.bootique.graphql.jaxrs.GraphQLRestQuery; import org.objectstyle.bootique.graphql.json.JsonReader; import com.google.inject.Inject;
package org.objectstyle.bootique.graphql.jaxrs.provider; @Singleton @Provider public class GraphiQLRestQueryReader implements MessageBodyReader<GraphQLRestQuery> { @Inject
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/GraphQLRestQuery.java // public class GraphQLRestQuery { // // private String query; // private String variables; // // public String getQuery() { // return query; // } // // public void setQuery(String query) { // this.query = query; // } // // public String getVariables() { // return variables; // } // // public void setVariables(String variables) { // this.variables = variables; // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/json/JsonReader.java // public interface JsonReader { // // <T> T read(Class<T> type, InputStream jsonStream); // } // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/GraphiQLRestQueryReader.java import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.inject.Singleton; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.Provider; import org.objectstyle.bootique.graphql.jaxrs.GraphQLRestQuery; import org.objectstyle.bootique.graphql.json.JsonReader; import com.google.inject.Inject; package org.objectstyle.bootique.graphql.jaxrs.provider; @Singleton @Provider public class GraphiQLRestQueryReader implements MessageBodyReader<GraphQLRestQuery> { @Inject
private JsonReader jsonParser;
andrus/bootique-graphql
bootique-graphql/src/test/java/org/objectstyle/bootique/graphql/it/fixture/GraphQLJerseyTestOnDerby.java
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/GraphQLModule.java // public class GraphQLModule extends ConfigModule { // // @Override // public void configure(Binder binder) { // // binder.bind(JacksonReaderWriter.class).in(Singleton.class); // binder.bind(JsonReader.class).to(JacksonReaderWriter.class); // binder.bind(JsonWriter.class).to(JacksonReaderWriter.class); // // JerseyBinder.contributeTo(binder).features(GraphQLFeature.class); // } // // @Provides // @Singleton // GraphQL createGraphQL(ServerRuntime cayenneRuntime, SchemaTranslator translator) { // GraphQLSchema schema = translator.toGraphQL(cayenneRuntime.getChannel().getEntityResolver()); // return new GraphQL(schema); // } // // /** // * Overrides JerseyModule JerseyServlet definition with the one mapped to // * "/graphql" path. // * // * @param configFactory // * Bootique configuration factory. // * @param config // * Jersey config object. // * @return Jersey servlet as {@link MappedServlet}. // */ // @JerseyServlet // @Provides // @Singleton // MappedServlet createJerseyServlet(ConfigurationFactory configFactory, ResourceConfig config) { // return configFactory.config(JerseyServletFactory.class, configPrefix).initServletPathIfNotSet("/graphql/*") // .createJerseyServlet(config); // } // // @Provides // @Singleton // SchemaTranslator createSchemaTranslator(ServerRuntime cayenneRuntime) { // return new DefaultSchemaTranslator(cayenneRuntime.newContext()); // } // // } // // Path: bootique-graphql/src/test/java/org/objectstyle/graphql/it/fixture/cayenne/E1.java // public class E1 extends _E1 { // // private static final long serialVersionUID = 1L; // // }
import static org.mockito.Mockito.mock; import java.io.IOException; import java.sql.SQLException; import java.util.Arrays; import javax.ws.rs.client.Entity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.cayenne.ObjectContext; import org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy; import org.apache.cayenne.access.dbsync.SchemaUpdateStrategy; import org.apache.cayenne.configuration.server.ServerRuntime; import org.apache.cayenne.configuration.server.ServerRuntimeBuilder; import org.apache.cayenne.query.EJBQLQuery; import org.apache.cayenne.query.QueryChain; import org.apache.cayenne.query.RefreshQuery; import org.apache.cayenne.query.SQLSelect; import org.apache.cayenne.query.SQLTemplate; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; import org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory; import org.glassfish.jersey.test.spi.TestContainerException; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.objectstyle.bootique.graphql.GraphQLModule; import org.objectstyle.graphql.it.fixture.cayenne.E1; import com.google.inject.Guice; import com.google.inject.Injector; import com.google.inject.Module; import com.google.inject.util.Modules; import com.nhl.bootique.config.ConfigurationFactory; import com.nhl.bootique.jersey.JerseyModule;
} @AfterClass public static void tearDownClass() throws IOException, SQLException { runtime.shutdown(); runtime = null; derbyAssembly.shutdown(); derbyAssembly = null; } protected Injector injector; protected ObjectContext context; public GraphQLJerseyTestOnDerby() throws TestContainerException { super(new InMemoryTestContainerFactory()); } @Override protected ResourceConfig configure() { this.injector = Guice.createInjector(createTestModules()); return injector.getInstance(ResourceConfig.class); } protected Iterable<Module> createTestModules() { Module m = (b) -> { b.bind(ConfigurationFactory.class).toInstance(mock(ConfigurationFactory.class)); b.bind(ServerRuntime.class).toInstance(runtime); };
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/GraphQLModule.java // public class GraphQLModule extends ConfigModule { // // @Override // public void configure(Binder binder) { // // binder.bind(JacksonReaderWriter.class).in(Singleton.class); // binder.bind(JsonReader.class).to(JacksonReaderWriter.class); // binder.bind(JsonWriter.class).to(JacksonReaderWriter.class); // // JerseyBinder.contributeTo(binder).features(GraphQLFeature.class); // } // // @Provides // @Singleton // GraphQL createGraphQL(ServerRuntime cayenneRuntime, SchemaTranslator translator) { // GraphQLSchema schema = translator.toGraphQL(cayenneRuntime.getChannel().getEntityResolver()); // return new GraphQL(schema); // } // // /** // * Overrides JerseyModule JerseyServlet definition with the one mapped to // * "/graphql" path. // * // * @param configFactory // * Bootique configuration factory. // * @param config // * Jersey config object. // * @return Jersey servlet as {@link MappedServlet}. // */ // @JerseyServlet // @Provides // @Singleton // MappedServlet createJerseyServlet(ConfigurationFactory configFactory, ResourceConfig config) { // return configFactory.config(JerseyServletFactory.class, configPrefix).initServletPathIfNotSet("/graphql/*") // .createJerseyServlet(config); // } // // @Provides // @Singleton // SchemaTranslator createSchemaTranslator(ServerRuntime cayenneRuntime) { // return new DefaultSchemaTranslator(cayenneRuntime.newContext()); // } // // } // // Path: bootique-graphql/src/test/java/org/objectstyle/graphql/it/fixture/cayenne/E1.java // public class E1 extends _E1 { // // private static final long serialVersionUID = 1L; // // } // Path: bootique-graphql/src/test/java/org/objectstyle/bootique/graphql/it/fixture/GraphQLJerseyTestOnDerby.java import static org.mockito.Mockito.mock; import java.io.IOException; import java.sql.SQLException; import java.util.Arrays; import javax.ws.rs.client.Entity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.cayenne.ObjectContext; import org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy; import org.apache.cayenne.access.dbsync.SchemaUpdateStrategy; import org.apache.cayenne.configuration.server.ServerRuntime; import org.apache.cayenne.configuration.server.ServerRuntimeBuilder; import org.apache.cayenne.query.EJBQLQuery; import org.apache.cayenne.query.QueryChain; import org.apache.cayenne.query.RefreshQuery; import org.apache.cayenne.query.SQLSelect; import org.apache.cayenne.query.SQLTemplate; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; import org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory; import org.glassfish.jersey.test.spi.TestContainerException; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.objectstyle.bootique.graphql.GraphQLModule; import org.objectstyle.graphql.it.fixture.cayenne.E1; import com.google.inject.Guice; import com.google.inject.Injector; import com.google.inject.Module; import com.google.inject.util.Modules; import com.nhl.bootique.config.ConfigurationFactory; import com.nhl.bootique.jersey.JerseyModule; } @AfterClass public static void tearDownClass() throws IOException, SQLException { runtime.shutdown(); runtime = null; derbyAssembly.shutdown(); derbyAssembly = null; } protected Injector injector; protected ObjectContext context; public GraphQLJerseyTestOnDerby() throws TestContainerException { super(new InMemoryTestContainerFactory()); } @Override protected ResourceConfig configure() { this.injector = Guice.createInjector(createTestModules()); return injector.getInstance(ResourceConfig.class); } protected Iterable<Module> createTestModules() { Module m = (b) -> { b.bind(ConfigurationFactory.class).toInstance(mock(ConfigurationFactory.class)); b.bind(ServerRuntime.class).toInstance(runtime); };
Module combined = Modules.override(new JerseyModule()).with(new GraphQLModule());
andrus/bootique-graphql
bootique-graphql/src/test/java/org/objectstyle/bootique/graphql/it/fixture/GraphQLJerseyTestOnDerby.java
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/GraphQLModule.java // public class GraphQLModule extends ConfigModule { // // @Override // public void configure(Binder binder) { // // binder.bind(JacksonReaderWriter.class).in(Singleton.class); // binder.bind(JsonReader.class).to(JacksonReaderWriter.class); // binder.bind(JsonWriter.class).to(JacksonReaderWriter.class); // // JerseyBinder.contributeTo(binder).features(GraphQLFeature.class); // } // // @Provides // @Singleton // GraphQL createGraphQL(ServerRuntime cayenneRuntime, SchemaTranslator translator) { // GraphQLSchema schema = translator.toGraphQL(cayenneRuntime.getChannel().getEntityResolver()); // return new GraphQL(schema); // } // // /** // * Overrides JerseyModule JerseyServlet definition with the one mapped to // * "/graphql" path. // * // * @param configFactory // * Bootique configuration factory. // * @param config // * Jersey config object. // * @return Jersey servlet as {@link MappedServlet}. // */ // @JerseyServlet // @Provides // @Singleton // MappedServlet createJerseyServlet(ConfigurationFactory configFactory, ResourceConfig config) { // return configFactory.config(JerseyServletFactory.class, configPrefix).initServletPathIfNotSet("/graphql/*") // .createJerseyServlet(config); // } // // @Provides // @Singleton // SchemaTranslator createSchemaTranslator(ServerRuntime cayenneRuntime) { // return new DefaultSchemaTranslator(cayenneRuntime.newContext()); // } // // } // // Path: bootique-graphql/src/test/java/org/objectstyle/graphql/it/fixture/cayenne/E1.java // public class E1 extends _E1 { // // private static final long serialVersionUID = 1L; // // }
import static org.mockito.Mockito.mock; import java.io.IOException; import java.sql.SQLException; import java.util.Arrays; import javax.ws.rs.client.Entity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.cayenne.ObjectContext; import org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy; import org.apache.cayenne.access.dbsync.SchemaUpdateStrategy; import org.apache.cayenne.configuration.server.ServerRuntime; import org.apache.cayenne.configuration.server.ServerRuntimeBuilder; import org.apache.cayenne.query.EJBQLQuery; import org.apache.cayenne.query.QueryChain; import org.apache.cayenne.query.RefreshQuery; import org.apache.cayenne.query.SQLSelect; import org.apache.cayenne.query.SQLTemplate; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; import org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory; import org.glassfish.jersey.test.spi.TestContainerException; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.objectstyle.bootique.graphql.GraphQLModule; import org.objectstyle.graphql.it.fixture.cayenne.E1; import com.google.inject.Guice; import com.google.inject.Injector; import com.google.inject.Module; import com.google.inject.util.Modules; import com.nhl.bootique.config.ConfigurationFactory; import com.nhl.bootique.jersey.JerseyModule;
}; Module combined = Modules.override(new JerseyModule()).with(new GraphQLModule()); return Arrays.asList(m, combined); } @Before public void before() { this.context = runtime.newContext(); // this is to prevent shared caches from returning bogus data between // test runs context.performQuery(new RefreshQuery()); QueryChain chain = new QueryChain(); // ordering is important to avoid FK constraint failures on delete chain.addQuery(new EJBQLQuery("delete from E2")); chain.addQuery(new EJBQLQuery("delete from E1")); context.performGenericQuery(chain); } protected int intForQuery(String querySql) { return SQLSelect.scalarQuery(Integer.class, querySql).selectOne(context).intValue(); } protected void insert(String table, String columns, String values) { String insertSql = "INSERT INTO utest." + table + " (" + columns + ") VALUES (" + values + ")";
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/GraphQLModule.java // public class GraphQLModule extends ConfigModule { // // @Override // public void configure(Binder binder) { // // binder.bind(JacksonReaderWriter.class).in(Singleton.class); // binder.bind(JsonReader.class).to(JacksonReaderWriter.class); // binder.bind(JsonWriter.class).to(JacksonReaderWriter.class); // // JerseyBinder.contributeTo(binder).features(GraphQLFeature.class); // } // // @Provides // @Singleton // GraphQL createGraphQL(ServerRuntime cayenneRuntime, SchemaTranslator translator) { // GraphQLSchema schema = translator.toGraphQL(cayenneRuntime.getChannel().getEntityResolver()); // return new GraphQL(schema); // } // // /** // * Overrides JerseyModule JerseyServlet definition with the one mapped to // * "/graphql" path. // * // * @param configFactory // * Bootique configuration factory. // * @param config // * Jersey config object. // * @return Jersey servlet as {@link MappedServlet}. // */ // @JerseyServlet // @Provides // @Singleton // MappedServlet createJerseyServlet(ConfigurationFactory configFactory, ResourceConfig config) { // return configFactory.config(JerseyServletFactory.class, configPrefix).initServletPathIfNotSet("/graphql/*") // .createJerseyServlet(config); // } // // @Provides // @Singleton // SchemaTranslator createSchemaTranslator(ServerRuntime cayenneRuntime) { // return new DefaultSchemaTranslator(cayenneRuntime.newContext()); // } // // } // // Path: bootique-graphql/src/test/java/org/objectstyle/graphql/it/fixture/cayenne/E1.java // public class E1 extends _E1 { // // private static final long serialVersionUID = 1L; // // } // Path: bootique-graphql/src/test/java/org/objectstyle/bootique/graphql/it/fixture/GraphQLJerseyTestOnDerby.java import static org.mockito.Mockito.mock; import java.io.IOException; import java.sql.SQLException; import java.util.Arrays; import javax.ws.rs.client.Entity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.cayenne.ObjectContext; import org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy; import org.apache.cayenne.access.dbsync.SchemaUpdateStrategy; import org.apache.cayenne.configuration.server.ServerRuntime; import org.apache.cayenne.configuration.server.ServerRuntimeBuilder; import org.apache.cayenne.query.EJBQLQuery; import org.apache.cayenne.query.QueryChain; import org.apache.cayenne.query.RefreshQuery; import org.apache.cayenne.query.SQLSelect; import org.apache.cayenne.query.SQLTemplate; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; import org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory; import org.glassfish.jersey.test.spi.TestContainerException; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.objectstyle.bootique.graphql.GraphQLModule; import org.objectstyle.graphql.it.fixture.cayenne.E1; import com.google.inject.Guice; import com.google.inject.Injector; import com.google.inject.Module; import com.google.inject.util.Modules; import com.nhl.bootique.config.ConfigurationFactory; import com.nhl.bootique.jersey.JerseyModule; }; Module combined = Modules.override(new JerseyModule()).with(new GraphQLModule()); return Arrays.asList(m, combined); } @Before public void before() { this.context = runtime.newContext(); // this is to prevent shared caches from returning bogus data between // test runs context.performQuery(new RefreshQuery()); QueryChain chain = new QueryChain(); // ordering is important to avoid FK constraint failures on delete chain.addQuery(new EJBQLQuery("delete from E2")); chain.addQuery(new EJBQLQuery("delete from E1")); context.performGenericQuery(chain); } protected int intForQuery(String querySql) { return SQLSelect.scalarQuery(Integer.class, querySql).selectOne(context).intValue(); } protected void insert(String table, String columns, String values) { String insertSql = "INSERT INTO utest." + table + " (" + columns + ") VALUES (" + values + ")";
context.performGenericQuery(new SQLTemplate(E1.class, insertSql));
andrus/bootique-graphql
bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/GraphQLFeature.java
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/BQGraphQLRestExceptionMapper.java // @Provider // @Singleton // public class BQGraphQLRestExceptionMapper implements ExceptionMapper<BQGraphQLRestException> { // // private static final Logger LOGGER = LoggerFactory.getLogger(BQGraphQLRestExceptionMapper.class); // // @Override // public Response toResponse(BQGraphQLRestException exception) { // // String message = exception.getMessage(); // Status status = exception.getStatus(); // // if (LOGGER.isInfoEnabled()) { // StringBuilder log = new StringBuilder(); // log.append(status.getStatusCode()).append(" ").append(status.getReasonPhrase()); // // if (message != null) { // log.append(" (").append(message).append(")"); // } // // if (exception.getCause() != null && exception.getCause().getMessage() != null) { // log.append(" [cause: ").append(exception.getCause().getMessage()).append("]"); // } // // // include stack trace in debug mode... // if (LOGGER.isDebugEnabled()) { // LOGGER.debug(log.toString(), exception); // } else { // LOGGER.info(log.toString()); // } // } // // return Response.status(status).entity(new MessageResponse(message)).type(MediaType.APPLICATION_JSON_TYPE) // .build(); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/ExecutionResultWriter.java // @Provider // @Singleton // public class ExecutionResultWriter implements MessageBodyWriter<ExecutionResult> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return ExecutionResult.class.isAssignableFrom(type); // } // // @Override // public void writeTo(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException, WebApplicationException { // // writer.write(entityStream, generator -> { // // generator.writeStartObject(); // // // TODO: is it ok to rely on default serialization of data and // // errors? // // if (t.getData() != null) { // generator.writeObjectField("data", t.getData()); // } // // if (t.getErrors() != null && !t.getErrors().isEmpty()) { // generator.writeObjectField("errors", t.getErrors()); // } // // generator.writeEndObject(); // // }); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/GraphiQLRestQueryReader.java // @Singleton // @Provider // public class GraphiQLRestQueryReader implements MessageBodyReader<GraphQLRestQuery> { // // @Inject // private JsonReader jsonParser; // // @Override // public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return GraphQLRestQuery.class.isAssignableFrom(type); // } // // @Override // public GraphQLRestQuery readFrom(Class<GraphQLRestQuery> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) // throws IOException, WebApplicationException { // // return jsonParser.read(GraphQLRestQuery.class, entityStream); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/MessageResponseWriter.java // public class MessageResponseWriter implements MessageBodyWriter<MessageResponse> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return MessageResponse.class.isAssignableFrom(type); // } // // @Override // public void writeTo(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException { // // writer.write(entityStream, generator -> { // generator.writeStartObject(); // // if (t.getMessage() != null) { // generator.writeStringField("message", t.getMessage()); // } // // generator.writeEndObject(); // }); // // } // // }
import javax.ws.rs.core.Feature; import javax.ws.rs.core.FeatureContext; import org.objectstyle.bootique.graphql.jaxrs.provider.BQGraphQLRestExceptionMapper; import org.objectstyle.bootique.graphql.jaxrs.provider.ExecutionResultWriter; import org.objectstyle.bootique.graphql.jaxrs.provider.GraphiQLRestQueryReader; import org.objectstyle.bootique.graphql.jaxrs.provider.MessageResponseWriter;
package org.objectstyle.bootique.graphql.jaxrs; /** * Loads JAX-RS extensions for GraphQL processing. */ public class GraphQLFeature implements Feature { @Override public boolean configure(FeatureContext context) {
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/BQGraphQLRestExceptionMapper.java // @Provider // @Singleton // public class BQGraphQLRestExceptionMapper implements ExceptionMapper<BQGraphQLRestException> { // // private static final Logger LOGGER = LoggerFactory.getLogger(BQGraphQLRestExceptionMapper.class); // // @Override // public Response toResponse(BQGraphQLRestException exception) { // // String message = exception.getMessage(); // Status status = exception.getStatus(); // // if (LOGGER.isInfoEnabled()) { // StringBuilder log = new StringBuilder(); // log.append(status.getStatusCode()).append(" ").append(status.getReasonPhrase()); // // if (message != null) { // log.append(" (").append(message).append(")"); // } // // if (exception.getCause() != null && exception.getCause().getMessage() != null) { // log.append(" [cause: ").append(exception.getCause().getMessage()).append("]"); // } // // // include stack trace in debug mode... // if (LOGGER.isDebugEnabled()) { // LOGGER.debug(log.toString(), exception); // } else { // LOGGER.info(log.toString()); // } // } // // return Response.status(status).entity(new MessageResponse(message)).type(MediaType.APPLICATION_JSON_TYPE) // .build(); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/ExecutionResultWriter.java // @Provider // @Singleton // public class ExecutionResultWriter implements MessageBodyWriter<ExecutionResult> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return ExecutionResult.class.isAssignableFrom(type); // } // // @Override // public void writeTo(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException, WebApplicationException { // // writer.write(entityStream, generator -> { // // generator.writeStartObject(); // // // TODO: is it ok to rely on default serialization of data and // // errors? // // if (t.getData() != null) { // generator.writeObjectField("data", t.getData()); // } // // if (t.getErrors() != null && !t.getErrors().isEmpty()) { // generator.writeObjectField("errors", t.getErrors()); // } // // generator.writeEndObject(); // // }); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/GraphiQLRestQueryReader.java // @Singleton // @Provider // public class GraphiQLRestQueryReader implements MessageBodyReader<GraphQLRestQuery> { // // @Inject // private JsonReader jsonParser; // // @Override // public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return GraphQLRestQuery.class.isAssignableFrom(type); // } // // @Override // public GraphQLRestQuery readFrom(Class<GraphQLRestQuery> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) // throws IOException, WebApplicationException { // // return jsonParser.read(GraphQLRestQuery.class, entityStream); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/MessageResponseWriter.java // public class MessageResponseWriter implements MessageBodyWriter<MessageResponse> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return MessageResponse.class.isAssignableFrom(type); // } // // @Override // public void writeTo(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException { // // writer.write(entityStream, generator -> { // generator.writeStartObject(); // // if (t.getMessage() != null) { // generator.writeStringField("message", t.getMessage()); // } // // generator.writeEndObject(); // }); // // } // // } // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/GraphQLFeature.java import javax.ws.rs.core.Feature; import javax.ws.rs.core.FeatureContext; import org.objectstyle.bootique.graphql.jaxrs.provider.BQGraphQLRestExceptionMapper; import org.objectstyle.bootique.graphql.jaxrs.provider.ExecutionResultWriter; import org.objectstyle.bootique.graphql.jaxrs.provider.GraphiQLRestQueryReader; import org.objectstyle.bootique.graphql.jaxrs.provider.MessageResponseWriter; package org.objectstyle.bootique.graphql.jaxrs; /** * Loads JAX-RS extensions for GraphQL processing. */ public class GraphQLFeature implements Feature { @Override public boolean configure(FeatureContext context) {
context.register(MessageResponseWriter.class);
andrus/bootique-graphql
bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/GraphQLFeature.java
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/BQGraphQLRestExceptionMapper.java // @Provider // @Singleton // public class BQGraphQLRestExceptionMapper implements ExceptionMapper<BQGraphQLRestException> { // // private static final Logger LOGGER = LoggerFactory.getLogger(BQGraphQLRestExceptionMapper.class); // // @Override // public Response toResponse(BQGraphQLRestException exception) { // // String message = exception.getMessage(); // Status status = exception.getStatus(); // // if (LOGGER.isInfoEnabled()) { // StringBuilder log = new StringBuilder(); // log.append(status.getStatusCode()).append(" ").append(status.getReasonPhrase()); // // if (message != null) { // log.append(" (").append(message).append(")"); // } // // if (exception.getCause() != null && exception.getCause().getMessage() != null) { // log.append(" [cause: ").append(exception.getCause().getMessage()).append("]"); // } // // // include stack trace in debug mode... // if (LOGGER.isDebugEnabled()) { // LOGGER.debug(log.toString(), exception); // } else { // LOGGER.info(log.toString()); // } // } // // return Response.status(status).entity(new MessageResponse(message)).type(MediaType.APPLICATION_JSON_TYPE) // .build(); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/ExecutionResultWriter.java // @Provider // @Singleton // public class ExecutionResultWriter implements MessageBodyWriter<ExecutionResult> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return ExecutionResult.class.isAssignableFrom(type); // } // // @Override // public void writeTo(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException, WebApplicationException { // // writer.write(entityStream, generator -> { // // generator.writeStartObject(); // // // TODO: is it ok to rely on default serialization of data and // // errors? // // if (t.getData() != null) { // generator.writeObjectField("data", t.getData()); // } // // if (t.getErrors() != null && !t.getErrors().isEmpty()) { // generator.writeObjectField("errors", t.getErrors()); // } // // generator.writeEndObject(); // // }); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/GraphiQLRestQueryReader.java // @Singleton // @Provider // public class GraphiQLRestQueryReader implements MessageBodyReader<GraphQLRestQuery> { // // @Inject // private JsonReader jsonParser; // // @Override // public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return GraphQLRestQuery.class.isAssignableFrom(type); // } // // @Override // public GraphQLRestQuery readFrom(Class<GraphQLRestQuery> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) // throws IOException, WebApplicationException { // // return jsonParser.read(GraphQLRestQuery.class, entityStream); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/MessageResponseWriter.java // public class MessageResponseWriter implements MessageBodyWriter<MessageResponse> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return MessageResponse.class.isAssignableFrom(type); // } // // @Override // public void writeTo(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException { // // writer.write(entityStream, generator -> { // generator.writeStartObject(); // // if (t.getMessage() != null) { // generator.writeStringField("message", t.getMessage()); // } // // generator.writeEndObject(); // }); // // } // // }
import javax.ws.rs.core.Feature; import javax.ws.rs.core.FeatureContext; import org.objectstyle.bootique.graphql.jaxrs.provider.BQGraphQLRestExceptionMapper; import org.objectstyle.bootique.graphql.jaxrs.provider.ExecutionResultWriter; import org.objectstyle.bootique.graphql.jaxrs.provider.GraphiQLRestQueryReader; import org.objectstyle.bootique.graphql.jaxrs.provider.MessageResponseWriter;
package org.objectstyle.bootique.graphql.jaxrs; /** * Loads JAX-RS extensions for GraphQL processing. */ public class GraphQLFeature implements Feature { @Override public boolean configure(FeatureContext context) { context.register(MessageResponseWriter.class);
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/BQGraphQLRestExceptionMapper.java // @Provider // @Singleton // public class BQGraphQLRestExceptionMapper implements ExceptionMapper<BQGraphQLRestException> { // // private static final Logger LOGGER = LoggerFactory.getLogger(BQGraphQLRestExceptionMapper.class); // // @Override // public Response toResponse(BQGraphQLRestException exception) { // // String message = exception.getMessage(); // Status status = exception.getStatus(); // // if (LOGGER.isInfoEnabled()) { // StringBuilder log = new StringBuilder(); // log.append(status.getStatusCode()).append(" ").append(status.getReasonPhrase()); // // if (message != null) { // log.append(" (").append(message).append(")"); // } // // if (exception.getCause() != null && exception.getCause().getMessage() != null) { // log.append(" [cause: ").append(exception.getCause().getMessage()).append("]"); // } // // // include stack trace in debug mode... // if (LOGGER.isDebugEnabled()) { // LOGGER.debug(log.toString(), exception); // } else { // LOGGER.info(log.toString()); // } // } // // return Response.status(status).entity(new MessageResponse(message)).type(MediaType.APPLICATION_JSON_TYPE) // .build(); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/ExecutionResultWriter.java // @Provider // @Singleton // public class ExecutionResultWriter implements MessageBodyWriter<ExecutionResult> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return ExecutionResult.class.isAssignableFrom(type); // } // // @Override // public void writeTo(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException, WebApplicationException { // // writer.write(entityStream, generator -> { // // generator.writeStartObject(); // // // TODO: is it ok to rely on default serialization of data and // // errors? // // if (t.getData() != null) { // generator.writeObjectField("data", t.getData()); // } // // if (t.getErrors() != null && !t.getErrors().isEmpty()) { // generator.writeObjectField("errors", t.getErrors()); // } // // generator.writeEndObject(); // // }); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/GraphiQLRestQueryReader.java // @Singleton // @Provider // public class GraphiQLRestQueryReader implements MessageBodyReader<GraphQLRestQuery> { // // @Inject // private JsonReader jsonParser; // // @Override // public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return GraphQLRestQuery.class.isAssignableFrom(type); // } // // @Override // public GraphQLRestQuery readFrom(Class<GraphQLRestQuery> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) // throws IOException, WebApplicationException { // // return jsonParser.read(GraphQLRestQuery.class, entityStream); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/MessageResponseWriter.java // public class MessageResponseWriter implements MessageBodyWriter<MessageResponse> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return MessageResponse.class.isAssignableFrom(type); // } // // @Override // public void writeTo(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException { // // writer.write(entityStream, generator -> { // generator.writeStartObject(); // // if (t.getMessage() != null) { // generator.writeStringField("message", t.getMessage()); // } // // generator.writeEndObject(); // }); // // } // // } // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/GraphQLFeature.java import javax.ws.rs.core.Feature; import javax.ws.rs.core.FeatureContext; import org.objectstyle.bootique.graphql.jaxrs.provider.BQGraphQLRestExceptionMapper; import org.objectstyle.bootique.graphql.jaxrs.provider.ExecutionResultWriter; import org.objectstyle.bootique.graphql.jaxrs.provider.GraphiQLRestQueryReader; import org.objectstyle.bootique.graphql.jaxrs.provider.MessageResponseWriter; package org.objectstyle.bootique.graphql.jaxrs; /** * Loads JAX-RS extensions for GraphQL processing. */ public class GraphQLFeature implements Feature { @Override public boolean configure(FeatureContext context) { context.register(MessageResponseWriter.class);
context.register(BQGraphQLRestExceptionMapper.class);
andrus/bootique-graphql
bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/GraphQLFeature.java
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/BQGraphQLRestExceptionMapper.java // @Provider // @Singleton // public class BQGraphQLRestExceptionMapper implements ExceptionMapper<BQGraphQLRestException> { // // private static final Logger LOGGER = LoggerFactory.getLogger(BQGraphQLRestExceptionMapper.class); // // @Override // public Response toResponse(BQGraphQLRestException exception) { // // String message = exception.getMessage(); // Status status = exception.getStatus(); // // if (LOGGER.isInfoEnabled()) { // StringBuilder log = new StringBuilder(); // log.append(status.getStatusCode()).append(" ").append(status.getReasonPhrase()); // // if (message != null) { // log.append(" (").append(message).append(")"); // } // // if (exception.getCause() != null && exception.getCause().getMessage() != null) { // log.append(" [cause: ").append(exception.getCause().getMessage()).append("]"); // } // // // include stack trace in debug mode... // if (LOGGER.isDebugEnabled()) { // LOGGER.debug(log.toString(), exception); // } else { // LOGGER.info(log.toString()); // } // } // // return Response.status(status).entity(new MessageResponse(message)).type(MediaType.APPLICATION_JSON_TYPE) // .build(); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/ExecutionResultWriter.java // @Provider // @Singleton // public class ExecutionResultWriter implements MessageBodyWriter<ExecutionResult> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return ExecutionResult.class.isAssignableFrom(type); // } // // @Override // public void writeTo(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException, WebApplicationException { // // writer.write(entityStream, generator -> { // // generator.writeStartObject(); // // // TODO: is it ok to rely on default serialization of data and // // errors? // // if (t.getData() != null) { // generator.writeObjectField("data", t.getData()); // } // // if (t.getErrors() != null && !t.getErrors().isEmpty()) { // generator.writeObjectField("errors", t.getErrors()); // } // // generator.writeEndObject(); // // }); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/GraphiQLRestQueryReader.java // @Singleton // @Provider // public class GraphiQLRestQueryReader implements MessageBodyReader<GraphQLRestQuery> { // // @Inject // private JsonReader jsonParser; // // @Override // public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return GraphQLRestQuery.class.isAssignableFrom(type); // } // // @Override // public GraphQLRestQuery readFrom(Class<GraphQLRestQuery> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) // throws IOException, WebApplicationException { // // return jsonParser.read(GraphQLRestQuery.class, entityStream); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/MessageResponseWriter.java // public class MessageResponseWriter implements MessageBodyWriter<MessageResponse> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return MessageResponse.class.isAssignableFrom(type); // } // // @Override // public void writeTo(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException { // // writer.write(entityStream, generator -> { // generator.writeStartObject(); // // if (t.getMessage() != null) { // generator.writeStringField("message", t.getMessage()); // } // // generator.writeEndObject(); // }); // // } // // }
import javax.ws.rs.core.Feature; import javax.ws.rs.core.FeatureContext; import org.objectstyle.bootique.graphql.jaxrs.provider.BQGraphQLRestExceptionMapper; import org.objectstyle.bootique.graphql.jaxrs.provider.ExecutionResultWriter; import org.objectstyle.bootique.graphql.jaxrs.provider.GraphiQLRestQueryReader; import org.objectstyle.bootique.graphql.jaxrs.provider.MessageResponseWriter;
package org.objectstyle.bootique.graphql.jaxrs; /** * Loads JAX-RS extensions for GraphQL processing. */ public class GraphQLFeature implements Feature { @Override public boolean configure(FeatureContext context) { context.register(MessageResponseWriter.class); context.register(BQGraphQLRestExceptionMapper.class);
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/BQGraphQLRestExceptionMapper.java // @Provider // @Singleton // public class BQGraphQLRestExceptionMapper implements ExceptionMapper<BQGraphQLRestException> { // // private static final Logger LOGGER = LoggerFactory.getLogger(BQGraphQLRestExceptionMapper.class); // // @Override // public Response toResponse(BQGraphQLRestException exception) { // // String message = exception.getMessage(); // Status status = exception.getStatus(); // // if (LOGGER.isInfoEnabled()) { // StringBuilder log = new StringBuilder(); // log.append(status.getStatusCode()).append(" ").append(status.getReasonPhrase()); // // if (message != null) { // log.append(" (").append(message).append(")"); // } // // if (exception.getCause() != null && exception.getCause().getMessage() != null) { // log.append(" [cause: ").append(exception.getCause().getMessage()).append("]"); // } // // // include stack trace in debug mode... // if (LOGGER.isDebugEnabled()) { // LOGGER.debug(log.toString(), exception); // } else { // LOGGER.info(log.toString()); // } // } // // return Response.status(status).entity(new MessageResponse(message)).type(MediaType.APPLICATION_JSON_TYPE) // .build(); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/ExecutionResultWriter.java // @Provider // @Singleton // public class ExecutionResultWriter implements MessageBodyWriter<ExecutionResult> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return ExecutionResult.class.isAssignableFrom(type); // } // // @Override // public void writeTo(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException, WebApplicationException { // // writer.write(entityStream, generator -> { // // generator.writeStartObject(); // // // TODO: is it ok to rely on default serialization of data and // // errors? // // if (t.getData() != null) { // generator.writeObjectField("data", t.getData()); // } // // if (t.getErrors() != null && !t.getErrors().isEmpty()) { // generator.writeObjectField("errors", t.getErrors()); // } // // generator.writeEndObject(); // // }); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/GraphiQLRestQueryReader.java // @Singleton // @Provider // public class GraphiQLRestQueryReader implements MessageBodyReader<GraphQLRestQuery> { // // @Inject // private JsonReader jsonParser; // // @Override // public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return GraphQLRestQuery.class.isAssignableFrom(type); // } // // @Override // public GraphQLRestQuery readFrom(Class<GraphQLRestQuery> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) // throws IOException, WebApplicationException { // // return jsonParser.read(GraphQLRestQuery.class, entityStream); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/MessageResponseWriter.java // public class MessageResponseWriter implements MessageBodyWriter<MessageResponse> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return MessageResponse.class.isAssignableFrom(type); // } // // @Override // public void writeTo(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException { // // writer.write(entityStream, generator -> { // generator.writeStartObject(); // // if (t.getMessage() != null) { // generator.writeStringField("message", t.getMessage()); // } // // generator.writeEndObject(); // }); // // } // // } // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/GraphQLFeature.java import javax.ws.rs.core.Feature; import javax.ws.rs.core.FeatureContext; import org.objectstyle.bootique.graphql.jaxrs.provider.BQGraphQLRestExceptionMapper; import org.objectstyle.bootique.graphql.jaxrs.provider.ExecutionResultWriter; import org.objectstyle.bootique.graphql.jaxrs.provider.GraphiQLRestQueryReader; import org.objectstyle.bootique.graphql.jaxrs.provider.MessageResponseWriter; package org.objectstyle.bootique.graphql.jaxrs; /** * Loads JAX-RS extensions for GraphQL processing. */ public class GraphQLFeature implements Feature { @Override public boolean configure(FeatureContext context) { context.register(MessageResponseWriter.class); context.register(BQGraphQLRestExceptionMapper.class);
context.register(GraphiQLRestQueryReader.class);
andrus/bootique-graphql
bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/GraphQLFeature.java
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/BQGraphQLRestExceptionMapper.java // @Provider // @Singleton // public class BQGraphQLRestExceptionMapper implements ExceptionMapper<BQGraphQLRestException> { // // private static final Logger LOGGER = LoggerFactory.getLogger(BQGraphQLRestExceptionMapper.class); // // @Override // public Response toResponse(BQGraphQLRestException exception) { // // String message = exception.getMessage(); // Status status = exception.getStatus(); // // if (LOGGER.isInfoEnabled()) { // StringBuilder log = new StringBuilder(); // log.append(status.getStatusCode()).append(" ").append(status.getReasonPhrase()); // // if (message != null) { // log.append(" (").append(message).append(")"); // } // // if (exception.getCause() != null && exception.getCause().getMessage() != null) { // log.append(" [cause: ").append(exception.getCause().getMessage()).append("]"); // } // // // include stack trace in debug mode... // if (LOGGER.isDebugEnabled()) { // LOGGER.debug(log.toString(), exception); // } else { // LOGGER.info(log.toString()); // } // } // // return Response.status(status).entity(new MessageResponse(message)).type(MediaType.APPLICATION_JSON_TYPE) // .build(); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/ExecutionResultWriter.java // @Provider // @Singleton // public class ExecutionResultWriter implements MessageBodyWriter<ExecutionResult> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return ExecutionResult.class.isAssignableFrom(type); // } // // @Override // public void writeTo(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException, WebApplicationException { // // writer.write(entityStream, generator -> { // // generator.writeStartObject(); // // // TODO: is it ok to rely on default serialization of data and // // errors? // // if (t.getData() != null) { // generator.writeObjectField("data", t.getData()); // } // // if (t.getErrors() != null && !t.getErrors().isEmpty()) { // generator.writeObjectField("errors", t.getErrors()); // } // // generator.writeEndObject(); // // }); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/GraphiQLRestQueryReader.java // @Singleton // @Provider // public class GraphiQLRestQueryReader implements MessageBodyReader<GraphQLRestQuery> { // // @Inject // private JsonReader jsonParser; // // @Override // public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return GraphQLRestQuery.class.isAssignableFrom(type); // } // // @Override // public GraphQLRestQuery readFrom(Class<GraphQLRestQuery> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) // throws IOException, WebApplicationException { // // return jsonParser.read(GraphQLRestQuery.class, entityStream); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/MessageResponseWriter.java // public class MessageResponseWriter implements MessageBodyWriter<MessageResponse> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return MessageResponse.class.isAssignableFrom(type); // } // // @Override // public void writeTo(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException { // // writer.write(entityStream, generator -> { // generator.writeStartObject(); // // if (t.getMessage() != null) { // generator.writeStringField("message", t.getMessage()); // } // // generator.writeEndObject(); // }); // // } // // }
import javax.ws.rs.core.Feature; import javax.ws.rs.core.FeatureContext; import org.objectstyle.bootique.graphql.jaxrs.provider.BQGraphQLRestExceptionMapper; import org.objectstyle.bootique.graphql.jaxrs.provider.ExecutionResultWriter; import org.objectstyle.bootique.graphql.jaxrs.provider.GraphiQLRestQueryReader; import org.objectstyle.bootique.graphql.jaxrs.provider.MessageResponseWriter;
package org.objectstyle.bootique.graphql.jaxrs; /** * Loads JAX-RS extensions for GraphQL processing. */ public class GraphQLFeature implements Feature { @Override public boolean configure(FeatureContext context) { context.register(MessageResponseWriter.class); context.register(BQGraphQLRestExceptionMapper.class); context.register(GraphiQLRestQueryReader.class);
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/BQGraphQLRestExceptionMapper.java // @Provider // @Singleton // public class BQGraphQLRestExceptionMapper implements ExceptionMapper<BQGraphQLRestException> { // // private static final Logger LOGGER = LoggerFactory.getLogger(BQGraphQLRestExceptionMapper.class); // // @Override // public Response toResponse(BQGraphQLRestException exception) { // // String message = exception.getMessage(); // Status status = exception.getStatus(); // // if (LOGGER.isInfoEnabled()) { // StringBuilder log = new StringBuilder(); // log.append(status.getStatusCode()).append(" ").append(status.getReasonPhrase()); // // if (message != null) { // log.append(" (").append(message).append(")"); // } // // if (exception.getCause() != null && exception.getCause().getMessage() != null) { // log.append(" [cause: ").append(exception.getCause().getMessage()).append("]"); // } // // // include stack trace in debug mode... // if (LOGGER.isDebugEnabled()) { // LOGGER.debug(log.toString(), exception); // } else { // LOGGER.info(log.toString()); // } // } // // return Response.status(status).entity(new MessageResponse(message)).type(MediaType.APPLICATION_JSON_TYPE) // .build(); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/ExecutionResultWriter.java // @Provider // @Singleton // public class ExecutionResultWriter implements MessageBodyWriter<ExecutionResult> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return ExecutionResult.class.isAssignableFrom(type); // } // // @Override // public void writeTo(ExecutionResult t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException, WebApplicationException { // // writer.write(entityStream, generator -> { // // generator.writeStartObject(); // // // TODO: is it ok to rely on default serialization of data and // // errors? // // if (t.getData() != null) { // generator.writeObjectField("data", t.getData()); // } // // if (t.getErrors() != null && !t.getErrors().isEmpty()) { // generator.writeObjectField("errors", t.getErrors()); // } // // generator.writeEndObject(); // // }); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/GraphiQLRestQueryReader.java // @Singleton // @Provider // public class GraphiQLRestQueryReader implements MessageBodyReader<GraphQLRestQuery> { // // @Inject // private JsonReader jsonParser; // // @Override // public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return GraphQLRestQuery.class.isAssignableFrom(type); // } // // @Override // public GraphQLRestQuery readFrom(Class<GraphQLRestQuery> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) // throws IOException, WebApplicationException { // // return jsonParser.read(GraphQLRestQuery.class, entityStream); // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/MessageResponseWriter.java // public class MessageResponseWriter implements MessageBodyWriter<MessageResponse> { // // @Inject // private JsonWriter writer; // // @Override // public long getSize(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType) { // return -1; // } // // @Override // public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { // return MessageResponse.class.isAssignableFrom(type); // } // // @Override // public void writeTo(MessageResponse t, Class<?> type, Type genericType, Annotation[] annotations, // MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) // throws IOException { // // writer.write(entityStream, generator -> { // generator.writeStartObject(); // // if (t.getMessage() != null) { // generator.writeStringField("message", t.getMessage()); // } // // generator.writeEndObject(); // }); // // } // // } // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/GraphQLFeature.java import javax.ws.rs.core.Feature; import javax.ws.rs.core.FeatureContext; import org.objectstyle.bootique.graphql.jaxrs.provider.BQGraphQLRestExceptionMapper; import org.objectstyle.bootique.graphql.jaxrs.provider.ExecutionResultWriter; import org.objectstyle.bootique.graphql.jaxrs.provider.GraphiQLRestQueryReader; import org.objectstyle.bootique.graphql.jaxrs.provider.MessageResponseWriter; package org.objectstyle.bootique.graphql.jaxrs; /** * Loads JAX-RS extensions for GraphQL processing. */ public class GraphQLFeature implements Feature { @Override public boolean configure(FeatureContext context) { context.register(MessageResponseWriter.class); context.register(BQGraphQLRestExceptionMapper.class); context.register(GraphiQLRestQueryReader.class);
context.register(ExecutionResultWriter.class);
andrus/bootique-graphql
bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/MessageResponseWriter.java
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/MessageResponse.java // public class MessageResponse { // // private String message; // // public MessageResponse(String message) { // this.message = message; // } // // public String getMessage() { // return message; // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/json/JsonWriter.java // public interface JsonWriter { // // void write(OutputStream out, JacksonWriterDelegate delegate); // }
import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; import org.objectstyle.bootique.graphql.jaxrs.MessageResponse; import org.objectstyle.bootique.graphql.json.JsonWriter; import com.google.inject.Inject;
package org.objectstyle.bootique.graphql.jaxrs.provider; public class MessageResponseWriter implements MessageBodyWriter<MessageResponse> { @Inject
// Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/MessageResponse.java // public class MessageResponse { // // private String message; // // public MessageResponse(String message) { // this.message = message; // } // // public String getMessage() { // return message; // } // } // // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/json/JsonWriter.java // public interface JsonWriter { // // void write(OutputStream out, JacksonWriterDelegate delegate); // } // Path: bootique-graphql/src/main/java/org/objectstyle/bootique/graphql/jaxrs/provider/MessageResponseWriter.java import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; import org.objectstyle.bootique.graphql.jaxrs.MessageResponse; import org.objectstyle.bootique.graphql.json.JsonWriter; import com.google.inject.Inject; package org.objectstyle.bootique.graphql.jaxrs.provider; public class MessageResponseWriter implements MessageBodyWriter<MessageResponse> { @Inject
private JsonWriter writer;
374901588/PaperPlane
app/src/main/java/com/hut/zero/homepage/MainFragment.java
// Path: app/src/main/java/com/hut/zero/adapter/MainPagerAdapter.java // public class MainPagerAdapter extends FragmentPagerAdapter { // private String[] mTitles; // // private ZhihuDailyFragment zhihuDailyFragment; // private GuokeHandpickFragment guokeHandpickFragment; // private DoubanMomentFragment doubanMomentFragment; // // public MainPagerAdapter(FragmentManager fm, Context context, ZhihuDailyFragment zhihuDailyFragment, GuokeHandpickFragment guokeHandpickFragment, DoubanMomentFragment doubanMomentFragment) { // super(fm); // // mTitles = new String[]{context.getResources().getString(R.string.zhihu_daily), // context.getResources().getString(R.string.guokr_handpick), // context.getResources().getString(R.string.douban_moment)}; // // this.zhihuDailyFragment=zhihuDailyFragment; // this.doubanMomentFragment=doubanMomentFragment; // this.guokeHandpickFragment=guokeHandpickFragment; // } // // @Override // public Fragment getItem(int position) { // switch (position) { // case 1:return guokeHandpickFragment; // case 2:return doubanMomentFragment; // default:return zhihuDailyFragment; // } // } // // @Override // public int getCount() { // return mTitles.length; // } // // @Override // public CharSequence getPageTitle(int position) { // return mTitles[position]; // } // // public ZhihuDailyFragment getZhihuDailyFragment() { // return zhihuDailyFragment; // } // // public GuokeHandpickFragment getGuokeHandpickFragment() { // return guokeHandpickFragment; // } // // public DoubanMomentFragment getDoubanMomentFragment() { // return doubanMomentFragment; // } // }
import android.content.Context; import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import com.hut.zero.R; import com.hut.zero.adapter.MainPagerAdapter; import com.hut.zero.databinding.FragmentMainBinding; import java.util.Random;
package com.hut.zero.homepage; /** * Created by Zero on 2017/4/2. */ public class MainFragment extends Fragment { private Context mContext;
// Path: app/src/main/java/com/hut/zero/adapter/MainPagerAdapter.java // public class MainPagerAdapter extends FragmentPagerAdapter { // private String[] mTitles; // // private ZhihuDailyFragment zhihuDailyFragment; // private GuokeHandpickFragment guokeHandpickFragment; // private DoubanMomentFragment doubanMomentFragment; // // public MainPagerAdapter(FragmentManager fm, Context context, ZhihuDailyFragment zhihuDailyFragment, GuokeHandpickFragment guokeHandpickFragment, DoubanMomentFragment doubanMomentFragment) { // super(fm); // // mTitles = new String[]{context.getResources().getString(R.string.zhihu_daily), // context.getResources().getString(R.string.guokr_handpick), // context.getResources().getString(R.string.douban_moment)}; // // this.zhihuDailyFragment=zhihuDailyFragment; // this.doubanMomentFragment=doubanMomentFragment; // this.guokeHandpickFragment=guokeHandpickFragment; // } // // @Override // public Fragment getItem(int position) { // switch (position) { // case 1:return guokeHandpickFragment; // case 2:return doubanMomentFragment; // default:return zhihuDailyFragment; // } // } // // @Override // public int getCount() { // return mTitles.length; // } // // @Override // public CharSequence getPageTitle(int position) { // return mTitles[position]; // } // // public ZhihuDailyFragment getZhihuDailyFragment() { // return zhihuDailyFragment; // } // // public GuokeHandpickFragment getGuokeHandpickFragment() { // return guokeHandpickFragment; // } // // public DoubanMomentFragment getDoubanMomentFragment() { // return doubanMomentFragment; // } // } // Path: app/src/main/java/com/hut/zero/homepage/MainFragment.java import android.content.Context; import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import com.hut.zero.R; import com.hut.zero.adapter.MainPagerAdapter; import com.hut.zero.databinding.FragmentMainBinding; import java.util.Random; package com.hut.zero.homepage; /** * Created by Zero on 2017/4/2. */ public class MainFragment extends Fragment { private Context mContext;
private MainPagerAdapter mAdapter;
374901588/PaperPlane
app/src/main/java/com/hut/zero/homepage/ZhihuDailyFragment.java
// Path: app/src/main/java/com/hut/zero/adapter/ZhihuDailyNewsAdapter.java // public class ZhihuDailyNewsAdapter extends RecyclerView.Adapter<BaseViewHolder> { // private static final int TYPE_NORMAL = 0; // private static final int TYPE_FOOTER = 1; // // private OnRecyclerViewOnClickListener mListener; // // private List<ZhihuDailyNews.Question> data; // // public ZhihuDailyNewsAdapter(List<ZhihuDailyNews.Question> data) { // this.data = data; // } // // @Override // public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // switch (viewType) { // case TYPE_NORMAL: // return new WithListenerViewHolder( // DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.home_list_item_layout, parent, false), // mListener); // case TYPE_FOOTER: // return new BaseViewHolder( // DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.home_list_item_layout, parent, false)); // } // return null; // } // // @Override // public void onBindViewHolder(BaseViewHolder holder, int position) { // if (holder instanceof WithListenerViewHolder) {//holder instanceof NormalViewHolder // ZhihuDailyNews.Question item = data.get(position); // // //DataBindingCustomAttr.DataBindingCustomAttr() // holder.getBinding().setVariable(BR.imgUrl,(item.getImages().get(0) == null? DataBindingCustomAttr.NO_LOAD:item.getImages().get(0))); // holder.getBinding().setVariable(BR.title,item.getTitle()); // } // } // // // 因为含有footer,返回值需要 + 1 // @Override // public int getItemCount() { // return data.size()+1; // } // // @Override // public int getItemViewType(int position) { // return position==data.size()?TYPE_FOOTER:TYPE_NORMAL; // } // // public void setItemClickListener(OnRecyclerViewOnClickListener listener) { // mListener=listener; // } // // private class NormalViewHolder extends WithListenerViewHolder { // NormalViewHolder(ViewDataBinding binding, OnRecyclerViewOnClickListener listener) { // super(binding, listener); // } // } // // private class FooterViewHolder extends BaseViewHolder { // // FooterViewHolder(ViewDataBinding binding) { // super(binding); // } // } // // // public List<ZhihuDailyNews.Question> getData() { // return data; // } // // public void setData(List<ZhihuDailyNews.Question> data) { // this.data=data; // } // } // // Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // }
import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.hut.zero.R; import com.hut.zero.adapter.ZhihuDailyNewsAdapter; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.databinding.FragmentListBinding; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; import java.util.ArrayList; import java.util.Calendar;
package com.hut.zero.homepage; /** * Created by Zero on 2017/4/2. */ public class ZhihuDailyFragment extends Fragment implements ZhihuDailyContract.View { private FragmentListBinding mBinding;
// Path: app/src/main/java/com/hut/zero/adapter/ZhihuDailyNewsAdapter.java // public class ZhihuDailyNewsAdapter extends RecyclerView.Adapter<BaseViewHolder> { // private static final int TYPE_NORMAL = 0; // private static final int TYPE_FOOTER = 1; // // private OnRecyclerViewOnClickListener mListener; // // private List<ZhihuDailyNews.Question> data; // // public ZhihuDailyNewsAdapter(List<ZhihuDailyNews.Question> data) { // this.data = data; // } // // @Override // public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // switch (viewType) { // case TYPE_NORMAL: // return new WithListenerViewHolder( // DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.home_list_item_layout, parent, false), // mListener); // case TYPE_FOOTER: // return new BaseViewHolder( // DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.home_list_item_layout, parent, false)); // } // return null; // } // // @Override // public void onBindViewHolder(BaseViewHolder holder, int position) { // if (holder instanceof WithListenerViewHolder) {//holder instanceof NormalViewHolder // ZhihuDailyNews.Question item = data.get(position); // // //DataBindingCustomAttr.DataBindingCustomAttr() // holder.getBinding().setVariable(BR.imgUrl,(item.getImages().get(0) == null? DataBindingCustomAttr.NO_LOAD:item.getImages().get(0))); // holder.getBinding().setVariable(BR.title,item.getTitle()); // } // } // // // 因为含有footer,返回值需要 + 1 // @Override // public int getItemCount() { // return data.size()+1; // } // // @Override // public int getItemViewType(int position) { // return position==data.size()?TYPE_FOOTER:TYPE_NORMAL; // } // // public void setItemClickListener(OnRecyclerViewOnClickListener listener) { // mListener=listener; // } // // private class NormalViewHolder extends WithListenerViewHolder { // NormalViewHolder(ViewDataBinding binding, OnRecyclerViewOnClickListener listener) { // super(binding, listener); // } // } // // private class FooterViewHolder extends BaseViewHolder { // // FooterViewHolder(ViewDataBinding binding) { // super(binding); // } // } // // // public List<ZhihuDailyNews.Question> getData() { // return data; // } // // public void setData(List<ZhihuDailyNews.Question> data) { // this.data=data; // } // } // // Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // Path: app/src/main/java/com/hut/zero/homepage/ZhihuDailyFragment.java import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.hut.zero.R; import com.hut.zero.adapter.ZhihuDailyNewsAdapter; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.databinding.FragmentListBinding; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; import java.util.ArrayList; import java.util.Calendar; package com.hut.zero.homepage; /** * Created by Zero on 2017/4/2. */ public class ZhihuDailyFragment extends Fragment implements ZhihuDailyContract.View { private FragmentListBinding mBinding;
private ZhihuDailyNewsAdapter mAdapter;
374901588/PaperPlane
app/src/main/java/com/hut/zero/homepage/ZhihuDailyFragment.java
// Path: app/src/main/java/com/hut/zero/adapter/ZhihuDailyNewsAdapter.java // public class ZhihuDailyNewsAdapter extends RecyclerView.Adapter<BaseViewHolder> { // private static final int TYPE_NORMAL = 0; // private static final int TYPE_FOOTER = 1; // // private OnRecyclerViewOnClickListener mListener; // // private List<ZhihuDailyNews.Question> data; // // public ZhihuDailyNewsAdapter(List<ZhihuDailyNews.Question> data) { // this.data = data; // } // // @Override // public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // switch (viewType) { // case TYPE_NORMAL: // return new WithListenerViewHolder( // DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.home_list_item_layout, parent, false), // mListener); // case TYPE_FOOTER: // return new BaseViewHolder( // DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.home_list_item_layout, parent, false)); // } // return null; // } // // @Override // public void onBindViewHolder(BaseViewHolder holder, int position) { // if (holder instanceof WithListenerViewHolder) {//holder instanceof NormalViewHolder // ZhihuDailyNews.Question item = data.get(position); // // //DataBindingCustomAttr.DataBindingCustomAttr() // holder.getBinding().setVariable(BR.imgUrl,(item.getImages().get(0) == null? DataBindingCustomAttr.NO_LOAD:item.getImages().get(0))); // holder.getBinding().setVariable(BR.title,item.getTitle()); // } // } // // // 因为含有footer,返回值需要 + 1 // @Override // public int getItemCount() { // return data.size()+1; // } // // @Override // public int getItemViewType(int position) { // return position==data.size()?TYPE_FOOTER:TYPE_NORMAL; // } // // public void setItemClickListener(OnRecyclerViewOnClickListener listener) { // mListener=listener; // } // // private class NormalViewHolder extends WithListenerViewHolder { // NormalViewHolder(ViewDataBinding binding, OnRecyclerViewOnClickListener listener) { // super(binding, listener); // } // } // // private class FooterViewHolder extends BaseViewHolder { // // FooterViewHolder(ViewDataBinding binding) { // super(binding); // } // } // // // public List<ZhihuDailyNews.Question> getData() { // return data; // } // // public void setData(List<ZhihuDailyNews.Question> data) { // this.data=data; // } // } // // Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // }
import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.hut.zero.R; import com.hut.zero.adapter.ZhihuDailyNewsAdapter; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.databinding.FragmentListBinding; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; import java.util.ArrayList; import java.util.Calendar;
isSlidingToLast = (dy > 0); // 隐藏或者显示fab if(dy > 20 || dy < -20) { fab.hide(); } else { fab.show(); } } }); } @Override public void showError() { Snackbar.make(fab, R.string.loaded_failed,Snackbar.LENGTH_INDEFINITE) .setAction(R.string.retry, v -> mPresenter.refresh()) .show(); } @Override public void showLoading() { mBinding.refreshLayout.post(() -> mBinding.refreshLayout.setRefreshing(true)); } @Override public void stopLoading() { mBinding.refreshLayout.post(() -> mBinding.refreshLayout.setRefreshing(false)); } @Override
// Path: app/src/main/java/com/hut/zero/adapter/ZhihuDailyNewsAdapter.java // public class ZhihuDailyNewsAdapter extends RecyclerView.Adapter<BaseViewHolder> { // private static final int TYPE_NORMAL = 0; // private static final int TYPE_FOOTER = 1; // // private OnRecyclerViewOnClickListener mListener; // // private List<ZhihuDailyNews.Question> data; // // public ZhihuDailyNewsAdapter(List<ZhihuDailyNews.Question> data) { // this.data = data; // } // // @Override // public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // switch (viewType) { // case TYPE_NORMAL: // return new WithListenerViewHolder( // DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.home_list_item_layout, parent, false), // mListener); // case TYPE_FOOTER: // return new BaseViewHolder( // DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.home_list_item_layout, parent, false)); // } // return null; // } // // @Override // public void onBindViewHolder(BaseViewHolder holder, int position) { // if (holder instanceof WithListenerViewHolder) {//holder instanceof NormalViewHolder // ZhihuDailyNews.Question item = data.get(position); // // //DataBindingCustomAttr.DataBindingCustomAttr() // holder.getBinding().setVariable(BR.imgUrl,(item.getImages().get(0) == null? DataBindingCustomAttr.NO_LOAD:item.getImages().get(0))); // holder.getBinding().setVariable(BR.title,item.getTitle()); // } // } // // // 因为含有footer,返回值需要 + 1 // @Override // public int getItemCount() { // return data.size()+1; // } // // @Override // public int getItemViewType(int position) { // return position==data.size()?TYPE_FOOTER:TYPE_NORMAL; // } // // public void setItemClickListener(OnRecyclerViewOnClickListener listener) { // mListener=listener; // } // // private class NormalViewHolder extends WithListenerViewHolder { // NormalViewHolder(ViewDataBinding binding, OnRecyclerViewOnClickListener listener) { // super(binding, listener); // } // } // // private class FooterViewHolder extends BaseViewHolder { // // FooterViewHolder(ViewDataBinding binding) { // super(binding); // } // } // // // public List<ZhihuDailyNews.Question> getData() { // return data; // } // // public void setData(List<ZhihuDailyNews.Question> data) { // this.data=data; // } // } // // Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // Path: app/src/main/java/com/hut/zero/homepage/ZhihuDailyFragment.java import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.hut.zero.R; import com.hut.zero.adapter.ZhihuDailyNewsAdapter; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.databinding.FragmentListBinding; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; import java.util.ArrayList; import java.util.Calendar; isSlidingToLast = (dy > 0); // 隐藏或者显示fab if(dy > 20 || dy < -20) { fab.hide(); } else { fab.show(); } } }); } @Override public void showError() { Snackbar.make(fab, R.string.loaded_failed,Snackbar.LENGTH_INDEFINITE) .setAction(R.string.retry, v -> mPresenter.refresh()) .show(); } @Override public void showLoading() { mBinding.refreshLayout.post(() -> mBinding.refreshLayout.setRefreshing(true)); } @Override public void stopLoading() { mBinding.refreshLayout.post(() -> mBinding.refreshLayout.setRefreshing(false)); } @Override
public void showResults(ArrayList<ZhihuDailyNews.Question> list) {
374901588/PaperPlane
app/src/main/java/com/hut/zero/detail/DetailActivity.java
// Path: app/src/main/java/com/hut/zero/bean/BeanType.java // public enum BeanType { // // TYPE_ZHIHU, TYPE_GUOKE,TYPE_DOUBAN; // // }
import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import com.hut.zero.R; import com.hut.zero.bean.BeanType;
package com.hut.zero.detail; public class DetailActivity extends AppCompatActivity { private DetailFragment fragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.frame); if (savedInstanceState != null) { fragment = (DetailFragment) getSupportFragmentManager().getFragment(savedInstanceState,"detailFragment"); } else { fragment = new DetailFragment(); getSupportFragmentManager().beginTransaction() .replace(R.id.container, fragment) .commit(); } Intent intent = getIntent(); DetailPresenter presenter = new DetailPresenter(DetailActivity.this, fragment);
// Path: app/src/main/java/com/hut/zero/bean/BeanType.java // public enum BeanType { // // TYPE_ZHIHU, TYPE_GUOKE,TYPE_DOUBAN; // // } // Path: app/src/main/java/com/hut/zero/detail/DetailActivity.java import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import com.hut.zero.R; import com.hut.zero.bean.BeanType; package com.hut.zero.detail; public class DetailActivity extends AppCompatActivity { private DetailFragment fragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.frame); if (savedInstanceState != null) { fragment = (DetailFragment) getSupportFragmentManager().getFragment(savedInstanceState,"detailFragment"); } else { fragment = new DetailFragment(); getSupportFragmentManager().beginTransaction() .replace(R.id.container, fragment) .commit(); } Intent intent = getIntent(); DetailPresenter presenter = new DetailPresenter(DetailActivity.this, fragment);
presenter.setType((BeanType) intent.getSerializableExtra("type"));
374901588/PaperPlane
app/src/main/java/com/hut/zero/detail/DetailContract.java
// Path: app/src/main/java/com/hut/zero/BasePresenter.java // public interface BasePresenter { // // 获取数据并改变界面显示,在todo-mvp的项目中的调用时机为Fragment的OnResume()方法中 // void start(); // } // // Path: app/src/main/java/com/hut/zero/BaseView.java // public interface BaseView<T> { // // 为View设置Presenter // void setPresenter(T presenter); // // 初始化界面控件 // void initViews(); // }
import android.webkit.WebView; import com.hut.zero.BasePresenter; import com.hut.zero.BaseView;
/* * Copyright 2017 lizhaotailang * * 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 com.hut.zero.detail; /** * Created by lizhaotailang on 2016/12/27. */ public class DetailContract { interface View extends BaseView<Presenter> { void showLoading(); void stopLoading(); void showLoadingError(); void showSharingError(); void showResult(String result); void showResultWithoutBody(String url); void showCover(String url); void setTitle(String title); void setImageMode(boolean showImage); void showBrowserNotFoundError(); void showTextCopied(); void showCopyTextError(); void showAddedToBookmarks(); void showDeletedFromBookmarks(); }
// Path: app/src/main/java/com/hut/zero/BasePresenter.java // public interface BasePresenter { // // 获取数据并改变界面显示,在todo-mvp的项目中的调用时机为Fragment的OnResume()方法中 // void start(); // } // // Path: app/src/main/java/com/hut/zero/BaseView.java // public interface BaseView<T> { // // 为View设置Presenter // void setPresenter(T presenter); // // 初始化界面控件 // void initViews(); // } // Path: app/src/main/java/com/hut/zero/detail/DetailContract.java import android.webkit.WebView; import com.hut.zero.BasePresenter; import com.hut.zero.BaseView; /* * Copyright 2017 lizhaotailang * * 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 com.hut.zero.detail; /** * Created by lizhaotailang on 2016/12/27. */ public class DetailContract { interface View extends BaseView<Presenter> { void showLoading(); void stopLoading(); void showLoadingError(); void showSharingError(); void showResult(String result); void showResultWithoutBody(String url); void showCover(String url); void setTitle(String title); void setImageMode(boolean showImage); void showBrowserNotFoundError(); void showTextCopied(); void showCopyTextError(); void showAddedToBookmarks(); void showDeletedFromBookmarks(); }
interface Presenter extends BasePresenter {
374901588/PaperPlane
app/src/main/java/com/hut/zero/network_request/ZhihuService.java
// Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // // Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyStory.java // public class ZhihuDailyStory { // // private String body; // private String image_source; // private String title; // private String image; // private String share_url; // private ArrayList<String> js; // private String ga_prefix; // private ArrayList<String> images; // private int type; // private int id; // private ArrayList<String> css; // // public String getBody() { // return body; // } // // public void setBody(String body) { // this.body = body; // } // // public String getImage_source() { // return image_source; // } // // public void setImage_source(String image_source) { // this.image_source = image_source; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getImage() { // return image; // } // // public void setImage(String image) { // this.image = image; // } // // public String getShare_url() { // return share_url; // } // // public void setShare_url(String share_url) { // this.share_url = share_url; // } // // public ArrayList<String> getJs() { // return js; // } // // public void setJs(ArrayList<String> js) { // this.js = js; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public ArrayList<String> getCss() { // return css; // } // // public void setCss(ArrayList<String> css) { // this.css = css; // } // // }
import com.google.gson.Gson; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.bean.ZhihuDailyStory; import okhttp3.OkHttpClient; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.http.GET; import retrofit2.http.Path;
package com.hut.zero.network_request; /** * Created by Zero on 2017/4/3. */ public interface ZhihuService { ZhihuService SERVICE_HISTORY =new Retrofit.Builder() .baseUrl("http://news.at.zhihu.com/") .client(new OkHttpClient.Builder() .retryOnConnectionFailure(true)//设置失败重试 .build()) .addConverterFactory(GsonConverterFactory.create(new Gson())) .build().create(ZhihuService.class); ZhihuService SERVICE_STORY =new Retrofit.Builder() .baseUrl("http://news-at.zhihu.com/") .client(new OkHttpClient.Builder() .retryOnConnectionFailure(true)//设置失败重试 .build()) .addConverterFactory(GsonConverterFactory.create(new Gson())) .build().create(ZhihuService.class); @GET("api/4/news/before/{date}")
// Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // // Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyStory.java // public class ZhihuDailyStory { // // private String body; // private String image_source; // private String title; // private String image; // private String share_url; // private ArrayList<String> js; // private String ga_prefix; // private ArrayList<String> images; // private int type; // private int id; // private ArrayList<String> css; // // public String getBody() { // return body; // } // // public void setBody(String body) { // this.body = body; // } // // public String getImage_source() { // return image_source; // } // // public void setImage_source(String image_source) { // this.image_source = image_source; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getImage() { // return image; // } // // public void setImage(String image) { // this.image = image; // } // // public String getShare_url() { // return share_url; // } // // public void setShare_url(String share_url) { // this.share_url = share_url; // } // // public ArrayList<String> getJs() { // return js; // } // // public void setJs(ArrayList<String> js) { // this.js = js; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public ArrayList<String> getCss() { // return css; // } // // public void setCss(ArrayList<String> css) { // this.css = css; // } // // } // Path: app/src/main/java/com/hut/zero/network_request/ZhihuService.java import com.google.gson.Gson; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.bean.ZhihuDailyStory; import okhttp3.OkHttpClient; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.http.GET; import retrofit2.http.Path; package com.hut.zero.network_request; /** * Created by Zero on 2017/4/3. */ public interface ZhihuService { ZhihuService SERVICE_HISTORY =new Retrofit.Builder() .baseUrl("http://news.at.zhihu.com/") .client(new OkHttpClient.Builder() .retryOnConnectionFailure(true)//设置失败重试 .build()) .addConverterFactory(GsonConverterFactory.create(new Gson())) .build().create(ZhihuService.class); ZhihuService SERVICE_STORY =new Retrofit.Builder() .baseUrl("http://news-at.zhihu.com/") .client(new OkHttpClient.Builder() .retryOnConnectionFailure(true)//设置失败重试 .build()) .addConverterFactory(GsonConverterFactory.create(new Gson())) .build().create(ZhihuService.class); @GET("api/4/news/before/{date}")
Call<ZhihuDailyNews> loadHistory(@Path("date") String date);
374901588/PaperPlane
app/src/main/java/com/hut/zero/network_request/ZhihuService.java
// Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // // Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyStory.java // public class ZhihuDailyStory { // // private String body; // private String image_source; // private String title; // private String image; // private String share_url; // private ArrayList<String> js; // private String ga_prefix; // private ArrayList<String> images; // private int type; // private int id; // private ArrayList<String> css; // // public String getBody() { // return body; // } // // public void setBody(String body) { // this.body = body; // } // // public String getImage_source() { // return image_source; // } // // public void setImage_source(String image_source) { // this.image_source = image_source; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getImage() { // return image; // } // // public void setImage(String image) { // this.image = image; // } // // public String getShare_url() { // return share_url; // } // // public void setShare_url(String share_url) { // this.share_url = share_url; // } // // public ArrayList<String> getJs() { // return js; // } // // public void setJs(ArrayList<String> js) { // this.js = js; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public ArrayList<String> getCss() { // return css; // } // // public void setCss(ArrayList<String> css) { // this.css = css; // } // // }
import com.google.gson.Gson; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.bean.ZhihuDailyStory; import okhttp3.OkHttpClient; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.http.GET; import retrofit2.http.Path;
package com.hut.zero.network_request; /** * Created by Zero on 2017/4/3. */ public interface ZhihuService { ZhihuService SERVICE_HISTORY =new Retrofit.Builder() .baseUrl("http://news.at.zhihu.com/") .client(new OkHttpClient.Builder() .retryOnConnectionFailure(true)//设置失败重试 .build()) .addConverterFactory(GsonConverterFactory.create(new Gson())) .build().create(ZhihuService.class); ZhihuService SERVICE_STORY =new Retrofit.Builder() .baseUrl("http://news-at.zhihu.com/") .client(new OkHttpClient.Builder() .retryOnConnectionFailure(true)//设置失败重试 .build()) .addConverterFactory(GsonConverterFactory.create(new Gson())) .build().create(ZhihuService.class); @GET("api/4/news/before/{date}") Call<ZhihuDailyNews> loadHistory(@Path("date") String date); ZhihuService SERVICE_NEWS =new Retrofit.Builder() .baseUrl("http://news-at.zhihu.com/") .client(new OkHttpClient.Builder() .retryOnConnectionFailure(true)//设置失败重试 .build()) .build().create(ZhihuService.class); @GET("api/4/news/{zhihu_id}") Call<ResponseBody> loadNews(@Path("zhihu_id") String zhihuId); @GET("api/4/news/{zhihu_id}")
// Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // // Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyStory.java // public class ZhihuDailyStory { // // private String body; // private String image_source; // private String title; // private String image; // private String share_url; // private ArrayList<String> js; // private String ga_prefix; // private ArrayList<String> images; // private int type; // private int id; // private ArrayList<String> css; // // public String getBody() { // return body; // } // // public void setBody(String body) { // this.body = body; // } // // public String getImage_source() { // return image_source; // } // // public void setImage_source(String image_source) { // this.image_source = image_source; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getImage() { // return image; // } // // public void setImage(String image) { // this.image = image; // } // // public String getShare_url() { // return share_url; // } // // public void setShare_url(String share_url) { // this.share_url = share_url; // } // // public ArrayList<String> getJs() { // return js; // } // // public void setJs(ArrayList<String> js) { // this.js = js; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public ArrayList<String> getCss() { // return css; // } // // public void setCss(ArrayList<String> css) { // this.css = css; // } // // } // Path: app/src/main/java/com/hut/zero/network_request/ZhihuService.java import com.google.gson.Gson; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.bean.ZhihuDailyStory; import okhttp3.OkHttpClient; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.http.GET; import retrofit2.http.Path; package com.hut.zero.network_request; /** * Created by Zero on 2017/4/3. */ public interface ZhihuService { ZhihuService SERVICE_HISTORY =new Retrofit.Builder() .baseUrl("http://news.at.zhihu.com/") .client(new OkHttpClient.Builder() .retryOnConnectionFailure(true)//设置失败重试 .build()) .addConverterFactory(GsonConverterFactory.create(new Gson())) .build().create(ZhihuService.class); ZhihuService SERVICE_STORY =new Retrofit.Builder() .baseUrl("http://news-at.zhihu.com/") .client(new OkHttpClient.Builder() .retryOnConnectionFailure(true)//设置失败重试 .build()) .addConverterFactory(GsonConverterFactory.create(new Gson())) .build().create(ZhihuService.class); @GET("api/4/news/before/{date}") Call<ZhihuDailyNews> loadHistory(@Path("date") String date); ZhihuService SERVICE_NEWS =new Retrofit.Builder() .baseUrl("http://news-at.zhihu.com/") .client(new OkHttpClient.Builder() .retryOnConnectionFailure(true)//设置失败重试 .build()) .build().create(ZhihuService.class); @GET("api/4/news/{zhihu_id}") Call<ResponseBody> loadNews(@Path("zhihu_id") String zhihuId); @GET("api/4/news/{zhihu_id}")
Call<ZhihuDailyStory> loadStory(@Path("zhihu_id") String zhihuId);
374901588/PaperPlane
app/src/main/java/com/hut/zero/innerbrowser/InnerBrowserFragment.java
// Path: app/src/main/java/com/hut/zero/util/NetworkState.java // public class NetworkState { // // // 检查是否连接到网络 // // whether connect to internet // public static boolean networkConnected(Context context){ // // if (context != null){ // ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); // NetworkInfo info = manager.getActiveNetworkInfo(); // if (info != null) // return info.isAvailable(); // } // // return false; // } // // // 检查WiFi是否连接 // // if wifi connect // public static boolean wifiConnected(Context context){ // if (context != null){ // ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); // NetworkInfo info = manager.getActiveNetworkInfo(); // if (info != null){ // if (info.getType() == ConnectivityManager.TYPE_WIFI) // return info.isAvailable(); // } // } // return false; // } // // // 检查移动网络是否连接 // // if mobile data connect // public static boolean mobileDataConnected(Context context){ // if (context != null){ // ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); // NetworkInfo info = manager.getActiveNetworkInfo(); // if (info != null){ // if (info.getType() == ConnectivityManager.TYPE_MOBILE) // return true; // } // } // return false; // } // // }
import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.webkit.WebChromeClient; import android.webkit.WebResourceError; import android.webkit.WebResourceRequest; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.hut.zero.R; import com.hut.zero.util.NetworkState;
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_inner_browser, container, false); initViews(view); initWebViewSettings(webView); // if not set this, click the back arrow will call nothing setHasOptionsMenu(true); webView.setWebChromeClient(new WebChromeClient(){ @Override public void onProgressChanged(WebView view, int newProgress) { changeToolbarAndProgressBar(newProgress); } }); webView.setWebViewClient(new WebViewClient(){ @Override public void onReceivedError(WebView view1, WebResourceRequest request, WebResourceError error) { webView.setVisibility(View.GONE); imageView.setVisibility(View.VISIBLE); textView.setVisibility(View.VISIBLE); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) {
// Path: app/src/main/java/com/hut/zero/util/NetworkState.java // public class NetworkState { // // // 检查是否连接到网络 // // whether connect to internet // public static boolean networkConnected(Context context){ // // if (context != null){ // ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); // NetworkInfo info = manager.getActiveNetworkInfo(); // if (info != null) // return info.isAvailable(); // } // // return false; // } // // // 检查WiFi是否连接 // // if wifi connect // public static boolean wifiConnected(Context context){ // if (context != null){ // ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); // NetworkInfo info = manager.getActiveNetworkInfo(); // if (info != null){ // if (info.getType() == ConnectivityManager.TYPE_WIFI) // return info.isAvailable(); // } // } // return false; // } // // // 检查移动网络是否连接 // // if mobile data connect // public static boolean mobileDataConnected(Context context){ // if (context != null){ // ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); // NetworkInfo info = manager.getActiveNetworkInfo(); // if (info != null){ // if (info.getType() == ConnectivityManager.TYPE_MOBILE) // return true; // } // } // return false; // } // // } // Path: app/src/main/java/com/hut/zero/innerbrowser/InnerBrowserFragment.java import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.webkit.WebChromeClient; import android.webkit.WebResourceError; import android.webkit.WebResourceRequest; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.hut.zero.R; import com.hut.zero.util.NetworkState; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_inner_browser, container, false); initViews(view); initWebViewSettings(webView); // if not set this, click the back arrow will call nothing setHasOptionsMenu(true); webView.setWebChromeClient(new WebChromeClient(){ @Override public void onProgressChanged(WebView view, int newProgress) { changeToolbarAndProgressBar(newProgress); } }); webView.setWebViewClient(new WebViewClient(){ @Override public void onReceivedError(WebView view1, WebResourceRequest request, WebResourceError error) { webView.setVisibility(View.GONE); imageView.setVisibility(View.VISIBLE); textView.setVisibility(View.VISIBLE); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) {
if (NetworkState.networkConnected(getContext())){
374901588/PaperPlane
app/src/main/java/com/hut/zero/homepage/ZhihuDailyContract.java
// Path: app/src/main/java/com/hut/zero/BasePresenter.java // public interface BasePresenter { // // 获取数据并改变界面显示,在todo-mvp的项目中的调用时机为Fragment的OnResume()方法中 // void start(); // } // // Path: app/src/main/java/com/hut/zero/BaseView.java // public interface BaseView<T> { // // 为View设置Presenter // void setPresenter(T presenter); // // 初始化界面控件 // void initViews(); // } // // Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // }
import com.hut.zero.BasePresenter; import com.hut.zero.BaseView; import com.hut.zero.bean.ZhihuDailyNews; import java.util.ArrayList;
/* * Copyright 2017 lizhaotailang * * 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 com.hut.zero.homepage; /** * Created by Lizhaotailang on 2016/9/16. */ public interface ZhihuDailyContract { interface View extends BaseView<Presenter> { // 显示加载或其他类型的错误 void showError(); // 显示正在加载 void showLoading(); // 停止显示正在加载 void stopLoading(); // 成功获取到数据后,在界面中显示
// Path: app/src/main/java/com/hut/zero/BasePresenter.java // public interface BasePresenter { // // 获取数据并改变界面显示,在todo-mvp的项目中的调用时机为Fragment的OnResume()方法中 // void start(); // } // // Path: app/src/main/java/com/hut/zero/BaseView.java // public interface BaseView<T> { // // 为View设置Presenter // void setPresenter(T presenter); // // 初始化界面控件 // void initViews(); // } // // Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // Path: app/src/main/java/com/hut/zero/homepage/ZhihuDailyContract.java import com.hut.zero.BasePresenter; import com.hut.zero.BaseView; import com.hut.zero.bean.ZhihuDailyNews; import java.util.ArrayList; /* * Copyright 2017 lizhaotailang * * 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 com.hut.zero.homepage; /** * Created by Lizhaotailang on 2016/9/16. */ public interface ZhihuDailyContract { interface View extends BaseView<Presenter> { // 显示加载或其他类型的错误 void showError(); // 显示正在加载 void showLoading(); // 停止显示正在加载 void stopLoading(); // 成功获取到数据后,在界面中显示
void showResults(ArrayList<ZhihuDailyNews.Question> list);
374901588/PaperPlane
app/src/main/java/com/hut/zero/homepage/ZhihuDailyContract.java
// Path: app/src/main/java/com/hut/zero/BasePresenter.java // public interface BasePresenter { // // 获取数据并改变界面显示,在todo-mvp的项目中的调用时机为Fragment的OnResume()方法中 // void start(); // } // // Path: app/src/main/java/com/hut/zero/BaseView.java // public interface BaseView<T> { // // 为View设置Presenter // void setPresenter(T presenter); // // 初始化界面控件 // void initViews(); // } // // Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // }
import com.hut.zero.BasePresenter; import com.hut.zero.BaseView; import com.hut.zero.bean.ZhihuDailyNews; import java.util.ArrayList;
/* * Copyright 2017 lizhaotailang * * 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 com.hut.zero.homepage; /** * Created by Lizhaotailang on 2016/9/16. */ public interface ZhihuDailyContract { interface View extends BaseView<Presenter> { // 显示加载或其他类型的错误 void showError(); // 显示正在加载 void showLoading(); // 停止显示正在加载 void stopLoading(); // 成功获取到数据后,在界面中显示 void showResults(ArrayList<ZhihuDailyNews.Question> list); void showPickDialog(); }
// Path: app/src/main/java/com/hut/zero/BasePresenter.java // public interface BasePresenter { // // 获取数据并改变界面显示,在todo-mvp的项目中的调用时机为Fragment的OnResume()方法中 // void start(); // } // // Path: app/src/main/java/com/hut/zero/BaseView.java // public interface BaseView<T> { // // 为View设置Presenter // void setPresenter(T presenter); // // 初始化界面控件 // void initViews(); // } // // Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // Path: app/src/main/java/com/hut/zero/homepage/ZhihuDailyContract.java import com.hut.zero.BasePresenter; import com.hut.zero.BaseView; import com.hut.zero.bean.ZhihuDailyNews; import java.util.ArrayList; /* * Copyright 2017 lizhaotailang * * 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 com.hut.zero.homepage; /** * Created by Lizhaotailang on 2016/9/16. */ public interface ZhihuDailyContract { interface View extends BaseView<Presenter> { // 显示加载或其他类型的错误 void showError(); // 显示正在加载 void showLoading(); // 停止显示正在加载 void stopLoading(); // 成功获取到数据后,在界面中显示 void showResults(ArrayList<ZhihuDailyNews.Question> list); void showPickDialog(); }
interface Presenter extends BasePresenter {
374901588/PaperPlane
app/src/main/java/com/hut/zero/customtabs/CustomFallback.java
// Path: app/src/main/java/com/hut/zero/innerbrowser/InnerBrowserActivity.java // public class InnerBrowserActivity extends AppCompatActivity { // // @Override // protected void onCreate(@Nullable Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.frame); // // getSupportFragmentManager().beginTransaction().replace(R.id.container, InnerBrowserFragment.getInstance()).commit(); // // } // // }
import android.app.Activity; import android.content.Intent; import android.net.Uri; import com.hut.zero.innerbrowser.InnerBrowserActivity;
/* * Copyright 2017 lizhaotailang * * 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 com.hut.zero.customtabs; /** * Created by Lizhaotailang on 2016/9/4. */ public class CustomFallback implements CustomTabActivityHelper.CustomTabFallback { @Override public void openUri(Activity activity, Uri uri) {
// Path: app/src/main/java/com/hut/zero/innerbrowser/InnerBrowserActivity.java // public class InnerBrowserActivity extends AppCompatActivity { // // @Override // protected void onCreate(@Nullable Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.frame); // // getSupportFragmentManager().beginTransaction().replace(R.id.container, InnerBrowserFragment.getInstance()).commit(); // // } // // } // Path: app/src/main/java/com/hut/zero/customtabs/CustomFallback.java import android.app.Activity; import android.content.Intent; import android.net.Uri; import com.hut.zero.innerbrowser.InnerBrowserActivity; /* * Copyright 2017 lizhaotailang * * 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 com.hut.zero.customtabs; /** * Created by Lizhaotailang on 2016/9/4. */ public class CustomFallback implements CustomTabActivityHelper.CustomTabFallback { @Override public void openUri(Activity activity, Uri uri) {
activity.startActivity(new Intent(activity, InnerBrowserActivity.class).putExtra("url", uri.toString()));
374901588/PaperPlane
app/src/main/java/com/hut/zero/MyApplication.java
// Path: app/src/main/java/com/hut/zero/other_pages/SettingsPreferenceActivity.java // public class SettingsPreferenceActivity extends AppCompatActivity { // public static final String SETTINGS_CONFIG_FILE_NAME = "com.hut.zero_preferences";//设置文件的默认文件名 // // @Override // protected void onCreate(@Nullable Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_settings); // // setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); // getSupportActionBar().setDisplayHomeAsUpEnabled(true); // } // // @Override // public boolean onOptionsItemSelected(MenuItem item) { // if (item.getItemId() == android.R.id.home){ // onBackPressed(); // } // return super.onOptionsItemSelected(item); // } // // }
import android.support.v7.app.AppCompatDelegate; import com.hut.zero.other_pages.SettingsPreferenceActivity;
/* * Copyright 2017 lizhaotailang * * 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 com.hut.zero; /** * Created by Lizhaotailang on 2016/8/23. */ public class MyApplication extends org.litepal.LitePalApplication { @Override public void onCreate() { super.onCreate(); // the 'theme' has two values, 0 and 1 AppCompatDelegate.setDefaultNightMode(
// Path: app/src/main/java/com/hut/zero/other_pages/SettingsPreferenceActivity.java // public class SettingsPreferenceActivity extends AppCompatActivity { // public static final String SETTINGS_CONFIG_FILE_NAME = "com.hut.zero_preferences";//设置文件的默认文件名 // // @Override // protected void onCreate(@Nullable Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_settings); // // setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); // getSupportActionBar().setDisplayHomeAsUpEnabled(true); // } // // @Override // public boolean onOptionsItemSelected(MenuItem item) { // if (item.getItemId() == android.R.id.home){ // onBackPressed(); // } // return super.onOptionsItemSelected(item); // } // // } // Path: app/src/main/java/com/hut/zero/MyApplication.java import android.support.v7.app.AppCompatDelegate; import com.hut.zero.other_pages.SettingsPreferenceActivity; /* * Copyright 2017 lizhaotailang * * 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 com.hut.zero; /** * Created by Lizhaotailang on 2016/8/23. */ public class MyApplication extends org.litepal.LitePalApplication { @Override public void onCreate() { super.onCreate(); // the 'theme' has two values, 0 and 1 AppCompatDelegate.setDefaultNightMode(
getSharedPreferences(SettingsPreferenceActivity.SETTINGS_CONFIG_FILE_NAME,MODE_PRIVATE).getInt("theme", 0) == 0 ?
374901588/PaperPlane
app/src/main/java/com/hut/zero/adapter/ZhihuDailyNewsAdapter.java
// Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // // Path: app/src/main/java/com/hut/zero/other/OnRecyclerViewOnClickListener.java // @FunctionalInterface // public interface OnRecyclerViewOnClickListener { // // void onItemClick(View v, int position); // // } // // Path: app/src/main/java/com/hut/zero/other/BaseViewHolder.java // public class BaseViewHolder extends RecyclerView.ViewHolder { // private final ViewDataBinding binding; // // // public BaseViewHolder(ViewDataBinding binding) { // super(binding.getRoot()); // this.binding=binding; // } // // public ViewDataBinding getBinding() { // return binding; // } // } // // Path: app/src/main/java/com/hut/zero/other/DataBindingCustomAttr.java // public class DataBindingCustomAttr { // public static final String NO_LOAD="NO_LOAD"; // // @BindingAdapter({"imageUrl"}) // public static void loadImage(ImageView view, String url) { // //在设置imageUrl的值之前,会存在null的情况,所以需要加上判空的操作 // if (TextUtils.isEmpty(url)||url.equals(NO_LOAD)) view.setImageResource(R.drawable.placeholder); // else Glide.with(view.getContext()).load(url) // .asBitmap() // .placeholder(R.drawable.placeholder) // .diskCacheStrategy(DiskCacheStrategy.SOURCE) // .error(R.drawable.placeholder) // .centerCrop() // .into(view); // } // } // // Path: app/src/main/java/com/hut/zero/other/WithListenerViewHolder.java // public class WithListenerViewHolder extends BaseViewHolder implements View.OnClickListener { // private final OnRecyclerViewOnClickListener listener; // // public WithListenerViewHolder(ViewDataBinding binding,OnRecyclerViewOnClickListener listener) { // super(binding); // this.listener=listener; // binding.getRoot().setOnClickListener(this); // } // // @Override // public void onClick(View v) { // if (listener != null){ // listener.onItemClick(v,getLayoutPosition()); // } // } // }
import android.databinding.DataBindingUtil; import android.databinding.ViewDataBinding; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.ViewGroup; import com.hut.zero.BR; import com.hut.zero.R; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.other.OnRecyclerViewOnClickListener; import com.hut.zero.other.BaseViewHolder; import com.hut.zero.other.DataBindingCustomAttr; import com.hut.zero.other.WithListenerViewHolder; import java.util.List;
package com.hut.zero.adapter; /** * Created by Zero on 2017/4/3. */ public class ZhihuDailyNewsAdapter extends RecyclerView.Adapter<BaseViewHolder> { private static final int TYPE_NORMAL = 0; private static final int TYPE_FOOTER = 1;
// Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // // Path: app/src/main/java/com/hut/zero/other/OnRecyclerViewOnClickListener.java // @FunctionalInterface // public interface OnRecyclerViewOnClickListener { // // void onItemClick(View v, int position); // // } // // Path: app/src/main/java/com/hut/zero/other/BaseViewHolder.java // public class BaseViewHolder extends RecyclerView.ViewHolder { // private final ViewDataBinding binding; // // // public BaseViewHolder(ViewDataBinding binding) { // super(binding.getRoot()); // this.binding=binding; // } // // public ViewDataBinding getBinding() { // return binding; // } // } // // Path: app/src/main/java/com/hut/zero/other/DataBindingCustomAttr.java // public class DataBindingCustomAttr { // public static final String NO_LOAD="NO_LOAD"; // // @BindingAdapter({"imageUrl"}) // public static void loadImage(ImageView view, String url) { // //在设置imageUrl的值之前,会存在null的情况,所以需要加上判空的操作 // if (TextUtils.isEmpty(url)||url.equals(NO_LOAD)) view.setImageResource(R.drawable.placeholder); // else Glide.with(view.getContext()).load(url) // .asBitmap() // .placeholder(R.drawable.placeholder) // .diskCacheStrategy(DiskCacheStrategy.SOURCE) // .error(R.drawable.placeholder) // .centerCrop() // .into(view); // } // } // // Path: app/src/main/java/com/hut/zero/other/WithListenerViewHolder.java // public class WithListenerViewHolder extends BaseViewHolder implements View.OnClickListener { // private final OnRecyclerViewOnClickListener listener; // // public WithListenerViewHolder(ViewDataBinding binding,OnRecyclerViewOnClickListener listener) { // super(binding); // this.listener=listener; // binding.getRoot().setOnClickListener(this); // } // // @Override // public void onClick(View v) { // if (listener != null){ // listener.onItemClick(v,getLayoutPosition()); // } // } // } // Path: app/src/main/java/com/hut/zero/adapter/ZhihuDailyNewsAdapter.java import android.databinding.DataBindingUtil; import android.databinding.ViewDataBinding; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.ViewGroup; import com.hut.zero.BR; import com.hut.zero.R; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.other.OnRecyclerViewOnClickListener; import com.hut.zero.other.BaseViewHolder; import com.hut.zero.other.DataBindingCustomAttr; import com.hut.zero.other.WithListenerViewHolder; import java.util.List; package com.hut.zero.adapter; /** * Created by Zero on 2017/4/3. */ public class ZhihuDailyNewsAdapter extends RecyclerView.Adapter<BaseViewHolder> { private static final int TYPE_NORMAL = 0; private static final int TYPE_FOOTER = 1;
private OnRecyclerViewOnClickListener mListener;
374901588/PaperPlane
app/src/main/java/com/hut/zero/adapter/ZhihuDailyNewsAdapter.java
// Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // // Path: app/src/main/java/com/hut/zero/other/OnRecyclerViewOnClickListener.java // @FunctionalInterface // public interface OnRecyclerViewOnClickListener { // // void onItemClick(View v, int position); // // } // // Path: app/src/main/java/com/hut/zero/other/BaseViewHolder.java // public class BaseViewHolder extends RecyclerView.ViewHolder { // private final ViewDataBinding binding; // // // public BaseViewHolder(ViewDataBinding binding) { // super(binding.getRoot()); // this.binding=binding; // } // // public ViewDataBinding getBinding() { // return binding; // } // } // // Path: app/src/main/java/com/hut/zero/other/DataBindingCustomAttr.java // public class DataBindingCustomAttr { // public static final String NO_LOAD="NO_LOAD"; // // @BindingAdapter({"imageUrl"}) // public static void loadImage(ImageView view, String url) { // //在设置imageUrl的值之前,会存在null的情况,所以需要加上判空的操作 // if (TextUtils.isEmpty(url)||url.equals(NO_LOAD)) view.setImageResource(R.drawable.placeholder); // else Glide.with(view.getContext()).load(url) // .asBitmap() // .placeholder(R.drawable.placeholder) // .diskCacheStrategy(DiskCacheStrategy.SOURCE) // .error(R.drawable.placeholder) // .centerCrop() // .into(view); // } // } // // Path: app/src/main/java/com/hut/zero/other/WithListenerViewHolder.java // public class WithListenerViewHolder extends BaseViewHolder implements View.OnClickListener { // private final OnRecyclerViewOnClickListener listener; // // public WithListenerViewHolder(ViewDataBinding binding,OnRecyclerViewOnClickListener listener) { // super(binding); // this.listener=listener; // binding.getRoot().setOnClickListener(this); // } // // @Override // public void onClick(View v) { // if (listener != null){ // listener.onItemClick(v,getLayoutPosition()); // } // } // }
import android.databinding.DataBindingUtil; import android.databinding.ViewDataBinding; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.ViewGroup; import com.hut.zero.BR; import com.hut.zero.R; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.other.OnRecyclerViewOnClickListener; import com.hut.zero.other.BaseViewHolder; import com.hut.zero.other.DataBindingCustomAttr; import com.hut.zero.other.WithListenerViewHolder; import java.util.List;
package com.hut.zero.adapter; /** * Created by Zero on 2017/4/3. */ public class ZhihuDailyNewsAdapter extends RecyclerView.Adapter<BaseViewHolder> { private static final int TYPE_NORMAL = 0; private static final int TYPE_FOOTER = 1; private OnRecyclerViewOnClickListener mListener;
// Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // // Path: app/src/main/java/com/hut/zero/other/OnRecyclerViewOnClickListener.java // @FunctionalInterface // public interface OnRecyclerViewOnClickListener { // // void onItemClick(View v, int position); // // } // // Path: app/src/main/java/com/hut/zero/other/BaseViewHolder.java // public class BaseViewHolder extends RecyclerView.ViewHolder { // private final ViewDataBinding binding; // // // public BaseViewHolder(ViewDataBinding binding) { // super(binding.getRoot()); // this.binding=binding; // } // // public ViewDataBinding getBinding() { // return binding; // } // } // // Path: app/src/main/java/com/hut/zero/other/DataBindingCustomAttr.java // public class DataBindingCustomAttr { // public static final String NO_LOAD="NO_LOAD"; // // @BindingAdapter({"imageUrl"}) // public static void loadImage(ImageView view, String url) { // //在设置imageUrl的值之前,会存在null的情况,所以需要加上判空的操作 // if (TextUtils.isEmpty(url)||url.equals(NO_LOAD)) view.setImageResource(R.drawable.placeholder); // else Glide.with(view.getContext()).load(url) // .asBitmap() // .placeholder(R.drawable.placeholder) // .diskCacheStrategy(DiskCacheStrategy.SOURCE) // .error(R.drawable.placeholder) // .centerCrop() // .into(view); // } // } // // Path: app/src/main/java/com/hut/zero/other/WithListenerViewHolder.java // public class WithListenerViewHolder extends BaseViewHolder implements View.OnClickListener { // private final OnRecyclerViewOnClickListener listener; // // public WithListenerViewHolder(ViewDataBinding binding,OnRecyclerViewOnClickListener listener) { // super(binding); // this.listener=listener; // binding.getRoot().setOnClickListener(this); // } // // @Override // public void onClick(View v) { // if (listener != null){ // listener.onItemClick(v,getLayoutPosition()); // } // } // } // Path: app/src/main/java/com/hut/zero/adapter/ZhihuDailyNewsAdapter.java import android.databinding.DataBindingUtil; import android.databinding.ViewDataBinding; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.ViewGroup; import com.hut.zero.BR; import com.hut.zero.R; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.other.OnRecyclerViewOnClickListener; import com.hut.zero.other.BaseViewHolder; import com.hut.zero.other.DataBindingCustomAttr; import com.hut.zero.other.WithListenerViewHolder; import java.util.List; package com.hut.zero.adapter; /** * Created by Zero on 2017/4/3. */ public class ZhihuDailyNewsAdapter extends RecyclerView.Adapter<BaseViewHolder> { private static final int TYPE_NORMAL = 0; private static final int TYPE_FOOTER = 1; private OnRecyclerViewOnClickListener mListener;
private List<ZhihuDailyNews.Question> data;
374901588/PaperPlane
app/src/main/java/com/hut/zero/adapter/ZhihuDailyNewsAdapter.java
// Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // // Path: app/src/main/java/com/hut/zero/other/OnRecyclerViewOnClickListener.java // @FunctionalInterface // public interface OnRecyclerViewOnClickListener { // // void onItemClick(View v, int position); // // } // // Path: app/src/main/java/com/hut/zero/other/BaseViewHolder.java // public class BaseViewHolder extends RecyclerView.ViewHolder { // private final ViewDataBinding binding; // // // public BaseViewHolder(ViewDataBinding binding) { // super(binding.getRoot()); // this.binding=binding; // } // // public ViewDataBinding getBinding() { // return binding; // } // } // // Path: app/src/main/java/com/hut/zero/other/DataBindingCustomAttr.java // public class DataBindingCustomAttr { // public static final String NO_LOAD="NO_LOAD"; // // @BindingAdapter({"imageUrl"}) // public static void loadImage(ImageView view, String url) { // //在设置imageUrl的值之前,会存在null的情况,所以需要加上判空的操作 // if (TextUtils.isEmpty(url)||url.equals(NO_LOAD)) view.setImageResource(R.drawable.placeholder); // else Glide.with(view.getContext()).load(url) // .asBitmap() // .placeholder(R.drawable.placeholder) // .diskCacheStrategy(DiskCacheStrategy.SOURCE) // .error(R.drawable.placeholder) // .centerCrop() // .into(view); // } // } // // Path: app/src/main/java/com/hut/zero/other/WithListenerViewHolder.java // public class WithListenerViewHolder extends BaseViewHolder implements View.OnClickListener { // private final OnRecyclerViewOnClickListener listener; // // public WithListenerViewHolder(ViewDataBinding binding,OnRecyclerViewOnClickListener listener) { // super(binding); // this.listener=listener; // binding.getRoot().setOnClickListener(this); // } // // @Override // public void onClick(View v) { // if (listener != null){ // listener.onItemClick(v,getLayoutPosition()); // } // } // }
import android.databinding.DataBindingUtil; import android.databinding.ViewDataBinding; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.ViewGroup; import com.hut.zero.BR; import com.hut.zero.R; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.other.OnRecyclerViewOnClickListener; import com.hut.zero.other.BaseViewHolder; import com.hut.zero.other.DataBindingCustomAttr; import com.hut.zero.other.WithListenerViewHolder; import java.util.List;
package com.hut.zero.adapter; /** * Created by Zero on 2017/4/3. */ public class ZhihuDailyNewsAdapter extends RecyclerView.Adapter<BaseViewHolder> { private static final int TYPE_NORMAL = 0; private static final int TYPE_FOOTER = 1; private OnRecyclerViewOnClickListener mListener; private List<ZhihuDailyNews.Question> data; public ZhihuDailyNewsAdapter(List<ZhihuDailyNews.Question> data) { this.data = data; } @Override public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case TYPE_NORMAL:
// Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // // Path: app/src/main/java/com/hut/zero/other/OnRecyclerViewOnClickListener.java // @FunctionalInterface // public interface OnRecyclerViewOnClickListener { // // void onItemClick(View v, int position); // // } // // Path: app/src/main/java/com/hut/zero/other/BaseViewHolder.java // public class BaseViewHolder extends RecyclerView.ViewHolder { // private final ViewDataBinding binding; // // // public BaseViewHolder(ViewDataBinding binding) { // super(binding.getRoot()); // this.binding=binding; // } // // public ViewDataBinding getBinding() { // return binding; // } // } // // Path: app/src/main/java/com/hut/zero/other/DataBindingCustomAttr.java // public class DataBindingCustomAttr { // public static final String NO_LOAD="NO_LOAD"; // // @BindingAdapter({"imageUrl"}) // public static void loadImage(ImageView view, String url) { // //在设置imageUrl的值之前,会存在null的情况,所以需要加上判空的操作 // if (TextUtils.isEmpty(url)||url.equals(NO_LOAD)) view.setImageResource(R.drawable.placeholder); // else Glide.with(view.getContext()).load(url) // .asBitmap() // .placeholder(R.drawable.placeholder) // .diskCacheStrategy(DiskCacheStrategy.SOURCE) // .error(R.drawable.placeholder) // .centerCrop() // .into(view); // } // } // // Path: app/src/main/java/com/hut/zero/other/WithListenerViewHolder.java // public class WithListenerViewHolder extends BaseViewHolder implements View.OnClickListener { // private final OnRecyclerViewOnClickListener listener; // // public WithListenerViewHolder(ViewDataBinding binding,OnRecyclerViewOnClickListener listener) { // super(binding); // this.listener=listener; // binding.getRoot().setOnClickListener(this); // } // // @Override // public void onClick(View v) { // if (listener != null){ // listener.onItemClick(v,getLayoutPosition()); // } // } // } // Path: app/src/main/java/com/hut/zero/adapter/ZhihuDailyNewsAdapter.java import android.databinding.DataBindingUtil; import android.databinding.ViewDataBinding; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.ViewGroup; import com.hut.zero.BR; import com.hut.zero.R; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.other.OnRecyclerViewOnClickListener; import com.hut.zero.other.BaseViewHolder; import com.hut.zero.other.DataBindingCustomAttr; import com.hut.zero.other.WithListenerViewHolder; import java.util.List; package com.hut.zero.adapter; /** * Created by Zero on 2017/4/3. */ public class ZhihuDailyNewsAdapter extends RecyclerView.Adapter<BaseViewHolder> { private static final int TYPE_NORMAL = 0; private static final int TYPE_FOOTER = 1; private OnRecyclerViewOnClickListener mListener; private List<ZhihuDailyNews.Question> data; public ZhihuDailyNewsAdapter(List<ZhihuDailyNews.Question> data) { this.data = data; } @Override public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case TYPE_NORMAL:
return new WithListenerViewHolder(
374901588/PaperPlane
app/src/main/java/com/hut/zero/adapter/ZhihuDailyNewsAdapter.java
// Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // // Path: app/src/main/java/com/hut/zero/other/OnRecyclerViewOnClickListener.java // @FunctionalInterface // public interface OnRecyclerViewOnClickListener { // // void onItemClick(View v, int position); // // } // // Path: app/src/main/java/com/hut/zero/other/BaseViewHolder.java // public class BaseViewHolder extends RecyclerView.ViewHolder { // private final ViewDataBinding binding; // // // public BaseViewHolder(ViewDataBinding binding) { // super(binding.getRoot()); // this.binding=binding; // } // // public ViewDataBinding getBinding() { // return binding; // } // } // // Path: app/src/main/java/com/hut/zero/other/DataBindingCustomAttr.java // public class DataBindingCustomAttr { // public static final String NO_LOAD="NO_LOAD"; // // @BindingAdapter({"imageUrl"}) // public static void loadImage(ImageView view, String url) { // //在设置imageUrl的值之前,会存在null的情况,所以需要加上判空的操作 // if (TextUtils.isEmpty(url)||url.equals(NO_LOAD)) view.setImageResource(R.drawable.placeholder); // else Glide.with(view.getContext()).load(url) // .asBitmap() // .placeholder(R.drawable.placeholder) // .diskCacheStrategy(DiskCacheStrategy.SOURCE) // .error(R.drawable.placeholder) // .centerCrop() // .into(view); // } // } // // Path: app/src/main/java/com/hut/zero/other/WithListenerViewHolder.java // public class WithListenerViewHolder extends BaseViewHolder implements View.OnClickListener { // private final OnRecyclerViewOnClickListener listener; // // public WithListenerViewHolder(ViewDataBinding binding,OnRecyclerViewOnClickListener listener) { // super(binding); // this.listener=listener; // binding.getRoot().setOnClickListener(this); // } // // @Override // public void onClick(View v) { // if (listener != null){ // listener.onItemClick(v,getLayoutPosition()); // } // } // }
import android.databinding.DataBindingUtil; import android.databinding.ViewDataBinding; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.ViewGroup; import com.hut.zero.BR; import com.hut.zero.R; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.other.OnRecyclerViewOnClickListener; import com.hut.zero.other.BaseViewHolder; import com.hut.zero.other.DataBindingCustomAttr; import com.hut.zero.other.WithListenerViewHolder; import java.util.List;
package com.hut.zero.adapter; /** * Created by Zero on 2017/4/3. */ public class ZhihuDailyNewsAdapter extends RecyclerView.Adapter<BaseViewHolder> { private static final int TYPE_NORMAL = 0; private static final int TYPE_FOOTER = 1; private OnRecyclerViewOnClickListener mListener; private List<ZhihuDailyNews.Question> data; public ZhihuDailyNewsAdapter(List<ZhihuDailyNews.Question> data) { this.data = data; } @Override public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case TYPE_NORMAL: return new WithListenerViewHolder( DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.home_list_item_layout, parent, false), mListener); case TYPE_FOOTER: return new BaseViewHolder( DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.home_list_item_layout, parent, false)); } return null; } @Override public void onBindViewHolder(BaseViewHolder holder, int position) { if (holder instanceof WithListenerViewHolder) {//holder instanceof NormalViewHolder ZhihuDailyNews.Question item = data.get(position); //DataBindingCustomAttr.DataBindingCustomAttr()
// Path: app/src/main/java/com/hut/zero/bean/ZhihuDailyNews.java // public class ZhihuDailyNews { // // private String date; // private ArrayList<Question> stories; // // public String getDate() { // return date; // } // // public void setDate(String date) { // this.date = date; // } // // public ArrayList<Question> getStories() { // return stories; // } // // public void setStories(ArrayList<Question> stories) { // this.stories = stories; // } // // public class Question { // // private ArrayList<String> images; // private int type; // private int id; // private String ga_prefix; // private String title; // // public ArrayList<String> getImages() { // return images; // } // // public void setImages(ArrayList<String> images) { // this.images = images; // } // // public int getType() { // return type; // } // // public void setType(int type) { // this.type = type; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getGa_prefix() { // return ga_prefix; // } // // public void setGa_prefix(String ga_prefix) { // this.ga_prefix = ga_prefix; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // } // // } // // Path: app/src/main/java/com/hut/zero/other/OnRecyclerViewOnClickListener.java // @FunctionalInterface // public interface OnRecyclerViewOnClickListener { // // void onItemClick(View v, int position); // // } // // Path: app/src/main/java/com/hut/zero/other/BaseViewHolder.java // public class BaseViewHolder extends RecyclerView.ViewHolder { // private final ViewDataBinding binding; // // // public BaseViewHolder(ViewDataBinding binding) { // super(binding.getRoot()); // this.binding=binding; // } // // public ViewDataBinding getBinding() { // return binding; // } // } // // Path: app/src/main/java/com/hut/zero/other/DataBindingCustomAttr.java // public class DataBindingCustomAttr { // public static final String NO_LOAD="NO_LOAD"; // // @BindingAdapter({"imageUrl"}) // public static void loadImage(ImageView view, String url) { // //在设置imageUrl的值之前,会存在null的情况,所以需要加上判空的操作 // if (TextUtils.isEmpty(url)||url.equals(NO_LOAD)) view.setImageResource(R.drawable.placeholder); // else Glide.with(view.getContext()).load(url) // .asBitmap() // .placeholder(R.drawable.placeholder) // .diskCacheStrategy(DiskCacheStrategy.SOURCE) // .error(R.drawable.placeholder) // .centerCrop() // .into(view); // } // } // // Path: app/src/main/java/com/hut/zero/other/WithListenerViewHolder.java // public class WithListenerViewHolder extends BaseViewHolder implements View.OnClickListener { // private final OnRecyclerViewOnClickListener listener; // // public WithListenerViewHolder(ViewDataBinding binding,OnRecyclerViewOnClickListener listener) { // super(binding); // this.listener=listener; // binding.getRoot().setOnClickListener(this); // } // // @Override // public void onClick(View v) { // if (listener != null){ // listener.onItemClick(v,getLayoutPosition()); // } // } // } // Path: app/src/main/java/com/hut/zero/adapter/ZhihuDailyNewsAdapter.java import android.databinding.DataBindingUtil; import android.databinding.ViewDataBinding; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.ViewGroup; import com.hut.zero.BR; import com.hut.zero.R; import com.hut.zero.bean.ZhihuDailyNews; import com.hut.zero.other.OnRecyclerViewOnClickListener; import com.hut.zero.other.BaseViewHolder; import com.hut.zero.other.DataBindingCustomAttr; import com.hut.zero.other.WithListenerViewHolder; import java.util.List; package com.hut.zero.adapter; /** * Created by Zero on 2017/4/3. */ public class ZhihuDailyNewsAdapter extends RecyclerView.Adapter<BaseViewHolder> { private static final int TYPE_NORMAL = 0; private static final int TYPE_FOOTER = 1; private OnRecyclerViewOnClickListener mListener; private List<ZhihuDailyNews.Question> data; public ZhihuDailyNewsAdapter(List<ZhihuDailyNews.Question> data) { this.data = data; } @Override public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case TYPE_NORMAL: return new WithListenerViewHolder( DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.home_list_item_layout, parent, false), mListener); case TYPE_FOOTER: return new BaseViewHolder( DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.home_list_item_layout, parent, false)); } return null; } @Override public void onBindViewHolder(BaseViewHolder holder, int position) { if (holder instanceof WithListenerViewHolder) {//holder instanceof NormalViewHolder ZhihuDailyNews.Question item = data.get(position); //DataBindingCustomAttr.DataBindingCustomAttr()
holder.getBinding().setVariable(BR.imgUrl,(item.getImages().get(0) == null? DataBindingCustomAttr.NO_LOAD:item.getImages().get(0)));
GoogleCloudPlatform/point-of-sale
point-of-sale-app/inventory/src/main/java/com/google/abmedge/inventory/dao/InventoryStoreConnector.java
// Path: point-of-sale-app/inventory/src/main/java/com/google/abmedge/inventory/util/InventoryStoreConnectorException.java // public class InventoryStoreConnectorException extends Exception { // private static final long serialVersionUID = 8828512147713293558L; // // public InventoryStoreConnectorException() { // super(); // } // // public InventoryStoreConnectorException(String message, Throwable cause) { // super(message, cause); // } // // public InventoryStoreConnectorException(String message) { // super(message); // } // // public InventoryStoreConnectorException(Throwable cause) { // super(cause); // } // } // // Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/Item.java // public class Item { // // private UUID id; // private String name; // private String type; // private Number price; // private String imageUrl; // private long quantity; // private List<String> labels; // // public Item() { // this.labels = new ArrayList<>(); // } // // public static Item from(Item item) { // Item copyItem = new Item(); // copyItem.id = item.id; // copyItem.type = item.type; // copyItem.name = item.name; // copyItem.price = item.price; // copyItem.imageUrl = item.imageUrl; // copyItem.quantity = item.quantity; // copyItem.getLabels().addAll(item.getLabels()); // return copyItem; // } // // public UUID getId() { // return id; // } // // public void setId(UUID id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getType() { // return type; // } // // public void setType(String type) { // this.type = type; // } // // public long getQuantity() { // return quantity; // } // // public void setQuantity(long quantity) { // this.quantity = quantity; // } // // public Number getPrice() { // return price; // } // // public void setPrice(Number price) { // this.price = price; // } // // public String getImageUrl() { // return imageUrl; // } // // public void setImageUrl(String imageUrl) { // this.imageUrl = imageUrl; // } // // public List<String> getLabels() { // return labels; // } // // public void setLabels(List<String> labels) { // this.labels = labels; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (!(o instanceof Item)) { // return false; // } // Item item = (Item) o; // return id.equals(item.id) // && name.equals(item.name) // && type.equals(item.type) // && price.equals(item.price); // } // // @Override // public int hashCode() { // return Objects.hash(id, name, type, price); // } // // @Override // public String toString() { // return new StringJoiner(", ", Item.class.getSimpleName() + "[", "]") // .add("id=" + id) // .add("name='" + name + "'") // .add("type='" + type + "'") // .add("price=" + price) // .add("imageUrl='" + imageUrl + "'") // .add("quantity=" + quantity) // .add("labels=" + labels) // .toString(); // } // }
import com.google.abmedge.inventory.util.InventoryStoreConnectorException; import com.google.abmedge.dto.Item; import java.util.List; import java.util.Optional; import java.util.Set; import java.util.UUID;
// Copyright 2021 Google LLC // // 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 com.google.abmedge.inventory.dao; /** * {@link InventoryStoreConnector} explains the interface using which we can interact with the * underlying store that holds all the inventory information. Implementations of this interface may * be storing and retrieving items from different places. */ public interface InventoryStoreConnector { /** * This method fetches all the items from the underlying store irrespective of what type the items * are or what type the inventory system's context is set to serve. * * @return a complete list of all the items currently available */ List<Item> getAll(); /** * This method returns a list of all the items from the underlying store that matches a specific * type indicated by the input argument. * * @param type the type of items to be loaded from the store * @return a list of all items in the store that are of the type passed in as argument */ List<Item> getAllByType(String type); /** * This method returns all the different types of items that are present in the inventory. * * @return a set of strings consisting of all the different item types */ Set<String> getTypes(); /** * This method fetches the item from the underlying store that has the ID matching the input * argument to the method. The response is returned wrapped in an {@link Optional<Item>} object. * Thus if there is no item in the store that has the given ID then an {@link Optional#empty()} * instance is returned. * * @param id the ID of the item that is to be retrieved from the store * @return the item that has the given ID wrapped in an {@link Optional<Item>} object; if no such * item exists then return {@link Optional#empty()} */ Optional<Item> getById(UUID id); /** * This method takes in a list of {@link Item}s and inserts them into the underlying store. A * boolean value is returned indicating if the insert operation was SUCCESS or FAILURE. * * @param item the item to be inserted into the store * @return true if the insert operation was successful and false if not */
// Path: point-of-sale-app/inventory/src/main/java/com/google/abmedge/inventory/util/InventoryStoreConnectorException.java // public class InventoryStoreConnectorException extends Exception { // private static final long serialVersionUID = 8828512147713293558L; // // public InventoryStoreConnectorException() { // super(); // } // // public InventoryStoreConnectorException(String message, Throwable cause) { // super(message, cause); // } // // public InventoryStoreConnectorException(String message) { // super(message); // } // // public InventoryStoreConnectorException(Throwable cause) { // super(cause); // } // } // // Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/Item.java // public class Item { // // private UUID id; // private String name; // private String type; // private Number price; // private String imageUrl; // private long quantity; // private List<String> labels; // // public Item() { // this.labels = new ArrayList<>(); // } // // public static Item from(Item item) { // Item copyItem = new Item(); // copyItem.id = item.id; // copyItem.type = item.type; // copyItem.name = item.name; // copyItem.price = item.price; // copyItem.imageUrl = item.imageUrl; // copyItem.quantity = item.quantity; // copyItem.getLabels().addAll(item.getLabels()); // return copyItem; // } // // public UUID getId() { // return id; // } // // public void setId(UUID id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getType() { // return type; // } // // public void setType(String type) { // this.type = type; // } // // public long getQuantity() { // return quantity; // } // // public void setQuantity(long quantity) { // this.quantity = quantity; // } // // public Number getPrice() { // return price; // } // // public void setPrice(Number price) { // this.price = price; // } // // public String getImageUrl() { // return imageUrl; // } // // public void setImageUrl(String imageUrl) { // this.imageUrl = imageUrl; // } // // public List<String> getLabels() { // return labels; // } // // public void setLabels(List<String> labels) { // this.labels = labels; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (!(o instanceof Item)) { // return false; // } // Item item = (Item) o; // return id.equals(item.id) // && name.equals(item.name) // && type.equals(item.type) // && price.equals(item.price); // } // // @Override // public int hashCode() { // return Objects.hash(id, name, type, price); // } // // @Override // public String toString() { // return new StringJoiner(", ", Item.class.getSimpleName() + "[", "]") // .add("id=" + id) // .add("name='" + name + "'") // .add("type='" + type + "'") // .add("price=" + price) // .add("imageUrl='" + imageUrl + "'") // .add("quantity=" + quantity) // .add("labels=" + labels) // .toString(); // } // } // Path: point-of-sale-app/inventory/src/main/java/com/google/abmedge/inventory/dao/InventoryStoreConnector.java import com.google.abmedge.inventory.util.InventoryStoreConnectorException; import com.google.abmedge.dto.Item; import java.util.List; import java.util.Optional; import java.util.Set; import java.util.UUID; // Copyright 2021 Google LLC // // 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 com.google.abmedge.inventory.dao; /** * {@link InventoryStoreConnector} explains the interface using which we can interact with the * underlying store that holds all the inventory information. Implementations of this interface may * be storing and retrieving items from different places. */ public interface InventoryStoreConnector { /** * This method fetches all the items from the underlying store irrespective of what type the items * are or what type the inventory system's context is set to serve. * * @return a complete list of all the items currently available */ List<Item> getAll(); /** * This method returns a list of all the items from the underlying store that matches a specific * type indicated by the input argument. * * @param type the type of items to be loaded from the store * @return a list of all items in the store that are of the type passed in as argument */ List<Item> getAllByType(String type); /** * This method returns all the different types of items that are present in the inventory. * * @return a set of strings consisting of all the different item types */ Set<String> getTypes(); /** * This method fetches the item from the underlying store that has the ID matching the input * argument to the method. The response is returned wrapped in an {@link Optional<Item>} object. * Thus if there is no item in the store that has the given ID then an {@link Optional#empty()} * instance is returned. * * @param id the ID of the item that is to be retrieved from the store * @return the item that has the given ID wrapped in an {@link Optional<Item>} object; if no such * item exists then return {@link Optional#empty()} */ Optional<Item> getById(UUID id); /** * This method takes in a list of {@link Item}s and inserts them into the underlying store. A * boolean value is returned indicating if the insert operation was SUCCESS or FAILURE. * * @param item the item to be inserted into the store * @return true if the insert operation was successful and false if not */
void insert(Item item) throws InventoryStoreConnectorException;
GoogleCloudPlatform/point-of-sale
point-of-sale-app/inventory/src/main/java/com/google/abmedge/inventory/dao/InMemoryStoreConnector.java
// Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/Item.java // public class Item { // // private UUID id; // private String name; // private String type; // private Number price; // private String imageUrl; // private long quantity; // private List<String> labels; // // public Item() { // this.labels = new ArrayList<>(); // } // // public static Item from(Item item) { // Item copyItem = new Item(); // copyItem.id = item.id; // copyItem.type = item.type; // copyItem.name = item.name; // copyItem.price = item.price; // copyItem.imageUrl = item.imageUrl; // copyItem.quantity = item.quantity; // copyItem.getLabels().addAll(item.getLabels()); // return copyItem; // } // // public UUID getId() { // return id; // } // // public void setId(UUID id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getType() { // return type; // } // // public void setType(String type) { // this.type = type; // } // // public long getQuantity() { // return quantity; // } // // public void setQuantity(long quantity) { // this.quantity = quantity; // } // // public Number getPrice() { // return price; // } // // public void setPrice(Number price) { // this.price = price; // } // // public String getImageUrl() { // return imageUrl; // } // // public void setImageUrl(String imageUrl) { // this.imageUrl = imageUrl; // } // // public List<String> getLabels() { // return labels; // } // // public void setLabels(List<String> labels) { // this.labels = labels; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (!(o instanceof Item)) { // return false; // } // Item item = (Item) o; // return id.equals(item.id) // && name.equals(item.name) // && type.equals(item.type) // && price.equals(item.price); // } // // @Override // public int hashCode() { // return Objects.hash(id, name, type, price); // } // // @Override // public String toString() { // return new StringJoiner(", ", Item.class.getSimpleName() + "[", "]") // .add("id=" + id) // .add("name='" + name + "'") // .add("type='" + type + "'") // .add("price=" + price) // .add("imageUrl='" + imageUrl + "'") // .add("quantity=" + quantity) // .add("labels=" + labels) // .toString(); // } // } // // Path: point-of-sale-app/inventory/src/main/java/com/google/abmedge/inventory/util/InventoryStoreConnectorException.java // public class InventoryStoreConnectorException extends Exception { // private static final long serialVersionUID = 8828512147713293558L; // // public InventoryStoreConnectorException() { // super(); // } // // public InventoryStoreConnectorException(String message, Throwable cause) { // super(message, cause); // } // // public InventoryStoreConnectorException(String message) { // super(message); // } // // public InventoryStoreConnectorException(Throwable cause) { // super(cause); // } // }
import com.google.abmedge.dto.Item; import com.google.abmedge.inventory.util.InventoryStoreConnectorException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger;
// Copyright 2021 Google LLC // // 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 com.google.abmedge.inventory.dao; /** * An implementation of the {@link InventoryStoreConnector} that uses an in memory data structure to * hold all the inventory information. This implementation uses a simple HashMap to store all the * items */ public class InMemoryStoreConnector implements InventoryStoreConnector { private static final Logger LOGGER = LogManager.getLogger(InMemoryStoreConnector.class);
// Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/Item.java // public class Item { // // private UUID id; // private String name; // private String type; // private Number price; // private String imageUrl; // private long quantity; // private List<String> labels; // // public Item() { // this.labels = new ArrayList<>(); // } // // public static Item from(Item item) { // Item copyItem = new Item(); // copyItem.id = item.id; // copyItem.type = item.type; // copyItem.name = item.name; // copyItem.price = item.price; // copyItem.imageUrl = item.imageUrl; // copyItem.quantity = item.quantity; // copyItem.getLabels().addAll(item.getLabels()); // return copyItem; // } // // public UUID getId() { // return id; // } // // public void setId(UUID id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getType() { // return type; // } // // public void setType(String type) { // this.type = type; // } // // public long getQuantity() { // return quantity; // } // // public void setQuantity(long quantity) { // this.quantity = quantity; // } // // public Number getPrice() { // return price; // } // // public void setPrice(Number price) { // this.price = price; // } // // public String getImageUrl() { // return imageUrl; // } // // public void setImageUrl(String imageUrl) { // this.imageUrl = imageUrl; // } // // public List<String> getLabels() { // return labels; // } // // public void setLabels(List<String> labels) { // this.labels = labels; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (!(o instanceof Item)) { // return false; // } // Item item = (Item) o; // return id.equals(item.id) // && name.equals(item.name) // && type.equals(item.type) // && price.equals(item.price); // } // // @Override // public int hashCode() { // return Objects.hash(id, name, type, price); // } // // @Override // public String toString() { // return new StringJoiner(", ", Item.class.getSimpleName() + "[", "]") // .add("id=" + id) // .add("name='" + name + "'") // .add("type='" + type + "'") // .add("price=" + price) // .add("imageUrl='" + imageUrl + "'") // .add("quantity=" + quantity) // .add("labels=" + labels) // .toString(); // } // } // // Path: point-of-sale-app/inventory/src/main/java/com/google/abmedge/inventory/util/InventoryStoreConnectorException.java // public class InventoryStoreConnectorException extends Exception { // private static final long serialVersionUID = 8828512147713293558L; // // public InventoryStoreConnectorException() { // super(); // } // // public InventoryStoreConnectorException(String message, Throwable cause) { // super(message, cause); // } // // public InventoryStoreConnectorException(String message) { // super(message); // } // // public InventoryStoreConnectorException(Throwable cause) { // super(cause); // } // } // Path: point-of-sale-app/inventory/src/main/java/com/google/abmedge/inventory/dao/InMemoryStoreConnector.java import com.google.abmedge.dto.Item; import com.google.abmedge.inventory.util.InventoryStoreConnectorException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // Copyright 2021 Google LLC // // 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 com.google.abmedge.inventory.dao; /** * An implementation of the {@link InventoryStoreConnector} that uses an in memory data structure to * hold all the inventory information. This implementation uses a simple HashMap to store all the * items */ public class InMemoryStoreConnector implements InventoryStoreConnector { private static final Logger LOGGER = LogManager.getLogger(InMemoryStoreConnector.class);
private static final Map<UUID, Item> idToItemsMap = new ConcurrentHashMap<>();
GoogleCloudPlatform/point-of-sale
point-of-sale-app/inventory/src/main/java/com/google/abmedge/inventory/dao/InMemoryStoreConnector.java
// Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/Item.java // public class Item { // // private UUID id; // private String name; // private String type; // private Number price; // private String imageUrl; // private long quantity; // private List<String> labels; // // public Item() { // this.labels = new ArrayList<>(); // } // // public static Item from(Item item) { // Item copyItem = new Item(); // copyItem.id = item.id; // copyItem.type = item.type; // copyItem.name = item.name; // copyItem.price = item.price; // copyItem.imageUrl = item.imageUrl; // copyItem.quantity = item.quantity; // copyItem.getLabels().addAll(item.getLabels()); // return copyItem; // } // // public UUID getId() { // return id; // } // // public void setId(UUID id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getType() { // return type; // } // // public void setType(String type) { // this.type = type; // } // // public long getQuantity() { // return quantity; // } // // public void setQuantity(long quantity) { // this.quantity = quantity; // } // // public Number getPrice() { // return price; // } // // public void setPrice(Number price) { // this.price = price; // } // // public String getImageUrl() { // return imageUrl; // } // // public void setImageUrl(String imageUrl) { // this.imageUrl = imageUrl; // } // // public List<String> getLabels() { // return labels; // } // // public void setLabels(List<String> labels) { // this.labels = labels; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (!(o instanceof Item)) { // return false; // } // Item item = (Item) o; // return id.equals(item.id) // && name.equals(item.name) // && type.equals(item.type) // && price.equals(item.price); // } // // @Override // public int hashCode() { // return Objects.hash(id, name, type, price); // } // // @Override // public String toString() { // return new StringJoiner(", ", Item.class.getSimpleName() + "[", "]") // .add("id=" + id) // .add("name='" + name + "'") // .add("type='" + type + "'") // .add("price=" + price) // .add("imageUrl='" + imageUrl + "'") // .add("quantity=" + quantity) // .add("labels=" + labels) // .toString(); // } // } // // Path: point-of-sale-app/inventory/src/main/java/com/google/abmedge/inventory/util/InventoryStoreConnectorException.java // public class InventoryStoreConnectorException extends Exception { // private static final long serialVersionUID = 8828512147713293558L; // // public InventoryStoreConnectorException() { // super(); // } // // public InventoryStoreConnectorException(String message, Throwable cause) { // super(message, cause); // } // // public InventoryStoreConnectorException(String message) { // super(message); // } // // public InventoryStoreConnectorException(Throwable cause) { // super(cause); // } // }
import com.google.abmedge.dto.Item; import com.google.abmedge.inventory.util.InventoryStoreConnectorException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger;
// Copyright 2021 Google LLC // // 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 com.google.abmedge.inventory.dao; /** * An implementation of the {@link InventoryStoreConnector} that uses an in memory data structure to * hold all the inventory information. This implementation uses a simple HashMap to store all the * items */ public class InMemoryStoreConnector implements InventoryStoreConnector { private static final Logger LOGGER = LogManager.getLogger(InMemoryStoreConnector.class); private static final Map<UUID, Item> idToItemsMap = new ConcurrentHashMap<>(); private static final Map<String, List<Item>> typeToItemsMap = new ConcurrentHashMap<>(); @Override public List<Item> getAll() { return idToItemsMap.values().stream().map(Item::from).collect(Collectors.toList()); } @Override public List<Item> getAllByType(String type) { return typeToItemsMap.get(type); } @Override public Optional<Item> getById(UUID id) { return idToItemsMap.values().stream() .filter(i -> i.getId().equals(id)) .map(Item::from) .findAny(); } @Override public Set<String> getTypes() { return typeToItemsMap.keySet(); } @Override
// Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/Item.java // public class Item { // // private UUID id; // private String name; // private String type; // private Number price; // private String imageUrl; // private long quantity; // private List<String> labels; // // public Item() { // this.labels = new ArrayList<>(); // } // // public static Item from(Item item) { // Item copyItem = new Item(); // copyItem.id = item.id; // copyItem.type = item.type; // copyItem.name = item.name; // copyItem.price = item.price; // copyItem.imageUrl = item.imageUrl; // copyItem.quantity = item.quantity; // copyItem.getLabels().addAll(item.getLabels()); // return copyItem; // } // // public UUID getId() { // return id; // } // // public void setId(UUID id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getType() { // return type; // } // // public void setType(String type) { // this.type = type; // } // // public long getQuantity() { // return quantity; // } // // public void setQuantity(long quantity) { // this.quantity = quantity; // } // // public Number getPrice() { // return price; // } // // public void setPrice(Number price) { // this.price = price; // } // // public String getImageUrl() { // return imageUrl; // } // // public void setImageUrl(String imageUrl) { // this.imageUrl = imageUrl; // } // // public List<String> getLabels() { // return labels; // } // // public void setLabels(List<String> labels) { // this.labels = labels; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (!(o instanceof Item)) { // return false; // } // Item item = (Item) o; // return id.equals(item.id) // && name.equals(item.name) // && type.equals(item.type) // && price.equals(item.price); // } // // @Override // public int hashCode() { // return Objects.hash(id, name, type, price); // } // // @Override // public String toString() { // return new StringJoiner(", ", Item.class.getSimpleName() + "[", "]") // .add("id=" + id) // .add("name='" + name + "'") // .add("type='" + type + "'") // .add("price=" + price) // .add("imageUrl='" + imageUrl + "'") // .add("quantity=" + quantity) // .add("labels=" + labels) // .toString(); // } // } // // Path: point-of-sale-app/inventory/src/main/java/com/google/abmedge/inventory/util/InventoryStoreConnectorException.java // public class InventoryStoreConnectorException extends Exception { // private static final long serialVersionUID = 8828512147713293558L; // // public InventoryStoreConnectorException() { // super(); // } // // public InventoryStoreConnectorException(String message, Throwable cause) { // super(message, cause); // } // // public InventoryStoreConnectorException(String message) { // super(message); // } // // public InventoryStoreConnectorException(Throwable cause) { // super(cause); // } // } // Path: point-of-sale-app/inventory/src/main/java/com/google/abmedge/inventory/dao/InMemoryStoreConnector.java import com.google.abmedge.dto.Item; import com.google.abmedge.inventory.util.InventoryStoreConnectorException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // Copyright 2021 Google LLC // // 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 com.google.abmedge.inventory.dao; /** * An implementation of the {@link InventoryStoreConnector} that uses an in memory data structure to * hold all the inventory information. This implementation uses a simple HashMap to store all the * items */ public class InMemoryStoreConnector implements InventoryStoreConnector { private static final Logger LOGGER = LogManager.getLogger(InMemoryStoreConnector.class); private static final Map<UUID, Item> idToItemsMap = new ConcurrentHashMap<>(); private static final Map<String, List<Item>> typeToItemsMap = new ConcurrentHashMap<>(); @Override public List<Item> getAll() { return idToItemsMap.values().stream().map(Item::from).collect(Collectors.toList()); } @Override public List<Item> getAllByType(String type) { return typeToItemsMap.get(type); } @Override public Optional<Item> getById(UUID id) { return idToItemsMap.values().stream() .filter(i -> i.getId().equals(id)) .map(Item::from) .findAny(); } @Override public Set<String> getTypes() { return typeToItemsMap.keySet(); } @Override
public void insert(Item item) throws InventoryStoreConnectorException {
GoogleCloudPlatform/point-of-sale
point-of-sale-app/payments/src/main/java/com/google/abmedge/payments/dao/InMemoryPaymentGateway.java
// Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/Payment.java // public class Payment { // // private UUID id; // private List<PaymentUnit> unitList; // private PaymentType type; // private Number paidAmount; // // public Payment() { // } // // public Payment(UUID id, List<PaymentUnit> unitList, PaymentType type, Number paidAmount) { // this.id = id; // this.unitList = unitList; // this.type = type; // this.paidAmount = paidAmount; // } // // public UUID getId() { // return id; // } // // public void setId(UUID id) { // this.id = id; // } // // public List<PaymentUnit> getUnitList() { // return unitList; // } // // public void setUnitList(List<PaymentUnit> unitList) { // this.unitList = unitList; // } // // public PaymentType getType() { // return type; // } // // public void setType(PaymentType type) { // this.type = type; // } // // public Number getPaidAmount() { // return paidAmount; // } // // public void setPaidAmount(Number paidAmount) { // this.paidAmount = paidAmount; // } // } // // Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/PaymentUnit.java // public class PaymentUnit { // // private UUID itemId; // private String name; // private long quantity; // private Number totalCost; // // public PaymentUnit() {} // // public PaymentUnit(UUID itemId, String name, long quantity, Number totalCost) { // this.itemId = itemId; // this.name = name; // this.quantity = quantity; // this.totalCost = totalCost; // } // // public UUID getItemId() { // return itemId; // } // // public void setItemId(UUID itemId) { // this.itemId = itemId; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public long getQuantity() { // return quantity; // } // // public void setQuantity(long quantity) { // this.quantity = quantity; // } // // public Number getTotalCost() { // return totalCost; // } // // public void setTotalCost(Number totalCost) { // this.totalCost = totalCost; // } // } // // Path: point-of-sale-app/payments/src/main/java/com/google/abmedge/payments/dto/Bill.java // public class Bill { // // private Payment payment; // private PaymentStatus status; // private Number balance; // private String printedBill; // // public Payment getPayment() { // return payment; // } // // public Bill setPayment(Payment payment) { // this.payment = payment; // return this; // } // // public PaymentStatus getStatus() { // return status; // } // // public Bill setStatus(PaymentStatus status) { // this.status = status; // return this; // } // // public Number getBalance() { // return balance; // } // // public Bill setBalance(Number balance) { // this.balance = balance; // return this; // } // // public String getPrintedBill() { // return printedBill; // } // // public Bill setPrintedBill(String printedBill) { // this.printedBill = printedBill; // return this; // } // } // // Path: point-of-sale-app/payments/src/main/java/com/google/abmedge/payments/dto/PaymentStatus.java // public enum PaymentStatus { // SUCCESS("SUCCESS"), // FAILED("FAILED"); // // private String status; // // PaymentStatus(String status) { // this.status = status; // } // // public String getStatus() { // return status; // } // }
import com.google.abmedge.dto.Payment; import com.google.abmedge.dto.PaymentUnit; import com.google.abmedge.payments.dto.Bill; import com.google.abmedge.payments.dto.PaymentStatus; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger;
// Copyright 2021 Google LLC // // 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 com.google.abmedge.payments.dao; /** * This class is a specific implementation of the {@link PaymentGateway} interface. This class does * not interact with any external systems to process the payments. Instead, it uses an in-memory map * to keep track of all the payment events. This class acts as the default {@link * com.google.abmedge.payments.PaymentsController#activePaymentGateway} when either no/invalid * environment variable is set against the key 'PAYMENT_GW' or when it is set to 'IN_MEMORY'. */ public class InMemoryPaymentGateway implements PaymentGateway { private static final Logger LOGGER = LogManager.getLogger(InMemoryPaymentGateway.class);
// Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/Payment.java // public class Payment { // // private UUID id; // private List<PaymentUnit> unitList; // private PaymentType type; // private Number paidAmount; // // public Payment() { // } // // public Payment(UUID id, List<PaymentUnit> unitList, PaymentType type, Number paidAmount) { // this.id = id; // this.unitList = unitList; // this.type = type; // this.paidAmount = paidAmount; // } // // public UUID getId() { // return id; // } // // public void setId(UUID id) { // this.id = id; // } // // public List<PaymentUnit> getUnitList() { // return unitList; // } // // public void setUnitList(List<PaymentUnit> unitList) { // this.unitList = unitList; // } // // public PaymentType getType() { // return type; // } // // public void setType(PaymentType type) { // this.type = type; // } // // public Number getPaidAmount() { // return paidAmount; // } // // public void setPaidAmount(Number paidAmount) { // this.paidAmount = paidAmount; // } // } // // Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/PaymentUnit.java // public class PaymentUnit { // // private UUID itemId; // private String name; // private long quantity; // private Number totalCost; // // public PaymentUnit() {} // // public PaymentUnit(UUID itemId, String name, long quantity, Number totalCost) { // this.itemId = itemId; // this.name = name; // this.quantity = quantity; // this.totalCost = totalCost; // } // // public UUID getItemId() { // return itemId; // } // // public void setItemId(UUID itemId) { // this.itemId = itemId; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public long getQuantity() { // return quantity; // } // // public void setQuantity(long quantity) { // this.quantity = quantity; // } // // public Number getTotalCost() { // return totalCost; // } // // public void setTotalCost(Number totalCost) { // this.totalCost = totalCost; // } // } // // Path: point-of-sale-app/payments/src/main/java/com/google/abmedge/payments/dto/Bill.java // public class Bill { // // private Payment payment; // private PaymentStatus status; // private Number balance; // private String printedBill; // // public Payment getPayment() { // return payment; // } // // public Bill setPayment(Payment payment) { // this.payment = payment; // return this; // } // // public PaymentStatus getStatus() { // return status; // } // // public Bill setStatus(PaymentStatus status) { // this.status = status; // return this; // } // // public Number getBalance() { // return balance; // } // // public Bill setBalance(Number balance) { // this.balance = balance; // return this; // } // // public String getPrintedBill() { // return printedBill; // } // // public Bill setPrintedBill(String printedBill) { // this.printedBill = printedBill; // return this; // } // } // // Path: point-of-sale-app/payments/src/main/java/com/google/abmedge/payments/dto/PaymentStatus.java // public enum PaymentStatus { // SUCCESS("SUCCESS"), // FAILED("FAILED"); // // private String status; // // PaymentStatus(String status) { // this.status = status; // } // // public String getStatus() { // return status; // } // } // Path: point-of-sale-app/payments/src/main/java/com/google/abmedge/payments/dao/InMemoryPaymentGateway.java import com.google.abmedge.dto.Payment; import com.google.abmedge.dto.PaymentUnit; import com.google.abmedge.payments.dto.Bill; import com.google.abmedge.payments.dto.PaymentStatus; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // Copyright 2021 Google LLC // // 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 com.google.abmedge.payments.dao; /** * This class is a specific implementation of the {@link PaymentGateway} interface. This class does * not interact with any external systems to process the payments. Instead, it uses an in-memory map * to keep track of all the payment events. This class acts as the default {@link * com.google.abmedge.payments.PaymentsController#activePaymentGateway} when either no/invalid * environment variable is set against the key 'PAYMENT_GW' or when it is set to 'IN_MEMORY'. */ public class InMemoryPaymentGateway implements PaymentGateway { private static final Logger LOGGER = LogManager.getLogger(InMemoryPaymentGateway.class);
private static final Map<UUID, Payment> paymentMap = new ConcurrentHashMap<>();
GoogleCloudPlatform/point-of-sale
point-of-sale-app/payments/src/main/java/com/google/abmedge/payments/dao/InMemoryPaymentGateway.java
// Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/Payment.java // public class Payment { // // private UUID id; // private List<PaymentUnit> unitList; // private PaymentType type; // private Number paidAmount; // // public Payment() { // } // // public Payment(UUID id, List<PaymentUnit> unitList, PaymentType type, Number paidAmount) { // this.id = id; // this.unitList = unitList; // this.type = type; // this.paidAmount = paidAmount; // } // // public UUID getId() { // return id; // } // // public void setId(UUID id) { // this.id = id; // } // // public List<PaymentUnit> getUnitList() { // return unitList; // } // // public void setUnitList(List<PaymentUnit> unitList) { // this.unitList = unitList; // } // // public PaymentType getType() { // return type; // } // // public void setType(PaymentType type) { // this.type = type; // } // // public Number getPaidAmount() { // return paidAmount; // } // // public void setPaidAmount(Number paidAmount) { // this.paidAmount = paidAmount; // } // } // // Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/PaymentUnit.java // public class PaymentUnit { // // private UUID itemId; // private String name; // private long quantity; // private Number totalCost; // // public PaymentUnit() {} // // public PaymentUnit(UUID itemId, String name, long quantity, Number totalCost) { // this.itemId = itemId; // this.name = name; // this.quantity = quantity; // this.totalCost = totalCost; // } // // public UUID getItemId() { // return itemId; // } // // public void setItemId(UUID itemId) { // this.itemId = itemId; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public long getQuantity() { // return quantity; // } // // public void setQuantity(long quantity) { // this.quantity = quantity; // } // // public Number getTotalCost() { // return totalCost; // } // // public void setTotalCost(Number totalCost) { // this.totalCost = totalCost; // } // } // // Path: point-of-sale-app/payments/src/main/java/com/google/abmedge/payments/dto/Bill.java // public class Bill { // // private Payment payment; // private PaymentStatus status; // private Number balance; // private String printedBill; // // public Payment getPayment() { // return payment; // } // // public Bill setPayment(Payment payment) { // this.payment = payment; // return this; // } // // public PaymentStatus getStatus() { // return status; // } // // public Bill setStatus(PaymentStatus status) { // this.status = status; // return this; // } // // public Number getBalance() { // return balance; // } // // public Bill setBalance(Number balance) { // this.balance = balance; // return this; // } // // public String getPrintedBill() { // return printedBill; // } // // public Bill setPrintedBill(String printedBill) { // this.printedBill = printedBill; // return this; // } // } // // Path: point-of-sale-app/payments/src/main/java/com/google/abmedge/payments/dto/PaymentStatus.java // public enum PaymentStatus { // SUCCESS("SUCCESS"), // FAILED("FAILED"); // // private String status; // // PaymentStatus(String status) { // this.status = status; // } // // public String getStatus() { // return status; // } // }
import com.google.abmedge.dto.Payment; import com.google.abmedge.dto.PaymentUnit; import com.google.abmedge.payments.dto.Bill; import com.google.abmedge.payments.dto.PaymentStatus; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger;
// Copyright 2021 Google LLC // // 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 com.google.abmedge.payments.dao; /** * This class is a specific implementation of the {@link PaymentGateway} interface. This class does * not interact with any external systems to process the payments. Instead, it uses an in-memory map * to keep track of all the payment events. This class acts as the default {@link * com.google.abmedge.payments.PaymentsController#activePaymentGateway} when either no/invalid * environment variable is set against the key 'PAYMENT_GW' or when it is set to 'IN_MEMORY'. */ public class InMemoryPaymentGateway implements PaymentGateway { private static final Logger LOGGER = LogManager.getLogger(InMemoryPaymentGateway.class); private static final Map<UUID, Payment> paymentMap = new ConcurrentHashMap<>(); private static final String BILL_HEADER = "----------------------------------------------------------------------------\n"; private static final String SPACE = " "; private static final String TOTAL = " Total:"; private static final String TAX = " Tax:"; private static final String PAID = " Paid:"; private static final String BALANCE = " Balance:"; private static final double TAX_VALUE = 0.1495; @Override
// Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/Payment.java // public class Payment { // // private UUID id; // private List<PaymentUnit> unitList; // private PaymentType type; // private Number paidAmount; // // public Payment() { // } // // public Payment(UUID id, List<PaymentUnit> unitList, PaymentType type, Number paidAmount) { // this.id = id; // this.unitList = unitList; // this.type = type; // this.paidAmount = paidAmount; // } // // public UUID getId() { // return id; // } // // public void setId(UUID id) { // this.id = id; // } // // public List<PaymentUnit> getUnitList() { // return unitList; // } // // public void setUnitList(List<PaymentUnit> unitList) { // this.unitList = unitList; // } // // public PaymentType getType() { // return type; // } // // public void setType(PaymentType type) { // this.type = type; // } // // public Number getPaidAmount() { // return paidAmount; // } // // public void setPaidAmount(Number paidAmount) { // this.paidAmount = paidAmount; // } // } // // Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/PaymentUnit.java // public class PaymentUnit { // // private UUID itemId; // private String name; // private long quantity; // private Number totalCost; // // public PaymentUnit() {} // // public PaymentUnit(UUID itemId, String name, long quantity, Number totalCost) { // this.itemId = itemId; // this.name = name; // this.quantity = quantity; // this.totalCost = totalCost; // } // // public UUID getItemId() { // return itemId; // } // // public void setItemId(UUID itemId) { // this.itemId = itemId; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public long getQuantity() { // return quantity; // } // // public void setQuantity(long quantity) { // this.quantity = quantity; // } // // public Number getTotalCost() { // return totalCost; // } // // public void setTotalCost(Number totalCost) { // this.totalCost = totalCost; // } // } // // Path: point-of-sale-app/payments/src/main/java/com/google/abmedge/payments/dto/Bill.java // public class Bill { // // private Payment payment; // private PaymentStatus status; // private Number balance; // private String printedBill; // // public Payment getPayment() { // return payment; // } // // public Bill setPayment(Payment payment) { // this.payment = payment; // return this; // } // // public PaymentStatus getStatus() { // return status; // } // // public Bill setStatus(PaymentStatus status) { // this.status = status; // return this; // } // // public Number getBalance() { // return balance; // } // // public Bill setBalance(Number balance) { // this.balance = balance; // return this; // } // // public String getPrintedBill() { // return printedBill; // } // // public Bill setPrintedBill(String printedBill) { // this.printedBill = printedBill; // return this; // } // } // // Path: point-of-sale-app/payments/src/main/java/com/google/abmedge/payments/dto/PaymentStatus.java // public enum PaymentStatus { // SUCCESS("SUCCESS"), // FAILED("FAILED"); // // private String status; // // PaymentStatus(String status) { // this.status = status; // } // // public String getStatus() { // return status; // } // } // Path: point-of-sale-app/payments/src/main/java/com/google/abmedge/payments/dao/InMemoryPaymentGateway.java import com.google.abmedge.dto.Payment; import com.google.abmedge.dto.PaymentUnit; import com.google.abmedge.payments.dto.Bill; import com.google.abmedge.payments.dto.PaymentStatus; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // Copyright 2021 Google LLC // // 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 com.google.abmedge.payments.dao; /** * This class is a specific implementation of the {@link PaymentGateway} interface. This class does * not interact with any external systems to process the payments. Instead, it uses an in-memory map * to keep track of all the payment events. This class acts as the default {@link * com.google.abmedge.payments.PaymentsController#activePaymentGateway} when either no/invalid * environment variable is set against the key 'PAYMENT_GW' or when it is set to 'IN_MEMORY'. */ public class InMemoryPaymentGateway implements PaymentGateway { private static final Logger LOGGER = LogManager.getLogger(InMemoryPaymentGateway.class); private static final Map<UUID, Payment> paymentMap = new ConcurrentHashMap<>(); private static final String BILL_HEADER = "----------------------------------------------------------------------------\n"; private static final String SPACE = " "; private static final String TOTAL = " Total:"; private static final String TAX = " Tax:"; private static final String PAID = " Paid:"; private static final String BALANCE = " Balance:"; private static final double TAX_VALUE = 0.1495; @Override
public Bill pay(Payment payment) {
GoogleCloudPlatform/point-of-sale
point-of-sale-app/api-server/src/main/java/com/google/abmedge/apiserver/dto/PayRequest.java
// Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/PaymentType.java // public enum PaymentType { // CARD("CARD"), // CASH("CASH"); // // private String type; // // PaymentType(String type) { // this.type = type; // } // // public String getType() { // return type; // } // } // // Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/PurchaseItem.java // public class PurchaseItem { // private UUID itemId; // private long itemCount; // // public PurchaseItem() {} // // public PurchaseItem(UUID itemId, long itemCount) { // this.itemId = itemId; // this.itemCount = itemCount; // } // // public UUID getItemId() { // return itemId; // } // // public void setItemId(UUID itemId) { // this.itemId = itemId; // } // // public long getItemCount() { // return itemCount; // } // // public void setItemCount(long itemCount) { // this.itemCount = itemCount; // } // }
import com.google.abmedge.dto.PaymentType; import com.google.abmedge.dto.PurchaseItem; import java.util.List;
// Copyright 2021 Google LLC // // 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 com.google.abmedge.apiserver.dto; /** * This class represents the sgtructure of the request object that is expected to be received via * {@link com.google.abmedge.apiserver.ApiServerController#pay(PayRequest)} method. The class * defines a collection of {@link PurchaseItem}s denoting the items for which the current payment is * being made. It also has reference to the type of the payment (as denoted by {@link PaymentType}) * and the amount paid. */ public class PayRequest { private List<PurchaseItem> items;
// Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/PaymentType.java // public enum PaymentType { // CARD("CARD"), // CASH("CASH"); // // private String type; // // PaymentType(String type) { // this.type = type; // } // // public String getType() { // return type; // } // } // // Path: point-of-sale-app/service-sdk/src/main/java/com/google/abmedge/dto/PurchaseItem.java // public class PurchaseItem { // private UUID itemId; // private long itemCount; // // public PurchaseItem() {} // // public PurchaseItem(UUID itemId, long itemCount) { // this.itemId = itemId; // this.itemCount = itemCount; // } // // public UUID getItemId() { // return itemId; // } // // public void setItemId(UUID itemId) { // this.itemId = itemId; // } // // public long getItemCount() { // return itemCount; // } // // public void setItemCount(long itemCount) { // this.itemCount = itemCount; // } // } // Path: point-of-sale-app/api-server/src/main/java/com/google/abmedge/apiserver/dto/PayRequest.java import com.google.abmedge.dto.PaymentType; import com.google.abmedge.dto.PurchaseItem; import java.util.List; // Copyright 2021 Google LLC // // 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 com.google.abmedge.apiserver.dto; /** * This class represents the sgtructure of the request object that is expected to be received via * {@link com.google.abmedge.apiserver.ApiServerController#pay(PayRequest)} method. The class * defines a collection of {@link PurchaseItem}s denoting the items for which the current payment is * being made. It also has reference to the type of the payment (as denoted by {@link PaymentType}) * and the amount paid. */ public class PayRequest { private List<PurchaseItem> items;
private PaymentType type;
proofpoint/cloud-management
src/main/java/com/proofpoint/cloudmanagement/service/inventoryclient/InventoryDnsManager.java
// Path: src/main/java/com/proofpoint/cloudmanagement/service/DnsManager.java // public interface DnsManager // { // public String getFullyQualifiedDomainName(Instance instance); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/Instance.java // public class Instance // { // private final String id; // private final String name; // private final String status; // private final String size; // private final String provider; // private final String location; // private final String hostname; // private final Iterable<String> tags; // // public Instance(String id, String name, String size, String status, String location) // { // this(id, name, size, status, null, location, null, null); // } // // public Instance(String id, String name, String size, String status, String provider, String location, String hostname, Iterable<String> tags) // { // Preconditions.checkNotNull(id); // this.id = id; // this.name = name; // this.size = size; // this.status = status; // this.provider = provider; // this.location = location; // this.hostname = hostname; // if (tags != null) { // this.tags = ImmutableList.copyOf(tags); // } // else { // this.tags = null; // } // } // // public String getId() // { // return id; // } // // public String getName() // { // return name; // } // // public String getStatus() // { // return status; // } // // public String getSize() // { // return size; // } // // public String getProvider() // { // return provider; // } // // public String getLocation() // { // return location; // } // // public String getHostname() // { // return hostname; // } // // public Iterable<String> getTags() // { // return tags; // } // // public Builder toBuilder() // { // return new Builder().setId(id).setName(name).setStatus(status).setSize(size).setProvider(provider).setLocation(location).setHostname(hostname).setTags(tags); // } // // @Override // public boolean equals(Object o) // { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Instance instance = (Instance) o; // // if (id != null ? !id.equals(instance.id) : instance.id != null) { // return false; // } // // return true; // } // // @Override // public int hashCode() // { // return id != null ? id.hashCode() : 0; // } // // @Override // public String toString() // { // return "Instance{" + // "id='" + id + '\'' + // ", name='" + name + '\'' + // ", status='" + status + '\'' + // ", size='" + size + '\'' + // ", provider='" + provider + '\'' + // ", location='" + location + '\'' + // ", hostname='" + hostname + '\'' + // ", tags=" + tags + // '}'; // } // // public static class Builder // { // private String id; // private String name; // private String size; // private String status; // private String provider; // private String location; // private String hostname = null; // private Iterable<String> tags = null; // // public Builder setId(String id) // { // this.id = id; // return this; // } // // public Builder setName(String name) // { // this.name = name; // return this; // } // // public Builder setSize(String size) // { // this.size = size; // return this; // } // // public Builder setStatus(String status) // { // this.status = status; // return this; // } // // public Builder setHostname(String hostname) // { // this.hostname = hostname; // return this; // } // // public Builder setTags(Iterable<String> tags) // { // this.tags = tags; // return this; // } // // public Builder setProvider(String provider) // { // this.provider = provider; // return this; // } // // public Builder setLocation(String location) // { // this.location = location; // return this; // } // // public Instance build() // { // return new Instance(id, name, size, status, provider, location, hostname, tags); // } // } // }
import com.proofpoint.cloudmanagement.service.DnsManager; import com.proofpoint.cloudmanagement.service.Instance; import javax.inject.Inject;
/* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service.inventoryclient; public class InventoryDnsManager implements DnsManager { private final InventoryClient inventoryClient; @Inject public InventoryDnsManager(InventoryClient inventoryClient) { this.inventoryClient = inventoryClient; } @Override
// Path: src/main/java/com/proofpoint/cloudmanagement/service/DnsManager.java // public interface DnsManager // { // public String getFullyQualifiedDomainName(Instance instance); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/Instance.java // public class Instance // { // private final String id; // private final String name; // private final String status; // private final String size; // private final String provider; // private final String location; // private final String hostname; // private final Iterable<String> tags; // // public Instance(String id, String name, String size, String status, String location) // { // this(id, name, size, status, null, location, null, null); // } // // public Instance(String id, String name, String size, String status, String provider, String location, String hostname, Iterable<String> tags) // { // Preconditions.checkNotNull(id); // this.id = id; // this.name = name; // this.size = size; // this.status = status; // this.provider = provider; // this.location = location; // this.hostname = hostname; // if (tags != null) { // this.tags = ImmutableList.copyOf(tags); // } // else { // this.tags = null; // } // } // // public String getId() // { // return id; // } // // public String getName() // { // return name; // } // // public String getStatus() // { // return status; // } // // public String getSize() // { // return size; // } // // public String getProvider() // { // return provider; // } // // public String getLocation() // { // return location; // } // // public String getHostname() // { // return hostname; // } // // public Iterable<String> getTags() // { // return tags; // } // // public Builder toBuilder() // { // return new Builder().setId(id).setName(name).setStatus(status).setSize(size).setProvider(provider).setLocation(location).setHostname(hostname).setTags(tags); // } // // @Override // public boolean equals(Object o) // { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // // Instance instance = (Instance) o; // // if (id != null ? !id.equals(instance.id) : instance.id != null) { // return false; // } // // return true; // } // // @Override // public int hashCode() // { // return id != null ? id.hashCode() : 0; // } // // @Override // public String toString() // { // return "Instance{" + // "id='" + id + '\'' + // ", name='" + name + '\'' + // ", status='" + status + '\'' + // ", size='" + size + '\'' + // ", provider='" + provider + '\'' + // ", location='" + location + '\'' + // ", hostname='" + hostname + '\'' + // ", tags=" + tags + // '}'; // } // // public static class Builder // { // private String id; // private String name; // private String size; // private String status; // private String provider; // private String location; // private String hostname = null; // private Iterable<String> tags = null; // // public Builder setId(String id) // { // this.id = id; // return this; // } // // public Builder setName(String name) // { // this.name = name; // return this; // } // // public Builder setSize(String size) // { // this.size = size; // return this; // } // // public Builder setStatus(String status) // { // this.status = status; // return this; // } // // public Builder setHostname(String hostname) // { // this.hostname = hostname; // return this; // } // // public Builder setTags(Iterable<String> tags) // { // this.tags = tags; // return this; // } // // public Builder setProvider(String provider) // { // this.provider = provider; // return this; // } // // public Builder setLocation(String location) // { // this.location = location; // return this; // } // // public Instance build() // { // return new Instance(id, name, size, status, provider, location, hostname, tags); // } // } // } // Path: src/main/java/com/proofpoint/cloudmanagement/service/inventoryclient/InventoryDnsManager.java import com.proofpoint.cloudmanagement.service.DnsManager; import com.proofpoint.cloudmanagement.service.Instance; import javax.inject.Inject; /* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service.inventoryclient; public class InventoryDnsManager implements DnsManager { private final InventoryClient inventoryClient; @Inject public InventoryDnsManager(InventoryClient inventoryClient) { this.inventoryClient = inventoryClient; } @Override
public String getFullyQualifiedDomainName(Instance instance)
proofpoint/cloud-management
src/test/java/com/proofpoint/cloudmanagement/service/TestInstancesResource.java
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class InMemoryTagManager implements TagManager // { // private final LoadingCache<String, Set<String>> tagCache = // CacheBuilder.newBuilder() // .build(new CacheLoader<String, Set<String>>() // { // // @Override // public Set<String> load(String key) // throws Exception // { // return new ConcurrentHashSet<String>(); // } // }); // // @Override // public TagUpdateStatus addTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).add(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public TagUpdateStatus deleteTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).remove(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public Iterable<String> getTags(Instance instance) // { // return tagCache.getUnchecked(instance.getId()); // } // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class NoOpDnsManager implements DnsManager // { // @Override // public String getFullyQualifiedDomainName(Instance instance) // { // return instance.getHostname(); // } // }
import com.google.common.base.Function; import com.google.common.collect.ConcurrentHashMultiset; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.InMemoryTagManager; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.NoOpDnsManager; import com.proofpoint.jaxrs.testing.MockUriInfo; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import javax.annotation.Nullable; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import java.net.URI; import java.util.HashSet; import java.util.Set; import static com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError.LOCATION_UNAVAILABLE; import static com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError.PROVIDER_UNAVAILABLE; import static com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError.SIZE_UNAVAILABLE; import static com.proofpoint.testing.Assertions.assertEqualsIgnoreOrder; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue;
/* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class TestInstancesResource { private InstancesResource instancesResource; private InMemoryInstanceConnector inMemoryInstanceConnector; private static final UriInfo INSTANCES_URI_INFO = MockUriInfo.from("http://localhost/v1/instance");
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class InMemoryTagManager implements TagManager // { // private final LoadingCache<String, Set<String>> tagCache = // CacheBuilder.newBuilder() // .build(new CacheLoader<String, Set<String>>() // { // // @Override // public Set<String> load(String key) // throws Exception // { // return new ConcurrentHashSet<String>(); // } // }); // // @Override // public TagUpdateStatus addTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).add(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public TagUpdateStatus deleteTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).remove(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public Iterable<String> getTags(Instance instance) // { // return tagCache.getUnchecked(instance.getId()); // } // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class NoOpDnsManager implements DnsManager // { // @Override // public String getFullyQualifiedDomainName(Instance instance) // { // return instance.getHostname(); // } // } // Path: src/test/java/com/proofpoint/cloudmanagement/service/TestInstancesResource.java import com.google.common.base.Function; import com.google.common.collect.ConcurrentHashMultiset; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.InMemoryTagManager; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.NoOpDnsManager; import com.proofpoint.jaxrs.testing.MockUriInfo; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import javax.annotation.Nullable; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import java.net.URI; import java.util.HashSet; import java.util.Set; import static com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError.LOCATION_UNAVAILABLE; import static com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError.PROVIDER_UNAVAILABLE; import static com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError.SIZE_UNAVAILABLE; import static com.proofpoint.testing.Assertions.assertEqualsIgnoreOrder; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; /* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class TestInstancesResource { private InstancesResource instancesResource; private InMemoryInstanceConnector inMemoryInstanceConnector; private static final UriInfo INSTANCES_URI_INFO = MockUriInfo.from("http://localhost/v1/instance");
private NoOpDnsManager dnsManager;
proofpoint/cloud-management
src/test/java/com/proofpoint/cloudmanagement/service/TestInstancesResource.java
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class InMemoryTagManager implements TagManager // { // private final LoadingCache<String, Set<String>> tagCache = // CacheBuilder.newBuilder() // .build(new CacheLoader<String, Set<String>>() // { // // @Override // public Set<String> load(String key) // throws Exception // { // return new ConcurrentHashSet<String>(); // } // }); // // @Override // public TagUpdateStatus addTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).add(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public TagUpdateStatus deleteTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).remove(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public Iterable<String> getTags(Instance instance) // { // return tagCache.getUnchecked(instance.getId()); // } // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class NoOpDnsManager implements DnsManager // { // @Override // public String getFullyQualifiedDomainName(Instance instance) // { // return instance.getHostname(); // } // }
import com.google.common.base.Function; import com.google.common.collect.ConcurrentHashMultiset; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.InMemoryTagManager; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.NoOpDnsManager; import com.proofpoint.jaxrs.testing.MockUriInfo; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import javax.annotation.Nullable; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import java.net.URI; import java.util.HashSet; import java.util.Set; import static com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError.LOCATION_UNAVAILABLE; import static com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError.PROVIDER_UNAVAILABLE; import static com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError.SIZE_UNAVAILABLE; import static com.proofpoint.testing.Assertions.assertEqualsIgnoreOrder; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue;
/* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class TestInstancesResource { private InstancesResource instancesResource; private InMemoryInstanceConnector inMemoryInstanceConnector; private static final UriInfo INSTANCES_URI_INFO = MockUriInfo.from("http://localhost/v1/instance"); private NoOpDnsManager dnsManager;
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class InMemoryTagManager implements TagManager // { // private final LoadingCache<String, Set<String>> tagCache = // CacheBuilder.newBuilder() // .build(new CacheLoader<String, Set<String>>() // { // // @Override // public Set<String> load(String key) // throws Exception // { // return new ConcurrentHashSet<String>(); // } // }); // // @Override // public TagUpdateStatus addTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).add(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public TagUpdateStatus deleteTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).remove(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public Iterable<String> getTags(Instance instance) // { // return tagCache.getUnchecked(instance.getId()); // } // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class NoOpDnsManager implements DnsManager // { // @Override // public String getFullyQualifiedDomainName(Instance instance) // { // return instance.getHostname(); // } // } // Path: src/test/java/com/proofpoint/cloudmanagement/service/TestInstancesResource.java import com.google.common.base.Function; import com.google.common.collect.ConcurrentHashMultiset; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.InMemoryTagManager; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.NoOpDnsManager; import com.proofpoint.jaxrs.testing.MockUriInfo; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import javax.annotation.Nullable; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import java.net.URI; import java.util.HashSet; import java.util.Set; import static com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError.LOCATION_UNAVAILABLE; import static com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError.PROVIDER_UNAVAILABLE; import static com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError.SIZE_UNAVAILABLE; import static com.proofpoint.testing.Assertions.assertEqualsIgnoreOrder; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; /* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class TestInstancesResource { private InstancesResource instancesResource; private InMemoryInstanceConnector inMemoryInstanceConnector; private static final UriInfo INSTANCES_URI_INFO = MockUriInfo.from("http://localhost/v1/instance"); private NoOpDnsManager dnsManager;
private InMemoryTagManager tagManager;
proofpoint/cloud-management
src/test/java/com/proofpoint/cloudmanagement/service/TestInstanceResource.java
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class InMemoryTagManager implements TagManager // { // private final LoadingCache<String, Set<String>> tagCache = // CacheBuilder.newBuilder() // .build(new CacheLoader<String, Set<String>>() // { // // @Override // public Set<String> load(String key) // throws Exception // { // return new ConcurrentHashSet<String>(); // } // }); // // @Override // public TagUpdateStatus addTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).add(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public TagUpdateStatus deleteTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).remove(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public Iterable<String> getTags(Instance instance) // { // return tagCache.getUnchecked(instance.getId()); // } // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class NoOpDnsManager implements DnsManager // { // @Override // public String getFullyQualifiedDomainName(Instance instance) // { // return instance.getHostname(); // } // }
import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.InMemoryTagManager; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.NoOpDnsManager; import com.proofpoint.jaxrs.testing.MockUriInfo; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import java.net.URI; import java.util.UUID; import static org.testng.Assert.assertEquals;
/* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class TestInstanceResource { private InstanceResource instanceResource; private InMemoryInstanceConnector inMemoryInstanceConnector; private static final UriInfo INSTANCE_URI_INFO = MockUriInfo.from("http://localhost/v1/instance");
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class InMemoryTagManager implements TagManager // { // private final LoadingCache<String, Set<String>> tagCache = // CacheBuilder.newBuilder() // .build(new CacheLoader<String, Set<String>>() // { // // @Override // public Set<String> load(String key) // throws Exception // { // return new ConcurrentHashSet<String>(); // } // }); // // @Override // public TagUpdateStatus addTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).add(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public TagUpdateStatus deleteTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).remove(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public Iterable<String> getTags(Instance instance) // { // return tagCache.getUnchecked(instance.getId()); // } // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class NoOpDnsManager implements DnsManager // { // @Override // public String getFullyQualifiedDomainName(Instance instance) // { // return instance.getHostname(); // } // } // Path: src/test/java/com/proofpoint/cloudmanagement/service/TestInstanceResource.java import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.InMemoryTagManager; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.NoOpDnsManager; import com.proofpoint.jaxrs.testing.MockUriInfo; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import java.net.URI; import java.util.UUID; import static org.testng.Assert.assertEquals; /* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class TestInstanceResource { private InstanceResource instanceResource; private InMemoryInstanceConnector inMemoryInstanceConnector; private static final UriInfo INSTANCE_URI_INFO = MockUriInfo.from("http://localhost/v1/instance");
private InMemoryTagManager tagManager;
proofpoint/cloud-management
src/test/java/com/proofpoint/cloudmanagement/service/TestInstanceResource.java
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class InMemoryTagManager implements TagManager // { // private final LoadingCache<String, Set<String>> tagCache = // CacheBuilder.newBuilder() // .build(new CacheLoader<String, Set<String>>() // { // // @Override // public Set<String> load(String key) // throws Exception // { // return new ConcurrentHashSet<String>(); // } // }); // // @Override // public TagUpdateStatus addTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).add(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public TagUpdateStatus deleteTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).remove(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public Iterable<String> getTags(Instance instance) // { // return tagCache.getUnchecked(instance.getId()); // } // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class NoOpDnsManager implements DnsManager // { // @Override // public String getFullyQualifiedDomainName(Instance instance) // { // return instance.getHostname(); // } // }
import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.InMemoryTagManager; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.NoOpDnsManager; import com.proofpoint.jaxrs.testing.MockUriInfo; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import java.net.URI; import java.util.UUID; import static org.testng.Assert.assertEquals;
/* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class TestInstanceResource { private InstanceResource instanceResource; private InMemoryInstanceConnector inMemoryInstanceConnector; private static final UriInfo INSTANCE_URI_INFO = MockUriInfo.from("http://localhost/v1/instance"); private InMemoryTagManager tagManager;
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class InMemoryTagManager implements TagManager // { // private final LoadingCache<String, Set<String>> tagCache = // CacheBuilder.newBuilder() // .build(new CacheLoader<String, Set<String>>() // { // // @Override // public Set<String> load(String key) // throws Exception // { // return new ConcurrentHashSet<String>(); // } // }); // // @Override // public TagUpdateStatus addTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).add(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public TagUpdateStatus deleteTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).remove(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public Iterable<String> getTags(Instance instance) // { // return tagCache.getUnchecked(instance.getId()); // } // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class NoOpDnsManager implements DnsManager // { // @Override // public String getFullyQualifiedDomainName(Instance instance) // { // return instance.getHostname(); // } // } // Path: src/test/java/com/proofpoint/cloudmanagement/service/TestInstanceResource.java import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.InMemoryTagManager; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.NoOpDnsManager; import com.proofpoint.jaxrs.testing.MockUriInfo; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import java.net.URI; import java.util.UUID; import static org.testng.Assert.assertEquals; /* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class TestInstanceResource { private InstanceResource instanceResource; private InMemoryInstanceConnector inMemoryInstanceConnector; private static final UriInfo INSTANCE_URI_INFO = MockUriInfo.from("http://localhost/v1/instance"); private InMemoryTagManager tagManager;
private NoOpDnsManager dnsManager;
proofpoint/cloud-management
src/main/java/com/proofpoint/cloudmanagement/service/Main.java
// Path: src/main/java/com/proofpoint/cloudmanagement/service/inventoryclient/InventoryClientModule.java // public class InventoryClientModule // implements Module // { // public void configure(Binder binder) // { // binder.requireExplicitBindings(); // binder.disableCircularProxies(); // // ConfigurationModule.bindConfig(binder).to(InventoryClientConfig.class); // ConfigurationModule.bindConfig(binder).to(HttpClientConfig.class); // binder.bind(InventoryClient.class).in(Scopes.SINGLETON); // // binder.bind(DnsManager.class).to(InventoryDnsManager.class).in(Scopes.SINGLETON); // binder.bind(TagManager.class).to(InventoryTagManager.class).in(Scopes.SINGLETON); // // Multibinder<InstanceCreationNotifier> instanceCreationNotifierMultibinder = Multibinder.newSetBinder(binder, InstanceCreationNotifier.class); // instanceCreationNotifierMultibinder.addBinding().to(InventoryClient.class).in(Scopes.SINGLETON); // // HttpClientBinder.httpClientBinder(binder).bindHttpClient("inventory", Inventory.class); // } // }
import org.weakref.jmx.guice.MBeanModule; import com.google.inject.Injector; import com.proofpoint.bootstrap.Bootstrap; import com.proofpoint.cloudmanagement.service.inventoryclient.InventoryClientModule; import com.proofpoint.discovery.client.Announcer; import com.proofpoint.discovery.client.DiscoveryModule; import com.proofpoint.event.client.NullEventModule; import com.proofpoint.http.server.HttpServerModule; import com.proofpoint.jaxrs.JaxrsModule; import com.proofpoint.jmx.JmxModule; import com.proofpoint.jmx.http.rpc.JmxHttpRpcModule; import com.proofpoint.json.JsonModule; import com.proofpoint.log.LogJmxModule; import com.proofpoint.log.Logger; import com.proofpoint.node.NodeModule; import com.proofpoint.tracetoken.TraceTokenModule;
/* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class Main { private final static Logger log = Logger.get(Main.class); public static void main(String[] args) throws Exception { Bootstrap app = new Bootstrap( new NodeModule(), new DiscoveryModule(), new HttpServerModule(), new JsonModule(), new JaxrsModule(), new MBeanModule(), new JmxModule(), new JmxHttpRpcModule(), new LogJmxModule(), new TraceTokenModule(), new NullEventModule(),
// Path: src/main/java/com/proofpoint/cloudmanagement/service/inventoryclient/InventoryClientModule.java // public class InventoryClientModule // implements Module // { // public void configure(Binder binder) // { // binder.requireExplicitBindings(); // binder.disableCircularProxies(); // // ConfigurationModule.bindConfig(binder).to(InventoryClientConfig.class); // ConfigurationModule.bindConfig(binder).to(HttpClientConfig.class); // binder.bind(InventoryClient.class).in(Scopes.SINGLETON); // // binder.bind(DnsManager.class).to(InventoryDnsManager.class).in(Scopes.SINGLETON); // binder.bind(TagManager.class).to(InventoryTagManager.class).in(Scopes.SINGLETON); // // Multibinder<InstanceCreationNotifier> instanceCreationNotifierMultibinder = Multibinder.newSetBinder(binder, InstanceCreationNotifier.class); // instanceCreationNotifierMultibinder.addBinding().to(InventoryClient.class).in(Scopes.SINGLETON); // // HttpClientBinder.httpClientBinder(binder).bindHttpClient("inventory", Inventory.class); // } // } // Path: src/main/java/com/proofpoint/cloudmanagement/service/Main.java import org.weakref.jmx.guice.MBeanModule; import com.google.inject.Injector; import com.proofpoint.bootstrap.Bootstrap; import com.proofpoint.cloudmanagement.service.inventoryclient.InventoryClientModule; import com.proofpoint.discovery.client.Announcer; import com.proofpoint.discovery.client.DiscoveryModule; import com.proofpoint.event.client.NullEventModule; import com.proofpoint.http.server.HttpServerModule; import com.proofpoint.jaxrs.JaxrsModule; import com.proofpoint.jmx.JmxModule; import com.proofpoint.jmx.http.rpc.JmxHttpRpcModule; import com.proofpoint.json.JsonModule; import com.proofpoint.log.LogJmxModule; import com.proofpoint.log.Logger; import com.proofpoint.node.NodeModule; import com.proofpoint.tracetoken.TraceTokenModule; /* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class Main { private final static Logger log = Logger.get(Main.class); public static void main(String[] args) throws Exception { Bootstrap app = new Bootstrap( new NodeModule(), new DiscoveryModule(), new HttpServerModule(), new JsonModule(), new JaxrsModule(), new MBeanModule(), new JmxModule(), new JmxHttpRpcModule(), new LogJmxModule(), new TraceTokenModule(), new NullEventModule(),
ConditionalModule.installIfPropertyEquals(new InventoryClientModule(), "cloud-management.manager", "Inventory"),
proofpoint/cloud-management
src/test/java/com/proofpoint/cloudmanagement/service/TestTagResource.java
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class InMemoryTagManager implements TagManager // { // private final LoadingCache<String, Set<String>> tagCache = // CacheBuilder.newBuilder() // .build(new CacheLoader<String, Set<String>>() // { // // @Override // public Set<String> load(String key) // throws Exception // { // return new ConcurrentHashSet<String>(); // } // }); // // @Override // public TagUpdateStatus addTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).add(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public TagUpdateStatus deleteTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).remove(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public Iterable<String> getTags(Instance instance) // { // return tagCache.getUnchecked(instance.getId()); // } // }
import com.google.common.collect.ImmutableMap; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.InMemoryTagManager; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import java.util.UUID; import static org.testng.AssertJUnit.assertEquals;
/* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class TestTagResource { private TagResource tagResource; private InMemoryInstanceConnector instanceConnector; @BeforeMethod public void setupResource() { instanceConnector = new InMemoryInstanceConnector();
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InMemoryManagerModule.java // public static class InMemoryTagManager implements TagManager // { // private final LoadingCache<String, Set<String>> tagCache = // CacheBuilder.newBuilder() // .build(new CacheLoader<String, Set<String>>() // { // // @Override // public Set<String> load(String key) // throws Exception // { // return new ConcurrentHashSet<String>(); // } // }); // // @Override // public TagUpdateStatus addTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).add(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public TagUpdateStatus deleteTag(Instance instance, String tag) // { // tagCache.getUnchecked(instance.getId()).remove(tag); // return TagUpdateStatus.UPDATED; // } // // @Override // public Iterable<String> getTags(Instance instance) // { // return tagCache.getUnchecked(instance.getId()); // } // } // Path: src/test/java/com/proofpoint/cloudmanagement/service/TestTagResource.java import com.google.common.collect.ImmutableMap; import com.proofpoint.cloudmanagement.service.InMemoryManagerModule.InMemoryTagManager; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import java.util.UUID; import static org.testng.AssertJUnit.assertEquals; /* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class TestTagResource { private TagResource tagResource; private InMemoryInstanceConnector instanceConnector; @BeforeMethod public void setupResource() { instanceConnector = new InMemoryInstanceConnector();
tagResource = new TagResource(ImmutableMap.<String, InstanceConnector>of("tmp", instanceConnector), new InMemoryTagManager());
proofpoint/cloud-management
src/test/java/com/proofpoint/cloudmanagement/service/TestInstanceCreationFailedResponse.java
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InstanceCreationFailedResponse.java // public enum InstanceCreationError // { // SIZE_UNAVAILABLE("Size Unavailable"), // LOCATION_UNAVAILABLE("Location Unavailable"), // PROVIDER_UNAVAILABLE("Provider Unavailable"); // // private String message; // // InstanceCreationError(String message) // { // this.message = message; // } // // public String getMessage() // { // return message; // } // }
import com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError; import com.proofpoint.json.JsonCodec; import com.proofpoint.testing.EquivalenceTester; import org.testng.annotations.Test; import java.util.Map; import static org.testng.Assert.assertEquals;
/* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class TestInstanceCreationFailedResponse { JsonCodec<InstanceCreationFailedResponse> icfrCodec = JsonCodec.jsonCodec(InstanceCreationFailedResponse.class); JsonCodec<Map<String, Object>> mapJsonCodec = JsonCodec.mapJsonCodec(String.class, Object.class); JsonCodec<InstanceCreationRequest> icrCodec = JsonCodec.jsonCodec(InstanceCreationRequest.class); @Test public void testEquivalence() { InstanceCreationRequest request1 = new InstanceCreationRequest("a", "aa", "aaa", "aaaa"); InstanceCreationRequest request2 = new InstanceCreationRequest("b", "bb", "bbb", "bbbb"); EquivalenceTester.equivalenceTester()
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InstanceCreationFailedResponse.java // public enum InstanceCreationError // { // SIZE_UNAVAILABLE("Size Unavailable"), // LOCATION_UNAVAILABLE("Location Unavailable"), // PROVIDER_UNAVAILABLE("Provider Unavailable"); // // private String message; // // InstanceCreationError(String message) // { // this.message = message; // } // // public String getMessage() // { // return message; // } // } // Path: src/test/java/com/proofpoint/cloudmanagement/service/TestInstanceCreationFailedResponse.java import com.proofpoint.cloudmanagement.service.InstanceCreationFailedResponse.InstanceCreationError; import com.proofpoint.json.JsonCodec; import com.proofpoint.testing.EquivalenceTester; import org.testng.annotations.Test; import java.util.Map; import static org.testng.Assert.assertEquals; /* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service; public class TestInstanceCreationFailedResponse { JsonCodec<InstanceCreationFailedResponse> icfrCodec = JsonCodec.jsonCodec(InstanceCreationFailedResponse.class); JsonCodec<Map<String, Object>> mapJsonCodec = JsonCodec.mapJsonCodec(String.class, Object.class); JsonCodec<InstanceCreationRequest> icrCodec = JsonCodec.jsonCodec(InstanceCreationRequest.class); @Test public void testEquivalence() { InstanceCreationRequest request1 = new InstanceCreationRequest("a", "aa", "aaa", "aaaa"); InstanceCreationRequest request2 = new InstanceCreationRequest("b", "bb", "bbb", "bbbb"); EquivalenceTester.equivalenceTester()
.addEquivalentGroup(new InstanceCreationFailedResponse(request1, InstanceCreationError.PROVIDER_UNAVAILABLE), new InstanceCreationFailedResponse(request1, InstanceCreationError.PROVIDER_UNAVAILABLE))
proofpoint/cloud-management
src/main/java/com/proofpoint/cloudmanagement/service/inventoryclient/InventoryClientModule.java
// Path: src/main/java/com/proofpoint/cloudmanagement/service/DnsManager.java // public interface DnsManager // { // public String getFullyQualifiedDomainName(Instance instance); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InstanceCreationNotifier.java // public interface InstanceCreationNotifier // { // public void notifyInstanceCreated(String instanceId); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/TagManager.java // public interface TagManager // { // enum TagUpdateStatus // { // UPDATED, NOT_FOUND // } // // public TagUpdateStatus addTag(Instance instance, String tag); // // public TagUpdateStatus deleteTag(Instance instance, String tag); // // public Iterable<String> getTags(Instance instance); // }
import com.google.inject.Binder; import com.google.inject.Module; import com.google.inject.Scopes; import com.google.inject.multibindings.Multibinder; import com.proofpoint.cloudmanagement.service.DnsManager; import com.proofpoint.cloudmanagement.service.InstanceCreationNotifier; import com.proofpoint.cloudmanagement.service.TagManager; import com.proofpoint.configuration.ConfigurationModule; import com.proofpoint.http.client.HttpClientBinder; import com.proofpoint.http.client.HttpClientConfig;
/* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service.inventoryclient; public class InventoryClientModule implements Module { public void configure(Binder binder) { binder.requireExplicitBindings(); binder.disableCircularProxies(); ConfigurationModule.bindConfig(binder).to(InventoryClientConfig.class); ConfigurationModule.bindConfig(binder).to(HttpClientConfig.class); binder.bind(InventoryClient.class).in(Scopes.SINGLETON);
// Path: src/main/java/com/proofpoint/cloudmanagement/service/DnsManager.java // public interface DnsManager // { // public String getFullyQualifiedDomainName(Instance instance); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InstanceCreationNotifier.java // public interface InstanceCreationNotifier // { // public void notifyInstanceCreated(String instanceId); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/TagManager.java // public interface TagManager // { // enum TagUpdateStatus // { // UPDATED, NOT_FOUND // } // // public TagUpdateStatus addTag(Instance instance, String tag); // // public TagUpdateStatus deleteTag(Instance instance, String tag); // // public Iterable<String> getTags(Instance instance); // } // Path: src/main/java/com/proofpoint/cloudmanagement/service/inventoryclient/InventoryClientModule.java import com.google.inject.Binder; import com.google.inject.Module; import com.google.inject.Scopes; import com.google.inject.multibindings.Multibinder; import com.proofpoint.cloudmanagement.service.DnsManager; import com.proofpoint.cloudmanagement.service.InstanceCreationNotifier; import com.proofpoint.cloudmanagement.service.TagManager; import com.proofpoint.configuration.ConfigurationModule; import com.proofpoint.http.client.HttpClientBinder; import com.proofpoint.http.client.HttpClientConfig; /* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service.inventoryclient; public class InventoryClientModule implements Module { public void configure(Binder binder) { binder.requireExplicitBindings(); binder.disableCircularProxies(); ConfigurationModule.bindConfig(binder).to(InventoryClientConfig.class); ConfigurationModule.bindConfig(binder).to(HttpClientConfig.class); binder.bind(InventoryClient.class).in(Scopes.SINGLETON);
binder.bind(DnsManager.class).to(InventoryDnsManager.class).in(Scopes.SINGLETON);
proofpoint/cloud-management
src/main/java/com/proofpoint/cloudmanagement/service/inventoryclient/InventoryClientModule.java
// Path: src/main/java/com/proofpoint/cloudmanagement/service/DnsManager.java // public interface DnsManager // { // public String getFullyQualifiedDomainName(Instance instance); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InstanceCreationNotifier.java // public interface InstanceCreationNotifier // { // public void notifyInstanceCreated(String instanceId); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/TagManager.java // public interface TagManager // { // enum TagUpdateStatus // { // UPDATED, NOT_FOUND // } // // public TagUpdateStatus addTag(Instance instance, String tag); // // public TagUpdateStatus deleteTag(Instance instance, String tag); // // public Iterable<String> getTags(Instance instance); // }
import com.google.inject.Binder; import com.google.inject.Module; import com.google.inject.Scopes; import com.google.inject.multibindings.Multibinder; import com.proofpoint.cloudmanagement.service.DnsManager; import com.proofpoint.cloudmanagement.service.InstanceCreationNotifier; import com.proofpoint.cloudmanagement.service.TagManager; import com.proofpoint.configuration.ConfigurationModule; import com.proofpoint.http.client.HttpClientBinder; import com.proofpoint.http.client.HttpClientConfig;
/* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service.inventoryclient; public class InventoryClientModule implements Module { public void configure(Binder binder) { binder.requireExplicitBindings(); binder.disableCircularProxies(); ConfigurationModule.bindConfig(binder).to(InventoryClientConfig.class); ConfigurationModule.bindConfig(binder).to(HttpClientConfig.class); binder.bind(InventoryClient.class).in(Scopes.SINGLETON); binder.bind(DnsManager.class).to(InventoryDnsManager.class).in(Scopes.SINGLETON);
// Path: src/main/java/com/proofpoint/cloudmanagement/service/DnsManager.java // public interface DnsManager // { // public String getFullyQualifiedDomainName(Instance instance); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InstanceCreationNotifier.java // public interface InstanceCreationNotifier // { // public void notifyInstanceCreated(String instanceId); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/TagManager.java // public interface TagManager // { // enum TagUpdateStatus // { // UPDATED, NOT_FOUND // } // // public TagUpdateStatus addTag(Instance instance, String tag); // // public TagUpdateStatus deleteTag(Instance instance, String tag); // // public Iterable<String> getTags(Instance instance); // } // Path: src/main/java/com/proofpoint/cloudmanagement/service/inventoryclient/InventoryClientModule.java import com.google.inject.Binder; import com.google.inject.Module; import com.google.inject.Scopes; import com.google.inject.multibindings.Multibinder; import com.proofpoint.cloudmanagement.service.DnsManager; import com.proofpoint.cloudmanagement.service.InstanceCreationNotifier; import com.proofpoint.cloudmanagement.service.TagManager; import com.proofpoint.configuration.ConfigurationModule; import com.proofpoint.http.client.HttpClientBinder; import com.proofpoint.http.client.HttpClientConfig; /* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service.inventoryclient; public class InventoryClientModule implements Module { public void configure(Binder binder) { binder.requireExplicitBindings(); binder.disableCircularProxies(); ConfigurationModule.bindConfig(binder).to(InventoryClientConfig.class); ConfigurationModule.bindConfig(binder).to(HttpClientConfig.class); binder.bind(InventoryClient.class).in(Scopes.SINGLETON); binder.bind(DnsManager.class).to(InventoryDnsManager.class).in(Scopes.SINGLETON);
binder.bind(TagManager.class).to(InventoryTagManager.class).in(Scopes.SINGLETON);
proofpoint/cloud-management
src/main/java/com/proofpoint/cloudmanagement/service/inventoryclient/InventoryClientModule.java
// Path: src/main/java/com/proofpoint/cloudmanagement/service/DnsManager.java // public interface DnsManager // { // public String getFullyQualifiedDomainName(Instance instance); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InstanceCreationNotifier.java // public interface InstanceCreationNotifier // { // public void notifyInstanceCreated(String instanceId); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/TagManager.java // public interface TagManager // { // enum TagUpdateStatus // { // UPDATED, NOT_FOUND // } // // public TagUpdateStatus addTag(Instance instance, String tag); // // public TagUpdateStatus deleteTag(Instance instance, String tag); // // public Iterable<String> getTags(Instance instance); // }
import com.google.inject.Binder; import com.google.inject.Module; import com.google.inject.Scopes; import com.google.inject.multibindings.Multibinder; import com.proofpoint.cloudmanagement.service.DnsManager; import com.proofpoint.cloudmanagement.service.InstanceCreationNotifier; import com.proofpoint.cloudmanagement.service.TagManager; import com.proofpoint.configuration.ConfigurationModule; import com.proofpoint.http.client.HttpClientBinder; import com.proofpoint.http.client.HttpClientConfig;
/* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service.inventoryclient; public class InventoryClientModule implements Module { public void configure(Binder binder) { binder.requireExplicitBindings(); binder.disableCircularProxies(); ConfigurationModule.bindConfig(binder).to(InventoryClientConfig.class); ConfigurationModule.bindConfig(binder).to(HttpClientConfig.class); binder.bind(InventoryClient.class).in(Scopes.SINGLETON); binder.bind(DnsManager.class).to(InventoryDnsManager.class).in(Scopes.SINGLETON); binder.bind(TagManager.class).to(InventoryTagManager.class).in(Scopes.SINGLETON);
// Path: src/main/java/com/proofpoint/cloudmanagement/service/DnsManager.java // public interface DnsManager // { // public String getFullyQualifiedDomainName(Instance instance); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/InstanceCreationNotifier.java // public interface InstanceCreationNotifier // { // public void notifyInstanceCreated(String instanceId); // } // // Path: src/main/java/com/proofpoint/cloudmanagement/service/TagManager.java // public interface TagManager // { // enum TagUpdateStatus // { // UPDATED, NOT_FOUND // } // // public TagUpdateStatus addTag(Instance instance, String tag); // // public TagUpdateStatus deleteTag(Instance instance, String tag); // // public Iterable<String> getTags(Instance instance); // } // Path: src/main/java/com/proofpoint/cloudmanagement/service/inventoryclient/InventoryClientModule.java import com.google.inject.Binder; import com.google.inject.Module; import com.google.inject.Scopes; import com.google.inject.multibindings.Multibinder; import com.proofpoint.cloudmanagement.service.DnsManager; import com.proofpoint.cloudmanagement.service.InstanceCreationNotifier; import com.proofpoint.cloudmanagement.service.TagManager; import com.proofpoint.configuration.ConfigurationModule; import com.proofpoint.http.client.HttpClientBinder; import com.proofpoint.http.client.HttpClientConfig; /* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service.inventoryclient; public class InventoryClientModule implements Module { public void configure(Binder binder) { binder.requireExplicitBindings(); binder.disableCircularProxies(); ConfigurationModule.bindConfig(binder).to(InventoryClientConfig.class); ConfigurationModule.bindConfig(binder).to(HttpClientConfig.class); binder.bind(InventoryClient.class).in(Scopes.SINGLETON); binder.bind(DnsManager.class).to(InventoryDnsManager.class).in(Scopes.SINGLETON); binder.bind(TagManager.class).to(InventoryTagManager.class).in(Scopes.SINGLETON);
Multibinder<InstanceCreationNotifier> instanceCreationNotifierMultibinder = Multibinder.newSetBinder(binder, InstanceCreationNotifier.class);
proofpoint/cloud-management
src/test/java/com/proofpoint/cloudmanagement/service/inventoryclient/TestClient.java
// Path: src/test/java/com/proofpoint/cloudmanagement/service/inventoryclient/MockInventoryServer.java // public static class MockInventoryServerModule // implements Module // { // @Override // public void configure(Binder binder) // { // binder.bind(MockInventoryServer.class).in(Scopes.SINGLETON); // } // }
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.inject.Guice; import com.google.inject.Injector; import com.proofpoint.cloudmanagement.service.inventoryclient.MockInventoryServer.MockInventoryServerModule; import com.proofpoint.configuration.ConfigurationFactory; import com.proofpoint.configuration.ConfigurationModule; import com.proofpoint.http.server.testing.TestingHttpServer; import com.proofpoint.http.server.testing.TestingHttpServerModule; import com.proofpoint.jaxrs.JaxrsModule; import com.proofpoint.json.JsonModule; import com.proofpoint.node.testing.TestingNodeModule; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import javax.ws.rs.core.UriBuilder; import java.util.Map; import java.util.Set; import java.util.UUID;
/* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service.inventoryclient; public class TestClient { private InventoryClient client; private TestingHttpServer server; private MockInventoryServer inventoryServer; private static final String INVENTORY_USER = "readonly"; private static final String INVENTORY_PASSWORD = "readonly"; @BeforeMethod public void setup() throws Exception { Injector inventoryServerInjector = Guice.createInjector( new TestingHttpServerModule(), new TestingNodeModule(), new JaxrsModule(), new JsonModule(),
// Path: src/test/java/com/proofpoint/cloudmanagement/service/inventoryclient/MockInventoryServer.java // public static class MockInventoryServerModule // implements Module // { // @Override // public void configure(Binder binder) // { // binder.bind(MockInventoryServer.class).in(Scopes.SINGLETON); // } // } // Path: src/test/java/com/proofpoint/cloudmanagement/service/inventoryclient/TestClient.java import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.inject.Guice; import com.google.inject.Injector; import com.proofpoint.cloudmanagement.service.inventoryclient.MockInventoryServer.MockInventoryServerModule; import com.proofpoint.configuration.ConfigurationFactory; import com.proofpoint.configuration.ConfigurationModule; import com.proofpoint.http.server.testing.TestingHttpServer; import com.proofpoint.http.server.testing.TestingHttpServerModule; import com.proofpoint.jaxrs.JaxrsModule; import com.proofpoint.json.JsonModule; import com.proofpoint.node.testing.TestingNodeModule; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import javax.ws.rs.core.UriBuilder; import java.util.Map; import java.util.Set; import java.util.UUID; /* * Copyright 2010 Proofpoint, Inc. * * 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 com.proofpoint.cloudmanagement.service.inventoryclient; public class TestClient { private InventoryClient client; private TestingHttpServer server; private MockInventoryServer inventoryServer; private static final String INVENTORY_USER = "readonly"; private static final String INVENTORY_PASSWORD = "readonly"; @BeforeMethod public void setup() throws Exception { Injector inventoryServerInjector = Guice.createInjector( new TestingHttpServerModule(), new TestingNodeModule(), new JaxrsModule(), new JsonModule(),
new MockInventoryServerModule()
proofpoint/cloud-management
src/main/java/com/proofpoint/cloudmanagement/service/InstanceResource.java
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InstanceConnector.java // public enum InstanceDestructionStatus // { // DESTROYED, NOT_FOUND // }
import static com.google.common.base.Preconditions.checkNotNull; import com.proofpoint.cloudmanagement.service.InstanceConnector.InstanceDestructionStatus; import javax.inject.Inject; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import java.net.URI; import java.util.Map;
@GET @Produces(MediaType.APPLICATION_JSON) public Response getInstance(@PathParam("id") String instanceId, @Context UriInfo uriInfo) { checkNotNull(instanceId); checkNotNull(uriInfo); for (Map.Entry<String, InstanceConnector> instanceConnectorEntry : instanceConnectorMap.entrySet()) { Instance instance = instanceConnectorEntry.getValue().getInstance(instanceId); if (instance != null) { return Response.ok( InstanceRepresentation.fromInstance( instance.toBuilder() .setProvider(instanceConnectorEntry.getKey()) .setHostname(dnsManager.getFullyQualifiedDomainName(instance)) .setTags(tagManager.getTags(instance)) .build(), constructSelfUri(uriInfo, instanceId))).build(); } } return Response.status(Status.NOT_FOUND).build(); } @DELETE public Response deleteInstance(@PathParam("id") String instanceId) { checkNotNull(instanceId, "Instance ID cannot be null"); for (InstanceConnector instanceConnector : instanceConnectorMap.values()) {
// Path: src/main/java/com/proofpoint/cloudmanagement/service/InstanceConnector.java // public enum InstanceDestructionStatus // { // DESTROYED, NOT_FOUND // } // Path: src/main/java/com/proofpoint/cloudmanagement/service/InstanceResource.java import static com.google.common.base.Preconditions.checkNotNull; import com.proofpoint.cloudmanagement.service.InstanceConnector.InstanceDestructionStatus; import javax.inject.Inject; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import java.net.URI; import java.util.Map; @GET @Produces(MediaType.APPLICATION_JSON) public Response getInstance(@PathParam("id") String instanceId, @Context UriInfo uriInfo) { checkNotNull(instanceId); checkNotNull(uriInfo); for (Map.Entry<String, InstanceConnector> instanceConnectorEntry : instanceConnectorMap.entrySet()) { Instance instance = instanceConnectorEntry.getValue().getInstance(instanceId); if (instance != null) { return Response.ok( InstanceRepresentation.fromInstance( instance.toBuilder() .setProvider(instanceConnectorEntry.getKey()) .setHostname(dnsManager.getFullyQualifiedDomainName(instance)) .setTags(tagManager.getTags(instance)) .build(), constructSelfUri(uriInfo, instanceId))).build(); } } return Response.status(Status.NOT_FOUND).build(); } @DELETE public Response deleteInstance(@PathParam("id") String instanceId) { checkNotNull(instanceId, "Instance ID cannot be null"); for (InstanceConnector instanceConnector : instanceConnectorMap.values()) {
if (instanceConnector.destroyInstance(instanceId) == InstanceDestructionStatus.DESTROYED) {
DataAgg/DAFramework
commons/src/main/java/com/dataagg/util/xml/XPathEvaluator.java
// Path: commons/src/main/java/com/dataagg/util/lang/ArgCheck.java // public class ArgCheck { // public static void checkState(boolean b, String msg) { // if (!b) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkState(boolean b) { // if (!b) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object) { // if (object == null) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object, String msg) { // if (object == null) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String possibleValues, String value) { // checkNotContains(StringUtil.split(possibleValues, ","), value); // } // // public static void checkNotContains(String possibleValues, String value, String msg) { // checkNotContains(StringUtil.split(possibleValues, ","), value, msg); // } // // public static void checkNotContains(String[] possibleValues, String value, String msg) { // if (!ArraysUtil.contains(possibleValues, value)) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String[] possibleValues, String value) { // checkNotContains(possibleValues, value, "possible values are [" + possibleValues + "], but value=" + value); // } // }
import com.dataagg.util.lang.ArgCheck; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.namespace.QName; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import java.util.Map;
try { expr = xpath.compile(exp); if (expr != null) { expCache.put(exp, expr); } return expr; } catch (XPathExpressionException e) { LOG.error(e.getMessage(), e); return null; } } return expr; } public String[] getNodesAttr(Node node, String exp, String attrName) { List<String> qs = new ArrayList<String>(); try { NodeList nodes = findNodes(node, exp); if (nodes != null && nodes.getLength() > 0) { for (int i = 0; i < nodes.getLength(); i++) { qs.add(XmlUtil.getAttribute(nodes.item(i), attrName)); } } } catch (Exception e) { } return qs.toArray(new String[]{}); } public String getNodeAttr(Node node, String exp, String attrName) { Node n = findOneNode(node, exp);
// Path: commons/src/main/java/com/dataagg/util/lang/ArgCheck.java // public class ArgCheck { // public static void checkState(boolean b, String msg) { // if (!b) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkState(boolean b) { // if (!b) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object) { // if (object == null) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object, String msg) { // if (object == null) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String possibleValues, String value) { // checkNotContains(StringUtil.split(possibleValues, ","), value); // } // // public static void checkNotContains(String possibleValues, String value, String msg) { // checkNotContains(StringUtil.split(possibleValues, ","), value, msg); // } // // public static void checkNotContains(String[] possibleValues, String value, String msg) { // if (!ArraysUtil.contains(possibleValues, value)) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String[] possibleValues, String value) { // checkNotContains(possibleValues, value, "possible values are [" + possibleValues + "], but value=" + value); // } // } // Path: commons/src/main/java/com/dataagg/util/xml/XPathEvaluator.java import com.dataagg.util.lang.ArgCheck; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.namespace.QName; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import java.util.Map; try { expr = xpath.compile(exp); if (expr != null) { expCache.put(exp, expr); } return expr; } catch (XPathExpressionException e) { LOG.error(e.getMessage(), e); return null; } } return expr; } public String[] getNodesAttr(Node node, String exp, String attrName) { List<String> qs = new ArrayList<String>(); try { NodeList nodes = findNodes(node, exp); if (nodes != null && nodes.getLength() > 0) { for (int i = 0; i < nodes.getLength(); i++) { qs.add(XmlUtil.getAttribute(nodes.item(i), attrName)); } } } catch (Exception e) { } return qs.toArray(new String[]{}); } public String getNodeAttr(Node node, String exp, String attrName) { Node n = findOneNode(node, exp);
ArgCheck.checkNotNull(n);
DataAgg/DAFramework
commons/src/main/java/com/dataagg/commons/domain/EMenu.java
// Path: commons/src/main/java/com/dataagg/util/ITreeNode.java // public interface ITreeNode<C extends ITreeNode<?>> extends Serializable { // public static final Logger LOG = LoggerFactory.getLogger(ITreeNode.class); // // public Long getId(); // // public void setId(Long id); // // public Long getParentId(); // // public void setParentId(Long parentId); // // public String getParentIds(); // // public void setParentIds(String parentIds); // // public String getName(); // // public void setName(String name); // // public String getCode(); // // public void setCode(String code); // // public List<C> getItems(); // // public void setItems(List<C> items); // // public default void addChild(C node) { // List<C> items = getItems(); // if (items == null) { // items = new ArrayList<>(); // } // node.setParentId(getId()); // items.add(node); // setItems(items); // } // // @SuppressWarnings("unchecked") // public default ITreeNode<C> buildTree(List<ITreeNode<C>> nodes) { // Map<Long, ITreeNode<C>> allNodes = new Hashtable<>(); // for (ITreeNode<C> node : nodes) { // allNodes.put(node.getId(), node); // } // // ITreeNode<C> root = null; // for (ITreeNode<C> node : nodes) { // ITreeNode<C> parent = null; // if (node.getParentId() != null) { // parent = allNodes.get(node.getParentId()); // if (parent != null) { // parent.addChild((C) node); // } else { // LOG.debug("不能找到根节点" + node.getId() + "--" + node.getParentId()); // } // } else { // if (root != null) { // LOG.debug("重复的根节点" + root.getId() + "--" + node.getParentId()); // } // root = node; // } // } // return root; // } // }
import java.util.ArrayList; import java.util.List; import org.nutz.dao.entity.annotation.ColDefine; import org.nutz.dao.entity.annotation.ColType; import org.nutz.dao.entity.annotation.Column; import org.nutz.dao.entity.annotation.Comment; import org.nutz.dao.entity.annotation.Default; import org.nutz.dao.entity.annotation.Id; import org.nutz.dao.entity.annotation.Table; import com.dataagg.util.ITreeNode; import jodd.util.StringUtil;
package com.dataagg.commons.domain; @Table("sys_menus") @Comment("系统菜单")
// Path: commons/src/main/java/com/dataagg/util/ITreeNode.java // public interface ITreeNode<C extends ITreeNode<?>> extends Serializable { // public static final Logger LOG = LoggerFactory.getLogger(ITreeNode.class); // // public Long getId(); // // public void setId(Long id); // // public Long getParentId(); // // public void setParentId(Long parentId); // // public String getParentIds(); // // public void setParentIds(String parentIds); // // public String getName(); // // public void setName(String name); // // public String getCode(); // // public void setCode(String code); // // public List<C> getItems(); // // public void setItems(List<C> items); // // public default void addChild(C node) { // List<C> items = getItems(); // if (items == null) { // items = new ArrayList<>(); // } // node.setParentId(getId()); // items.add(node); // setItems(items); // } // // @SuppressWarnings("unchecked") // public default ITreeNode<C> buildTree(List<ITreeNode<C>> nodes) { // Map<Long, ITreeNode<C>> allNodes = new Hashtable<>(); // for (ITreeNode<C> node : nodes) { // allNodes.put(node.getId(), node); // } // // ITreeNode<C> root = null; // for (ITreeNode<C> node : nodes) { // ITreeNode<C> parent = null; // if (node.getParentId() != null) { // parent = allNodes.get(node.getParentId()); // if (parent != null) { // parent.addChild((C) node); // } else { // LOG.debug("不能找到根节点" + node.getId() + "--" + node.getParentId()); // } // } else { // if (root != null) { // LOG.debug("重复的根节点" + root.getId() + "--" + node.getParentId()); // } // root = node; // } // } // return root; // } // } // Path: commons/src/main/java/com/dataagg/commons/domain/EMenu.java import java.util.ArrayList; import java.util.List; import org.nutz.dao.entity.annotation.ColDefine; import org.nutz.dao.entity.annotation.ColType; import org.nutz.dao.entity.annotation.Column; import org.nutz.dao.entity.annotation.Comment; import org.nutz.dao.entity.annotation.Default; import org.nutz.dao.entity.annotation.Id; import org.nutz.dao.entity.annotation.Table; import com.dataagg.util.ITreeNode; import jodd.util.StringUtil; package com.dataagg.commons.domain; @Table("sys_menus") @Comment("系统菜单")
public class EMenu implements ITreeNode<EMenu> {
DataAgg/DAFramework
commons/src/main/java/com/dataagg/util/xml/XmlUtil.java
// Path: commons/src/main/java/com/dataagg/util/collection/StrMap.java // public class StrMap extends LinkedHashMap<String, String> { // private static final long serialVersionUID = -2822103329782602109L; // // public StrMap() { // super(); // } // // public StrMap(String... allkv) { // super(); // this.addAll(allkv); // } // // public void addAll(String... allkv) { // if (allkv != null && allkv.length % 2 == 0) { // for (int i = 0; i + 1 < allkv.length; i += 2) { // put(allkv[i], allkv[i + 1]); // } // } // } // // public void putWithoutNull(String key, String value) { // if (value != null) { // put(key, value); // } // } // // public void put(String key, String value, String defaultValue) { // if (value == null && defaultValue != null) { // put(key, defaultValue); // return; // } // put(key, value); // } // // public String eval(String text) { // String out = text; // for (String key : keySet()) { // out = StringUtil.replace(out, "${" + key + "}", get(key)); // } // return out; // } // } // // Path: commons/src/main/java/com/dataagg/util/lang/ArgCheck.java // public class ArgCheck { // public static void checkState(boolean b, String msg) { // if (!b) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkState(boolean b) { // if (!b) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object) { // if (object == null) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object, String msg) { // if (object == null) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String possibleValues, String value) { // checkNotContains(StringUtil.split(possibleValues, ","), value); // } // // public static void checkNotContains(String possibleValues, String value, String msg) { // checkNotContains(StringUtil.split(possibleValues, ","), value, msg); // } // // public static void checkNotContains(String[] possibleValues, String value, String msg) { // if (!ArraysUtil.contains(possibleValues, value)) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String[] possibleValues, String value) { // checkNotContains(possibleValues, value, "possible values are [" + possibleValues + "], but value=" + value); // } // } // // Path: commons/src/main/java/com/dataagg/util/lang/TextUtils.java // public static String prefix(String key) { // return StringUtil.isBlank(key) ? "" : (key + "."); // }
import jodd.typeconverter.Convert; import jodd.util.StringUtil; import com.dataagg.util.collection.StrMap; import com.dataagg.util.lang.ArgCheck; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.InputStream; import static com.dataagg.util.lang.TextUtils.prefix;
NodeList nodes = node.getChildNodes(); int nindex = 0; for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); if (!XmlUtil.isBlank(n)) { if (nindex == index) { return n; } nindex++; } } } return null; } public static int getNotBlankChildNodeSize(Node node) { if (node != null) { NodeList nodes = node.getChildNodes(); int nindex = 0; for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); if (!XmlUtil.isBlank(n)) { nindex++; } } return nindex; } return 0; }
// Path: commons/src/main/java/com/dataagg/util/collection/StrMap.java // public class StrMap extends LinkedHashMap<String, String> { // private static final long serialVersionUID = -2822103329782602109L; // // public StrMap() { // super(); // } // // public StrMap(String... allkv) { // super(); // this.addAll(allkv); // } // // public void addAll(String... allkv) { // if (allkv != null && allkv.length % 2 == 0) { // for (int i = 0; i + 1 < allkv.length; i += 2) { // put(allkv[i], allkv[i + 1]); // } // } // } // // public void putWithoutNull(String key, String value) { // if (value != null) { // put(key, value); // } // } // // public void put(String key, String value, String defaultValue) { // if (value == null && defaultValue != null) { // put(key, defaultValue); // return; // } // put(key, value); // } // // public String eval(String text) { // String out = text; // for (String key : keySet()) { // out = StringUtil.replace(out, "${" + key + "}", get(key)); // } // return out; // } // } // // Path: commons/src/main/java/com/dataagg/util/lang/ArgCheck.java // public class ArgCheck { // public static void checkState(boolean b, String msg) { // if (!b) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkState(boolean b) { // if (!b) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object) { // if (object == null) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object, String msg) { // if (object == null) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String possibleValues, String value) { // checkNotContains(StringUtil.split(possibleValues, ","), value); // } // // public static void checkNotContains(String possibleValues, String value, String msg) { // checkNotContains(StringUtil.split(possibleValues, ","), value, msg); // } // // public static void checkNotContains(String[] possibleValues, String value, String msg) { // if (!ArraysUtil.contains(possibleValues, value)) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String[] possibleValues, String value) { // checkNotContains(possibleValues, value, "possible values are [" + possibleValues + "], but value=" + value); // } // } // // Path: commons/src/main/java/com/dataagg/util/lang/TextUtils.java // public static String prefix(String key) { // return StringUtil.isBlank(key) ? "" : (key + "."); // } // Path: commons/src/main/java/com/dataagg/util/xml/XmlUtil.java import jodd.typeconverter.Convert; import jodd.util.StringUtil; import com.dataagg.util.collection.StrMap; import com.dataagg.util.lang.ArgCheck; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.InputStream; import static com.dataagg.util.lang.TextUtils.prefix; NodeList nodes = node.getChildNodes(); int nindex = 0; for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); if (!XmlUtil.isBlank(n)) { if (nindex == index) { return n; } nindex++; } } } return null; } public static int getNotBlankChildNodeSize(Node node) { if (node != null) { NodeList nodes = node.getChildNodes(); int nindex = 0; for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); if (!XmlUtil.isBlank(n)) { nindex++; } } return nindex; } return 0; }
public static StrMap getAttributes(Node node) {
DataAgg/DAFramework
commons/src/main/java/com/dataagg/util/xml/XmlUtil.java
// Path: commons/src/main/java/com/dataagg/util/collection/StrMap.java // public class StrMap extends LinkedHashMap<String, String> { // private static final long serialVersionUID = -2822103329782602109L; // // public StrMap() { // super(); // } // // public StrMap(String... allkv) { // super(); // this.addAll(allkv); // } // // public void addAll(String... allkv) { // if (allkv != null && allkv.length % 2 == 0) { // for (int i = 0; i + 1 < allkv.length; i += 2) { // put(allkv[i], allkv[i + 1]); // } // } // } // // public void putWithoutNull(String key, String value) { // if (value != null) { // put(key, value); // } // } // // public void put(String key, String value, String defaultValue) { // if (value == null && defaultValue != null) { // put(key, defaultValue); // return; // } // put(key, value); // } // // public String eval(String text) { // String out = text; // for (String key : keySet()) { // out = StringUtil.replace(out, "${" + key + "}", get(key)); // } // return out; // } // } // // Path: commons/src/main/java/com/dataagg/util/lang/ArgCheck.java // public class ArgCheck { // public static void checkState(boolean b, String msg) { // if (!b) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkState(boolean b) { // if (!b) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object) { // if (object == null) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object, String msg) { // if (object == null) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String possibleValues, String value) { // checkNotContains(StringUtil.split(possibleValues, ","), value); // } // // public static void checkNotContains(String possibleValues, String value, String msg) { // checkNotContains(StringUtil.split(possibleValues, ","), value, msg); // } // // public static void checkNotContains(String[] possibleValues, String value, String msg) { // if (!ArraysUtil.contains(possibleValues, value)) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String[] possibleValues, String value) { // checkNotContains(possibleValues, value, "possible values are [" + possibleValues + "], but value=" + value); // } // } // // Path: commons/src/main/java/com/dataagg/util/lang/TextUtils.java // public static String prefix(String key) { // return StringUtil.isBlank(key) ? "" : (key + "."); // }
import jodd.typeconverter.Convert; import jodd.util.StringUtil; import com.dataagg.util.collection.StrMap; import com.dataagg.util.lang.ArgCheck; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.InputStream; import static com.dataagg.util.lang.TextUtils.prefix;
for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); if (!XmlUtil.isBlank(n)) { if (nindex == index) { return n; } nindex++; } } } return null; } public static int getNotBlankChildNodeSize(Node node) { if (node != null) { NodeList nodes = node.getChildNodes(); int nindex = 0; for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); if (!XmlUtil.isBlank(n)) { nindex++; } } return nindex; } return 0; } public static StrMap getAttributes(Node node) { StrMap attrs = new StrMap();
// Path: commons/src/main/java/com/dataagg/util/collection/StrMap.java // public class StrMap extends LinkedHashMap<String, String> { // private static final long serialVersionUID = -2822103329782602109L; // // public StrMap() { // super(); // } // // public StrMap(String... allkv) { // super(); // this.addAll(allkv); // } // // public void addAll(String... allkv) { // if (allkv != null && allkv.length % 2 == 0) { // for (int i = 0; i + 1 < allkv.length; i += 2) { // put(allkv[i], allkv[i + 1]); // } // } // } // // public void putWithoutNull(String key, String value) { // if (value != null) { // put(key, value); // } // } // // public void put(String key, String value, String defaultValue) { // if (value == null && defaultValue != null) { // put(key, defaultValue); // return; // } // put(key, value); // } // // public String eval(String text) { // String out = text; // for (String key : keySet()) { // out = StringUtil.replace(out, "${" + key + "}", get(key)); // } // return out; // } // } // // Path: commons/src/main/java/com/dataagg/util/lang/ArgCheck.java // public class ArgCheck { // public static void checkState(boolean b, String msg) { // if (!b) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkState(boolean b) { // if (!b) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object) { // if (object == null) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object, String msg) { // if (object == null) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String possibleValues, String value) { // checkNotContains(StringUtil.split(possibleValues, ","), value); // } // // public static void checkNotContains(String possibleValues, String value, String msg) { // checkNotContains(StringUtil.split(possibleValues, ","), value, msg); // } // // public static void checkNotContains(String[] possibleValues, String value, String msg) { // if (!ArraysUtil.contains(possibleValues, value)) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String[] possibleValues, String value) { // checkNotContains(possibleValues, value, "possible values are [" + possibleValues + "], but value=" + value); // } // } // // Path: commons/src/main/java/com/dataagg/util/lang/TextUtils.java // public static String prefix(String key) { // return StringUtil.isBlank(key) ? "" : (key + "."); // } // Path: commons/src/main/java/com/dataagg/util/xml/XmlUtil.java import jodd.typeconverter.Convert; import jodd.util.StringUtil; import com.dataagg.util.collection.StrMap; import com.dataagg.util.lang.ArgCheck; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.InputStream; import static com.dataagg.util.lang.TextUtils.prefix; for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); if (!XmlUtil.isBlank(n)) { if (nindex == index) { return n; } nindex++; } } } return null; } public static int getNotBlankChildNodeSize(Node node) { if (node != null) { NodeList nodes = node.getChildNodes(); int nindex = 0; for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); if (!XmlUtil.isBlank(n)) { nindex++; } } return nindex; } return 0; } public static StrMap getAttributes(Node node) { StrMap attrs = new StrMap();
ArgCheck.checkNotNull(node);
DataAgg/DAFramework
commons/src/main/java/com/dataagg/util/xml/XmlUtil.java
// Path: commons/src/main/java/com/dataagg/util/collection/StrMap.java // public class StrMap extends LinkedHashMap<String, String> { // private static final long serialVersionUID = -2822103329782602109L; // // public StrMap() { // super(); // } // // public StrMap(String... allkv) { // super(); // this.addAll(allkv); // } // // public void addAll(String... allkv) { // if (allkv != null && allkv.length % 2 == 0) { // for (int i = 0; i + 1 < allkv.length; i += 2) { // put(allkv[i], allkv[i + 1]); // } // } // } // // public void putWithoutNull(String key, String value) { // if (value != null) { // put(key, value); // } // } // // public void put(String key, String value, String defaultValue) { // if (value == null && defaultValue != null) { // put(key, defaultValue); // return; // } // put(key, value); // } // // public String eval(String text) { // String out = text; // for (String key : keySet()) { // out = StringUtil.replace(out, "${" + key + "}", get(key)); // } // return out; // } // } // // Path: commons/src/main/java/com/dataagg/util/lang/ArgCheck.java // public class ArgCheck { // public static void checkState(boolean b, String msg) { // if (!b) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkState(boolean b) { // if (!b) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object) { // if (object == null) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object, String msg) { // if (object == null) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String possibleValues, String value) { // checkNotContains(StringUtil.split(possibleValues, ","), value); // } // // public static void checkNotContains(String possibleValues, String value, String msg) { // checkNotContains(StringUtil.split(possibleValues, ","), value, msg); // } // // public static void checkNotContains(String[] possibleValues, String value, String msg) { // if (!ArraysUtil.contains(possibleValues, value)) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String[] possibleValues, String value) { // checkNotContains(possibleValues, value, "possible values are [" + possibleValues + "], but value=" + value); // } // } // // Path: commons/src/main/java/com/dataagg/util/lang/TextUtils.java // public static String prefix(String key) { // return StringUtil.isBlank(key) ? "" : (key + "."); // }
import jodd.typeconverter.Convert; import jodd.util.StringUtil; import com.dataagg.util.collection.StrMap; import com.dataagg.util.lang.ArgCheck; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.InputStream; import static com.dataagg.util.lang.TextUtils.prefix;
try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse(is); } catch (Throwable e) { LOG.error(e.getMessage(), e); } return null; } public static Element parseRootElement(InputStream is) { try { Document doc = parseDocument(is); return doc.getDocumentElement(); } catch (Throwable e) { LOG.error(e.getMessage(), e); } return null; } public static StrMap parseNameSpaces(Node doc) { StrMap ns = new StrMap(); String rootNodeName = doc.getNodeName(); //parse namespaces StrMap attrs = XmlUtil.getAttributes(doc); for (String attrName : attrs.keySet()) { if (attrName.trim().startsWith(NamespacePrefix)) { String value = Convert.toString(attrs.get(attrName)); String name = attrName.substring(NamespacePrefix.length());
// Path: commons/src/main/java/com/dataagg/util/collection/StrMap.java // public class StrMap extends LinkedHashMap<String, String> { // private static final long serialVersionUID = -2822103329782602109L; // // public StrMap() { // super(); // } // // public StrMap(String... allkv) { // super(); // this.addAll(allkv); // } // // public void addAll(String... allkv) { // if (allkv != null && allkv.length % 2 == 0) { // for (int i = 0; i + 1 < allkv.length; i += 2) { // put(allkv[i], allkv[i + 1]); // } // } // } // // public void putWithoutNull(String key, String value) { // if (value != null) { // put(key, value); // } // } // // public void put(String key, String value, String defaultValue) { // if (value == null && defaultValue != null) { // put(key, defaultValue); // return; // } // put(key, value); // } // // public String eval(String text) { // String out = text; // for (String key : keySet()) { // out = StringUtil.replace(out, "${" + key + "}", get(key)); // } // return out; // } // } // // Path: commons/src/main/java/com/dataagg/util/lang/ArgCheck.java // public class ArgCheck { // public static void checkState(boolean b, String msg) { // if (!b) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkState(boolean b) { // if (!b) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object) { // if (object == null) { // throw new IllegalArgumentException(); // } // } // // public static void checkNotNull(Object object, String msg) { // if (object == null) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String possibleValues, String value) { // checkNotContains(StringUtil.split(possibleValues, ","), value); // } // // public static void checkNotContains(String possibleValues, String value, String msg) { // checkNotContains(StringUtil.split(possibleValues, ","), value, msg); // } // // public static void checkNotContains(String[] possibleValues, String value, String msg) { // if (!ArraysUtil.contains(possibleValues, value)) { // throw new IllegalArgumentException(msg); // } // } // // public static void checkNotContains(String[] possibleValues, String value) { // checkNotContains(possibleValues, value, "possible values are [" + possibleValues + "], but value=" + value); // } // } // // Path: commons/src/main/java/com/dataagg/util/lang/TextUtils.java // public static String prefix(String key) { // return StringUtil.isBlank(key) ? "" : (key + "."); // } // Path: commons/src/main/java/com/dataagg/util/xml/XmlUtil.java import jodd.typeconverter.Convert; import jodd.util.StringUtil; import com.dataagg.util.collection.StrMap; import com.dataagg.util.lang.ArgCheck; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.InputStream; import static com.dataagg.util.lang.TextUtils.prefix; try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse(is); } catch (Throwable e) { LOG.error(e.getMessage(), e); } return null; } public static Element parseRootElement(InputStream is) { try { Document doc = parseDocument(is); return doc.getDocumentElement(); } catch (Throwable e) { LOG.error(e.getMessage(), e); } return null; } public static StrMap parseNameSpaces(Node doc) { StrMap ns = new StrMap(); String rootNodeName = doc.getNodeName(); //parse namespaces StrMap attrs = XmlUtil.getAttributes(doc); for (String attrName : attrs.keySet()) { if (attrName.trim().startsWith(NamespacePrefix)) { String value = Convert.toString(attrs.get(attrName)); String name = attrName.substring(NamespacePrefix.length());
ns.put(prefix(rootNodeName) + name, value);
DataAgg/DAFramework
core-service/src/main/java/com/dataagg/account/client/SecurityServiceClient.java
// Path: commons/src/main/java/com/dataagg/commons/domain/EUser.java // @Table("sys_user") // @Comment("用户信息") // public class EUser implements UserDetails { // private static final long serialVersionUID = 1485837934469013198L; // // @Id // private Long id; // // @Column(hump = true, value = "username") // @ColDefine(type = ColType.VARCHAR, width = 64, notNull = true) // private String username; // // @Column // private String password; // // private String oldPassword; // // @Column("org_id") // @Comment("所属机构Id") // @ColDefine(type = ColType.INT, width = 20, notNull = true) // private Long orgId; // // @Comment("所属机构类型") // private String orgType; // // @Comment("删除标记(0:正常,1:删除)") // @Column("del_flag") // @ColDefine(type = ColType.CHAR, width = 1, notNull = true) // @Default("0") // private String delFlag; // // private List<EAuthority> grantedAuthorities = new ArrayList<>(); // // @ManyMany(relation = "sys_user_role", from = "userid", to = "roleid") // private List<ERole> roles = new ArrayList<>(); // // @One(field = "id", key = "userId") // private EAccount account; // // @Override // public String getPassword() { // return password; // } // // @Override // public String getUsername() { // return username; // } // // public void setGrantedAuthorities(List<EAuthority> grantedAuthorities) { // this.grantedAuthorities = grantedAuthorities; // } // // @Override // public List<EAuthority> getAuthorities() { // return grantedAuthorities; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public Long getOrgId() { // return orgId; // } // // public void setOrgId(Long orgId) { // this.orgId = orgId; // } // // public void setUsername(String username) { // this.username = username; // } // // public void setPassword(String password) { // this.password = password; // } // // public List<ERole> getRoles() { // return roles; // } // // public void setRoles(List<ERole> roles) { // this.roles = roles; // } // // public EAccount getAccount() { // return account; // } // // public void setAccount(EAccount account) { // this.account = account; // } // // @Override // public boolean isAccountNonExpired() { // return true; // } // // @Override // public boolean isAccountNonLocked() { // return true; // } // // @Override // public boolean isCredentialsNonExpired() { // return true; // } // // @Override // public boolean isEnabled() { // return true; // } // // public String getDelFlag() { // return delFlag; // } // // public void setDelFlag(String delFlag) { // this.delFlag = delFlag; // } // // public String getOldPassword() { // return oldPassword; // } // // public void setOldPassword(String oldPassword) { // this.oldPassword = oldPassword; // } // // // // @Override // public String toString() { // return "EUser{" + "id=" + id + ", username='" + username + "\'}"; // } // }
import com.dataagg.commons.domain.EUser; import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod;
package com.dataagg.account.client; @FeignClient(name = "security", url = "/security") public interface SecurityServiceClient { @RequestMapping(method = RequestMethod.POST, value = "/users", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
// Path: commons/src/main/java/com/dataagg/commons/domain/EUser.java // @Table("sys_user") // @Comment("用户信息") // public class EUser implements UserDetails { // private static final long serialVersionUID = 1485837934469013198L; // // @Id // private Long id; // // @Column(hump = true, value = "username") // @ColDefine(type = ColType.VARCHAR, width = 64, notNull = true) // private String username; // // @Column // private String password; // // private String oldPassword; // // @Column("org_id") // @Comment("所属机构Id") // @ColDefine(type = ColType.INT, width = 20, notNull = true) // private Long orgId; // // @Comment("所属机构类型") // private String orgType; // // @Comment("删除标记(0:正常,1:删除)") // @Column("del_flag") // @ColDefine(type = ColType.CHAR, width = 1, notNull = true) // @Default("0") // private String delFlag; // // private List<EAuthority> grantedAuthorities = new ArrayList<>(); // // @ManyMany(relation = "sys_user_role", from = "userid", to = "roleid") // private List<ERole> roles = new ArrayList<>(); // // @One(field = "id", key = "userId") // private EAccount account; // // @Override // public String getPassword() { // return password; // } // // @Override // public String getUsername() { // return username; // } // // public void setGrantedAuthorities(List<EAuthority> grantedAuthorities) { // this.grantedAuthorities = grantedAuthorities; // } // // @Override // public List<EAuthority> getAuthorities() { // return grantedAuthorities; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public Long getOrgId() { // return orgId; // } // // public void setOrgId(Long orgId) { // this.orgId = orgId; // } // // public void setUsername(String username) { // this.username = username; // } // // public void setPassword(String password) { // this.password = password; // } // // public List<ERole> getRoles() { // return roles; // } // // public void setRoles(List<ERole> roles) { // this.roles = roles; // } // // public EAccount getAccount() { // return account; // } // // public void setAccount(EAccount account) { // this.account = account; // } // // @Override // public boolean isAccountNonExpired() { // return true; // } // // @Override // public boolean isAccountNonLocked() { // return true; // } // // @Override // public boolean isCredentialsNonExpired() { // return true; // } // // @Override // public boolean isEnabled() { // return true; // } // // public String getDelFlag() { // return delFlag; // } // // public void setDelFlag(String delFlag) { // this.delFlag = delFlag; // } // // public String getOldPassword() { // return oldPassword; // } // // public void setOldPassword(String oldPassword) { // this.oldPassword = oldPassword; // } // // // // @Override // public String toString() { // return "EUser{" + "id=" + id + ", username='" + username + "\'}"; // } // } // Path: core-service/src/main/java/com/dataagg/account/client/SecurityServiceClient.java import com.dataagg.commons.domain.EUser; import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; package com.dataagg.account.client; @FeignClient(name = "security", url = "/security") public interface SecurityServiceClient { @RequestMapping(method = RequestMethod.POST, value = "/users", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
void createUser(EUser user);
DataAgg/DAFramework
core-service/src/test/java/com/dataagg/commons/dao/RoleDaoTest.java
// Path: core-service/src/main/java/com/dataagg/CoreServiceApplication.java // @SpringBootApplication // @EnableResourceServer // //@EnableDiscoveryClient // @EnableOAuth2Client // @EnableFeignClients // @EnableGlobalMethodSecurity(prePostEnabled = true) // @EnableConfigurationProperties // @Configuration // public class CoreServiceApplication extends ResourceServerConfigurerAdapter { // // @Autowired // private ResourceServerProperties sso; // // public static void main(String[] args) { // SpringApplication.run(CoreServiceApplication.class, args); // } // // @Bean // @ConfigurationProperties(prefix = "security.oauth2.client") // public ClientCredentialsResourceDetails clientCredentialsResourceDetails() { // return new ClientCredentialsResourceDetails(); // } // // @Bean // public RequestInterceptor oauth2FeignRequestInterceptor() { // return new OAuth2FeignRequestInterceptor(new DefaultOAuth2ClientContext(), clientCredentialsResourceDetails()); // } // // @Bean // public OAuth2RestTemplate clientCredentialsRestTemplate() { // return new OAuth2RestTemplate(clientCredentialsResourceDetails()); // } // // @Bean // public ResourceServerTokenServices tokenServices() { // return new CustomUserInfoTokenServices(sso.getUserInfoUri(), sso.getClientId()); // } // // @Override // public void configure(HttpSecurity http) throws Exception { // http.authorizeRequests().antMatchers("/", "/demo").permitAll().anyRequest().authenticated(); // } // } // // Path: commons/src/main/java/com/dataagg/commons/domain/ERole.java // @Table("sys_role") // @Comment("角色信息") // public class ERole { // @Id // @Comment("主键") // private Long id; // // @Column(hump = true) // @ColDefine(type = ColType.VARCHAR, width = 64, notNull = true) // @Comment("角色名") // private String name; // // @Column(hump = true) // @ColDefine(type = ColType.VARCHAR, width = 200, notNull = false) // @Comment("描述") // private String description; // // @ManyMany(relation = "sys_role_authority", from = "role_id", to = "authority_id") // private List<EAuthority> authorities = new ArrayList<>(); // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public List<EAuthority> getAuthorities() { // return authorities; // } // // public void setAuthorities(List<EAuthority> authorities) { // this.authorities = authorities; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // }
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.dataagg.CoreServiceApplication; import com.dataagg.commons.domain.ERole;
package com.dataagg.commons.dao; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = CoreServiceApplication.class) public class RoleDaoTest { @Autowired private RoleDao roleDao; @Before public void setUp() throws Exception {} @After public void tearDown() throws Exception {} @Test public void testGetDefaultRoles() {} @Test public void testFetchByName() {} @Test public void testFetchFullByName() {} @Test public void testSave() {
// Path: core-service/src/main/java/com/dataagg/CoreServiceApplication.java // @SpringBootApplication // @EnableResourceServer // //@EnableDiscoveryClient // @EnableOAuth2Client // @EnableFeignClients // @EnableGlobalMethodSecurity(prePostEnabled = true) // @EnableConfigurationProperties // @Configuration // public class CoreServiceApplication extends ResourceServerConfigurerAdapter { // // @Autowired // private ResourceServerProperties sso; // // public static void main(String[] args) { // SpringApplication.run(CoreServiceApplication.class, args); // } // // @Bean // @ConfigurationProperties(prefix = "security.oauth2.client") // public ClientCredentialsResourceDetails clientCredentialsResourceDetails() { // return new ClientCredentialsResourceDetails(); // } // // @Bean // public RequestInterceptor oauth2FeignRequestInterceptor() { // return new OAuth2FeignRequestInterceptor(new DefaultOAuth2ClientContext(), clientCredentialsResourceDetails()); // } // // @Bean // public OAuth2RestTemplate clientCredentialsRestTemplate() { // return new OAuth2RestTemplate(clientCredentialsResourceDetails()); // } // // @Bean // public ResourceServerTokenServices tokenServices() { // return new CustomUserInfoTokenServices(sso.getUserInfoUri(), sso.getClientId()); // } // // @Override // public void configure(HttpSecurity http) throws Exception { // http.authorizeRequests().antMatchers("/", "/demo").permitAll().anyRequest().authenticated(); // } // } // // Path: commons/src/main/java/com/dataagg/commons/domain/ERole.java // @Table("sys_role") // @Comment("角色信息") // public class ERole { // @Id // @Comment("主键") // private Long id; // // @Column(hump = true) // @ColDefine(type = ColType.VARCHAR, width = 64, notNull = true) // @Comment("角色名") // private String name; // // @Column(hump = true) // @ColDefine(type = ColType.VARCHAR, width = 200, notNull = false) // @Comment("描述") // private String description; // // @ManyMany(relation = "sys_role_authority", from = "role_id", to = "authority_id") // private List<EAuthority> authorities = new ArrayList<>(); // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public List<EAuthority> getAuthorities() { // return authorities; // } // // public void setAuthorities(List<EAuthority> authorities) { // this.authorities = authorities; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // } // Path: core-service/src/test/java/com/dataagg/commons/dao/RoleDaoTest.java import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.dataagg.CoreServiceApplication; import com.dataagg.commons.domain.ERole; package com.dataagg.commons.dao; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = CoreServiceApplication.class) public class RoleDaoTest { @Autowired private RoleDao roleDao; @Before public void setUp() throws Exception {} @After public void tearDown() throws Exception {} @Test public void testGetDefaultRoles() {} @Test public void testFetchByName() {} @Test public void testFetchFullByName() {} @Test public void testSave() {
ERole adminRole = new ERole();
DataAgg/DAFramework
commons/src/main/java/com/dataagg/util/SecurityHelper.java
// Path: commons/src/main/java/com/dataagg/commons/domain/EAuthority.java // @Table("sys_authority") // @Comment("权限标识") // public class EAuthority implements GrantedAuthority { // private static final long serialVersionUID = 7423414401567180611L; // @Id // private Long id; // // @Column(hump = true) // @ColDefine(type = ColType.VARCHAR, width = 64, notNull = true) // @Comment("权限标识") // private String name; // // @Column(hump = true) // @ColDefine(type = ColType.VARCHAR, width = 200, notNull = true) // @Comment("描述") // private String description; // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // @Override // public String getAuthority() { // return name; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // }
import java.util.ArrayList; import java.util.List; import java.util.Set; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import com.dataagg.commons.domain.EAuthority;
package com.dataagg.util; public class SecurityHelper { public static Authentication getAuthentication() { SecurityContext sc = SecurityContextHolder.getContext(); return sc.getAuthentication(); } public static Authentication auth(AuthenticationManager authenticationManager, String userName, String password) { SecurityContext sc = SecurityContextHolder.getContext(); UsernamePasswordAuthenticationToken upToken = new UsernamePasswordAuthenticationToken(userName, password); Authentication authentication = authenticationManager.authenticate(upToken); sc.setAuthentication(authentication); return sc.getAuthentication(); } public static boolean hasAuthority(Set<String> authorities, String authority) { if (authorities != null) { String authorityText = "," + authority + ","; for (String a : authorities) { if (authorityText.contains("," + a + ",")) { return true; } } } return false; }
// Path: commons/src/main/java/com/dataagg/commons/domain/EAuthority.java // @Table("sys_authority") // @Comment("权限标识") // public class EAuthority implements GrantedAuthority { // private static final long serialVersionUID = 7423414401567180611L; // @Id // private Long id; // // @Column(hump = true) // @ColDefine(type = ColType.VARCHAR, width = 64, notNull = true) // @Comment("权限标识") // private String name; // // @Column(hump = true) // @ColDefine(type = ColType.VARCHAR, width = 200, notNull = true) // @Comment("描述") // private String description; // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // @Override // public String getAuthority() { // return name; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // } // Path: commons/src/main/java/com/dataagg/util/SecurityHelper.java import java.util.ArrayList; import java.util.List; import java.util.Set; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import com.dataagg.commons.domain.EAuthority; package com.dataagg.util; public class SecurityHelper { public static Authentication getAuthentication() { SecurityContext sc = SecurityContextHolder.getContext(); return sc.getAuthentication(); } public static Authentication auth(AuthenticationManager authenticationManager, String userName, String password) { SecurityContext sc = SecurityContextHolder.getContext(); UsernamePasswordAuthenticationToken upToken = new UsernamePasswordAuthenticationToken(userName, password); Authentication authentication = authenticationManager.authenticate(upToken); sc.setAuthentication(authentication); return sc.getAuthentication(); } public static boolean hasAuthority(Set<String> authorities, String authority) { if (authorities != null) { String authorityText = "," + authority + ","; for (String a : authorities) { if (authorityText.contains("," + a + ",")) { return true; } } } return false; }
public static List<EAuthority> buildAuthority(String... allAuthorities) {
DataAgg/DAFramework
commons/src/test/java/com/dataagg/util/WPageIteratorTest.java
// Path: commons/src/main/java/com/dataagg/util/lang/ValuePlus.java // public class ValuePlus { // public static int intValue(Object value, int defaultValue) { // if (value != null) { // return Convert.toIntValue(value); // } // return defaultValue; // } // // public static long longValue(Object value, long defaultValue) { // if (value != null) { // return Convert.toLongValue(value); // } // return defaultValue; // } // // public static short shortValue(Object value, short defaultValue) { // if (value != null) { // return Convert.toShortValue(value); // } // return defaultValue; // } // // public static float floatValue(Object value, float defaultValue) { // if (value != null) { // return Convert.toFloatValue(value); // } // return defaultValue; // } // // public static double doubleValue(Object value, double defaultValue) { // if (value != null) { // return Convert.toDoubleValue(value); // } // return defaultValue; // } // // public static byte byteValue(Object value, byte defaultValue) { // if (value != null) { // return Convert.toByteValue(value); // } // return defaultValue; // } // // public static char charValue(Object value, char defaultValue) { // if (value != null) { // return Convert.toCharValue(value); // } // return defaultValue; // } // // public static String strValue(Object value, String defaultValue) { // if (value != null) { // return Convert.toString(value); // } // return defaultValue; // } // // public static String[] strValues(Object value, String[] defaultValue) { // if (value != null) { // return Convert.toStringArray(value); // } // return defaultValue; // } // // public static boolean booleanValue(Object value, boolean defaultValue) { // if (value != null && value instanceof String && ((String) value).trim().length() > 0) { // String v = ((String) value).trim(); // if ("1".equals(v) || "true".equalsIgnoreCase(v) || "yes".equalsIgnoreCase(v) || "on".equalsIgnoreCase(v)) { // return true; // } // if ("0".equals(v) || "false".equalsIgnoreCase(v) || "no".equalsIgnoreCase(v) || "off".equalsIgnoreCase(v)) { // return false; // } // return Convert.toBooleanValue(value); // } // return defaultValue; // } // // @SuppressWarnings("unchecked") // public static <T> List<T> lst(T... all) { // List<T> lst = new ArrayList<>(); // for (T t : all) { // lst.add(t); // } // return lst; // } // }
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.Arrays; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.dataagg.util.lang.ValuePlus;
package com.dataagg.util; public class WPageIteratorTest { private static final Logger LOG = LoggerFactory.getLogger(WPageIteratorTest.class); @Before public void setUp() throws Exception {} @After public void tearDown() throws Exception {} @Test public void testWPage() { WPage page = new WPage(); //100 int total = 100; page.setTotal(total); // page.setFrom(0); // assertEquals(1, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(19); // assertEquals(1, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(20); // assertEquals(2, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(99); // assertEquals(5, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // page.setFrom(100); // assertEquals(5, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // //101 // total = 101; // page.setTotal(total); // // page.setFrom(0); // assertEquals(1, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(19); // assertEquals(1, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(20); // assertEquals(2, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(99); // assertEquals(5, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(100); // assertEquals(6, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // page.setFrom(101); // assertEquals(6, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); } @Test public void testDoSearch() { WPage page = new WPage(); int total = 10; page.setSize(3); WPageIterator<Integer> wpIterator = new WPageIterator<Integer>(page) { @Override public void doSearch() {
// Path: commons/src/main/java/com/dataagg/util/lang/ValuePlus.java // public class ValuePlus { // public static int intValue(Object value, int defaultValue) { // if (value != null) { // return Convert.toIntValue(value); // } // return defaultValue; // } // // public static long longValue(Object value, long defaultValue) { // if (value != null) { // return Convert.toLongValue(value); // } // return defaultValue; // } // // public static short shortValue(Object value, short defaultValue) { // if (value != null) { // return Convert.toShortValue(value); // } // return defaultValue; // } // // public static float floatValue(Object value, float defaultValue) { // if (value != null) { // return Convert.toFloatValue(value); // } // return defaultValue; // } // // public static double doubleValue(Object value, double defaultValue) { // if (value != null) { // return Convert.toDoubleValue(value); // } // return defaultValue; // } // // public static byte byteValue(Object value, byte defaultValue) { // if (value != null) { // return Convert.toByteValue(value); // } // return defaultValue; // } // // public static char charValue(Object value, char defaultValue) { // if (value != null) { // return Convert.toCharValue(value); // } // return defaultValue; // } // // public static String strValue(Object value, String defaultValue) { // if (value != null) { // return Convert.toString(value); // } // return defaultValue; // } // // public static String[] strValues(Object value, String[] defaultValue) { // if (value != null) { // return Convert.toStringArray(value); // } // return defaultValue; // } // // public static boolean booleanValue(Object value, boolean defaultValue) { // if (value != null && value instanceof String && ((String) value).trim().length() > 0) { // String v = ((String) value).trim(); // if ("1".equals(v) || "true".equalsIgnoreCase(v) || "yes".equalsIgnoreCase(v) || "on".equalsIgnoreCase(v)) { // return true; // } // if ("0".equals(v) || "false".equalsIgnoreCase(v) || "no".equalsIgnoreCase(v) || "off".equalsIgnoreCase(v)) { // return false; // } // return Convert.toBooleanValue(value); // } // return defaultValue; // } // // @SuppressWarnings("unchecked") // public static <T> List<T> lst(T... all) { // List<T> lst = new ArrayList<>(); // for (T t : all) { // lst.add(t); // } // return lst; // } // } // Path: commons/src/test/java/com/dataagg/util/WPageIteratorTest.java import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.Arrays; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.dataagg.util.lang.ValuePlus; package com.dataagg.util; public class WPageIteratorTest { private static final Logger LOG = LoggerFactory.getLogger(WPageIteratorTest.class); @Before public void setUp() throws Exception {} @After public void tearDown() throws Exception {} @Test public void testWPage() { WPage page = new WPage(); //100 int total = 100; page.setTotal(total); // page.setFrom(0); // assertEquals(1, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(19); // assertEquals(1, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(20); // assertEquals(2, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(99); // assertEquals(5, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // page.setFrom(100); // assertEquals(5, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // //101 // total = 101; // page.setTotal(total); // // page.setFrom(0); // assertEquals(1, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(19); // assertEquals(1, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(20); // assertEquals(2, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(99); // assertEquals(5, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // // page.setFrom(100); // assertEquals(6, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); // page.setFrom(101); // assertEquals(6, page.getPageNo()); // assertEquals(total, page.getTotal().intValue()); } @Test public void testDoSearch() { WPage page = new WPage(); int total = 10; page.setSize(3); WPageIterator<Integer> wpIterator = new WPageIterator<Integer>(page) { @Override public void doSearch() {
update(ValuePlus.lst(1, 2, 3), total);
JOML-CI/JOML
src/org/joml/Matrix4x3fStack.java
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // }
import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput;
result = prime * result + mats[i].hashCode(); } return result; } /* * Contract between Matrix4x3f and Matrix4x3fStack: * * - Matrix4x3f.equals(Matrix4x3fStack) is true iff all the 12 matrix elements are equal * - Matrix4x3fStack.equals(Matrix4x3f) is true iff all the 12 matrix elements are equal * - Matrix4x3fStack.equals(Matrix4x3fStack) is true iff all 12 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix4x3fStack) { Matrix4x3fStack other = (Matrix4x3fStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; }
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // Path: src/org/joml/Matrix4x3fStack.java import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; result = prime * result + mats[i].hashCode(); } return result; } /* * Contract between Matrix4x3f and Matrix4x3fStack: * * - Matrix4x3f.equals(Matrix4x3fStack) is true iff all the 12 matrix elements are equal * - Matrix4x3fStack.equals(Matrix4x3f) is true iff all the 12 matrix elements are equal * - Matrix4x3fStack.equals(Matrix4x3fStack) is true iff all 12 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix4x3fStack) { Matrix4x3fStack other = (Matrix4x3fStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Matrix4x3fStack.java
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // }
import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput;
* - Matrix4x3f.equals(Matrix4x3fStack) is true iff all the 12 matrix elements are equal * - Matrix4x3fStack.equals(Matrix4x3f) is true iff all the 12 matrix elements are equal * - Matrix4x3fStack.equals(Matrix4x3fStack) is true iff all 12 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix4x3fStack) { Matrix4x3fStack other = (Matrix4x3fStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; } public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeInt(curr); for (int i = 0; i < curr; i++) { out.writeObject(mats[i]); } }
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // Path: src/org/joml/Matrix4x3fStack.java import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; * - Matrix4x3f.equals(Matrix4x3fStack) is true iff all the 12 matrix elements are equal * - Matrix4x3fStack.equals(Matrix4x3f) is true iff all the 12 matrix elements are equal * - Matrix4x3fStack.equals(Matrix4x3fStack) is true iff all 12 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix4x3fStack) { Matrix4x3fStack other = (Matrix4x3fStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; } public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeInt(curr); for (int i = 0; i < curr; i++) { out.writeObject(mats[i]); } }
public void readExternal(ObjectInput in) throws IOException {
JOML-CI/JOML
src/org/joml/Vector4i.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer;
this.w = -w; return this; } public Vector4i negate(Vector4i dest) { dest.x = -x; dest.y = -y; dest.z = -z; dest.w = -w; return dest; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector4i.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer; this.w = -w; return this; } public Vector4i negate(Vector4i dest) { dest.x = -x; dest.y = -y; dest.z = -z; dest.w = -w; return dest; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */
public String toString(NumberFormat formatter) {
JOML-CI/JOML
src/org/joml/Vector4i.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer;
public Vector4i negate(Vector4i dest) { dest.x = -x; dest.y = -y; dest.z = -z; dest.w = -w; return dest; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + formatter.format(x) + " " + formatter.format(y) + " " + formatter.format(z) + " " + formatter.format(w) + ")"; }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector4i.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer; public Vector4i negate(Vector4i dest) { dest.x = -x; dest.y = -y; dest.z = -z; dest.w = -w; return dest; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + formatter.format(x) + " " + formatter.format(y) + " " + formatter.format(z) + " " + formatter.format(w) + ")"; }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Vector4i.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer;
/** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + formatter.format(x) + " " + formatter.format(y) + " " + formatter.format(z) + " " + formatter.format(w) + ")"; } public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeInt(w); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector4i.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer; /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + formatter.format(x) + " " + formatter.format(y) + " " + formatter.format(z) + " " + formatter.format(w) + ")"; } public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(x); out.writeInt(y); out.writeInt(z); out.writeInt(w); }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
JOML-CI/JOML
src/org/joml/Quaterniond.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.text.DecimalFormat; import java.text.NumberFormat;
x = (dirnX + leftZ) * t; y = (upnZ + dirnY) * t; w = (upnX - leftY) * t; } } /* Multiply */ return dest.set(Math.fma(this.w, x, Math.fma(this.x, w, Math.fma(this.y, z, -this.z * y))), Math.fma(this.w, y, Math.fma(-this.x, z, Math.fma(this.y, w, this.z * x))), Math.fma(this.w, z, Math.fma(this.x, y, Math.fma(-this.y, x, this.z * w))), Math.fma(this.w, w, Math.fma(-this.x, x, Math.fma(-this.y, y, -this.z * z)))); } /** * Return a string representation of this quaternion. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this quaternion by formatting the components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the quaternion components with * @return the string representation */
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Quaterniond.java import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.text.DecimalFormat; import java.text.NumberFormat; x = (dirnX + leftZ) * t; y = (upnZ + dirnY) * t; w = (upnX - leftY) * t; } } /* Multiply */ return dest.set(Math.fma(this.w, x, Math.fma(this.x, w, Math.fma(this.y, z, -this.z * y))), Math.fma(this.w, y, Math.fma(-this.x, z, Math.fma(this.y, w, this.z * x))), Math.fma(this.w, z, Math.fma(this.x, y, Math.fma(-this.y, x, this.z * w))), Math.fma(this.w, w, Math.fma(-this.x, x, Math.fma(-this.y, y, -this.z * z)))); } /** * Return a string representation of this quaternion. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this quaternion by formatting the components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the quaternion components with * @return the string representation */
public String toString(NumberFormat formatter) {
JOML-CI/JOML
src/org/joml/Quaterniond.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.text.DecimalFormat; import java.text.NumberFormat;
} /* Multiply */ return dest.set(Math.fma(this.w, x, Math.fma(this.x, w, Math.fma(this.y, z, -this.z * y))), Math.fma(this.w, y, Math.fma(-this.x, z, Math.fma(this.y, w, this.z * x))), Math.fma(this.w, z, Math.fma(this.x, y, Math.fma(-this.y, x, this.z * w))), Math.fma(this.w, w, Math.fma(-this.x, x, Math.fma(-this.y, y, -this.z * z)))); } /** * Return a string representation of this quaternion. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this quaternion by formatting the components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the quaternion components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + Runtime.format(x, formatter) + " " + Runtime.format(y, formatter) + " " + Runtime.format(z, formatter) + " " + Runtime.format(w, formatter) + ")"; }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Quaterniond.java import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.text.DecimalFormat; import java.text.NumberFormat; } /* Multiply */ return dest.set(Math.fma(this.w, x, Math.fma(this.x, w, Math.fma(this.y, z, -this.z * y))), Math.fma(this.w, y, Math.fma(-this.x, z, Math.fma(this.y, w, this.z * x))), Math.fma(this.w, z, Math.fma(this.x, y, Math.fma(-this.y, x, this.z * w))), Math.fma(this.w, w, Math.fma(-this.x, x, Math.fma(-this.y, y, -this.z * z)))); } /** * Return a string representation of this quaternion. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this quaternion by formatting the components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the quaternion components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + Runtime.format(x, formatter) + " " + Runtime.format(y, formatter) + " " + Runtime.format(z, formatter) + " " + Runtime.format(w, formatter) + ")"; }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Quaterniond.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.text.DecimalFormat; import java.text.NumberFormat;
/** * Return a string representation of this quaternion. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this quaternion by formatting the components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the quaternion components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + Runtime.format(x, formatter) + " " + Runtime.format(y, formatter) + " " + Runtime.format(z, formatter) + " " + Runtime.format(w, formatter) + ")"; } public void writeExternal(ObjectOutput out) throws IOException { out.writeDouble(x); out.writeDouble(y); out.writeDouble(z); out.writeDouble(w); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Quaterniond.java import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.text.DecimalFormat; import java.text.NumberFormat; /** * Return a string representation of this quaternion. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this quaternion by formatting the components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the quaternion components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + Runtime.format(x, formatter) + " " + Runtime.format(y, formatter) + " " + Runtime.format(z, formatter) + " " + Runtime.format(w, formatter) + ")"; } public void writeExternal(ObjectOutput out) throws IOException { out.writeDouble(x); out.writeDouble(y); out.writeDouble(z); out.writeDouble(w); }
public void readExternal(ObjectInput in) throws IOException,
JOML-CI/JOML
src/org/joml/Matrix3d.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.nio.FloatBuffer; import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.DoubleBuffer;
* * @return the string representation */ public String toString() { String str = toString(Options.NUMBER_FORMAT); StringBuffer res = new StringBuffer(); int eIndex = Integer.MIN_VALUE; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == 'E') { eIndex = i; } else if (c == ' ' && eIndex == i - 1) { // workaround Java 1.4 DecimalFormat bug res.append('+'); continue; } else if (Character.isDigit(c) && eIndex == i - 1) { res.append('+'); } res.append(c); } return res.toString(); } /** * Return a string representation of this matrix by formatting the matrix elements with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the matrix values with * @return the string representation */
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix3d.java import java.nio.FloatBuffer; import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.DoubleBuffer; * * @return the string representation */ public String toString() { String str = toString(Options.NUMBER_FORMAT); StringBuffer res = new StringBuffer(); int eIndex = Integer.MIN_VALUE; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == 'E') { eIndex = i; } else if (c == ' ' && eIndex == i - 1) { // workaround Java 1.4 DecimalFormat bug res.append('+'); continue; } else if (Character.isDigit(c) && eIndex == i - 1) { res.append('+'); } res.append(c); } return res.toString(); } /** * Return a string representation of this matrix by formatting the matrix elements with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the matrix values with * @return the string representation */
public String toString(NumberFormat formatter) {
JOML-CI/JOML
src/org/joml/Matrix3d.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.nio.FloatBuffer; import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.DoubleBuffer;
} public Vector3f transform(Vector3f v) { return v.mul(this); } public Vector3f transform(Vector3fc v, Vector3f dest) { return v.mul(this, dest); } public Vector3d transform(double x, double y, double z, Vector3d dest) { return dest.set(Math.fma(m00, x, Math.fma(m10, y, m20 * z)), Math.fma(m01, x, Math.fma(m11, y, m21 * z)), Math.fma(m02, x, Math.fma(m12, y, m22 * z))); } public Vector3d transformTranspose(Vector3d v) { return v.mulTranspose(this); } public Vector3d transformTranspose(Vector3dc v, Vector3d dest) { return v.mulTranspose(this, dest); } public Vector3d transformTranspose(double x, double y, double z, Vector3d dest) { return dest.set(Math.fma(m00, x, Math.fma(m01, y, m02 * z)), Math.fma(m10, x, Math.fma(m11, y, m12 * z)), Math.fma(m20, x, Math.fma(m21, y, m22 * z))); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix3d.java import java.nio.FloatBuffer; import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.DoubleBuffer; } public Vector3f transform(Vector3f v) { return v.mul(this); } public Vector3f transform(Vector3fc v, Vector3f dest) { return v.mul(this, dest); } public Vector3d transform(double x, double y, double z, Vector3d dest) { return dest.set(Math.fma(m00, x, Math.fma(m10, y, m20 * z)), Math.fma(m01, x, Math.fma(m11, y, m21 * z)), Math.fma(m02, x, Math.fma(m12, y, m22 * z))); } public Vector3d transformTranspose(Vector3d v) { return v.mulTranspose(this); } public Vector3d transformTranspose(Vector3dc v, Vector3d dest) { return v.mulTranspose(this, dest); } public Vector3d transformTranspose(double x, double y, double z, Vector3d dest) { return dest.set(Math.fma(m00, x, Math.fma(m01, y, m02 * z)), Math.fma(m10, x, Math.fma(m11, y, m12 * z)), Math.fma(m20, x, Math.fma(m21, y, m22 * z))); }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Matrix3d.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.nio.FloatBuffer; import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.DoubleBuffer;
Math.fma(m01, x, Math.fma(m11, y, m21 * z)), Math.fma(m02, x, Math.fma(m12, y, m22 * z))); } public Vector3d transformTranspose(Vector3d v) { return v.mulTranspose(this); } public Vector3d transformTranspose(Vector3dc v, Vector3d dest) { return v.mulTranspose(this, dest); } public Vector3d transformTranspose(double x, double y, double z, Vector3d dest) { return dest.set(Math.fma(m00, x, Math.fma(m01, y, m02 * z)), Math.fma(m10, x, Math.fma(m11, y, m12 * z)), Math.fma(m20, x, Math.fma(m21, y, m22 * z))); } public void writeExternal(ObjectOutput out) throws IOException { out.writeDouble(m00); out.writeDouble(m01); out.writeDouble(m02); out.writeDouble(m10); out.writeDouble(m11); out.writeDouble(m12); out.writeDouble(m20); out.writeDouble(m21); out.writeDouble(m22); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix3d.java import java.nio.FloatBuffer; import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.DoubleBuffer; Math.fma(m01, x, Math.fma(m11, y, m21 * z)), Math.fma(m02, x, Math.fma(m12, y, m22 * z))); } public Vector3d transformTranspose(Vector3d v) { return v.mulTranspose(this); } public Vector3d transformTranspose(Vector3dc v, Vector3d dest) { return v.mulTranspose(this, dest); } public Vector3d transformTranspose(double x, double y, double z, Vector3d dest) { return dest.set(Math.fma(m00, x, Math.fma(m01, y, m02 * z)), Math.fma(m10, x, Math.fma(m11, y, m12 * z)), Math.fma(m20, x, Math.fma(m21, y, m22 * z))); } public void writeExternal(ObjectOutput out) throws IOException { out.writeDouble(m00); out.writeDouble(m01); out.writeDouble(m02); out.writeDouble(m10); out.writeDouble(m11); out.writeDouble(m12); out.writeDouble(m20); out.writeDouble(m21); out.writeDouble(m22); }
public void readExternal(ObjectInput in) throws IOException {
JOML-CI/JOML
src/org/joml/Matrix4x3dStack.java
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // }
import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput;
result = prime * result + mats[i].hashCode(); } return result; } /* * Contract between Matrix4x3d and Matrix4x3dStack: * * - Matrix4x3d.equals(Matrix4x3dStack) is true iff all the 12 matrix elements are equal * - Matrix4x3dStack.equals(Matrix4x3d) is true iff all the 12 matrix elements are equal * - Matrix4x3dStack.equals(Matrix4x3dStack) is true iff all 12 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix4x3dStack) { Matrix4x3dStack other = (Matrix4x3dStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; }
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // Path: src/org/joml/Matrix4x3dStack.java import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; result = prime * result + mats[i].hashCode(); } return result; } /* * Contract between Matrix4x3d and Matrix4x3dStack: * * - Matrix4x3d.equals(Matrix4x3dStack) is true iff all the 12 matrix elements are equal * - Matrix4x3dStack.equals(Matrix4x3d) is true iff all the 12 matrix elements are equal * - Matrix4x3dStack.equals(Matrix4x3dStack) is true iff all 12 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix4x3dStack) { Matrix4x3dStack other = (Matrix4x3dStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Matrix4x3dStack.java
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // }
import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput;
* - Matrix4x3d.equals(Matrix4x3dStack) is true iff all the 12 matrix elements are equal * - Matrix4x3dStack.equals(Matrix4x3d) is true iff all the 12 matrix elements are equal * - Matrix4x3dStack.equals(Matrix4x3dStack) is true iff all 12 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix4x3dStack) { Matrix4x3dStack other = (Matrix4x3dStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; } public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeInt(curr); for (int i = 0; i < curr; i++) { out.writeObject(mats[i]); } }
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // Path: src/org/joml/Matrix4x3dStack.java import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; * - Matrix4x3d.equals(Matrix4x3dStack) is true iff all the 12 matrix elements are equal * - Matrix4x3dStack.equals(Matrix4x3d) is true iff all the 12 matrix elements are equal * - Matrix4x3dStack.equals(Matrix4x3dStack) is true iff all 12 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix4x3dStack) { Matrix4x3dStack other = (Matrix4x3dStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; } public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeInt(curr); for (int i = 0; i < curr; i++) { out.writeObject(mats[i]); } }
public void readExternal(ObjectInput in) throws IOException {
JOML-CI/JOML
src/org/joml/Vector4d.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.*;
this.w = w > v.w() ? w : v.w(); return this; } public Vector4d max(Vector4dc v, Vector4d dest) { dest.x = x > v.x() ? x : v.x(); dest.y = y > v.y() ? y : v.y(); dest.z = z > v.z() ? z : v.z(); dest.w = w > v.w() ? w : v.w(); return dest; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector4d.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.*; this.w = w > v.w() ? w : v.w(); return this; } public Vector4d max(Vector4dc v, Vector4d dest) { dest.x = x > v.x() ? x : v.x(); dest.y = y > v.y() ? y : v.y(); dest.z = z > v.z() ? z : v.z(); dest.w = w > v.w() ? w : v.w(); return dest; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */
public String toString(NumberFormat formatter) {
JOML-CI/JOML
src/org/joml/Vector4d.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.*;
public Vector4d max(Vector4dc v, Vector4d dest) { dest.x = x > v.x() ? x : v.x(); dest.y = y > v.y() ? y : v.y(); dest.z = z > v.z() ? z : v.z(); dest.w = w > v.w() ? w : v.w(); return dest; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + Runtime.format(x, formatter) + " " + Runtime.format(y, formatter) + " " + Runtime.format(z, formatter) + " " + Runtime.format(w, formatter) + ")"; }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector4d.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.*; public Vector4d max(Vector4dc v, Vector4d dest) { dest.x = x > v.x() ? x : v.x(); dest.y = y > v.y() ? y : v.y(); dest.z = z > v.z() ? z : v.z(); dest.w = w > v.w() ? w : v.w(); return dest; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + Runtime.format(x, formatter) + " " + Runtime.format(y, formatter) + " " + Runtime.format(z, formatter) + " " + Runtime.format(w, formatter) + ")"; }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Vector4d.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.*;
/** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + Runtime.format(x, formatter) + " " + Runtime.format(y, formatter) + " " + Runtime.format(z, formatter) + " " + Runtime.format(w, formatter) + ")"; } public void writeExternal(ObjectOutput out) throws IOException { out.writeDouble(x); out.writeDouble(y); out.writeDouble(z); out.writeDouble(w); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector4d.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.*; /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + Runtime.format(x, formatter) + " " + Runtime.format(y, formatter) + " " + Runtime.format(z, formatter) + " " + Runtime.format(w, formatter) + ")"; } public void writeExternal(ObjectOutput out) throws IOException { out.writeDouble(x); out.writeDouble(y); out.writeDouble(z); out.writeDouble(w); }
public void readExternal(ObjectInput in) throws IOException,
JOML-CI/JOML
src/org/joml/Vector2i.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer;
/** * Divide all components of this {@link Vector2i} by the given scalar value. * * @param scalar * the scalar to divide by * @return a vector holding the result */ public Vector2i div(int scalar) { this.x = x / scalar; this.y = y / scalar; return this; } public Vector2i div(int scalar, Vector2i dest) { dest.x = x / scalar; dest.y = y / scalar; return dest; } /** * Set all components to zero. * * @return this */ public Vector2i zero() { this.x = 0; this.y = 0; return this; }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector2i.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer; /** * Divide all components of this {@link Vector2i} by the given scalar value. * * @param scalar * the scalar to divide by * @return a vector holding the result */ public Vector2i div(int scalar) { this.x = x / scalar; this.y = y / scalar; return this; } public Vector2i div(int scalar, Vector2i dest) { dest.x = x / scalar; dest.y = y / scalar; return dest; } /** * Set all components to zero. * * @return this */ public Vector2i zero() { this.x = 0; this.y = 0; return this; }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Vector2i.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer;
* @return a vector holding the result */ public Vector2i div(int scalar) { this.x = x / scalar; this.y = y / scalar; return this; } public Vector2i div(int scalar, Vector2i dest) { dest.x = x / scalar; dest.y = y / scalar; return dest; } /** * Set all components to zero. * * @return this */ public Vector2i zero() { this.x = 0; this.y = 0; return this; } public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(x); out.writeInt(y); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector2i.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer; * @return a vector holding the result */ public Vector2i div(int scalar) { this.x = x / scalar; this.y = y / scalar; return this; } public Vector2i div(int scalar, Vector2i dest) { dest.x = x / scalar; dest.y = y / scalar; return dest; } /** * Set all components to zero. * * @return this */ public Vector2i zero() { this.x = 0; this.y = 0; return this; } public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(x); out.writeInt(y); }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
JOML-CI/JOML
src/org/joml/Vector2i.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer;
} return true; } public boolean equals(int x, int y) { if (this.x != x) return false; if (this.y != y) return false; return true; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector2i.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer; } return true; } public boolean equals(int x, int y) { if (this.x != x) return false; if (this.y != y) return false; return true; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */
public String toString(NumberFormat formatter) {
JOML-CI/JOML
src/org/joml/Matrix2f.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
* * @return the string representation */ public String toString() { String str = toString(Options.NUMBER_FORMAT); StringBuffer res = new StringBuffer(); int eIndex = Integer.MIN_VALUE; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == 'E') { eIndex = i; } else if (c == ' ' && eIndex == i - 1) { // workaround Java 1.4 DecimalFormat bug res.append('+'); continue; } else if (Character.isDigit(c) && eIndex == i - 1) { res.append('+'); } res.append(c); } return res.toString(); } /** * Return a string representation of this matrix by formatting the matrix elements with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the matrix values with * @return the string representation */
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix2f.java import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.nio.ByteBuffer; import java.nio.FloatBuffer; * * @return the string representation */ public String toString() { String str = toString(Options.NUMBER_FORMAT); StringBuffer res = new StringBuffer(); int eIndex = Integer.MIN_VALUE; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == 'E') { eIndex = i; } else if (c == ' ' && eIndex == i - 1) { // workaround Java 1.4 DecimalFormat bug res.append('+'); continue; } else if (Character.isDigit(c) && eIndex == i - 1) { res.append('+'); } res.append(c); } return res.toString(); } /** * Return a string representation of this matrix by formatting the matrix elements with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the matrix values with * @return the string representation */
public String toString(NumberFormat formatter) {
JOML-CI/JOML
src/org/joml/Matrix2f.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
public Vector2f transform(Vector2f v) { return v.mul(this); } public Vector2f transform(Vector2fc v, Vector2f dest) { v.mul(this, dest); return dest; } public Vector2f transform(float x, float y, Vector2f dest) { dest.set(m00 * x + m10 * y, m01 * x + m11 * y); return dest; } public Vector2f transformTranspose(Vector2f v) { return v.mulTranspose(this); } public Vector2f transformTranspose(Vector2fc v, Vector2f dest) { v.mulTranspose(this, dest); return dest; } public Vector2f transformTranspose(float x, float y, Vector2f dest) { dest.set(m00 * x + m01 * y, m10 * x + m11 * y); return dest; }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix2f.java import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.nio.ByteBuffer; import java.nio.FloatBuffer; public Vector2f transform(Vector2f v) { return v.mul(this); } public Vector2f transform(Vector2fc v, Vector2f dest) { v.mul(this, dest); return dest; } public Vector2f transform(float x, float y, Vector2f dest) { dest.set(m00 * x + m10 * y, m01 * x + m11 * y); return dest; } public Vector2f transformTranspose(Vector2f v) { return v.mulTranspose(this); } public Vector2f transformTranspose(Vector2fc v, Vector2f dest) { v.mulTranspose(this, dest); return dest; } public Vector2f transformTranspose(float x, float y, Vector2f dest) { dest.set(m00 * x + m01 * y, m10 * x + m11 * y); return dest; }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Matrix2f.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
} public Vector2f transform(float x, float y, Vector2f dest) { dest.set(m00 * x + m10 * y, m01 * x + m11 * y); return dest; } public Vector2f transformTranspose(Vector2f v) { return v.mulTranspose(this); } public Vector2f transformTranspose(Vector2fc v, Vector2f dest) { v.mulTranspose(this, dest); return dest; } public Vector2f transformTranspose(float x, float y, Vector2f dest) { dest.set(m00 * x + m01 * y, m10 * x + m11 * y); return dest; } public void writeExternal(ObjectOutput out) throws IOException { out.writeFloat(m00); out.writeFloat(m01); out.writeFloat(m10); out.writeFloat(m11); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix2f.java import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.nio.ByteBuffer; import java.nio.FloatBuffer; } public Vector2f transform(float x, float y, Vector2f dest) { dest.set(m00 * x + m10 * y, m01 * x + m11 * y); return dest; } public Vector2f transformTranspose(Vector2f v) { return v.mulTranspose(this); } public Vector2f transformTranspose(Vector2fc v, Vector2f dest) { v.mulTranspose(this, dest); return dest; } public Vector2f transformTranspose(float x, float y, Vector2f dest) { dest.set(m00 * x + m01 * y, m10 * x + m11 * y); return dest; } public void writeExternal(ObjectOutput out) throws IOException { out.writeFloat(m00); out.writeFloat(m01); out.writeFloat(m10); out.writeFloat(m11); }
public void readExternal(ObjectInput in) throws IOException {
JOML-CI/JOML
src/org/joml/Options.java
// Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Arrays; import java.util.Locale;
/* * The MIT License * * Copyright (c) 2016-2021 JOML * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.joml; //#ifndef __GWT__ //#endif /** * Utility class for reading system properties. * * @author Kai Burjack */ public final class Options { /** * Whether certain debugging checks should be made, such as that only direct NIO Buffers are used when Unsafe is active, * and a proxy should be created on calls to readOnlyView(). */ public static final boolean DEBUG = hasOption(System.getProperty("joml.debug", "false")); //#ifdef __HAS_UNSAFE__ /** * Whether <i>not</i> to use sun.misc.Unsafe when copying memory with MemUtil. */ public static final boolean NO_UNSAFE = hasOption(System.getProperty("joml.nounsafe", "false")); /** * Whether to <i>force</i> the use of sun.misc.Unsafe when copying memory with MemUtil. */ public static final boolean FORCE_UNSAFE = hasOption(System.getProperty("joml.forceUnsafe", "false")); //#endif /** * Whether fast approximations of some java.lang.Math operations should be used. */ public static final boolean FASTMATH = hasOption(System.getProperty("joml.fastmath", "false")); /** * When {@link #FASTMATH} is <code>true</code>, whether to use a lookup table for sin/cos. */ public static final boolean SIN_LOOKUP = hasOption(System.getProperty("joml.sinLookup", "false")); /** * When {@link #SIN_LOOKUP} is <code>true</code>, this determines the table size. */ public static final int SIN_LOOKUP_BITS = Integer.parseInt(System.getProperty("joml.sinLookup.bits", "14")); //#ifndef __GWT__ /** * Whether to use a {@link NumberFormat} producing scientific notation output when formatting matrix, * vector and quaternion components to strings. */ public static final boolean useNumberFormat = hasOption(System.getProperty("joml.format", "true")); //#endif //#ifdef __HAS_MATH_FMA__ /** * Whether to try using java.lang.Math.fma() in most matrix/vector/quaternion operations if it is available. * If the CPU does <i>not</i> support it, it will be a lot slower than `a*b+c` and potentially generate a lot of memory allocations * for the emulation with `java.util.BigDecimal`, though. */ public static final boolean USE_MATH_FMA = hasOption(System.getProperty("joml.useMathFma", "false")); //#endif //#ifndef __GWT__ /** * When {@link #useNumberFormat} is <code>true</code> then this determines the number of decimal digits * produced in the formatted numbers. */ //#else /** * Determines the number of decimal digits produced in the formatted numbers. */ //#endif public static final int numberFormatDecimals = Integer.parseInt(System.getProperty("joml.format.decimals", "3")); /** * The {@link NumberFormat} used to format all numbers throughout all JOML classes. */
// Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Options.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Arrays; import java.util.Locale; /* * The MIT License * * Copyright (c) 2016-2021 JOML * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.joml; //#ifndef __GWT__ //#endif /** * Utility class for reading system properties. * * @author Kai Burjack */ public final class Options { /** * Whether certain debugging checks should be made, such as that only direct NIO Buffers are used when Unsafe is active, * and a proxy should be created on calls to readOnlyView(). */ public static final boolean DEBUG = hasOption(System.getProperty("joml.debug", "false")); //#ifdef __HAS_UNSAFE__ /** * Whether <i>not</i> to use sun.misc.Unsafe when copying memory with MemUtil. */ public static final boolean NO_UNSAFE = hasOption(System.getProperty("joml.nounsafe", "false")); /** * Whether to <i>force</i> the use of sun.misc.Unsafe when copying memory with MemUtil. */ public static final boolean FORCE_UNSAFE = hasOption(System.getProperty("joml.forceUnsafe", "false")); //#endif /** * Whether fast approximations of some java.lang.Math operations should be used. */ public static final boolean FASTMATH = hasOption(System.getProperty("joml.fastmath", "false")); /** * When {@link #FASTMATH} is <code>true</code>, whether to use a lookup table for sin/cos. */ public static final boolean SIN_LOOKUP = hasOption(System.getProperty("joml.sinLookup", "false")); /** * When {@link #SIN_LOOKUP} is <code>true</code>, this determines the table size. */ public static final int SIN_LOOKUP_BITS = Integer.parseInt(System.getProperty("joml.sinLookup.bits", "14")); //#ifndef __GWT__ /** * Whether to use a {@link NumberFormat} producing scientific notation output when formatting matrix, * vector and quaternion components to strings. */ public static final boolean useNumberFormat = hasOption(System.getProperty("joml.format", "true")); //#endif //#ifdef __HAS_MATH_FMA__ /** * Whether to try using java.lang.Math.fma() in most matrix/vector/quaternion operations if it is available. * If the CPU does <i>not</i> support it, it will be a lot slower than `a*b+c` and potentially generate a lot of memory allocations * for the emulation with `java.util.BigDecimal`, though. */ public static final boolean USE_MATH_FMA = hasOption(System.getProperty("joml.useMathFma", "false")); //#endif //#ifndef __GWT__ /** * When {@link #useNumberFormat} is <code>true</code> then this determines the number of decimal digits * produced in the formatted numbers. */ //#else /** * Determines the number of decimal digits produced in the formatted numbers. */ //#endif public static final int numberFormatDecimals = Integer.parseInt(System.getProperty("joml.format.decimals", "3")); /** * The {@link NumberFormat} used to format all numbers throughout all JOML classes. */
public static final NumberFormat NUMBER_FORMAT = decimalFormat();
JOML-CI/JOML
src/org/joml/Options.java
// Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Arrays; import java.util.Locale;
/* * The MIT License * * Copyright (c) 2016-2021 JOML * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.joml; //#ifndef __GWT__ //#endif /** * Utility class for reading system properties. * * @author Kai Burjack */ public final class Options { /** * Whether certain debugging checks should be made, such as that only direct NIO Buffers are used when Unsafe is active, * and a proxy should be created on calls to readOnlyView(). */ public static final boolean DEBUG = hasOption(System.getProperty("joml.debug", "false")); //#ifdef __HAS_UNSAFE__ /** * Whether <i>not</i> to use sun.misc.Unsafe when copying memory with MemUtil. */ public static final boolean NO_UNSAFE = hasOption(System.getProperty("joml.nounsafe", "false")); /** * Whether to <i>force</i> the use of sun.misc.Unsafe when copying memory with MemUtil. */ public static final boolean FORCE_UNSAFE = hasOption(System.getProperty("joml.forceUnsafe", "false")); //#endif /** * Whether fast approximations of some java.lang.Math operations should be used. */ public static final boolean FASTMATH = hasOption(System.getProperty("joml.fastmath", "false")); /** * When {@link #FASTMATH} is <code>true</code>, whether to use a lookup table for sin/cos. */ public static final boolean SIN_LOOKUP = hasOption(System.getProperty("joml.sinLookup", "false")); /** * When {@link #SIN_LOOKUP} is <code>true</code>, this determines the table size. */ public static final int SIN_LOOKUP_BITS = Integer.parseInt(System.getProperty("joml.sinLookup.bits", "14")); //#ifndef __GWT__ /** * Whether to use a {@link NumberFormat} producing scientific notation output when formatting matrix, * vector and quaternion components to strings. */ public static final boolean useNumberFormat = hasOption(System.getProperty("joml.format", "true")); //#endif //#ifdef __HAS_MATH_FMA__ /** * Whether to try using java.lang.Math.fma() in most matrix/vector/quaternion operations if it is available. * If the CPU does <i>not</i> support it, it will be a lot slower than `a*b+c` and potentially generate a lot of memory allocations * for the emulation with `java.util.BigDecimal`, though. */ public static final boolean USE_MATH_FMA = hasOption(System.getProperty("joml.useMathFma", "false")); //#endif //#ifndef __GWT__ /** * When {@link #useNumberFormat} is <code>true</code> then this determines the number of decimal digits * produced in the formatted numbers. */ //#else /** * Determines the number of decimal digits produced in the formatted numbers. */ //#endif public static final int numberFormatDecimals = Integer.parseInt(System.getProperty("joml.format.decimals", "3")); /** * The {@link NumberFormat} used to format all numbers throughout all JOML classes. */ public static final NumberFormat NUMBER_FORMAT = decimalFormat(); private Options() { } private static NumberFormat decimalFormat() { NumberFormat df; //#ifndef __GWT__ if (useNumberFormat) { //#endif char[] prec = new char[numberFormatDecimals]; Arrays.fill(prec, '0');
// Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Options.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Arrays; import java.util.Locale; /* * The MIT License * * Copyright (c) 2016-2021 JOML * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.joml; //#ifndef __GWT__ //#endif /** * Utility class for reading system properties. * * @author Kai Burjack */ public final class Options { /** * Whether certain debugging checks should be made, such as that only direct NIO Buffers are used when Unsafe is active, * and a proxy should be created on calls to readOnlyView(). */ public static final boolean DEBUG = hasOption(System.getProperty("joml.debug", "false")); //#ifdef __HAS_UNSAFE__ /** * Whether <i>not</i> to use sun.misc.Unsafe when copying memory with MemUtil. */ public static final boolean NO_UNSAFE = hasOption(System.getProperty("joml.nounsafe", "false")); /** * Whether to <i>force</i> the use of sun.misc.Unsafe when copying memory with MemUtil. */ public static final boolean FORCE_UNSAFE = hasOption(System.getProperty("joml.forceUnsafe", "false")); //#endif /** * Whether fast approximations of some java.lang.Math operations should be used. */ public static final boolean FASTMATH = hasOption(System.getProperty("joml.fastmath", "false")); /** * When {@link #FASTMATH} is <code>true</code>, whether to use a lookup table for sin/cos. */ public static final boolean SIN_LOOKUP = hasOption(System.getProperty("joml.sinLookup", "false")); /** * When {@link #SIN_LOOKUP} is <code>true</code>, this determines the table size. */ public static final int SIN_LOOKUP_BITS = Integer.parseInt(System.getProperty("joml.sinLookup.bits", "14")); //#ifndef __GWT__ /** * Whether to use a {@link NumberFormat} producing scientific notation output when formatting matrix, * vector and quaternion components to strings. */ public static final boolean useNumberFormat = hasOption(System.getProperty("joml.format", "true")); //#endif //#ifdef __HAS_MATH_FMA__ /** * Whether to try using java.lang.Math.fma() in most matrix/vector/quaternion operations if it is available. * If the CPU does <i>not</i> support it, it will be a lot slower than `a*b+c` and potentially generate a lot of memory allocations * for the emulation with `java.util.BigDecimal`, though. */ public static final boolean USE_MATH_FMA = hasOption(System.getProperty("joml.useMathFma", "false")); //#endif //#ifndef __GWT__ /** * When {@link #useNumberFormat} is <code>true</code> then this determines the number of decimal digits * produced in the formatted numbers. */ //#else /** * Determines the number of decimal digits produced in the formatted numbers. */ //#endif public static final int numberFormatDecimals = Integer.parseInt(System.getProperty("joml.format.decimals", "3")); /** * The {@link NumberFormat} used to format all numbers throughout all JOML classes. */ public static final NumberFormat NUMBER_FORMAT = decimalFormat(); private Options() { } private static NumberFormat decimalFormat() { NumberFormat df; //#ifndef __GWT__ if (useNumberFormat) { //#endif char[] prec = new char[numberFormatDecimals]; Arrays.fill(prec, '0');
df = new DecimalFormat(" 0." + new String(prec) + "E0;-");
JOML-CI/JOML
src/org/joml/Matrix3fStack.java
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // }
import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput;
result = prime * result + mats[i].hashCode(); } return result; } /* * Contract between Matrix3f and Matrix3fStack: * * - Matrix3f.equals(Matrix3fStack) is true iff all the 9 matrix elements are equal * - Matrix3fStack.equals(Matrix3f) is true iff all the 9 matrix elements are equal * - Matrix3fStack.equals(Matrix3fStack) is true iff all 9 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix3fStack) { Matrix3fStack other = (Matrix3fStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; }
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // Path: src/org/joml/Matrix3fStack.java import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; result = prime * result + mats[i].hashCode(); } return result; } /* * Contract between Matrix3f and Matrix3fStack: * * - Matrix3f.equals(Matrix3fStack) is true iff all the 9 matrix elements are equal * - Matrix3fStack.equals(Matrix3f) is true iff all the 9 matrix elements are equal * - Matrix3fStack.equals(Matrix3fStack) is true iff all 9 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix3fStack) { Matrix3fStack other = (Matrix3fStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Matrix3fStack.java
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // }
import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput;
* - Matrix3f.equals(Matrix3fStack) is true iff all the 9 matrix elements are equal * - Matrix3fStack.equals(Matrix3f) is true iff all the 9 matrix elements are equal * - Matrix3fStack.equals(Matrix3fStack) is true iff all 9 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix3fStack) { Matrix3fStack other = (Matrix3fStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; } public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeInt(curr); for (int i = 0; i < curr; i++) { out.writeObject(mats[i]); } }
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // Path: src/org/joml/Matrix3fStack.java import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; * - Matrix3f.equals(Matrix3fStack) is true iff all the 9 matrix elements are equal * - Matrix3fStack.equals(Matrix3f) is true iff all the 9 matrix elements are equal * - Matrix3fStack.equals(Matrix3fStack) is true iff all 9 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix3fStack) { Matrix3fStack other = (Matrix3fStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; } public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeInt(curr); for (int i = 0; i < curr; i++) { out.writeObject(mats[i]); } }
public void readExternal(ObjectInput in) throws IOException {
JOML-CI/JOML
src/org/joml/Vector3i.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer;
/** * Set all components to zero. * * @return this */ public Vector3i zero() { this.x = 0; this.y = 0; this.z = 0; return this; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector3i.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer; /** * Set all components to zero. * * @return this */ public Vector3i zero() { this.x = 0; this.y = 0; this.z = 0; return this; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */
public String toString(NumberFormat formatter) {
JOML-CI/JOML
src/org/joml/Vector3i.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer;
*/ public Vector3i zero() { this.x = 0; this.y = 0; this.z = 0; return this; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + formatter.format(x) + " " + formatter.format(y) + " " + formatter.format(z) + ")"; }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector3i.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer; */ public Vector3i zero() { this.x = 0; this.y = 0; this.z = 0; return this; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + formatter.format(x) + " " + formatter.format(y) + " " + formatter.format(z) + ")"; }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Vector3i.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer;
} /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + formatter.format(x) + " " + formatter.format(y) + " " + formatter.format(z) + ")"; } public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(x); out.writeInt(y); out.writeInt(z); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector3i.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.IntBuffer; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + formatter.format(x) + " " + formatter.format(y) + " " + formatter.format(z) + ")"; } public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(x); out.writeInt(y); out.writeInt(z); }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
* * @return the string representation */ public String toString() { String str = toString(Options.NUMBER_FORMAT); StringBuffer res = new StringBuffer(); int eIndex = Integer.MIN_VALUE; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == 'E') { eIndex = i; } else if (c == ' ' && eIndex == i - 1) { // workaround Java 1.4 DecimalFormat bug res.append('+'); continue; } else if (Character.isDigit(c) && eIndex == i - 1) { res.append('+'); } res.append(c); } return res.toString(); } /** * Return a string representation of this matrix by formatting the matrix elements with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the matrix values with * @return the string representation */
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix4x3f.java import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer; * * @return the string representation */ public String toString() { String str = toString(Options.NUMBER_FORMAT); StringBuffer res = new StringBuffer(); int eIndex = Integer.MIN_VALUE; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == 'E') { eIndex = i; } else if (c == ' ' && eIndex == i - 1) { // workaround Java 1.4 DecimalFormat bug res.append('+'); continue; } else if (Character.isDigit(c) && eIndex == i - 1) { res.append('+'); } res.append(c); } return res.toString(); } /** * Return a string representation of this matrix by formatting the matrix elements with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the matrix values with * @return the string representation */
public String toString(NumberFormat formatter) {
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
dest.properties = properties & ~(PROPERTY_IDENTITY); return dest; } /** * Pre-multiply a translation to this matrix by translating by the given number of * units in x, y and z. * <p> * If <code>M</code> is <code>this</code> matrix and <code>T</code> the translation * matrix, then the new matrix will be <code>T * M</code>. So when * transforming a vector <code>v</code> with the new matrix by using * <code>T * M * v</code>, the translation will be applied last! * <p> * In order to set the matrix to a translation transformation without pre-multiplying * it, use {@link #translation(float, float, float)}. * * @see #translation(float, float, float) * * @param x * the offset to translate in x * @param y * the offset to translate in y * @param z * the offset to translate in z * @return this */ public Matrix4x3f translateLocal(float x, float y, float z) { return translateLocal(x, y, z, this); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix4x3f.java import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer; dest.properties = properties & ~(PROPERTY_IDENTITY); return dest; } /** * Pre-multiply a translation to this matrix by translating by the given number of * units in x, y and z. * <p> * If <code>M</code> is <code>this</code> matrix and <code>T</code> the translation * matrix, then the new matrix will be <code>T * M</code>. So when * transforming a vector <code>v</code> with the new matrix by using * <code>T * M * v</code>, the translation will be applied last! * <p> * In order to set the matrix to a translation transformation without pre-multiplying * it, use {@link #translation(float, float, float)}. * * @see #translation(float, float, float) * * @param x * the offset to translate in x * @param y * the offset to translate in y * @param z * the offset to translate in z * @return this */ public Matrix4x3f translateLocal(float x, float y, float z) { return translateLocal(x, y, z, this); }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
* * @see #translation(float, float, float) * * @param x * the offset to translate in x * @param y * the offset to translate in y * @param z * the offset to translate in z * @return this */ public Matrix4x3f translateLocal(float x, float y, float z) { return translateLocal(x, y, z, this); } public void writeExternal(ObjectOutput out) throws IOException { out.writeFloat(m00); out.writeFloat(m01); out.writeFloat(m02); out.writeFloat(m10); out.writeFloat(m11); out.writeFloat(m12); out.writeFloat(m20); out.writeFloat(m21); out.writeFloat(m22); out.writeFloat(m30); out.writeFloat(m31); out.writeFloat(m32); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix4x3f.java import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer; * * @see #translation(float, float, float) * * @param x * the offset to translate in x * @param y * the offset to translate in y * @param z * the offset to translate in z * @return this */ public Matrix4x3f translateLocal(float x, float y, float z) { return translateLocal(x, y, z, this); } public void writeExternal(ObjectOutput out) throws IOException { out.writeFloat(m00); out.writeFloat(m01); out.writeFloat(m02); out.writeFloat(m10); out.writeFloat(m11); out.writeFloat(m12); out.writeFloat(m20); out.writeFloat(m21); out.writeFloat(m22); out.writeFloat(m30); out.writeFloat(m31); out.writeFloat(m32); }
public void readExternal(ObjectInput in) throws IOException {
JOML-CI/JOML
src/org/joml/Matrix3dStack.java
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // }
import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput;
result = prime * result + mats[i].hashCode(); } return result; } /* * Contract between Matrix3d and Matrix3dStack: * * - Matrix3d.equals(Matrix3dStack) is true iff all the 9 matrix elements are equal * - Matrix3dStack.equals(Matrix3d) is true iff all the 9 matrix elements are equal * - Matrix3dStack.equals(Matrix3dStack) is true iff all 9 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix3dStack) { Matrix3dStack other = (Matrix3dStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; }
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // Path: src/org/joml/Matrix3dStack.java import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; result = prime * result + mats[i].hashCode(); } return result; } /* * Contract between Matrix3d and Matrix3dStack: * * - Matrix3d.equals(Matrix3dStack) is true iff all the 9 matrix elements are equal * - Matrix3dStack.equals(Matrix3d) is true iff all the 9 matrix elements are equal * - Matrix3dStack.equals(Matrix3dStack) is true iff all 9 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix3dStack) { Matrix3dStack other = (Matrix3dStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Matrix3dStack.java
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // }
import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput;
* - Matrix3d.equals(Matrix3dStack) is true iff all the 9 matrix elements are equal * - Matrix3dStack.equals(Matrix3d) is true iff all the 9 matrix elements are equal * - Matrix3dStack.equals(Matrix3dStack) is true iff all 9 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix3dStack) { Matrix3dStack other = (Matrix3dStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; } public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeInt(curr); for (int i = 0; i < curr; i++) { out.writeObject(mats[i]); } }
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // Path: src/org/joml/Matrix3dStack.java import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; * - Matrix3d.equals(Matrix3dStack) is true iff all the 9 matrix elements are equal * - Matrix3dStack.equals(Matrix3d) is true iff all the 9 matrix elements are equal * - Matrix3dStack.equals(Matrix3dStack) is true iff all 9 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix3dStack) { Matrix3dStack other = (Matrix3dStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; } public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeInt(curr); for (int i = 0; i < curr; i++) { out.writeObject(mats[i]); } }
public void readExternal(ObjectInput in) throws IOException {
JOML-CI/JOML
src/org/joml/Matrix3x2dStack.java
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // }
import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput;
result = prime * result + mats[i].hashCode(); } return result; } /* * Contract between Matrix3x2d and Matrix3x2dStack: * * - Matrix3x2d.equals(Matrix3x2dStack) is true iff all the 6 matrix elements are equal * - Matrix3x2dStack.equals(Matrix3x2d) is true iff all the 6 matrix elements are equal * - Matrix3x2dStack.equals(Matrix3x2dStack) is true iff all 6 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix3x2dStack) { Matrix3x2dStack other = (Matrix3x2dStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; }
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // Path: src/org/joml/Matrix3x2dStack.java import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; result = prime * result + mats[i].hashCode(); } return result; } /* * Contract between Matrix3x2d and Matrix3x2dStack: * * - Matrix3x2d.equals(Matrix3x2dStack) is true iff all the 6 matrix elements are equal * - Matrix3x2dStack.equals(Matrix3x2d) is true iff all the 6 matrix elements are equal * - Matrix3x2dStack.equals(Matrix3x2dStack) is true iff all 6 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix3x2dStack) { Matrix3x2dStack other = (Matrix3x2dStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Matrix3x2dStack.java
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // }
import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput;
* - Matrix3x2d.equals(Matrix3x2dStack) is true iff all the 6 matrix elements are equal * - Matrix3x2dStack.equals(Matrix3x2d) is true iff all the 6 matrix elements are equal * - Matrix3x2dStack.equals(Matrix3x2dStack) is true iff all 6 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix3x2dStack) { Matrix3x2dStack other = (Matrix3x2dStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; } public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeInt(curr); for (int i = 0; i < curr; i++) { out.writeObject(mats[i]); } }
// Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // Path: src/org/joml/Matrix3x2dStack.java import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; * - Matrix3x2d.equals(Matrix3x2dStack) is true iff all the 6 matrix elements are equal * - Matrix3x2dStack.equals(Matrix3x2d) is true iff all the 6 matrix elements are equal * - Matrix3x2dStack.equals(Matrix3x2dStack) is true iff all 6 matrix elements are equal AND the matrix arrays as well as the stack pointer are equal * - everything else is inequal */ public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (obj instanceof Matrix3x2dStack) { Matrix3x2dStack other = (Matrix3x2dStack) obj; if (curr != other.curr) return false; for (int i = 0; i < curr; i++) { if (!mats[i].equals(other.mats[i])) return false; } } return true; } public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeInt(curr); for (int i = 0; i < curr; i++) { out.writeObject(mats[i]); } }
public void readExternal(ObjectInput in) throws IOException {
JOML-CI/JOML
src/org/joml/Vector2f.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
/** * Increment the components of this vector by the given values. * * @param x * the x component to add * @param y * the y component to add * @return this */ public Vector2f add(float x, float y) { return add(x, y, this); } public Vector2f add(float x, float y, Vector2f dest) { dest.x = this.x + x; dest.y = this.y + y; return dest; } /** * Set all components to zero. * * @return this */ public Vector2f zero() { this.x = 0; this.y = 0; return this; }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector2f.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer; /** * Increment the components of this vector by the given values. * * @param x * the x component to add * @param y * the y component to add * @return this */ public Vector2f add(float x, float y) { return add(x, y, this); } public Vector2f add(float x, float y, Vector2f dest) { dest.x = this.x + x; dest.y = this.y + y; return dest; } /** * Set all components to zero. * * @return this */ public Vector2f zero() { this.x = 0; this.y = 0; return this; }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Vector2f.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
* @param y * the y component to add * @return this */ public Vector2f add(float x, float y) { return add(x, y, this); } public Vector2f add(float x, float y, Vector2f dest) { dest.x = this.x + x; dest.y = this.y + y; return dest; } /** * Set all components to zero. * * @return this */ public Vector2f zero() { this.x = 0; this.y = 0; return this; } public void writeExternal(ObjectOutput out) throws IOException { out.writeFloat(x); out.writeFloat(y); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector2f.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer; * @param y * the y component to add * @return this */ public Vector2f add(float x, float y) { return add(x, y, this); } public Vector2f add(float x, float y, Vector2f dest) { dest.x = this.x + x; dest.y = this.y + y; return dest; } /** * Set all components to zero. * * @return this */ public Vector2f zero() { this.x = 0; this.y = 0; return this; } public void writeExternal(ObjectOutput out) throws IOException { out.writeFloat(x); out.writeFloat(y); }
public void readExternal(ObjectInput in) throws IOException,
JOML-CI/JOML
src/org/joml/Vector2f.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
return false; return true; } public boolean equals(float x, float y) { if (Float.floatToIntBits(this.x) != Float.floatToIntBits(x)) return false; if (Float.floatToIntBits(this.y) != Float.floatToIntBits(y)) return false; return true; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Vector2f.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer; return false; return true; } public boolean equals(float x, float y) { if (Float.floatToIntBits(this.x) != Float.floatToIntBits(x)) return false; if (Float.floatToIntBits(this.y) != Float.floatToIntBits(y)) return false; return true; } /** * Return a string representation of this vector. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this vector by formatting the vector components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the vector components with * @return the string representation */
public String toString(NumberFormat formatter) {
JOML-CI/JOML
src/org/joml/Matrix3x2d.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float64Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.DoubleBuffer;
* * @return the string representation */ public String toString() { String str = toString(Options.NUMBER_FORMAT); StringBuffer res = new StringBuffer(); int eIndex = Integer.MIN_VALUE; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == 'E') { eIndex = i; } else if (c == ' ' && eIndex == i - 1) { // workaround Java 1.4 DecimalFormat bug res.append('+'); continue; } else if (Character.isDigit(c) && eIndex == i - 1) { res.append('+'); } res.append(c); } return res.toString(); } /** * Return a string representation of this matrix by formatting the matrix elements with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the matrix values with * @return the string representation */
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix3x2d.java import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float64Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.DoubleBuffer; * * @return the string representation */ public String toString() { String str = toString(Options.NUMBER_FORMAT); StringBuffer res = new StringBuffer(); int eIndex = Integer.MIN_VALUE; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == 'E') { eIndex = i; } else if (c == ' ' && eIndex == i - 1) { // workaround Java 1.4 DecimalFormat bug res.append('+'); continue; } else if (Character.isDigit(c) && eIndex == i - 1) { res.append('+'); } res.append(c); } return res.toString(); } /** * Return a string representation of this matrix by formatting the matrix elements with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the matrix values with * @return the string representation */
public String toString(NumberFormat formatter) {
JOML-CI/JOML
src/org/joml/Matrix3x2d.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float64Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.DoubleBuffer;
public Vector2d transformDirection(Vector2dc v, Vector2d dest) { dest.set(m00 * v.x() + m10 * v.y(), m01 * v.x() + m11 * v.y()); return dest; } /** * Transform/multiply the given 2D-vector <code>(x, y)</code>, as if it was a 3D-vector with z=0, by * this matrix and store the result in <code>dest</code>. * <p> * The given 2D-vector is treated as a 3D-vector with its z-component being <code>0.0</code>, so it * will represent a direction in 2D-space rather than a position. This method will therefore * not take the translation part of the matrix into account. * <p> * In order to store the result in the same vector, use {@link #transformDirection(Vector2d)}. * * @see #transformDirection(Vector2d) * * @param x * the x component of the vector to transform * @param y * the y component of the vector to transform * @param dest * will hold the result * @return dest */ public Vector2d transformDirection(double x, double y, Vector2d dest) { return dest.set(m00 * x + m10 * y, m01 * x + m11 * y); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix3x2d.java import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float64Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.DoubleBuffer; public Vector2d transformDirection(Vector2dc v, Vector2d dest) { dest.set(m00 * v.x() + m10 * v.y(), m01 * v.x() + m11 * v.y()); return dest; } /** * Transform/multiply the given 2D-vector <code>(x, y)</code>, as if it was a 3D-vector with z=0, by * this matrix and store the result in <code>dest</code>. * <p> * The given 2D-vector is treated as a 3D-vector with its z-component being <code>0.0</code>, so it * will represent a direction in 2D-space rather than a position. This method will therefore * not take the translation part of the matrix into account. * <p> * In order to store the result in the same vector, use {@link #transformDirection(Vector2d)}. * * @see #transformDirection(Vector2d) * * @param x * the x component of the vector to transform * @param y * the y component of the vector to transform * @param dest * will hold the result * @return dest */ public Vector2d transformDirection(double x, double y, Vector2d dest) { return dest.set(m00 * x + m10 * y, m01 * x + m11 * y); }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Matrix3x2d.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float64Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.DoubleBuffer;
* <p> * The given 2D-vector is treated as a 3D-vector with its z-component being <code>0.0</code>, so it * will represent a direction in 2D-space rather than a position. This method will therefore * not take the translation part of the matrix into account. * <p> * In order to store the result in the same vector, use {@link #transformDirection(Vector2d)}. * * @see #transformDirection(Vector2d) * * @param x * the x component of the vector to transform * @param y * the y component of the vector to transform * @param dest * will hold the result * @return dest */ public Vector2d transformDirection(double x, double y, Vector2d dest) { return dest.set(m00 * x + m10 * y, m01 * x + m11 * y); } public void writeExternal(ObjectOutput out) throws IOException { out.writeDouble(m00); out.writeDouble(m01); out.writeDouble(m10); out.writeDouble(m11); out.writeDouble(m20); out.writeDouble(m21); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix3x2d.java import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float64Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.DoubleBuffer; * <p> * The given 2D-vector is treated as a 3D-vector with its z-component being <code>0.0</code>, so it * will represent a direction in 2D-space rather than a position. This method will therefore * not take the translation part of the matrix into account. * <p> * In order to store the result in the same vector, use {@link #transformDirection(Vector2d)}. * * @see #transformDirection(Vector2d) * * @param x * the x component of the vector to transform * @param y * the y component of the vector to transform * @param dest * will hold the result * @return dest */ public Vector2d transformDirection(double x, double y, Vector2d dest) { return dest.set(m00 * x + m10 * y, m01 * x + m11 * y); } public void writeExternal(ObjectOutput out) throws IOException { out.writeDouble(m00); out.writeDouble(m01); out.writeDouble(m10); out.writeDouble(m11); out.writeDouble(m20); out.writeDouble(m21); }
public void readExternal(ObjectInput in) throws IOException {
JOML-CI/JOML
src/org/joml/Quaternionf.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
* @param axisX * the x coordinate of the rotation axis * @param axisY * the y coordinate of the rotation axis * @param axisZ * the z coordinate of the rotation axis * @return this */ public Quaternionf rotateAxis(float angle, float axisX, float axisY, float axisZ) { return rotateAxis(angle, axisX, axisY, axisZ, this); } /** * Return a string representation of this quaternion. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this quaternion by formatting the components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the quaternion components with * @return the string representation */
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Quaternionf.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer; * @param axisX * the x coordinate of the rotation axis * @param axisY * the y coordinate of the rotation axis * @param axisZ * the z coordinate of the rotation axis * @return this */ public Quaternionf rotateAxis(float angle, float axisX, float axisY, float axisZ) { return rotateAxis(angle, axisX, axisY, axisZ, this); } /** * Return a string representation of this quaternion. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this quaternion by formatting the components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the quaternion components with * @return the string representation */
public String toString(NumberFormat formatter) {
JOML-CI/JOML
src/org/joml/Quaternionf.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
* @param axisZ * the z coordinate of the rotation axis * @return this */ public Quaternionf rotateAxis(float angle, float axisX, float axisY, float axisZ) { return rotateAxis(angle, axisX, axisY, axisZ, this); } /** * Return a string representation of this quaternion. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this quaternion by formatting the components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the quaternion components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + Runtime.format(x, formatter) + " " + Runtime.format(y, formatter) + " " + Runtime.format(z, formatter) + " " + Runtime.format(w, formatter) + ")"; }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Quaternionf.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer; * @param axisZ * the z coordinate of the rotation axis * @return this */ public Quaternionf rotateAxis(float angle, float axisX, float axisY, float axisZ) { return rotateAxis(angle, axisX, axisY, axisZ, this); } /** * Return a string representation of this quaternion. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this quaternion by formatting the components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the quaternion components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + Runtime.format(x, formatter) + " " + Runtime.format(y, formatter) + " " + Runtime.format(z, formatter) + " " + Runtime.format(w, formatter) + ")"; }
public void writeExternal(ObjectOutput out) throws IOException {
JOML-CI/JOML
src/org/joml/Quaternionf.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
/** * Return a string representation of this quaternion. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this quaternion by formatting the components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the quaternion components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + Runtime.format(x, formatter) + " " + Runtime.format(y, formatter) + " " + Runtime.format(z, formatter) + " " + Runtime.format(w, formatter) + ")"; } public void writeExternal(ObjectOutput out) throws IOException { out.writeFloat(x); out.writeFloat(y); out.writeFloat(z); out.writeFloat(w); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Quaternionf.java import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer; /** * Return a string representation of this quaternion. * <p> * This method creates a new {@link DecimalFormat} on every invocation with the format string "<code>0.000E0;-</code>". * * @return the string representation */ public String toString() { return Runtime.formatNumbers(toString(Options.NUMBER_FORMAT)); } /** * Return a string representation of this quaternion by formatting the components with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the quaternion components with * @return the string representation */ public String toString(NumberFormat formatter) { return "(" + Runtime.format(x, formatter) + " " + Runtime.format(y, formatter) + " " + Runtime.format(z, formatter) + " " + Runtime.format(w, formatter) + ")"; } public void writeExternal(ObjectOutput out) throws IOException { out.writeFloat(x); out.writeFloat(y); out.writeFloat(z); out.writeFloat(w); }
public void readExternal(ObjectInput in) throws IOException,
JOML-CI/JOML
src/org/joml/Matrix3x2f.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
* * @return the string representation */ public String toString() { String str = toString(Options.NUMBER_FORMAT); StringBuffer res = new StringBuffer(); int eIndex = Integer.MIN_VALUE; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == 'E') { eIndex = i; } else if (c == ' ' && eIndex == i - 1) { // workaround Java 1.4 DecimalFormat bug res.append('+'); continue; } else if (Character.isDigit(c) && eIndex == i - 1) { res.append('+'); } res.append(c); } return res.toString(); } /** * Return a string representation of this matrix by formatting the matrix elements with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the matrix values with * @return the string representation */
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix3x2f.java import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer; * * @return the string representation */ public String toString() { String str = toString(Options.NUMBER_FORMAT); StringBuffer res = new StringBuffer(); int eIndex = Integer.MIN_VALUE; for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == 'E') { eIndex = i; } else if (c == ' ' && eIndex == i - 1) { // workaround Java 1.4 DecimalFormat bug res.append('+'); continue; } else if (Character.isDigit(c) && eIndex == i - 1) { res.append('+'); } res.append(c); } return res.toString(); } /** * Return a string representation of this matrix by formatting the matrix elements with the given {@link NumberFormat}. * * @param formatter * the {@link NumberFormat} used to format the matrix values with * @return the string representation */
public String toString(NumberFormat formatter) {
JOML-CI/JOML
src/org/joml/Matrix3x2f.java
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // }
import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer;
public Vector2f transformDirection(Vector2fc v, Vector2f dest) { dest.set(m00 * v.x() + m10 * v.y(), m01 * v.x() + m11 * v.y()); return dest; } /** * Transform/multiply the given 2D-vector <code>(x, y)</code>, as if it was a 3D-vector with z=0, by * this matrix and store the result in <code>dest</code>. * <p> * The given 2D-vector is treated as a 3D-vector with its z-component being <code>0.0</code>, so it * will represent a direction in 2D-space rather than a position. This method will therefore * not take the translation part of the matrix into account. * <p> * In order to store the result in the same vector, use {@link #transformDirection(Vector2f)}. * * @see #transformDirection(Vector2f) * * @param x * the x component of the vector to transform * @param y * the y component of the vector to transform * @param dest * will hold the result * @return dest */ public Vector2f transformDirection(float x, float y, Vector2f dest) { return dest.set(m00 * x + m10 * y, m01 * x + m11 * y); }
// Path: src/org/joml/jre/java/io/Externalizable.java // public interface Externalizable extends java.io.Serializable { // void writeExternal(ObjectOutput out) throws IOException; // void readExternal(ObjectInput in) throws IOException, ClassNotFoundException; // } // // Path: src/org/joml/jre/java/io/ObjectInput.java // public interface ObjectInput extends DataOutput { // // double readDouble() throws IOException; // float readFloat() throws IOException; // int readInt() throws IOException; // // } // // Path: src/org/joml/jre/java/io/ObjectOutput.java // public interface ObjectOutput extends DataOutput { // void writeObject(Object obj); // } // // Path: src/org/joml/jre/java/text/DecimalFormat.java // public class DecimalFormat extends NumberFormat { // // public DecimalFormat() { // } // public DecimalFormat(String pattern) { // } // public DecimalFormat (String pattern, DecimalFormatSymbols symbols) { // } // // public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Number parse(String source, ParsePosition parsePosition) { // return null; // } // public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { // return null; // } // public Object parseObject(String source, ParsePosition pos) { // return null; // } // // } // // Path: src/org/joml/jre/java/text/NumberFormat.java // public abstract class NumberFormat extends Format { // public final String format(double number) { // return Double.toString(number); // } // public final String format(long number) { // return Long.toString(number); // } // } // Path: src/org/joml/Matrix3x2f.java import java.text.DecimalFormat; import java.text.NumberFormat; import com.google.gwt.typedarrays.shared.Float32Array; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.nio.ByteBuffer; import java.nio.FloatBuffer; public Vector2f transformDirection(Vector2fc v, Vector2f dest) { dest.set(m00 * v.x() + m10 * v.y(), m01 * v.x() + m11 * v.y()); return dest; } /** * Transform/multiply the given 2D-vector <code>(x, y)</code>, as if it was a 3D-vector with z=0, by * this matrix and store the result in <code>dest</code>. * <p> * The given 2D-vector is treated as a 3D-vector with its z-component being <code>0.0</code>, so it * will represent a direction in 2D-space rather than a position. This method will therefore * not take the translation part of the matrix into account. * <p> * In order to store the result in the same vector, use {@link #transformDirection(Vector2f)}. * * @see #transformDirection(Vector2f) * * @param x * the x component of the vector to transform * @param y * the y component of the vector to transform * @param dest * will hold the result * @return dest */ public Vector2f transformDirection(float x, float y, Vector2f dest) { return dest.set(m00 * x + m10 * y, m01 * x + m11 * y); }
public void writeExternal(ObjectOutput out) throws IOException {