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
|
---|---|---|---|---|---|---|
czyrux/GroceryStore
|
app/src/androidTest/java/de/czyrux/store/toolbox/rules/RxIdlingRule.java
|
// Path: app/src/androidTest/java/de/czyrux/store/toolbox/idlingresource/RxIdlingResource.java
// public class RxIdlingResource implements IdlingResource, Function<Runnable, Runnable> {
//
// private static final String RESOURCE_NAME = RxIdlingResource.class.getSimpleName();
//
// private static final ReentrantLock IDLING_STATE_LOCK = new ReentrantLock();
//
// // Guarded by IDLING_STATE_LOCK
// private int taskCount = 0;
//
// // Guarded by IDLING_STATE_LOCK
// private IdlingResource.ResourceCallback transitionCallback;
//
// @Override
// public String getName() {
// return RESOURCE_NAME;
// }
//
// @Override
// public boolean isIdleNow() {
// boolean result;
//
// IDLING_STATE_LOCK.lock();
// result = taskCount == 0;
// IDLING_STATE_LOCK.unlock();
//
// return result;
// }
//
// @Override
// public void registerIdleTransitionCallback(final ResourceCallback callback) {
// IDLING_STATE_LOCK.lock();
// this.transitionCallback = callback;
// IDLING_STATE_LOCK.unlock();
// }
//
// @Override
// public Runnable apply(final Runnable runnable) {
// return () -> {
// IDLING_STATE_LOCK.lock();
// taskCount++;
// IDLING_STATE_LOCK.unlock();
//
// try {
// runnable.run();
// } finally {
// IDLING_STATE_LOCK.lock();
//
// try {
// taskCount--;
//
// if (taskCount == 0 && transitionCallback != null) {
// transitionCallback.onTransitionToIdle();
// }
// } finally {
// IDLING_STATE_LOCK.unlock();
// }
// }
// };
// }
// }
|
import android.support.test.espresso.Espresso;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import de.czyrux.store.toolbox.idlingresource.RxIdlingResource;
import io.reactivex.plugins.RxJavaPlugins;
|
package de.czyrux.store.toolbox.rules;
public class RxIdlingRule implements TestRule {
@Override
public Statement apply(final Statement base, Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
|
// Path: app/src/androidTest/java/de/czyrux/store/toolbox/idlingresource/RxIdlingResource.java
// public class RxIdlingResource implements IdlingResource, Function<Runnable, Runnable> {
//
// private static final String RESOURCE_NAME = RxIdlingResource.class.getSimpleName();
//
// private static final ReentrantLock IDLING_STATE_LOCK = new ReentrantLock();
//
// // Guarded by IDLING_STATE_LOCK
// private int taskCount = 0;
//
// // Guarded by IDLING_STATE_LOCK
// private IdlingResource.ResourceCallback transitionCallback;
//
// @Override
// public String getName() {
// return RESOURCE_NAME;
// }
//
// @Override
// public boolean isIdleNow() {
// boolean result;
//
// IDLING_STATE_LOCK.lock();
// result = taskCount == 0;
// IDLING_STATE_LOCK.unlock();
//
// return result;
// }
//
// @Override
// public void registerIdleTransitionCallback(final ResourceCallback callback) {
// IDLING_STATE_LOCK.lock();
// this.transitionCallback = callback;
// IDLING_STATE_LOCK.unlock();
// }
//
// @Override
// public Runnable apply(final Runnable runnable) {
// return () -> {
// IDLING_STATE_LOCK.lock();
// taskCount++;
// IDLING_STATE_LOCK.unlock();
//
// try {
// runnable.run();
// } finally {
// IDLING_STATE_LOCK.lock();
//
// try {
// taskCount--;
//
// if (taskCount == 0 && transitionCallback != null) {
// transitionCallback.onTransitionToIdle();
// }
// } finally {
// IDLING_STATE_LOCK.unlock();
// }
// }
// };
// }
// }
// Path: app/src/androidTest/java/de/czyrux/store/toolbox/rules/RxIdlingRule.java
import android.support.test.espresso.Espresso;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import de.czyrux.store.toolbox.idlingresource.RxIdlingResource;
import io.reactivex.plugins.RxJavaPlugins;
package de.czyrux.store.toolbox.rules;
public class RxIdlingRule implements TestRule {
@Override
public Statement apply(final Statement base, Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
|
RxIdlingResource rxIdlingResource = new RxIdlingResource();
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/inject/Injector.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
//
// private final CartDataSource cartDataSource;
// private final CartStore cartStore;
//
// public CartService(CartDataSource cartDataSource, CartStore cartStore) {
// this.cartDataSource = cartDataSource;
// this.cartStore = cartStore;
// }
//
// /**
// * Gets Cart. This Observable will receive updates every time that the
// * underlying Cart gets updated.
// */
// public Observable<Cart> getCart() {
// return cartDataSource.getCart()
// .compose(cartPublisher())
// .toObservable()
// .flatMap(cart -> cartStore.observe());
// }
//
// /**
// * Add a product to the Cart.
// */
// public Single<Cart> addProduct(CartProduct cartProduct) {
// return cartDataSource.addProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Remove a product to the Cart.
// */
// public Single<Cart> removeProduct(CartProduct cartProduct) {
// return cartDataSource.removeProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Clear Cart content.
// */
// public Completable clear() {
// return cartDataSource.emptyCart()
// .compose(cartPublisher())
// .toCompletable();
// }
//
// private SingleTransformer<Cart, Cart> cartPublisher() {
// return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
//
// private final ProductDataSource productDataSource;
//
// public ProductService(ProductDataSource productDataSource) {
// this.productDataSource = productDataSource;
// }
//
// public Single<ProductResponse> getAllCatalog() {
// return productDataSource.getAllCatalog()
// .map(ProductResponse::new);
// }
// }
|
import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
|
package de.czyrux.store.inject;
/**
* Class use as a centralize point for DI.
*/
public class Injector {
private static Injector INSTANCE;
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
//
// private final CartDataSource cartDataSource;
// private final CartStore cartStore;
//
// public CartService(CartDataSource cartDataSource, CartStore cartStore) {
// this.cartDataSource = cartDataSource;
// this.cartStore = cartStore;
// }
//
// /**
// * Gets Cart. This Observable will receive updates every time that the
// * underlying Cart gets updated.
// */
// public Observable<Cart> getCart() {
// return cartDataSource.getCart()
// .compose(cartPublisher())
// .toObservable()
// .flatMap(cart -> cartStore.observe());
// }
//
// /**
// * Add a product to the Cart.
// */
// public Single<Cart> addProduct(CartProduct cartProduct) {
// return cartDataSource.addProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Remove a product to the Cart.
// */
// public Single<Cart> removeProduct(CartProduct cartProduct) {
// return cartDataSource.removeProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Clear Cart content.
// */
// public Completable clear() {
// return cartDataSource.emptyCart()
// .compose(cartPublisher())
// .toCompletable();
// }
//
// private SingleTransformer<Cart, Cart> cartPublisher() {
// return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
//
// private final ProductDataSource productDataSource;
//
// public ProductService(ProductDataSource productDataSource) {
// this.productDataSource = productDataSource;
// }
//
// public Single<ProductResponse> getAllCatalog() {
// return productDataSource.getAllCatalog()
// .map(ProductResponse::new);
// }
// }
// Path: app/src/main/java/de/czyrux/store/inject/Injector.java
import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
package de.czyrux.store.inject;
/**
* Class use as a centralize point for DI.
*/
public class Injector {
private static Injector INSTANCE;
|
private final CartService cartService;
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/inject/Injector.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
//
// private final CartDataSource cartDataSource;
// private final CartStore cartStore;
//
// public CartService(CartDataSource cartDataSource, CartStore cartStore) {
// this.cartDataSource = cartDataSource;
// this.cartStore = cartStore;
// }
//
// /**
// * Gets Cart. This Observable will receive updates every time that the
// * underlying Cart gets updated.
// */
// public Observable<Cart> getCart() {
// return cartDataSource.getCart()
// .compose(cartPublisher())
// .toObservable()
// .flatMap(cart -> cartStore.observe());
// }
//
// /**
// * Add a product to the Cart.
// */
// public Single<Cart> addProduct(CartProduct cartProduct) {
// return cartDataSource.addProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Remove a product to the Cart.
// */
// public Single<Cart> removeProduct(CartProduct cartProduct) {
// return cartDataSource.removeProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Clear Cart content.
// */
// public Completable clear() {
// return cartDataSource.emptyCart()
// .compose(cartPublisher())
// .toCompletable();
// }
//
// private SingleTransformer<Cart, Cart> cartPublisher() {
// return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
//
// private final ProductDataSource productDataSource;
//
// public ProductService(ProductDataSource productDataSource) {
// this.productDataSource = productDataSource;
// }
//
// public Single<ProductResponse> getAllCatalog() {
// return productDataSource.getAllCatalog()
// .map(ProductResponse::new);
// }
// }
|
import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
|
package de.czyrux.store.inject;
/**
* Class use as a centralize point for DI.
*/
public class Injector {
private static Injector INSTANCE;
private final CartService cartService;
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
//
// private final CartDataSource cartDataSource;
// private final CartStore cartStore;
//
// public CartService(CartDataSource cartDataSource, CartStore cartStore) {
// this.cartDataSource = cartDataSource;
// this.cartStore = cartStore;
// }
//
// /**
// * Gets Cart. This Observable will receive updates every time that the
// * underlying Cart gets updated.
// */
// public Observable<Cart> getCart() {
// return cartDataSource.getCart()
// .compose(cartPublisher())
// .toObservable()
// .flatMap(cart -> cartStore.observe());
// }
//
// /**
// * Add a product to the Cart.
// */
// public Single<Cart> addProduct(CartProduct cartProduct) {
// return cartDataSource.addProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Remove a product to the Cart.
// */
// public Single<Cart> removeProduct(CartProduct cartProduct) {
// return cartDataSource.removeProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Clear Cart content.
// */
// public Completable clear() {
// return cartDataSource.emptyCart()
// .compose(cartPublisher())
// .toCompletable();
// }
//
// private SingleTransformer<Cart, Cart> cartPublisher() {
// return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
//
// private final ProductDataSource productDataSource;
//
// public ProductService(ProductDataSource productDataSource) {
// this.productDataSource = productDataSource;
// }
//
// public Single<ProductResponse> getAllCatalog() {
// return productDataSource.getAllCatalog()
// .map(ProductResponse::new);
// }
// }
// Path: app/src/main/java/de/czyrux/store/inject/Injector.java
import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
package de.czyrux.store.inject;
/**
* Class use as a centralize point for DI.
*/
public class Injector {
private static Injector INSTANCE;
private final CartService cartService;
|
private final ProductService productService;
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/inject/Injector.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
//
// private final CartDataSource cartDataSource;
// private final CartStore cartStore;
//
// public CartService(CartDataSource cartDataSource, CartStore cartStore) {
// this.cartDataSource = cartDataSource;
// this.cartStore = cartStore;
// }
//
// /**
// * Gets Cart. This Observable will receive updates every time that the
// * underlying Cart gets updated.
// */
// public Observable<Cart> getCart() {
// return cartDataSource.getCart()
// .compose(cartPublisher())
// .toObservable()
// .flatMap(cart -> cartStore.observe());
// }
//
// /**
// * Add a product to the Cart.
// */
// public Single<Cart> addProduct(CartProduct cartProduct) {
// return cartDataSource.addProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Remove a product to the Cart.
// */
// public Single<Cart> removeProduct(CartProduct cartProduct) {
// return cartDataSource.removeProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Clear Cart content.
// */
// public Completable clear() {
// return cartDataSource.emptyCart()
// .compose(cartPublisher())
// .toCompletable();
// }
//
// private SingleTransformer<Cart, Cart> cartPublisher() {
// return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
//
// private final ProductDataSource productDataSource;
//
// public ProductService(ProductDataSource productDataSource) {
// this.productDataSource = productDataSource;
// }
//
// public Single<ProductResponse> getAllCatalog() {
// return productDataSource.getAllCatalog()
// .map(ProductResponse::new);
// }
// }
|
import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
|
package de.czyrux.store.inject;
/**
* Class use as a centralize point for DI.
*/
public class Injector {
private static Injector INSTANCE;
private final CartService cartService;
private final ProductService productService;
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
//
// private final CartDataSource cartDataSource;
// private final CartStore cartStore;
//
// public CartService(CartDataSource cartDataSource, CartStore cartStore) {
// this.cartDataSource = cartDataSource;
// this.cartStore = cartStore;
// }
//
// /**
// * Gets Cart. This Observable will receive updates every time that the
// * underlying Cart gets updated.
// */
// public Observable<Cart> getCart() {
// return cartDataSource.getCart()
// .compose(cartPublisher())
// .toObservable()
// .flatMap(cart -> cartStore.observe());
// }
//
// /**
// * Add a product to the Cart.
// */
// public Single<Cart> addProduct(CartProduct cartProduct) {
// return cartDataSource.addProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Remove a product to the Cart.
// */
// public Single<Cart> removeProduct(CartProduct cartProduct) {
// return cartDataSource.removeProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Clear Cart content.
// */
// public Completable clear() {
// return cartDataSource.emptyCart()
// .compose(cartPublisher())
// .toCompletable();
// }
//
// private SingleTransformer<Cart, Cart> cartPublisher() {
// return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
//
// private final ProductDataSource productDataSource;
//
// public ProductService(ProductDataSource productDataSource) {
// this.productDataSource = productDataSource;
// }
//
// public Single<ProductResponse> getAllCatalog() {
// return productDataSource.getAllCatalog()
// .map(ProductResponse::new);
// }
// }
// Path: app/src/main/java/de/czyrux/store/inject/Injector.java
import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
package de.czyrux.store.inject;
/**
* Class use as a centralize point for DI.
*/
public class Injector {
private static Injector INSTANCE;
private final CartService cartService;
private final ProductService productService;
|
private final CartStore cartStore;
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
//
// private final CartDataSource cartDataSource;
// private final CartStore cartStore;
//
// public CartService(CartDataSource cartDataSource, CartStore cartStore) {
// this.cartDataSource = cartDataSource;
// this.cartStore = cartStore;
// }
//
// /**
// * Gets Cart. This Observable will receive updates every time that the
// * underlying Cart gets updated.
// */
// public Observable<Cart> getCart() {
// return cartDataSource.getCart()
// .compose(cartPublisher())
// .toObservable()
// .flatMap(cart -> cartStore.observe());
// }
//
// /**
// * Add a product to the Cart.
// */
// public Single<Cart> addProduct(CartProduct cartProduct) {
// return cartDataSource.addProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Remove a product to the Cart.
// */
// public Single<Cart> removeProduct(CartProduct cartProduct) {
// return cartDataSource.removeProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Clear Cart content.
// */
// public Completable clear() {
// return cartDataSource.emptyCart()
// .compose(cartPublisher())
// .toCompletable();
// }
//
// private SingleTransformer<Cart, Cart> cartPublisher() {
// return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
//
// private final ProductDataSource productDataSource;
//
// public ProductService(ProductDataSource productDataSource) {
// this.productDataSource = productDataSource;
// }
//
// public Single<ProductResponse> getAllCatalog() {
// return productDataSource.getAllCatalog()
// .map(ProductResponse::new);
// }
// }
|
import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
|
package de.czyrux.store.inject;
public class DefaultDependenciesFactory implements DependenciesFactory {
private final DataDependenciesFactory dataDependenciesFactory;
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
//
// private final CartDataSource cartDataSource;
// private final CartStore cartStore;
//
// public CartService(CartDataSource cartDataSource, CartStore cartStore) {
// this.cartDataSource = cartDataSource;
// this.cartStore = cartStore;
// }
//
// /**
// * Gets Cart. This Observable will receive updates every time that the
// * underlying Cart gets updated.
// */
// public Observable<Cart> getCart() {
// return cartDataSource.getCart()
// .compose(cartPublisher())
// .toObservable()
// .flatMap(cart -> cartStore.observe());
// }
//
// /**
// * Add a product to the Cart.
// */
// public Single<Cart> addProduct(CartProduct cartProduct) {
// return cartDataSource.addProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Remove a product to the Cart.
// */
// public Single<Cart> removeProduct(CartProduct cartProduct) {
// return cartDataSource.removeProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Clear Cart content.
// */
// public Completable clear() {
// return cartDataSource.emptyCart()
// .compose(cartPublisher())
// .toCompletable();
// }
//
// private SingleTransformer<Cart, Cart> cartPublisher() {
// return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
//
// private final ProductDataSource productDataSource;
//
// public ProductService(ProductDataSource productDataSource) {
// this.productDataSource = productDataSource;
// }
//
// public Single<ProductResponse> getAllCatalog() {
// return productDataSource.getAllCatalog()
// .map(ProductResponse::new);
// }
// }
// Path: app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
package de.czyrux.store.inject;
public class DefaultDependenciesFactory implements DependenciesFactory {
private final DataDependenciesFactory dataDependenciesFactory;
|
private final CartStore cartStore;
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
//
// private final CartDataSource cartDataSource;
// private final CartStore cartStore;
//
// public CartService(CartDataSource cartDataSource, CartStore cartStore) {
// this.cartDataSource = cartDataSource;
// this.cartStore = cartStore;
// }
//
// /**
// * Gets Cart. This Observable will receive updates every time that the
// * underlying Cart gets updated.
// */
// public Observable<Cart> getCart() {
// return cartDataSource.getCart()
// .compose(cartPublisher())
// .toObservable()
// .flatMap(cart -> cartStore.observe());
// }
//
// /**
// * Add a product to the Cart.
// */
// public Single<Cart> addProduct(CartProduct cartProduct) {
// return cartDataSource.addProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Remove a product to the Cart.
// */
// public Single<Cart> removeProduct(CartProduct cartProduct) {
// return cartDataSource.removeProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Clear Cart content.
// */
// public Completable clear() {
// return cartDataSource.emptyCart()
// .compose(cartPublisher())
// .toCompletable();
// }
//
// private SingleTransformer<Cart, Cart> cartPublisher() {
// return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
//
// private final ProductDataSource productDataSource;
//
// public ProductService(ProductDataSource productDataSource) {
// this.productDataSource = productDataSource;
// }
//
// public Single<ProductResponse> getAllCatalog() {
// return productDataSource.getAllCatalog()
// .map(ProductResponse::new);
// }
// }
|
import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
|
package de.czyrux.store.inject;
public class DefaultDependenciesFactory implements DependenciesFactory {
private final DataDependenciesFactory dataDependenciesFactory;
private final CartStore cartStore;
public DefaultDependenciesFactory(DataDependenciesFactory dataDependenciesFactory) {
this.dataDependenciesFactory = dataDependenciesFactory;
cartStore = new CartStore();
}
@Override
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
//
// private final CartDataSource cartDataSource;
// private final CartStore cartStore;
//
// public CartService(CartDataSource cartDataSource, CartStore cartStore) {
// this.cartDataSource = cartDataSource;
// this.cartStore = cartStore;
// }
//
// /**
// * Gets Cart. This Observable will receive updates every time that the
// * underlying Cart gets updated.
// */
// public Observable<Cart> getCart() {
// return cartDataSource.getCart()
// .compose(cartPublisher())
// .toObservable()
// .flatMap(cart -> cartStore.observe());
// }
//
// /**
// * Add a product to the Cart.
// */
// public Single<Cart> addProduct(CartProduct cartProduct) {
// return cartDataSource.addProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Remove a product to the Cart.
// */
// public Single<Cart> removeProduct(CartProduct cartProduct) {
// return cartDataSource.removeProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Clear Cart content.
// */
// public Completable clear() {
// return cartDataSource.emptyCart()
// .compose(cartPublisher())
// .toCompletable();
// }
//
// private SingleTransformer<Cart, Cart> cartPublisher() {
// return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
//
// private final ProductDataSource productDataSource;
//
// public ProductService(ProductDataSource productDataSource) {
// this.productDataSource = productDataSource;
// }
//
// public Single<ProductResponse> getAllCatalog() {
// return productDataSource.getAllCatalog()
// .map(ProductResponse::new);
// }
// }
// Path: app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
package de.czyrux.store.inject;
public class DefaultDependenciesFactory implements DependenciesFactory {
private final DataDependenciesFactory dataDependenciesFactory;
private final CartStore cartStore;
public DefaultDependenciesFactory(DataDependenciesFactory dataDependenciesFactory) {
this.dataDependenciesFactory = dataDependenciesFactory;
cartStore = new CartStore();
}
@Override
|
public CartService createCartService() {
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
//
// private final CartDataSource cartDataSource;
// private final CartStore cartStore;
//
// public CartService(CartDataSource cartDataSource, CartStore cartStore) {
// this.cartDataSource = cartDataSource;
// this.cartStore = cartStore;
// }
//
// /**
// * Gets Cart. This Observable will receive updates every time that the
// * underlying Cart gets updated.
// */
// public Observable<Cart> getCart() {
// return cartDataSource.getCart()
// .compose(cartPublisher())
// .toObservable()
// .flatMap(cart -> cartStore.observe());
// }
//
// /**
// * Add a product to the Cart.
// */
// public Single<Cart> addProduct(CartProduct cartProduct) {
// return cartDataSource.addProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Remove a product to the Cart.
// */
// public Single<Cart> removeProduct(CartProduct cartProduct) {
// return cartDataSource.removeProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Clear Cart content.
// */
// public Completable clear() {
// return cartDataSource.emptyCart()
// .compose(cartPublisher())
// .toCompletable();
// }
//
// private SingleTransformer<Cart, Cart> cartPublisher() {
// return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
//
// private final ProductDataSource productDataSource;
//
// public ProductService(ProductDataSource productDataSource) {
// this.productDataSource = productDataSource;
// }
//
// public Single<ProductResponse> getAllCatalog() {
// return productDataSource.getAllCatalog()
// .map(ProductResponse::new);
// }
// }
|
import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
|
package de.czyrux.store.inject;
public class DefaultDependenciesFactory implements DependenciesFactory {
private final DataDependenciesFactory dataDependenciesFactory;
private final CartStore cartStore;
public DefaultDependenciesFactory(DataDependenciesFactory dataDependenciesFactory) {
this.dataDependenciesFactory = dataDependenciesFactory;
cartStore = new CartStore();
}
@Override
public CartService createCartService() {
return new CartService(dataDependenciesFactory.createCartDataSource(), cartStore);
}
@Override
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartService.java
// public class CartService {
//
// private final CartDataSource cartDataSource;
// private final CartStore cartStore;
//
// public CartService(CartDataSource cartDataSource, CartStore cartStore) {
// this.cartDataSource = cartDataSource;
// this.cartStore = cartStore;
// }
//
// /**
// * Gets Cart. This Observable will receive updates every time that the
// * underlying Cart gets updated.
// */
// public Observable<Cart> getCart() {
// return cartDataSource.getCart()
// .compose(cartPublisher())
// .toObservable()
// .flatMap(cart -> cartStore.observe());
// }
//
// /**
// * Add a product to the Cart.
// */
// public Single<Cart> addProduct(CartProduct cartProduct) {
// return cartDataSource.addProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Remove a product to the Cart.
// */
// public Single<Cart> removeProduct(CartProduct cartProduct) {
// return cartDataSource.removeProduct(cartProduct)
// .compose(cartPublisher());
// }
//
// /**
// * Clear Cart content.
// */
// public Completable clear() {
// return cartDataSource.emptyCart()
// .compose(cartPublisher())
// .toCompletable();
// }
//
// private SingleTransformer<Cart, Cart> cartPublisher() {
// return cartObservable -> cartObservable.doOnSuccess(cartStore::publish);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartStore.java
// public class CartStore extends Store<Cart> { }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductService.java
// public class ProductService {
//
// private final ProductDataSource productDataSource;
//
// public ProductService(ProductDataSource productDataSource) {
// this.productDataSource = productDataSource;
// }
//
// public Single<ProductResponse> getAllCatalog() {
// return productDataSource.getAllCatalog()
// .map(ProductResponse::new);
// }
// }
// Path: app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
import de.czyrux.store.core.domain.cart.CartService;
import de.czyrux.store.core.domain.cart.CartStore;
import de.czyrux.store.core.domain.product.ProductService;
package de.czyrux.store.inject;
public class DefaultDependenciesFactory implements DependenciesFactory {
private final DataDependenciesFactory dataDependenciesFactory;
private final CartStore cartStore;
public DefaultDependenciesFactory(DataDependenciesFactory dataDependenciesFactory) {
this.dataDependenciesFactory = dataDependenciesFactory;
cartStore = new CartStore();
}
@Override
public CartService createCartService() {
return new CartService(dataDependenciesFactory.createCartDataSource(), cartStore);
}
@Override
|
public ProductService createProductService() {
|
czyrux/GroceryStore
|
app/src/test/java/de/czyrux/store/test/CartFakeCreator.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/Cart.java
// public class Cart {
//
// public static final Cart EMPTY = new Cart(Collections.emptyList());
// public final List<CartProduct> products;
//
// public Cart(List<CartProduct> products) {
// this.products = products;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// Cart cart = (Cart) o;
//
// return products != null ? products.equals(cart.products) : cart.products == null;
//
// }
//
// @Override
// public int hashCode() {
// return products != null ? products.hashCode() : 0;
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartProduct.java
// public class CartProduct extends Product {
//
// public final int quantity;
//
// public CartProduct(String sku, String title, String imageUrl, double price, int quantity) {
// super(sku, title, imageUrl, price);
// this.quantity = quantity;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// CartProduct product = (CartProduct) o;
//
// return quantity == product.quantity;
//
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + quantity;
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("CartProduct{");
// sb.append("quantity=").append(quantity);
// sb.append('}');
// return sb.toString();
// }
// }
|
import java.util.Arrays;
import java.util.Collections;
import de.czyrux.store.core.domain.cart.Cart;
import de.czyrux.store.core.domain.cart.CartProduct;
|
package de.czyrux.store.test;
public class CartFakeCreator {
public static Cart emptyCart() {
return new Cart(Collections.emptyList());
}
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/Cart.java
// public class Cart {
//
// public static final Cart EMPTY = new Cart(Collections.emptyList());
// public final List<CartProduct> products;
//
// public Cart(List<CartProduct> products) {
// this.products = products;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// Cart cart = (Cart) o;
//
// return products != null ? products.equals(cart.products) : cart.products == null;
//
// }
//
// @Override
// public int hashCode() {
// return products != null ? products.hashCode() : 0;
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartProduct.java
// public class CartProduct extends Product {
//
// public final int quantity;
//
// public CartProduct(String sku, String title, String imageUrl, double price, int quantity) {
// super(sku, title, imageUrl, price);
// this.quantity = quantity;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// CartProduct product = (CartProduct) o;
//
// return quantity == product.quantity;
//
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + quantity;
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("CartProduct{");
// sb.append("quantity=").append(quantity);
// sb.append('}');
// return sb.toString();
// }
// }
// Path: app/src/test/java/de/czyrux/store/test/CartFakeCreator.java
import java.util.Arrays;
import java.util.Collections;
import de.czyrux.store.core.domain.cart.Cart;
import de.czyrux.store.core.domain.cart.CartProduct;
package de.czyrux.store.test;
public class CartFakeCreator {
public static Cart emptyCart() {
return new Cart(Collections.emptyList());
}
|
public static Cart cartWithElements(CartProduct... products) {
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
|
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryCartDataSource.java
// public class InMemoryCartDataSource implements CartDataSource {
//
// private final TimeDelayer timeDelayer;
// private Cart cart;
//
// public InMemoryCartDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// this.cart = Cart.EMPTY;
// }
//
// @Override
// public synchronized Single<Cart> getCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> addProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .addProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> removeProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .removeProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> emptyCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// cart = Cart.EMPTY;
// return cart;
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryProductDataSource.java
// public class InMemoryProductDataSource implements ProductDataSource {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryProductDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// }
//
// @Override
// public Single<List<Product>> getAllCatalog() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return ProductProvider.getProductList();
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/util/TimeDelayer.java
// public class TimeDelayer {
//
// private static final int MAX_DEFAULT_DELAY = 2000; // 2 sec
// private final Random random;
//
// public TimeDelayer() {
// random = new Random(System.nanoTime());
// }
//
// public void delay(int maxTime) {
// try {
// Thread.sleep(random.nextInt(maxTime));
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
//
// public void delay() {
// delay(MAX_DEFAULT_DELAY);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
|
import de.czyrux.store.core.data.sources.InMemoryCartDataSource;
import de.czyrux.store.core.data.sources.InMemoryProductDataSource;
import de.czyrux.store.core.data.util.TimeDelayer;
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
|
package de.czyrux.store.inject;
public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
private final TimeDelayer timeDelayer;
public InMemoryDataDependenciesFactory() {
timeDelayer = new TimeDelayer();
}
@Override
|
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryCartDataSource.java
// public class InMemoryCartDataSource implements CartDataSource {
//
// private final TimeDelayer timeDelayer;
// private Cart cart;
//
// public InMemoryCartDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// this.cart = Cart.EMPTY;
// }
//
// @Override
// public synchronized Single<Cart> getCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> addProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .addProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> removeProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .removeProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> emptyCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// cart = Cart.EMPTY;
// return cart;
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryProductDataSource.java
// public class InMemoryProductDataSource implements ProductDataSource {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryProductDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// }
//
// @Override
// public Single<List<Product>> getAllCatalog() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return ProductProvider.getProductList();
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/util/TimeDelayer.java
// public class TimeDelayer {
//
// private static final int MAX_DEFAULT_DELAY = 2000; // 2 sec
// private final Random random;
//
// public TimeDelayer() {
// random = new Random(System.nanoTime());
// }
//
// public void delay(int maxTime) {
// try {
// Thread.sleep(random.nextInt(maxTime));
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
//
// public void delay() {
// delay(MAX_DEFAULT_DELAY);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
import de.czyrux.store.core.data.sources.InMemoryCartDataSource;
import de.czyrux.store.core.data.sources.InMemoryProductDataSource;
import de.czyrux.store.core.data.util.TimeDelayer;
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
package de.czyrux.store.inject;
public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
private final TimeDelayer timeDelayer;
public InMemoryDataDependenciesFactory() {
timeDelayer = new TimeDelayer();
}
@Override
|
public CartDataSource createCartDataSource() {
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
|
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryCartDataSource.java
// public class InMemoryCartDataSource implements CartDataSource {
//
// private final TimeDelayer timeDelayer;
// private Cart cart;
//
// public InMemoryCartDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// this.cart = Cart.EMPTY;
// }
//
// @Override
// public synchronized Single<Cart> getCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> addProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .addProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> removeProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .removeProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> emptyCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// cart = Cart.EMPTY;
// return cart;
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryProductDataSource.java
// public class InMemoryProductDataSource implements ProductDataSource {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryProductDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// }
//
// @Override
// public Single<List<Product>> getAllCatalog() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return ProductProvider.getProductList();
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/util/TimeDelayer.java
// public class TimeDelayer {
//
// private static final int MAX_DEFAULT_DELAY = 2000; // 2 sec
// private final Random random;
//
// public TimeDelayer() {
// random = new Random(System.nanoTime());
// }
//
// public void delay(int maxTime) {
// try {
// Thread.sleep(random.nextInt(maxTime));
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
//
// public void delay() {
// delay(MAX_DEFAULT_DELAY);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
|
import de.czyrux.store.core.data.sources.InMemoryCartDataSource;
import de.czyrux.store.core.data.sources.InMemoryProductDataSource;
import de.czyrux.store.core.data.util.TimeDelayer;
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
|
package de.czyrux.store.inject;
public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
private final TimeDelayer timeDelayer;
public InMemoryDataDependenciesFactory() {
timeDelayer = new TimeDelayer();
}
@Override
public CartDataSource createCartDataSource() {
|
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryCartDataSource.java
// public class InMemoryCartDataSource implements CartDataSource {
//
// private final TimeDelayer timeDelayer;
// private Cart cart;
//
// public InMemoryCartDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// this.cart = Cart.EMPTY;
// }
//
// @Override
// public synchronized Single<Cart> getCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> addProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .addProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> removeProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .removeProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> emptyCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// cart = Cart.EMPTY;
// return cart;
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryProductDataSource.java
// public class InMemoryProductDataSource implements ProductDataSource {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryProductDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// }
//
// @Override
// public Single<List<Product>> getAllCatalog() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return ProductProvider.getProductList();
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/util/TimeDelayer.java
// public class TimeDelayer {
//
// private static final int MAX_DEFAULT_DELAY = 2000; // 2 sec
// private final Random random;
//
// public TimeDelayer() {
// random = new Random(System.nanoTime());
// }
//
// public void delay(int maxTime) {
// try {
// Thread.sleep(random.nextInt(maxTime));
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
//
// public void delay() {
// delay(MAX_DEFAULT_DELAY);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
import de.czyrux.store.core.data.sources.InMemoryCartDataSource;
import de.czyrux.store.core.data.sources.InMemoryProductDataSource;
import de.czyrux.store.core.data.util.TimeDelayer;
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
package de.czyrux.store.inject;
public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
private final TimeDelayer timeDelayer;
public InMemoryDataDependenciesFactory() {
timeDelayer = new TimeDelayer();
}
@Override
public CartDataSource createCartDataSource() {
|
return new InMemoryCartDataSource(timeDelayer);
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
|
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryCartDataSource.java
// public class InMemoryCartDataSource implements CartDataSource {
//
// private final TimeDelayer timeDelayer;
// private Cart cart;
//
// public InMemoryCartDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// this.cart = Cart.EMPTY;
// }
//
// @Override
// public synchronized Single<Cart> getCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> addProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .addProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> removeProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .removeProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> emptyCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// cart = Cart.EMPTY;
// return cart;
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryProductDataSource.java
// public class InMemoryProductDataSource implements ProductDataSource {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryProductDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// }
//
// @Override
// public Single<List<Product>> getAllCatalog() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return ProductProvider.getProductList();
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/util/TimeDelayer.java
// public class TimeDelayer {
//
// private static final int MAX_DEFAULT_DELAY = 2000; // 2 sec
// private final Random random;
//
// public TimeDelayer() {
// random = new Random(System.nanoTime());
// }
//
// public void delay(int maxTime) {
// try {
// Thread.sleep(random.nextInt(maxTime));
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
//
// public void delay() {
// delay(MAX_DEFAULT_DELAY);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
|
import de.czyrux.store.core.data.sources.InMemoryCartDataSource;
import de.czyrux.store.core.data.sources.InMemoryProductDataSource;
import de.czyrux.store.core.data.util.TimeDelayer;
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
|
package de.czyrux.store.inject;
public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
private final TimeDelayer timeDelayer;
public InMemoryDataDependenciesFactory() {
timeDelayer = new TimeDelayer();
}
@Override
public CartDataSource createCartDataSource() {
return new InMemoryCartDataSource(timeDelayer);
}
@Override
|
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryCartDataSource.java
// public class InMemoryCartDataSource implements CartDataSource {
//
// private final TimeDelayer timeDelayer;
// private Cart cart;
//
// public InMemoryCartDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// this.cart = Cart.EMPTY;
// }
//
// @Override
// public synchronized Single<Cart> getCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> addProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .addProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> removeProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .removeProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> emptyCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// cart = Cart.EMPTY;
// return cart;
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryProductDataSource.java
// public class InMemoryProductDataSource implements ProductDataSource {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryProductDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// }
//
// @Override
// public Single<List<Product>> getAllCatalog() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return ProductProvider.getProductList();
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/util/TimeDelayer.java
// public class TimeDelayer {
//
// private static final int MAX_DEFAULT_DELAY = 2000; // 2 sec
// private final Random random;
//
// public TimeDelayer() {
// random = new Random(System.nanoTime());
// }
//
// public void delay(int maxTime) {
// try {
// Thread.sleep(random.nextInt(maxTime));
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
//
// public void delay() {
// delay(MAX_DEFAULT_DELAY);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
import de.czyrux.store.core.data.sources.InMemoryCartDataSource;
import de.czyrux.store.core.data.sources.InMemoryProductDataSource;
import de.czyrux.store.core.data.util.TimeDelayer;
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
package de.czyrux.store.inject;
public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
private final TimeDelayer timeDelayer;
public InMemoryDataDependenciesFactory() {
timeDelayer = new TimeDelayer();
}
@Override
public CartDataSource createCartDataSource() {
return new InMemoryCartDataSource(timeDelayer);
}
@Override
|
public ProductDataSource createProductDataSource() {
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
|
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryCartDataSource.java
// public class InMemoryCartDataSource implements CartDataSource {
//
// private final TimeDelayer timeDelayer;
// private Cart cart;
//
// public InMemoryCartDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// this.cart = Cart.EMPTY;
// }
//
// @Override
// public synchronized Single<Cart> getCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> addProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .addProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> removeProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .removeProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> emptyCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// cart = Cart.EMPTY;
// return cart;
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryProductDataSource.java
// public class InMemoryProductDataSource implements ProductDataSource {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryProductDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// }
//
// @Override
// public Single<List<Product>> getAllCatalog() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return ProductProvider.getProductList();
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/util/TimeDelayer.java
// public class TimeDelayer {
//
// private static final int MAX_DEFAULT_DELAY = 2000; // 2 sec
// private final Random random;
//
// public TimeDelayer() {
// random = new Random(System.nanoTime());
// }
//
// public void delay(int maxTime) {
// try {
// Thread.sleep(random.nextInt(maxTime));
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
//
// public void delay() {
// delay(MAX_DEFAULT_DELAY);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
|
import de.czyrux.store.core.data.sources.InMemoryCartDataSource;
import de.czyrux.store.core.data.sources.InMemoryProductDataSource;
import de.czyrux.store.core.data.util.TimeDelayer;
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
|
package de.czyrux.store.inject;
public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
private final TimeDelayer timeDelayer;
public InMemoryDataDependenciesFactory() {
timeDelayer = new TimeDelayer();
}
@Override
public CartDataSource createCartDataSource() {
return new InMemoryCartDataSource(timeDelayer);
}
@Override
public ProductDataSource createProductDataSource() {
|
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryCartDataSource.java
// public class InMemoryCartDataSource implements CartDataSource {
//
// private final TimeDelayer timeDelayer;
// private Cart cart;
//
// public InMemoryCartDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// this.cart = Cart.EMPTY;
// }
//
// @Override
// public synchronized Single<Cart> getCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> addProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .addProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> removeProduct(CartProduct cartProduct) {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
//
// cart = CartBuilder.from(cart)
// .removeProduct(cartProduct)
// .build();
//
// return cart;
// });
// }
//
// @Override
// public synchronized Single<Cart> emptyCart() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// cart = Cart.EMPTY;
// return cart;
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryProductDataSource.java
// public class InMemoryProductDataSource implements ProductDataSource {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryProductDataSource(TimeDelayer timeDelayer) {
// this.timeDelayer = timeDelayer;
// }
//
// @Override
// public Single<List<Product>> getAllCatalog() {
// return Single.fromCallable(() -> {
// timeDelayer.delay();
// return ProductProvider.getProductList();
// });
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/data/util/TimeDelayer.java
// public class TimeDelayer {
//
// private static final int MAX_DEFAULT_DELAY = 2000; // 2 sec
// private final Random random;
//
// public TimeDelayer() {
// random = new Random(System.nanoTime());
// }
//
// public void delay(int maxTime) {
// try {
// Thread.sleep(random.nextInt(maxTime));
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
//
// public void delay() {
// delay(MAX_DEFAULT_DELAY);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
import de.czyrux.store.core.data.sources.InMemoryCartDataSource;
import de.czyrux.store.core.data.sources.InMemoryProductDataSource;
import de.czyrux.store.core.data.util.TimeDelayer;
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
package de.czyrux.store.inject;
public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
private final TimeDelayer timeDelayer;
public InMemoryDataDependenciesFactory() {
timeDelayer = new TimeDelayer();
}
@Override
public CartDataSource createCartDataSource() {
return new InMemoryCartDataSource(timeDelayer);
}
@Override
public ProductDataSource createProductDataSource() {
|
return new InMemoryProductDataSource(timeDelayer);
|
czyrux/GroceryStore
|
app/src/test/java/de/czyrux/store/core/domain/cart/CartBuilderTest.java
|
// Path: app/src/test/java/de/czyrux/store/test/CartProductFakeCreator.java
// public class CartProductFakeCreator {
//
// private static final String DEFAULT_SKU = "ada300343";
// private static final int DEFAULT_QUANTITY = 1;
//
// private CartProductFakeCreator() {
// }
//
// public static CartProduct createProduct() {
// return createProduct(DEFAULT_SKU, DEFAULT_QUANTITY);
// }
//
// public static CartProduct createProduct(String sku) {
// return createProduct(sku, DEFAULT_QUANTITY);
// }
//
// public static CartProduct createProduct(String sku, int quantity) {
// return new CartProduct(sku, "Adidas Perf", "someImage", 23.5f, quantity);
// }
// }
//
// Path: app/src/test/java/de/czyrux/store/test/CartFakeCreator.java
// public class CartFakeCreator {
//
// public static Cart emptyCart() {
// return new Cart(Collections.emptyList());
// }
//
// public static Cart cartWithElements(CartProduct... products) {
// return new Cart(Arrays.asList(products));
// }
// }
|
import org.junit.Test;
import java.util.List;
import de.czyrux.store.test.CartProductFakeCreator;
import de.czyrux.store.test.CartFakeCreator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
|
package de.czyrux.store.core.domain.cart;
public class CartBuilderTest {
@Test
public void should_InitializeEmpty_When_InitialCartElementsAreNull() {
Cart cart = CartBuilder.from(new Cart(null))
.build();
assertTrue(cart.products.isEmpty());
}
@Test
public void should_createAnEmptyCart_When_NoCartProvided() {
Cart cart = CartBuilder.empty().build();
assertTrue(cart.products.isEmpty());
}
@Test
public void should_createACartWithInitialItems_When_CartProvided() {
|
// Path: app/src/test/java/de/czyrux/store/test/CartProductFakeCreator.java
// public class CartProductFakeCreator {
//
// private static final String DEFAULT_SKU = "ada300343";
// private static final int DEFAULT_QUANTITY = 1;
//
// private CartProductFakeCreator() {
// }
//
// public static CartProduct createProduct() {
// return createProduct(DEFAULT_SKU, DEFAULT_QUANTITY);
// }
//
// public static CartProduct createProduct(String sku) {
// return createProduct(sku, DEFAULT_QUANTITY);
// }
//
// public static CartProduct createProduct(String sku, int quantity) {
// return new CartProduct(sku, "Adidas Perf", "someImage", 23.5f, quantity);
// }
// }
//
// Path: app/src/test/java/de/czyrux/store/test/CartFakeCreator.java
// public class CartFakeCreator {
//
// public static Cart emptyCart() {
// return new Cart(Collections.emptyList());
// }
//
// public static Cart cartWithElements(CartProduct... products) {
// return new Cart(Arrays.asList(products));
// }
// }
// Path: app/src/test/java/de/czyrux/store/core/domain/cart/CartBuilderTest.java
import org.junit.Test;
import java.util.List;
import de.czyrux.store.test.CartProductFakeCreator;
import de.czyrux.store.test.CartFakeCreator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
package de.czyrux.store.core.domain.cart;
public class CartBuilderTest {
@Test
public void should_InitializeEmpty_When_InitialCartElementsAreNull() {
Cart cart = CartBuilder.from(new Cart(null))
.build();
assertTrue(cart.products.isEmpty());
}
@Test
public void should_createAnEmptyCart_When_NoCartProvided() {
Cart cart = CartBuilder.empty().build();
assertTrue(cart.products.isEmpty());
}
@Test
public void should_createACartWithInitialItems_When_CartProvided() {
|
CartProduct product1 = CartProductFakeCreator.createProduct("Sku1");
|
czyrux/GroceryStore
|
app/src/test/java/de/czyrux/store/core/domain/cart/CartBuilderTest.java
|
// Path: app/src/test/java/de/czyrux/store/test/CartProductFakeCreator.java
// public class CartProductFakeCreator {
//
// private static final String DEFAULT_SKU = "ada300343";
// private static final int DEFAULT_QUANTITY = 1;
//
// private CartProductFakeCreator() {
// }
//
// public static CartProduct createProduct() {
// return createProduct(DEFAULT_SKU, DEFAULT_QUANTITY);
// }
//
// public static CartProduct createProduct(String sku) {
// return createProduct(sku, DEFAULT_QUANTITY);
// }
//
// public static CartProduct createProduct(String sku, int quantity) {
// return new CartProduct(sku, "Adidas Perf", "someImage", 23.5f, quantity);
// }
// }
//
// Path: app/src/test/java/de/czyrux/store/test/CartFakeCreator.java
// public class CartFakeCreator {
//
// public static Cart emptyCart() {
// return new Cart(Collections.emptyList());
// }
//
// public static Cart cartWithElements(CartProduct... products) {
// return new Cart(Arrays.asList(products));
// }
// }
|
import org.junit.Test;
import java.util.List;
import de.czyrux.store.test.CartProductFakeCreator;
import de.czyrux.store.test.CartFakeCreator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
|
package de.czyrux.store.core.domain.cart;
public class CartBuilderTest {
@Test
public void should_InitializeEmpty_When_InitialCartElementsAreNull() {
Cart cart = CartBuilder.from(new Cart(null))
.build();
assertTrue(cart.products.isEmpty());
}
@Test
public void should_createAnEmptyCart_When_NoCartProvided() {
Cart cart = CartBuilder.empty().build();
assertTrue(cart.products.isEmpty());
}
@Test
public void should_createACartWithInitialItems_When_CartProvided() {
CartProduct product1 = CartProductFakeCreator.createProduct("Sku1");
CartProduct product2 = CartProductFakeCreator.createProduct("Sku2");
|
// Path: app/src/test/java/de/czyrux/store/test/CartProductFakeCreator.java
// public class CartProductFakeCreator {
//
// private static final String DEFAULT_SKU = "ada300343";
// private static final int DEFAULT_QUANTITY = 1;
//
// private CartProductFakeCreator() {
// }
//
// public static CartProduct createProduct() {
// return createProduct(DEFAULT_SKU, DEFAULT_QUANTITY);
// }
//
// public static CartProduct createProduct(String sku) {
// return createProduct(sku, DEFAULT_QUANTITY);
// }
//
// public static CartProduct createProduct(String sku, int quantity) {
// return new CartProduct(sku, "Adidas Perf", "someImage", 23.5f, quantity);
// }
// }
//
// Path: app/src/test/java/de/czyrux/store/test/CartFakeCreator.java
// public class CartFakeCreator {
//
// public static Cart emptyCart() {
// return new Cart(Collections.emptyList());
// }
//
// public static Cart cartWithElements(CartProduct... products) {
// return new Cart(Arrays.asList(products));
// }
// }
// Path: app/src/test/java/de/czyrux/store/core/domain/cart/CartBuilderTest.java
import org.junit.Test;
import java.util.List;
import de.czyrux.store.test.CartProductFakeCreator;
import de.czyrux.store.test.CartFakeCreator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
package de.czyrux.store.core.domain.cart;
public class CartBuilderTest {
@Test
public void should_InitializeEmpty_When_InitialCartElementsAreNull() {
Cart cart = CartBuilder.from(new Cart(null))
.build();
assertTrue(cart.products.isEmpty());
}
@Test
public void should_createAnEmptyCart_When_NoCartProvided() {
Cart cart = CartBuilder.empty().build();
assertTrue(cart.products.isEmpty());
}
@Test
public void should_createACartWithInitialItems_When_CartProvided() {
CartProduct product1 = CartProductFakeCreator.createProduct("Sku1");
CartProduct product2 = CartProductFakeCreator.createProduct("Sku2");
|
Cart sourceCart = CartFakeCreator.cartWithElements(product1, product2);
|
czyrux/GroceryStore
|
app/src/androidTest/java/de/czyrux/store/toolbox/mock/TestDataDependenciesFactory.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/DataDependenciesFactory.java
// public interface DataDependenciesFactory {
// CartDataSource createCartDataSource();
//
// ProductDataSource createProductDataSource();
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
// public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryDataDependenciesFactory() {
// timeDelayer = new TimeDelayer();
// }
//
// @Override
// public CartDataSource createCartDataSource() {
// return new InMemoryCartDataSource(timeDelayer);
// }
//
// @Override
// public ProductDataSource createProductDataSource() {
// return new InMemoryProductDataSource(timeDelayer);
// }
// }
|
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
import de.czyrux.store.inject.DataDependenciesFactory;
import de.czyrux.store.inject.InMemoryDataDependenciesFactory;
|
package de.czyrux.store.toolbox.mock;
public class TestDataDependenciesFactory implements DataDependenciesFactory {
private final CartDataSource cartDataSource;
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/DataDependenciesFactory.java
// public interface DataDependenciesFactory {
// CartDataSource createCartDataSource();
//
// ProductDataSource createProductDataSource();
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
// public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryDataDependenciesFactory() {
// timeDelayer = new TimeDelayer();
// }
//
// @Override
// public CartDataSource createCartDataSource() {
// return new InMemoryCartDataSource(timeDelayer);
// }
//
// @Override
// public ProductDataSource createProductDataSource() {
// return new InMemoryProductDataSource(timeDelayer);
// }
// }
// Path: app/src/androidTest/java/de/czyrux/store/toolbox/mock/TestDataDependenciesFactory.java
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
import de.czyrux.store.inject.DataDependenciesFactory;
import de.czyrux.store.inject.InMemoryDataDependenciesFactory;
package de.czyrux.store.toolbox.mock;
public class TestDataDependenciesFactory implements DataDependenciesFactory {
private final CartDataSource cartDataSource;
|
private final ProductDataSource productDataSource;
|
czyrux/GroceryStore
|
app/src/androidTest/java/de/czyrux/store/toolbox/mock/TestDataDependenciesFactory.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/DataDependenciesFactory.java
// public interface DataDependenciesFactory {
// CartDataSource createCartDataSource();
//
// ProductDataSource createProductDataSource();
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
// public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryDataDependenciesFactory() {
// timeDelayer = new TimeDelayer();
// }
//
// @Override
// public CartDataSource createCartDataSource() {
// return new InMemoryCartDataSource(timeDelayer);
// }
//
// @Override
// public ProductDataSource createProductDataSource() {
// return new InMemoryProductDataSource(timeDelayer);
// }
// }
|
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
import de.czyrux.store.inject.DataDependenciesFactory;
import de.czyrux.store.inject.InMemoryDataDependenciesFactory;
|
package de.czyrux.store.toolbox.mock;
public class TestDataDependenciesFactory implements DataDependenciesFactory {
private final CartDataSource cartDataSource;
private final ProductDataSource productDataSource;
private TestDataDependenciesFactory(CartDataSource cartDataSource, ProductDataSource productDataSource) {
this.cartDataSource = cartDataSource;
this.productDataSource = productDataSource;
}
@Override
public CartDataSource createCartDataSource() {
return cartDataSource;
}
@Override
public ProductDataSource createProductDataSource() {
return productDataSource;
}
public static TestDataDependenciesFactory.Builder fromDefault() {
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/DataDependenciesFactory.java
// public interface DataDependenciesFactory {
// CartDataSource createCartDataSource();
//
// ProductDataSource createProductDataSource();
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
// public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryDataDependenciesFactory() {
// timeDelayer = new TimeDelayer();
// }
//
// @Override
// public CartDataSource createCartDataSource() {
// return new InMemoryCartDataSource(timeDelayer);
// }
//
// @Override
// public ProductDataSource createProductDataSource() {
// return new InMemoryProductDataSource(timeDelayer);
// }
// }
// Path: app/src/androidTest/java/de/czyrux/store/toolbox/mock/TestDataDependenciesFactory.java
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
import de.czyrux.store.inject.DataDependenciesFactory;
import de.czyrux.store.inject.InMemoryDataDependenciesFactory;
package de.czyrux.store.toolbox.mock;
public class TestDataDependenciesFactory implements DataDependenciesFactory {
private final CartDataSource cartDataSource;
private final ProductDataSource productDataSource;
private TestDataDependenciesFactory(CartDataSource cartDataSource, ProductDataSource productDataSource) {
this.cartDataSource = cartDataSource;
this.productDataSource = productDataSource;
}
@Override
public CartDataSource createCartDataSource() {
return cartDataSource;
}
@Override
public ProductDataSource createProductDataSource() {
return productDataSource;
}
public static TestDataDependenciesFactory.Builder fromDefault() {
|
return from(new InMemoryDataDependenciesFactory());
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/ui/catalog/CatalogItemViewHolder.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/product/Product.java
// public class Product {
// public final String sku;
// public final String title;
// public final String imageUrl;
// public final double price;
//
// public Product(String sku, String title, String imageUrl, double price) {
// this.sku = sku;
// this.title = title;
// this.imageUrl = imageUrl;
// this.price = price;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// Product product = (Product) o;
//
// if (Double.compare(product.price, price) != 0) return false;
// if (sku != null ? !sku.equals(product.sku) : product.sku != null) return false;
// if (title != null ? !title.equals(product.title) : product.title != null) return false;
// return imageUrl != null ? imageUrl.equals(product.imageUrl) : product.imageUrl == null;
// }
//
// @Override
// public int hashCode() {
// int result;
// long temp;
// result = sku != null ? sku.hashCode() : 0;
// result = 31 * result + (title != null ? title.hashCode() : 0);
// result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
// temp = Double.doubleToLongBits(price);
// result = 31 * result + (int) (temp ^ (temp >>> 32));
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("Product{");
// sb.append("sku='").append(sku).append('\'');
// sb.append(", title='").append(title).append('\'');
// sb.append(", imageUrl='").append(imageUrl).append('\'');
// sb.append(", price=").append(price);
// sb.append('}');
// return sb.toString();
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/ui/util/PriceFormatter.java
// public class PriceFormatter {
//
// private PriceFormatter() { }
//
// public static String format(double price) {
// String formattedPrice = NumberFormat.getNumberInstance(Locale.getDefault()).format(price);
// return String.format("%s €", formattedPrice);
// }
// }
|
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.czyrux.store.R;
import de.czyrux.store.core.domain.product.Product;
import de.czyrux.store.ui.util.PriceFormatter;
|
package de.czyrux.store.ui.catalog;
class CatalogItemViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.catalog_item_imageview)
ImageView image;
@BindView(R.id.catalog_item_name)
TextView name;
@BindView(R.id.catalog_item_price)
TextView price;
private final CatalogListener listListener;
CatalogItemViewHolder(View view, CatalogListener listListener) {
super(view);
this.listListener = listListener;
ButterKnife.bind(this, view);
}
|
// Path: app/src/main/java/de/czyrux/store/core/domain/product/Product.java
// public class Product {
// public final String sku;
// public final String title;
// public final String imageUrl;
// public final double price;
//
// public Product(String sku, String title, String imageUrl, double price) {
// this.sku = sku;
// this.title = title;
// this.imageUrl = imageUrl;
// this.price = price;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// Product product = (Product) o;
//
// if (Double.compare(product.price, price) != 0) return false;
// if (sku != null ? !sku.equals(product.sku) : product.sku != null) return false;
// if (title != null ? !title.equals(product.title) : product.title != null) return false;
// return imageUrl != null ? imageUrl.equals(product.imageUrl) : product.imageUrl == null;
// }
//
// @Override
// public int hashCode() {
// int result;
// long temp;
// result = sku != null ? sku.hashCode() : 0;
// result = 31 * result + (title != null ? title.hashCode() : 0);
// result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
// temp = Double.doubleToLongBits(price);
// result = 31 * result + (int) (temp ^ (temp >>> 32));
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("Product{");
// sb.append("sku='").append(sku).append('\'');
// sb.append(", title='").append(title).append('\'');
// sb.append(", imageUrl='").append(imageUrl).append('\'');
// sb.append(", price=").append(price);
// sb.append('}');
// return sb.toString();
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/ui/util/PriceFormatter.java
// public class PriceFormatter {
//
// private PriceFormatter() { }
//
// public static String format(double price) {
// String formattedPrice = NumberFormat.getNumberInstance(Locale.getDefault()).format(price);
// return String.format("%s €", formattedPrice);
// }
// }
// Path: app/src/main/java/de/czyrux/store/ui/catalog/CatalogItemViewHolder.java
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.czyrux.store.R;
import de.czyrux.store.core.domain.product.Product;
import de.czyrux.store.ui.util.PriceFormatter;
package de.czyrux.store.ui.catalog;
class CatalogItemViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.catalog_item_imageview)
ImageView image;
@BindView(R.id.catalog_item_name)
TextView name;
@BindView(R.id.catalog_item_price)
TextView price;
private final CatalogListener listListener;
CatalogItemViewHolder(View view, CatalogListener listListener) {
super(view);
this.listListener = listListener;
ButterKnife.bind(this, view);
}
|
public void bind(Product product) {
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/ui/catalog/CatalogItemViewHolder.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/product/Product.java
// public class Product {
// public final String sku;
// public final String title;
// public final String imageUrl;
// public final double price;
//
// public Product(String sku, String title, String imageUrl, double price) {
// this.sku = sku;
// this.title = title;
// this.imageUrl = imageUrl;
// this.price = price;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// Product product = (Product) o;
//
// if (Double.compare(product.price, price) != 0) return false;
// if (sku != null ? !sku.equals(product.sku) : product.sku != null) return false;
// if (title != null ? !title.equals(product.title) : product.title != null) return false;
// return imageUrl != null ? imageUrl.equals(product.imageUrl) : product.imageUrl == null;
// }
//
// @Override
// public int hashCode() {
// int result;
// long temp;
// result = sku != null ? sku.hashCode() : 0;
// result = 31 * result + (title != null ? title.hashCode() : 0);
// result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
// temp = Double.doubleToLongBits(price);
// result = 31 * result + (int) (temp ^ (temp >>> 32));
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("Product{");
// sb.append("sku='").append(sku).append('\'');
// sb.append(", title='").append(title).append('\'');
// sb.append(", imageUrl='").append(imageUrl).append('\'');
// sb.append(", price=").append(price);
// sb.append('}');
// return sb.toString();
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/ui/util/PriceFormatter.java
// public class PriceFormatter {
//
// private PriceFormatter() { }
//
// public static String format(double price) {
// String formattedPrice = NumberFormat.getNumberInstance(Locale.getDefault()).format(price);
// return String.format("%s €", formattedPrice);
// }
// }
|
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.czyrux.store.R;
import de.czyrux.store.core.domain.product.Product;
import de.czyrux.store.ui.util.PriceFormatter;
|
package de.czyrux.store.ui.catalog;
class CatalogItemViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.catalog_item_imageview)
ImageView image;
@BindView(R.id.catalog_item_name)
TextView name;
@BindView(R.id.catalog_item_price)
TextView price;
private final CatalogListener listListener;
CatalogItemViewHolder(View view, CatalogListener listListener) {
super(view);
this.listListener = listListener;
ButterKnife.bind(this, view);
}
public void bind(Product product) {
name.setText(product.title);
|
// Path: app/src/main/java/de/czyrux/store/core/domain/product/Product.java
// public class Product {
// public final String sku;
// public final String title;
// public final String imageUrl;
// public final double price;
//
// public Product(String sku, String title, String imageUrl, double price) {
// this.sku = sku;
// this.title = title;
// this.imageUrl = imageUrl;
// this.price = price;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// Product product = (Product) o;
//
// if (Double.compare(product.price, price) != 0) return false;
// if (sku != null ? !sku.equals(product.sku) : product.sku != null) return false;
// if (title != null ? !title.equals(product.title) : product.title != null) return false;
// return imageUrl != null ? imageUrl.equals(product.imageUrl) : product.imageUrl == null;
// }
//
// @Override
// public int hashCode() {
// int result;
// long temp;
// result = sku != null ? sku.hashCode() : 0;
// result = 31 * result + (title != null ? title.hashCode() : 0);
// result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
// temp = Double.doubleToLongBits(price);
// result = 31 * result + (int) (temp ^ (temp >>> 32));
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("Product{");
// sb.append("sku='").append(sku).append('\'');
// sb.append(", title='").append(title).append('\'');
// sb.append(", imageUrl='").append(imageUrl).append('\'');
// sb.append(", price=").append(price);
// sb.append('}');
// return sb.toString();
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/ui/util/PriceFormatter.java
// public class PriceFormatter {
//
// private PriceFormatter() { }
//
// public static String format(double price) {
// String formattedPrice = NumberFormat.getNumberInstance(Locale.getDefault()).format(price);
// return String.format("%s €", formattedPrice);
// }
// }
// Path: app/src/main/java/de/czyrux/store/ui/catalog/CatalogItemViewHolder.java
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.czyrux.store.R;
import de.czyrux.store.core.domain.product.Product;
import de.czyrux.store.ui.util.PriceFormatter;
package de.czyrux.store.ui.catalog;
class CatalogItemViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.catalog_item_imageview)
ImageView image;
@BindView(R.id.catalog_item_name)
TextView name;
@BindView(R.id.catalog_item_price)
TextView price;
private final CatalogListener listListener;
CatalogItemViewHolder(View view, CatalogListener listListener) {
super(view);
this.listListener = listListener;
ButterKnife.bind(this, view);
}
public void bind(Product product) {
name.setText(product.title);
|
price.setText(PriceFormatter.format(product.price));
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/core/data/sources/InMemoryProductDataSource.java
|
// Path: app/src/main/java/de/czyrux/store/core/data/util/TimeDelayer.java
// public class TimeDelayer {
//
// private static final int MAX_DEFAULT_DELAY = 2000; // 2 sec
// private final Random random;
//
// public TimeDelayer() {
// random = new Random(System.nanoTime());
// }
//
// public void delay(int maxTime) {
// try {
// Thread.sleep(random.nextInt(maxTime));
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
//
// public void delay() {
// delay(MAX_DEFAULT_DELAY);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/Product.java
// public class Product {
// public final String sku;
// public final String title;
// public final String imageUrl;
// public final double price;
//
// public Product(String sku, String title, String imageUrl, double price) {
// this.sku = sku;
// this.title = title;
// this.imageUrl = imageUrl;
// this.price = price;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// Product product = (Product) o;
//
// if (Double.compare(product.price, price) != 0) return false;
// if (sku != null ? !sku.equals(product.sku) : product.sku != null) return false;
// if (title != null ? !title.equals(product.title) : product.title != null) return false;
// return imageUrl != null ? imageUrl.equals(product.imageUrl) : product.imageUrl == null;
// }
//
// @Override
// public int hashCode() {
// int result;
// long temp;
// result = sku != null ? sku.hashCode() : 0;
// result = 31 * result + (title != null ? title.hashCode() : 0);
// result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
// temp = Double.doubleToLongBits(price);
// result = 31 * result + (int) (temp ^ (temp >>> 32));
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("Product{");
// sb.append("sku='").append(sku).append('\'');
// sb.append(", title='").append(title).append('\'');
// sb.append(", imageUrl='").append(imageUrl).append('\'');
// sb.append(", price=").append(price);
// sb.append('}');
// return sb.toString();
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
|
import java.util.List;
import de.czyrux.store.core.data.util.TimeDelayer;
import de.czyrux.store.core.domain.product.Product;
import de.czyrux.store.core.domain.product.ProductDataSource;
import io.reactivex.Single;
|
package de.czyrux.store.core.data.sources;
public class InMemoryProductDataSource implements ProductDataSource {
private final TimeDelayer timeDelayer;
public InMemoryProductDataSource(TimeDelayer timeDelayer) {
this.timeDelayer = timeDelayer;
}
@Override
|
// Path: app/src/main/java/de/czyrux/store/core/data/util/TimeDelayer.java
// public class TimeDelayer {
//
// private static final int MAX_DEFAULT_DELAY = 2000; // 2 sec
// private final Random random;
//
// public TimeDelayer() {
// random = new Random(System.nanoTime());
// }
//
// public void delay(int maxTime) {
// try {
// Thread.sleep(random.nextInt(maxTime));
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
//
// public void delay() {
// delay(MAX_DEFAULT_DELAY);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/Product.java
// public class Product {
// public final String sku;
// public final String title;
// public final String imageUrl;
// public final double price;
//
// public Product(String sku, String title, String imageUrl, double price) {
// this.sku = sku;
// this.title = title;
// this.imageUrl = imageUrl;
// this.price = price;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// Product product = (Product) o;
//
// if (Double.compare(product.price, price) != 0) return false;
// if (sku != null ? !sku.equals(product.sku) : product.sku != null) return false;
// if (title != null ? !title.equals(product.title) : product.title != null) return false;
// return imageUrl != null ? imageUrl.equals(product.imageUrl) : product.imageUrl == null;
// }
//
// @Override
// public int hashCode() {
// int result;
// long temp;
// result = sku != null ? sku.hashCode() : 0;
// result = 31 * result + (title != null ? title.hashCode() : 0);
// result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
// temp = Double.doubleToLongBits(price);
// result = 31 * result + (int) (temp ^ (temp >>> 32));
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("Product{");
// sb.append("sku='").append(sku).append('\'');
// sb.append(", title='").append(title).append('\'');
// sb.append(", imageUrl='").append(imageUrl).append('\'');
// sb.append(", price=").append(price);
// sb.append('}');
// return sb.toString();
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
// Path: app/src/main/java/de/czyrux/store/core/data/sources/InMemoryProductDataSource.java
import java.util.List;
import de.czyrux.store.core.data.util.TimeDelayer;
import de.czyrux.store.core.domain.product.Product;
import de.czyrux.store.core.domain.product.ProductDataSource;
import io.reactivex.Single;
package de.czyrux.store.core.data.sources;
public class InMemoryProductDataSource implements ProductDataSource {
private final TimeDelayer timeDelayer;
public InMemoryProductDataSource(TimeDelayer timeDelayer) {
this.timeDelayer = timeDelayer;
}
@Override
|
public Single<List<Product>> getAllCatalog() {
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/inject/DataDependenciesFactory.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
|
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
|
package de.czyrux.store.inject;
public interface DataDependenciesFactory {
CartDataSource createCartDataSource();
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartDataSource.java
// public interface CartDataSource {
//
// Single<Cart> getCart();
//
// Single<Cart> addProduct(CartProduct cartProduct);
//
// Single<Cart> removeProduct(CartProduct cartProduct);
//
// Single<Cart> emptyCart();
// }
//
// Path: app/src/main/java/de/czyrux/store/core/domain/product/ProductDataSource.java
// public interface ProductDataSource {
// Single<List<Product>> getAllCatalog();
// }
// Path: app/src/main/java/de/czyrux/store/inject/DataDependenciesFactory.java
import de.czyrux.store.core.domain.cart.CartDataSource;
import de.czyrux.store.core.domain.product.ProductDataSource;
package de.czyrux.store.inject;
public interface DataDependenciesFactory {
CartDataSource createCartDataSource();
|
ProductDataSource createProductDataSource();
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/ui/GroceryStoreApp.java
|
// Path: app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
// public class DefaultDependenciesFactory implements DependenciesFactory {
//
// private final DataDependenciesFactory dataDependenciesFactory;
// private final CartStore cartStore;
//
// public DefaultDependenciesFactory(DataDependenciesFactory dataDependenciesFactory) {
// this.dataDependenciesFactory = dataDependenciesFactory;
// cartStore = new CartStore();
// }
//
// @Override
// public CartService createCartService() {
// return new CartService(dataDependenciesFactory.createCartDataSource(), cartStore);
// }
//
// @Override
// public ProductService createProductService() {
// return new ProductService(dataDependenciesFactory.createProductDataSource());
// }
//
// @Override
// public CartStore createCartStore() {
// return cartStore;
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
// public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryDataDependenciesFactory() {
// timeDelayer = new TimeDelayer();
// }
//
// @Override
// public CartDataSource createCartDataSource() {
// return new InMemoryCartDataSource(timeDelayer);
// }
//
// @Override
// public ProductDataSource createProductDataSource() {
// return new InMemoryProductDataSource(timeDelayer);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/Injector.java
// public class Injector {
// private static Injector INSTANCE;
// private final CartService cartService;
// private final ProductService productService;
// private final CartStore cartStore;
//
// private Injector(CartService cartService, ProductService productService, CartStore cartStore) {
// this.cartService = cartService;
// this.productService = productService;
// this.cartStore = cartStore;
// }
//
// public static void using(DependenciesFactory factory) {
// CartService cartService = factory.createCartService();
// ProductService productService = factory.createProductService();
// CartStore cartStore = factory.createCartStore();
// INSTANCE = new Injector(cartService, productService, cartStore);
// }
//
// private static Injector instance() {
// if (INSTANCE == null) {
// throw new IllegalStateException("You need to setup Inject to use a valid DependenciesFactory");
// }
// return INSTANCE;
// }
//
// public static CartService cartService() { return instance().cartService; }
//
// public static ProductService productService() { return instance().productService; }
//
// public static CartStore cartStore() {
// return instance().cartStore;
// }
// }
|
import android.app.Application;
import de.czyrux.store.inject.DefaultDependenciesFactory;
import de.czyrux.store.inject.InMemoryDataDependenciesFactory;
import de.czyrux.store.inject.Injector;
|
package de.czyrux.store.ui;
public class GroceryStoreApp extends Application {
@Override
public void onCreate() {
super.onCreate();
|
// Path: app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
// public class DefaultDependenciesFactory implements DependenciesFactory {
//
// private final DataDependenciesFactory dataDependenciesFactory;
// private final CartStore cartStore;
//
// public DefaultDependenciesFactory(DataDependenciesFactory dataDependenciesFactory) {
// this.dataDependenciesFactory = dataDependenciesFactory;
// cartStore = new CartStore();
// }
//
// @Override
// public CartService createCartService() {
// return new CartService(dataDependenciesFactory.createCartDataSource(), cartStore);
// }
//
// @Override
// public ProductService createProductService() {
// return new ProductService(dataDependenciesFactory.createProductDataSource());
// }
//
// @Override
// public CartStore createCartStore() {
// return cartStore;
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
// public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryDataDependenciesFactory() {
// timeDelayer = new TimeDelayer();
// }
//
// @Override
// public CartDataSource createCartDataSource() {
// return new InMemoryCartDataSource(timeDelayer);
// }
//
// @Override
// public ProductDataSource createProductDataSource() {
// return new InMemoryProductDataSource(timeDelayer);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/Injector.java
// public class Injector {
// private static Injector INSTANCE;
// private final CartService cartService;
// private final ProductService productService;
// private final CartStore cartStore;
//
// private Injector(CartService cartService, ProductService productService, CartStore cartStore) {
// this.cartService = cartService;
// this.productService = productService;
// this.cartStore = cartStore;
// }
//
// public static void using(DependenciesFactory factory) {
// CartService cartService = factory.createCartService();
// ProductService productService = factory.createProductService();
// CartStore cartStore = factory.createCartStore();
// INSTANCE = new Injector(cartService, productService, cartStore);
// }
//
// private static Injector instance() {
// if (INSTANCE == null) {
// throw new IllegalStateException("You need to setup Inject to use a valid DependenciesFactory");
// }
// return INSTANCE;
// }
//
// public static CartService cartService() { return instance().cartService; }
//
// public static ProductService productService() { return instance().productService; }
//
// public static CartStore cartStore() {
// return instance().cartStore;
// }
// }
// Path: app/src/main/java/de/czyrux/store/ui/GroceryStoreApp.java
import android.app.Application;
import de.czyrux.store.inject.DefaultDependenciesFactory;
import de.czyrux.store.inject.InMemoryDataDependenciesFactory;
import de.czyrux.store.inject.Injector;
package de.czyrux.store.ui;
public class GroceryStoreApp extends Application {
@Override
public void onCreate() {
super.onCreate();
|
Injector.using(new DefaultDependenciesFactory(new InMemoryDataDependenciesFactory()));
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/ui/GroceryStoreApp.java
|
// Path: app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
// public class DefaultDependenciesFactory implements DependenciesFactory {
//
// private final DataDependenciesFactory dataDependenciesFactory;
// private final CartStore cartStore;
//
// public DefaultDependenciesFactory(DataDependenciesFactory dataDependenciesFactory) {
// this.dataDependenciesFactory = dataDependenciesFactory;
// cartStore = new CartStore();
// }
//
// @Override
// public CartService createCartService() {
// return new CartService(dataDependenciesFactory.createCartDataSource(), cartStore);
// }
//
// @Override
// public ProductService createProductService() {
// return new ProductService(dataDependenciesFactory.createProductDataSource());
// }
//
// @Override
// public CartStore createCartStore() {
// return cartStore;
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
// public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryDataDependenciesFactory() {
// timeDelayer = new TimeDelayer();
// }
//
// @Override
// public CartDataSource createCartDataSource() {
// return new InMemoryCartDataSource(timeDelayer);
// }
//
// @Override
// public ProductDataSource createProductDataSource() {
// return new InMemoryProductDataSource(timeDelayer);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/Injector.java
// public class Injector {
// private static Injector INSTANCE;
// private final CartService cartService;
// private final ProductService productService;
// private final CartStore cartStore;
//
// private Injector(CartService cartService, ProductService productService, CartStore cartStore) {
// this.cartService = cartService;
// this.productService = productService;
// this.cartStore = cartStore;
// }
//
// public static void using(DependenciesFactory factory) {
// CartService cartService = factory.createCartService();
// ProductService productService = factory.createProductService();
// CartStore cartStore = factory.createCartStore();
// INSTANCE = new Injector(cartService, productService, cartStore);
// }
//
// private static Injector instance() {
// if (INSTANCE == null) {
// throw new IllegalStateException("You need to setup Inject to use a valid DependenciesFactory");
// }
// return INSTANCE;
// }
//
// public static CartService cartService() { return instance().cartService; }
//
// public static ProductService productService() { return instance().productService; }
//
// public static CartStore cartStore() {
// return instance().cartStore;
// }
// }
|
import android.app.Application;
import de.czyrux.store.inject.DefaultDependenciesFactory;
import de.czyrux.store.inject.InMemoryDataDependenciesFactory;
import de.czyrux.store.inject.Injector;
|
package de.czyrux.store.ui;
public class GroceryStoreApp extends Application {
@Override
public void onCreate() {
super.onCreate();
|
// Path: app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
// public class DefaultDependenciesFactory implements DependenciesFactory {
//
// private final DataDependenciesFactory dataDependenciesFactory;
// private final CartStore cartStore;
//
// public DefaultDependenciesFactory(DataDependenciesFactory dataDependenciesFactory) {
// this.dataDependenciesFactory = dataDependenciesFactory;
// cartStore = new CartStore();
// }
//
// @Override
// public CartService createCartService() {
// return new CartService(dataDependenciesFactory.createCartDataSource(), cartStore);
// }
//
// @Override
// public ProductService createProductService() {
// return new ProductService(dataDependenciesFactory.createProductDataSource());
// }
//
// @Override
// public CartStore createCartStore() {
// return cartStore;
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
// public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryDataDependenciesFactory() {
// timeDelayer = new TimeDelayer();
// }
//
// @Override
// public CartDataSource createCartDataSource() {
// return new InMemoryCartDataSource(timeDelayer);
// }
//
// @Override
// public ProductDataSource createProductDataSource() {
// return new InMemoryProductDataSource(timeDelayer);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/Injector.java
// public class Injector {
// private static Injector INSTANCE;
// private final CartService cartService;
// private final ProductService productService;
// private final CartStore cartStore;
//
// private Injector(CartService cartService, ProductService productService, CartStore cartStore) {
// this.cartService = cartService;
// this.productService = productService;
// this.cartStore = cartStore;
// }
//
// public static void using(DependenciesFactory factory) {
// CartService cartService = factory.createCartService();
// ProductService productService = factory.createProductService();
// CartStore cartStore = factory.createCartStore();
// INSTANCE = new Injector(cartService, productService, cartStore);
// }
//
// private static Injector instance() {
// if (INSTANCE == null) {
// throw new IllegalStateException("You need to setup Inject to use a valid DependenciesFactory");
// }
// return INSTANCE;
// }
//
// public static CartService cartService() { return instance().cartService; }
//
// public static ProductService productService() { return instance().productService; }
//
// public static CartStore cartStore() {
// return instance().cartStore;
// }
// }
// Path: app/src/main/java/de/czyrux/store/ui/GroceryStoreApp.java
import android.app.Application;
import de.czyrux.store.inject.DefaultDependenciesFactory;
import de.czyrux.store.inject.InMemoryDataDependenciesFactory;
import de.czyrux.store.inject.Injector;
package de.czyrux.store.ui;
public class GroceryStoreApp extends Application {
@Override
public void onCreate() {
super.onCreate();
|
Injector.using(new DefaultDependenciesFactory(new InMemoryDataDependenciesFactory()));
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/ui/GroceryStoreApp.java
|
// Path: app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
// public class DefaultDependenciesFactory implements DependenciesFactory {
//
// private final DataDependenciesFactory dataDependenciesFactory;
// private final CartStore cartStore;
//
// public DefaultDependenciesFactory(DataDependenciesFactory dataDependenciesFactory) {
// this.dataDependenciesFactory = dataDependenciesFactory;
// cartStore = new CartStore();
// }
//
// @Override
// public CartService createCartService() {
// return new CartService(dataDependenciesFactory.createCartDataSource(), cartStore);
// }
//
// @Override
// public ProductService createProductService() {
// return new ProductService(dataDependenciesFactory.createProductDataSource());
// }
//
// @Override
// public CartStore createCartStore() {
// return cartStore;
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
// public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryDataDependenciesFactory() {
// timeDelayer = new TimeDelayer();
// }
//
// @Override
// public CartDataSource createCartDataSource() {
// return new InMemoryCartDataSource(timeDelayer);
// }
//
// @Override
// public ProductDataSource createProductDataSource() {
// return new InMemoryProductDataSource(timeDelayer);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/Injector.java
// public class Injector {
// private static Injector INSTANCE;
// private final CartService cartService;
// private final ProductService productService;
// private final CartStore cartStore;
//
// private Injector(CartService cartService, ProductService productService, CartStore cartStore) {
// this.cartService = cartService;
// this.productService = productService;
// this.cartStore = cartStore;
// }
//
// public static void using(DependenciesFactory factory) {
// CartService cartService = factory.createCartService();
// ProductService productService = factory.createProductService();
// CartStore cartStore = factory.createCartStore();
// INSTANCE = new Injector(cartService, productService, cartStore);
// }
//
// private static Injector instance() {
// if (INSTANCE == null) {
// throw new IllegalStateException("You need to setup Inject to use a valid DependenciesFactory");
// }
// return INSTANCE;
// }
//
// public static CartService cartService() { return instance().cartService; }
//
// public static ProductService productService() { return instance().productService; }
//
// public static CartStore cartStore() {
// return instance().cartStore;
// }
// }
|
import android.app.Application;
import de.czyrux.store.inject.DefaultDependenciesFactory;
import de.czyrux.store.inject.InMemoryDataDependenciesFactory;
import de.czyrux.store.inject.Injector;
|
package de.czyrux.store.ui;
public class GroceryStoreApp extends Application {
@Override
public void onCreate() {
super.onCreate();
|
// Path: app/src/main/java/de/czyrux/store/inject/DefaultDependenciesFactory.java
// public class DefaultDependenciesFactory implements DependenciesFactory {
//
// private final DataDependenciesFactory dataDependenciesFactory;
// private final CartStore cartStore;
//
// public DefaultDependenciesFactory(DataDependenciesFactory dataDependenciesFactory) {
// this.dataDependenciesFactory = dataDependenciesFactory;
// cartStore = new CartStore();
// }
//
// @Override
// public CartService createCartService() {
// return new CartService(dataDependenciesFactory.createCartDataSource(), cartStore);
// }
//
// @Override
// public ProductService createProductService() {
// return new ProductService(dataDependenciesFactory.createProductDataSource());
// }
//
// @Override
// public CartStore createCartStore() {
// return cartStore;
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/InMemoryDataDependenciesFactory.java
// public class InMemoryDataDependenciesFactory implements DataDependenciesFactory {
//
// private final TimeDelayer timeDelayer;
//
// public InMemoryDataDependenciesFactory() {
// timeDelayer = new TimeDelayer();
// }
//
// @Override
// public CartDataSource createCartDataSource() {
// return new InMemoryCartDataSource(timeDelayer);
// }
//
// @Override
// public ProductDataSource createProductDataSource() {
// return new InMemoryProductDataSource(timeDelayer);
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/inject/Injector.java
// public class Injector {
// private static Injector INSTANCE;
// private final CartService cartService;
// private final ProductService productService;
// private final CartStore cartStore;
//
// private Injector(CartService cartService, ProductService productService, CartStore cartStore) {
// this.cartService = cartService;
// this.productService = productService;
// this.cartStore = cartStore;
// }
//
// public static void using(DependenciesFactory factory) {
// CartService cartService = factory.createCartService();
// ProductService productService = factory.createProductService();
// CartStore cartStore = factory.createCartStore();
// INSTANCE = new Injector(cartService, productService, cartStore);
// }
//
// private static Injector instance() {
// if (INSTANCE == null) {
// throw new IllegalStateException("You need to setup Inject to use a valid DependenciesFactory");
// }
// return INSTANCE;
// }
//
// public static CartService cartService() { return instance().cartService; }
//
// public static ProductService productService() { return instance().productService; }
//
// public static CartStore cartStore() {
// return instance().cartStore;
// }
// }
// Path: app/src/main/java/de/czyrux/store/ui/GroceryStoreApp.java
import android.app.Application;
import de.czyrux.store.inject.DefaultDependenciesFactory;
import de.czyrux.store.inject.InMemoryDataDependenciesFactory;
import de.czyrux.store.inject.Injector;
package de.czyrux.store.ui;
public class GroceryStoreApp extends Application {
@Override
public void onCreate() {
super.onCreate();
|
Injector.using(new DefaultDependenciesFactory(new InMemoryDataDependenciesFactory()));
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/ui/cart/CartItemViewHolder.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartProduct.java
// public class CartProduct extends Product {
//
// public final int quantity;
//
// public CartProduct(String sku, String title, String imageUrl, double price, int quantity) {
// super(sku, title, imageUrl, price);
// this.quantity = quantity;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// CartProduct product = (CartProduct) o;
//
// return quantity == product.quantity;
//
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + quantity;
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("CartProduct{");
// sb.append("quantity=").append(quantity);
// sb.append('}');
// return sb.toString();
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/ui/util/PriceFormatter.java
// public class PriceFormatter {
//
// private PriceFormatter() { }
//
// public static String format(double price) {
// String formattedPrice = NumberFormat.getNumberInstance(Locale.getDefault()).format(price);
// return String.format("%s €", formattedPrice);
// }
// }
|
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.czyrux.store.R;
import de.czyrux.store.core.domain.cart.CartProduct;
import de.czyrux.store.ui.util.PriceFormatter;
|
package de.czyrux.store.ui.cart;
class CartItemViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.cart_item_imageview)
ImageView image;
@BindView(R.id.cart_item_name)
TextView name;
@BindView(R.id.cart_item_price)
TextView price;
@BindView(R.id.cart_item_quantity)
TextView quantity;
private final CartListener listListener;
CartItemViewHolder(View view, CartListener listListener) {
super(view);
this.listListener = listListener;
ButterKnife.bind(this, view);
}
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartProduct.java
// public class CartProduct extends Product {
//
// public final int quantity;
//
// public CartProduct(String sku, String title, String imageUrl, double price, int quantity) {
// super(sku, title, imageUrl, price);
// this.quantity = quantity;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// CartProduct product = (CartProduct) o;
//
// return quantity == product.quantity;
//
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + quantity;
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("CartProduct{");
// sb.append("quantity=").append(quantity);
// sb.append('}');
// return sb.toString();
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/ui/util/PriceFormatter.java
// public class PriceFormatter {
//
// private PriceFormatter() { }
//
// public static String format(double price) {
// String formattedPrice = NumberFormat.getNumberInstance(Locale.getDefault()).format(price);
// return String.format("%s €", formattedPrice);
// }
// }
// Path: app/src/main/java/de/czyrux/store/ui/cart/CartItemViewHolder.java
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.czyrux.store.R;
import de.czyrux.store.core.domain.cart.CartProduct;
import de.czyrux.store.ui.util.PriceFormatter;
package de.czyrux.store.ui.cart;
class CartItemViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.cart_item_imageview)
ImageView image;
@BindView(R.id.cart_item_name)
TextView name;
@BindView(R.id.cart_item_price)
TextView price;
@BindView(R.id.cart_item_quantity)
TextView quantity;
private final CartListener listListener;
CartItemViewHolder(View view, CartListener listListener) {
super(view);
this.listListener = listListener;
ButterKnife.bind(this, view);
}
|
public void bind(CartProduct product) {
|
czyrux/GroceryStore
|
app/src/main/java/de/czyrux/store/ui/cart/CartItemViewHolder.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartProduct.java
// public class CartProduct extends Product {
//
// public final int quantity;
//
// public CartProduct(String sku, String title, String imageUrl, double price, int quantity) {
// super(sku, title, imageUrl, price);
// this.quantity = quantity;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// CartProduct product = (CartProduct) o;
//
// return quantity == product.quantity;
//
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + quantity;
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("CartProduct{");
// sb.append("quantity=").append(quantity);
// sb.append('}');
// return sb.toString();
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/ui/util/PriceFormatter.java
// public class PriceFormatter {
//
// private PriceFormatter() { }
//
// public static String format(double price) {
// String formattedPrice = NumberFormat.getNumberInstance(Locale.getDefault()).format(price);
// return String.format("%s €", formattedPrice);
// }
// }
|
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.czyrux.store.R;
import de.czyrux.store.core.domain.cart.CartProduct;
import de.czyrux.store.ui.util.PriceFormatter;
|
package de.czyrux.store.ui.cart;
class CartItemViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.cart_item_imageview)
ImageView image;
@BindView(R.id.cart_item_name)
TextView name;
@BindView(R.id.cart_item_price)
TextView price;
@BindView(R.id.cart_item_quantity)
TextView quantity;
private final CartListener listListener;
CartItemViewHolder(View view, CartListener listListener) {
super(view);
this.listListener = listListener;
ButterKnife.bind(this, view);
}
public void bind(CartProduct product) {
name.setText(product.title);
|
// Path: app/src/main/java/de/czyrux/store/core/domain/cart/CartProduct.java
// public class CartProduct extends Product {
//
// public final int quantity;
//
// public CartProduct(String sku, String title, String imageUrl, double price, int quantity) {
// super(sku, title, imageUrl, price);
// this.quantity = quantity;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// CartProduct product = (CartProduct) o;
//
// return quantity == product.quantity;
//
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + quantity;
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("CartProduct{");
// sb.append("quantity=").append(quantity);
// sb.append('}');
// return sb.toString();
// }
// }
//
// Path: app/src/main/java/de/czyrux/store/ui/util/PriceFormatter.java
// public class PriceFormatter {
//
// private PriceFormatter() { }
//
// public static String format(double price) {
// String formattedPrice = NumberFormat.getNumberInstance(Locale.getDefault()).format(price);
// return String.format("%s €", formattedPrice);
// }
// }
// Path: app/src/main/java/de/czyrux/store/ui/cart/CartItemViewHolder.java
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import butterknife.BindView;
import butterknife.ButterKnife;
import de.czyrux.store.R;
import de.czyrux.store.core.domain.cart.CartProduct;
import de.czyrux.store.ui.util.PriceFormatter;
package de.czyrux.store.ui.cart;
class CartItemViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.cart_item_imageview)
ImageView image;
@BindView(R.id.cart_item_name)
TextView name;
@BindView(R.id.cart_item_price)
TextView price;
@BindView(R.id.cart_item_quantity)
TextView quantity;
private final CartListener listListener;
CartItemViewHolder(View view, CartListener listListener) {
super(view);
this.listListener = listListener;
ButterKnife.bind(this, view);
}
public void bind(CartProduct product) {
name.setText(product.title);
|
price.setText(PriceFormatter.format(product.price));
|
czyrux/GroceryStore
|
app/src/test/java/de/czyrux/store/test/ProductFakeCreator.java
|
// Path: app/src/main/java/de/czyrux/store/core/domain/product/Product.java
// public class Product {
// public final String sku;
// public final String title;
// public final String imageUrl;
// public final double price;
//
// public Product(String sku, String title, String imageUrl, double price) {
// this.sku = sku;
// this.title = title;
// this.imageUrl = imageUrl;
// this.price = price;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// Product product = (Product) o;
//
// if (Double.compare(product.price, price) != 0) return false;
// if (sku != null ? !sku.equals(product.sku) : product.sku != null) return false;
// if (title != null ? !title.equals(product.title) : product.title != null) return false;
// return imageUrl != null ? imageUrl.equals(product.imageUrl) : product.imageUrl == null;
// }
//
// @Override
// public int hashCode() {
// int result;
// long temp;
// result = sku != null ? sku.hashCode() : 0;
// result = 31 * result + (title != null ? title.hashCode() : 0);
// result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
// temp = Double.doubleToLongBits(price);
// result = 31 * result + (int) (temp ^ (temp >>> 32));
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("Product{");
// sb.append("sku='").append(sku).append('\'');
// sb.append(", title='").append(title).append('\'');
// sb.append(", imageUrl='").append(imageUrl).append('\'');
// sb.append(", price=").append(price);
// sb.append('}');
// return sb.toString();
// }
// }
|
import de.czyrux.store.core.domain.product.Product;
|
package de.czyrux.store.test;
public class ProductFakeCreator {
private static final String DEFAULT_SKU = "ada300343";
private ProductFakeCreator() {
}
|
// Path: app/src/main/java/de/czyrux/store/core/domain/product/Product.java
// public class Product {
// public final String sku;
// public final String title;
// public final String imageUrl;
// public final double price;
//
// public Product(String sku, String title, String imageUrl, double price) {
// this.sku = sku;
// this.title = title;
// this.imageUrl = imageUrl;
// this.price = price;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// Product product = (Product) o;
//
// if (Double.compare(product.price, price) != 0) return false;
// if (sku != null ? !sku.equals(product.sku) : product.sku != null) return false;
// if (title != null ? !title.equals(product.title) : product.title != null) return false;
// return imageUrl != null ? imageUrl.equals(product.imageUrl) : product.imageUrl == null;
// }
//
// @Override
// public int hashCode() {
// int result;
// long temp;
// result = sku != null ? sku.hashCode() : 0;
// result = 31 * result + (title != null ? title.hashCode() : 0);
// result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
// temp = Double.doubleToLongBits(price);
// result = 31 * result + (int) (temp ^ (temp >>> 32));
// return result;
// }
//
// @Override
// public String toString() {
// final StringBuilder sb = new StringBuilder("Product{");
// sb.append("sku='").append(sku).append('\'');
// sb.append(", title='").append(title).append('\'');
// sb.append(", imageUrl='").append(imageUrl).append('\'');
// sb.append(", price=").append(price);
// sb.append('}');
// return sb.toString();
// }
// }
// Path: app/src/test/java/de/czyrux/store/test/ProductFakeCreator.java
import de.czyrux.store.core.domain.product.Product;
package de.czyrux.store.test;
public class ProductFakeCreator {
private static final String DEFAULT_SKU = "ada300343";
private ProductFakeCreator() {
}
|
public static Product createProduct() {
|
Codewaves/Highlight.java
|
src/test/java/com/codewaves/codehighlight/core/TestRendererFactory.java
|
// Path: src/main/java/com/codewaves/codehighlight/renderer/HtmlRenderer.java
// public class HtmlRenderer implements StyleRenderer {
// private String mPrefix;
// private String mResult;
//
// public HtmlRenderer(String prefix) {
// mPrefix = prefix;
// }
//
// @Override
// public void onStart() {
// mResult = "";
// }
//
// @Override
// public void onFinish() {
// }
//
// @Override
// public void onPushStyle(String style) {
// mResult += "<span class=\"" + mPrefix + style + "\">";
// }
//
// @Override
// public void onPopStyle() {
// mResult += "</span>";
// }
//
// @Override
// public void onPushCodeBlock(CharSequence block) {
// mResult += escape(block.toString());
// }
//
// @Override
// public void onPushSubLanguage(String name, CharSequence code) {
// mResult += "<span class=\"" + name + "\">" + code + "</span>";
// }
//
// @Override
// public void onAbort(CharSequence code) {
// mResult = code.toString();
// }
//
// @Override
// public CharSequence getResult() {
// return mResult;
// }
//
// private String escape(String code) {
// return code.replace("&", "&").replace("<", "<").replace(">", ">");
// }
// }
|
import com.codewaves.codehighlight.renderer.HtmlRenderer;
|
package com.codewaves.codehighlight.core;
/**
* Created by Sergej Kravcenko on 5/17/2017.
* Copyright (c) 2017 Sergej Kravcenko
*/
public class TestRendererFactory implements StyleRendererFactory {
public StyleRenderer create(String languageName) {
|
// Path: src/main/java/com/codewaves/codehighlight/renderer/HtmlRenderer.java
// public class HtmlRenderer implements StyleRenderer {
// private String mPrefix;
// private String mResult;
//
// public HtmlRenderer(String prefix) {
// mPrefix = prefix;
// }
//
// @Override
// public void onStart() {
// mResult = "";
// }
//
// @Override
// public void onFinish() {
// }
//
// @Override
// public void onPushStyle(String style) {
// mResult += "<span class=\"" + mPrefix + style + "\">";
// }
//
// @Override
// public void onPopStyle() {
// mResult += "</span>";
// }
//
// @Override
// public void onPushCodeBlock(CharSequence block) {
// mResult += escape(block.toString());
// }
//
// @Override
// public void onPushSubLanguage(String name, CharSequence code) {
// mResult += "<span class=\"" + name + "\">" + code + "</span>";
// }
//
// @Override
// public void onAbort(CharSequence code) {
// mResult = code.toString();
// }
//
// @Override
// public CharSequence getResult() {
// return mResult;
// }
//
// private String escape(String code) {
// return code.replace("&", "&").replace("<", "<").replace(">", ">");
// }
// }
// Path: src/test/java/com/codewaves/codehighlight/core/TestRendererFactory.java
import com.codewaves.codehighlight.renderer.HtmlRenderer;
package com.codewaves.codehighlight.core;
/**
* Created by Sergej Kravcenko on 5/17/2017.
* Copyright (c) 2017 Sergej Kravcenko
*/
public class TestRendererFactory implements StyleRendererFactory {
public StyleRenderer create(String languageName) {
|
return new HtmlRenderer("hljs-");
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/value/ValueLogic.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/value/registry/ValueRegistry.java
// public class ValueRegistry {
// public static final ValueRegistry INSTANCE = new ValueRegistry();
//
// private Map<String, Value> stringValueMap = new HashMap<String, Value>();
// private Map<String, Class<? extends Value>> stringClassMap = new HashMap<String, Class<? extends Value>>();
// private Map<Class<? extends Value>, String> classStringMap = new HashMap<Class<? extends Value>, String>();
//
// private void register(final String name, final Value value, final boolean isAlias) {
// if (this.stringValueMap.containsKey(name)) {
// Reference.logger.error("Duplicate value key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Value name cannot be null!");
// return;
// }
//
// final String nameLowerCase = name.toLowerCase(Locale.ENGLISH);
// this.stringValueMap.put(nameLowerCase, value);
// this.stringClassMap.put(nameLowerCase, value.getClass());
// if (!isAlias) {
// this.classStringMap.put(value.getClass(), nameLowerCase);
// }
// }
//
// public void register(final Value value) {
// register(value.getName(), value, false);
//
// for (final String name : value.getAliases()) {
// register(name, value, true);
// }
// }
//
// public Value forName(String name) {
// name = name.toLowerCase(Locale.ENGLISH);
// try {
// final Class<? extends Value> clazz = this.stringClassMap.get(name);
// if (clazz != null) {
// final Value value = clazz.newInstance();
// if (value != null) {
// return value;
// }
// }
// } catch (final Exception e) {
// Reference.logger.error(String.format("Failed to create an instance for %s!", name), e);
// return new ValueSimple.ValueInvalid();
// }
//
// Reference.logger.error(String.format("Failed to create an instance for %s!", name));
// return new ValueSimple.ValueInvalid();
// }
//
// public String forClass(final Class<? extends Value> clazz) {
// final String str = this.classStringMap.get(clazz);
// return str != null ? str : "invalid";
// }
//
// public void init() {
// ValueComplex.register();
// ValueLogic.register();
// ValueMath.register();
// ValueSimple.register();
// }
// }
|
import com.github.lunatrius.ingameinfo.value.registry.ValueRegistry;
|
}
public static class ValueContains extends ValueLogic {
@Override
public String getValue() {
try {
final double current = getDoubleValue(0);
for (final Value operand : this.values.subList(1, this.values.size())) {
final double next = operand.getDoubleValue();
if (current == next) {
return String.valueOf(true);
}
}
return String.valueOf(false);
} catch (final Exception e) {
final String current = replaceVariables(getValue(0));
for (final Value operand : this.values.subList(1, this.values.size())) {
final String next = replaceVariables(operand.getValue());
if (current.equals(next)) {
return String.valueOf(true);
}
}
return String.valueOf(false);
}
}
}
public static void register() {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/value/registry/ValueRegistry.java
// public class ValueRegistry {
// public static final ValueRegistry INSTANCE = new ValueRegistry();
//
// private Map<String, Value> stringValueMap = new HashMap<String, Value>();
// private Map<String, Class<? extends Value>> stringClassMap = new HashMap<String, Class<? extends Value>>();
// private Map<Class<? extends Value>, String> classStringMap = new HashMap<Class<? extends Value>, String>();
//
// private void register(final String name, final Value value, final boolean isAlias) {
// if (this.stringValueMap.containsKey(name)) {
// Reference.logger.error("Duplicate value key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Value name cannot be null!");
// return;
// }
//
// final String nameLowerCase = name.toLowerCase(Locale.ENGLISH);
// this.stringValueMap.put(nameLowerCase, value);
// this.stringClassMap.put(nameLowerCase, value.getClass());
// if (!isAlias) {
// this.classStringMap.put(value.getClass(), nameLowerCase);
// }
// }
//
// public void register(final Value value) {
// register(value.getName(), value, false);
//
// for (final String name : value.getAliases()) {
// register(name, value, true);
// }
// }
//
// public Value forName(String name) {
// name = name.toLowerCase(Locale.ENGLISH);
// try {
// final Class<? extends Value> clazz = this.stringClassMap.get(name);
// if (clazz != null) {
// final Value value = clazz.newInstance();
// if (value != null) {
// return value;
// }
// }
// } catch (final Exception e) {
// Reference.logger.error(String.format("Failed to create an instance for %s!", name), e);
// return new ValueSimple.ValueInvalid();
// }
//
// Reference.logger.error(String.format("Failed to create an instance for %s!", name));
// return new ValueSimple.ValueInvalid();
// }
//
// public String forClass(final Class<? extends Value> clazz) {
// final String str = this.classStringMap.get(clazz);
// return str != null ? str : "invalid";
// }
//
// public void init() {
// ValueComplex.register();
// ValueLogic.register();
// ValueMath.register();
// ValueSimple.register();
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/value/ValueLogic.java
import com.github.lunatrius.ingameinfo.value.registry.ValueRegistry;
}
public static class ValueContains extends ValueLogic {
@Override
public String getValue() {
try {
final double current = getDoubleValue(0);
for (final Value operand : this.values.subList(1, this.values.size())) {
final double next = operand.getDoubleValue();
if (current == next) {
return String.valueOf(true);
}
}
return String.valueOf(false);
} catch (final Exception e) {
final String current = replaceVariables(getValue(0));
for (final Value operand : this.values.subList(1, this.values.size())) {
final String next = replaceVariables(operand.getValue());
if (current.equals(next)) {
return String.valueOf(true);
}
}
return String.valueOf(false);
}
}
}
public static void register() {
|
ValueRegistry.INSTANCE.register(new ValueIf().setName("if"));
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/proxy/ServerProxy.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/handler/PlayerHandler.java
// public class PlayerHandler {
// @SubscribeEvent
// public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) {
// if (event.player instanceof EntityPlayerMP) {
// try {
// PacketHandler.INSTANCE.sendTo(new MessageSeed(event.player.world.getSeed()), (EntityPlayerMP) event.player);
// } catch (final Exception ex) {
// Reference.logger.error("Failed to send the seed!", ex);
// }
// }
// }
// }
|
import com.github.lunatrius.ingameinfo.handler.PlayerHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
package com.github.lunatrius.ingameinfo.proxy;
public class ServerProxy extends CommonProxy {
@Override
public void init(final FMLInitializationEvent event) {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/handler/PlayerHandler.java
// public class PlayerHandler {
// @SubscribeEvent
// public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) {
// if (event.player instanceof EntityPlayerMP) {
// try {
// PacketHandler.INSTANCE.sendTo(new MessageSeed(event.player.world.getSeed()), (EntityPlayerMP) event.player);
// } catch (final Exception ex) {
// Reference.logger.error("Failed to send the seed!", ex);
// }
// }
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/proxy/ServerProxy.java
import com.github.lunatrius.ingameinfo.handler.PlayerHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
package com.github.lunatrius.ingameinfo.proxy;
public class ServerProxy extends CommonProxy {
@Override
public void init(final FMLInitializationEvent event) {
|
MinecraftForge.EVENT_BUS.register(new PlayerHandler());
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/tag/TagMouseOver.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
|
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityList;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
|
final IBlockState blockState = world.getBlockState(pos);
int power = -1;
for (final EnumFacing side : EnumFacing.VALUES) {
power = Math.max(power, blockState.getStrongPower(world, pos, side));
if (power >= 15) {
break;
}
}
return String.valueOf(power);
}
}
return "-1";
}
}
public static class PowerInput extends TagMouseOver {
@Override
public String getValue() {
final RayTraceResult objectMouseOver = minecraft.objectMouseOver;
if (objectMouseOver != null) {
if (objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) {
return String.valueOf(world.isBlockIndirectlyGettingPowered(objectMouseOver.getBlockPos()));
}
}
return "-1";
}
}
public static void register() {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/TagMouseOver.java
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityList;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
final IBlockState blockState = world.getBlockState(pos);
int power = -1;
for (final EnumFacing side : EnumFacing.VALUES) {
power = Math.max(power, blockState.getStrongPower(world, pos, side));
if (power >= 15) {
break;
}
}
return String.valueOf(power);
}
}
return "-1";
}
}
public static class PowerInput extends TagMouseOver {
@Override
public String getValue() {
final RayTraceResult objectMouseOver = minecraft.objectMouseOver;
if (objectMouseOver != null) {
if (objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) {
return String.valueOf(world.isBlockIndirectlyGettingPowered(objectMouseOver.getBlockPos()));
}
}
return "-1";
}
}
public static void register() {
|
TagRegistry.INSTANCE.register(new Name().setName("mouseovername"));
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/tag/TagPlayerPosition.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
|
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.util.math.MathHelper;
import java.util.Locale;
|
public static class AbbreviatedFineDirection extends TagPlayerPosition {
@Override
public String getValue() {
return ABRFINEDIRECTION[MathHelper.floor(player.rotationYaw * 8.0 / 360.0 + 0.5) & 7];
}
}
public static class AxisDirection extends TagPlayerPosition {
@Override
public String getValue() {
return AXISDIRECTION[MathHelper.floor(player.rotationYaw * 4.0 / 360.0 + 0.5) & 3];
}
}
public static class DirectionHud extends TagPlayerPosition {
@Override
public String getValue() {
final int direction = MathHelper.floor(player.rotationYaw * 16.0f / 360.0f + 0.5) & 15;
final String left = ABRFINEDIRECTION[(direction / 2 + ABRFINEDIRECTION.length - 1) % ABRFINEDIRECTION.length];
final String center = ABRFINEDIRECTION[(direction / 2 + ABRFINEDIRECTION.length) % ABRFINEDIRECTION.length];
final String right = ABRFINEDIRECTION[(direction / 2 + ABRFINEDIRECTION.length + 1) % ABRFINEDIRECTION.length];
if (direction % 2 == 0) {
return String.format("\u00a7r%s \u00a7c%s\u00a7r %s", left, center, right);
}
return String.format("\u00a7r %2s %2s ", center, right);
}
}
public static void register() {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/TagPlayerPosition.java
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.util.math.MathHelper;
import java.util.Locale;
public static class AbbreviatedFineDirection extends TagPlayerPosition {
@Override
public String getValue() {
return ABRFINEDIRECTION[MathHelper.floor(player.rotationYaw * 8.0 / 360.0 + 0.5) & 7];
}
}
public static class AxisDirection extends TagPlayerPosition {
@Override
public String getValue() {
return AXISDIRECTION[MathHelper.floor(player.rotationYaw * 4.0 / 360.0 + 0.5) & 3];
}
}
public static class DirectionHud extends TagPlayerPosition {
@Override
public String getValue() {
final int direction = MathHelper.floor(player.rotationYaw * 16.0f / 360.0f + 0.5) & 15;
final String left = ABRFINEDIRECTION[(direction / 2 + ABRFINEDIRECTION.length - 1) % ABRFINEDIRECTION.length];
final String center = ABRFINEDIRECTION[(direction / 2 + ABRFINEDIRECTION.length) % ABRFINEDIRECTION.length];
final String right = ABRFINEDIRECTION[(direction / 2 + ABRFINEDIRECTION.length + 1) % ABRFINEDIRECTION.length];
if (direction % 2 == 0) {
return String.format("\u00a7r%s \u00a7c%s\u00a7r %s", left, center, right);
}
return String.format("\u00a7r %2s %2s ", center, right);
}
}
public static void register() {
|
TagRegistry.INSTANCE.register(new ChunkX().setName("chunkx"));
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/tag/TagRiding.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
|
import com.github.lunatrius.ingameinfo.reference.Reference;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.passive.AbstractHorse;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
|
@Override
public String getValue() {
final Entity ridingEntity = player.getRidingEntity();
if (ridingEntity instanceof AbstractHorse) {
return String.format(Locale.ENGLISH, "%.3f", TICKS * CONSTANT * ((AbstractHorse) ridingEntity).getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue());
}
return "-1";
}
}
public static class HorseJump extends TagRiding {
private final Map<Double, Double> jumpHeightCache = new HashMap<Double, Double>();
private double getJumpHeight(final AbstractHorse horse) {
final double jumpStrength = horse.getHorseJumpStrength();
final Double height = this.jumpHeightCache.get(jumpStrength);
if (height != null) {
return height;
}
double jumpHeight = 0;
double velocity = jumpStrength;
while (velocity > 0) {
jumpHeight += velocity;
velocity -= 0.08;
velocity *= 0.98;
}
if (this.jumpHeightCache.size() > 16) {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/TagRiding.java
import com.github.lunatrius.ingameinfo.reference.Reference;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.passive.AbstractHorse;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
@Override
public String getValue() {
final Entity ridingEntity = player.getRidingEntity();
if (ridingEntity instanceof AbstractHorse) {
return String.format(Locale.ENGLISH, "%.3f", TICKS * CONSTANT * ((AbstractHorse) ridingEntity).getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue());
}
return "-1";
}
}
public static class HorseJump extends TagRiding {
private final Map<Double, Double> jumpHeightCache = new HashMap<Double, Double>();
private double getJumpHeight(final AbstractHorse horse) {
final double jumpStrength = horse.getHorseJumpStrength();
final Double height = this.jumpHeightCache.get(jumpStrength);
if (height != null) {
return height;
}
double jumpHeight = 0;
double velocity = jumpStrength;
while (velocity > 0) {
jumpHeight += velocity;
velocity -= 0.08;
velocity *= 0.98;
}
if (this.jumpHeightCache.size() > 16) {
|
Reference.logger.trace("Clearing horse jump height cache.");
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/tag/TagRiding.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
|
import com.github.lunatrius.ingameinfo.reference.Reference;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.passive.AbstractHorse;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
|
}
double jumpHeight = 0;
double velocity = jumpStrength;
while (velocity > 0) {
jumpHeight += velocity;
velocity -= 0.08;
velocity *= 0.98;
}
if (this.jumpHeightCache.size() > 16) {
Reference.logger.trace("Clearing horse jump height cache.");
this.jumpHeightCache.clear();
}
this.jumpHeightCache.put(jumpStrength, jumpHeight);
return jumpHeight;
}
@Override
public String getValue() {
final Entity ridingEntity = player.getRidingEntity();
if (ridingEntity instanceof AbstractHorse) {
return String.format(Locale.ENGLISH, "%.3f", getJumpHeight((AbstractHorse) ridingEntity));
}
return "-1";
}
}
public static void register() {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/TagRiding.java
import com.github.lunatrius.ingameinfo.reference.Reference;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.passive.AbstractHorse;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
}
double jumpHeight = 0;
double velocity = jumpStrength;
while (velocity > 0) {
jumpHeight += velocity;
velocity -= 0.08;
velocity *= 0.98;
}
if (this.jumpHeightCache.size() > 16) {
Reference.logger.trace("Clearing horse jump height cache.");
this.jumpHeightCache.clear();
}
this.jumpHeightCache.put(jumpStrength, jumpHeight);
return jumpHeight;
}
@Override
public String getValue() {
final Entity ridingEntity = player.getRidingEntity();
if (ridingEntity instanceof AbstractHorse) {
return String.format(Locale.ENGLISH, "%.3f", getJumpHeight((AbstractHorse) ridingEntity));
}
return "-1";
}
}
public static void register() {
|
TagRegistry.INSTANCE.register(new IsHorse().setName("ridinghorse"));
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/tag/TagPlayerEquipment.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/client/gui/overlay/InfoItem.java
// public class InfoItem extends Info {
// private static final Minecraft MINECRAFT = Minecraft.getMinecraft();
// private final ItemStack itemStack;
// private final boolean large;
// private final int size;
//
// public InfoItem(final ItemStack itemStack) {
// this(itemStack, false);
// }
//
// public InfoItem(final ItemStack itemStack, final boolean large) {
// this(itemStack, large, 0, 0);
// }
//
// public InfoItem(final ItemStack itemStack, final boolean large, final int x, final int y) {
// super(x, y);
// this.itemStack = itemStack;
// this.large = large;
// this.size = large ? 16 : 8;
// if (large) {
// this.y = -4;
// }
// }
//
// @Override
// public void drawInfo() {
// if (!this.itemStack.isEmpty()) {
// GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
// GlStateManager.enableRescaleNormal();
// RenderHelper.enableGUIStandardItemLighting();
//
// GlStateManager.translate(getX(), getY(), 0);
// if (!this.large) {
// GlStateManager.scale(0.5f, 0.5f, 0.5f);
// }
//
// final RenderItem renderItem = MINECRAFT.getRenderItem();
// final float zLevel = renderItem.zLevel;
// renderItem.zLevel = 300;
// renderItem.renderItemAndEffectIntoGUI(this.itemStack, 0, 0);
//
// if (ConfigurationHandler.showOverlayItemIcons) {
// renderItem.renderItemOverlayIntoGUI(MINECRAFT.fontRenderer, this.itemStack, 0, 0, "");
// }
//
// renderItem.zLevel = zLevel;
//
// if (!this.large) {
// GlStateManager.scale(2.0f, 2.0f, 2.0f);
// }
// GlStateManager.translate(-getX(), -getY(), 0);
//
// RenderHelper.disableStandardItemLighting();
// GlStateManager.disableRescaleNormal();
// GlStateManager.disableBlend();
// }
// }
//
// @Override
// public int getWidth() {
// return !this.itemStack.isEmpty() ? this.size : 0;
// }
//
// @Override
// public int getHeight() {
// return !this.itemStack.isEmpty() ? this.size : 0;
// }
//
// @Override
// public String toString() {
// return String.format("InfoItem{itemStack: %s, x: %d, y: %d, offsetX: %d, offsetY: %d, children: %s}", this.itemStack, this.x, this.y, this.offsetX, this.offsetY, this.children);
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
|
import com.github.lunatrius.core.entity.EntityHelper;
import com.github.lunatrius.ingameinfo.client.gui.overlay.InfoItem;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBow;
import net.minecraft.item.ItemStack;
|
}
}
public static class Quantity extends TagPlayerEquipment {
public Quantity(final int slot) {
super(slot);
}
@Override
public String getValue() {
final ItemStack itemStack = getItemStack(this.slot);
if (itemStack.isEmpty()) {
return String.valueOf(0);
}
return String.valueOf(EntityHelper.getItemCountInInventory(player.inventory, itemStack.getItem(), itemStack.getItemDamage()));
}
}
public static class Icon extends TagPlayerEquipment {
private final boolean large;
public Icon(final int slot, final boolean large) {
super(slot);
this.large = large;
}
@Override
public String getValue() {
final ItemStack itemStack = getItemStack(this.slot);
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/client/gui/overlay/InfoItem.java
// public class InfoItem extends Info {
// private static final Minecraft MINECRAFT = Minecraft.getMinecraft();
// private final ItemStack itemStack;
// private final boolean large;
// private final int size;
//
// public InfoItem(final ItemStack itemStack) {
// this(itemStack, false);
// }
//
// public InfoItem(final ItemStack itemStack, final boolean large) {
// this(itemStack, large, 0, 0);
// }
//
// public InfoItem(final ItemStack itemStack, final boolean large, final int x, final int y) {
// super(x, y);
// this.itemStack = itemStack;
// this.large = large;
// this.size = large ? 16 : 8;
// if (large) {
// this.y = -4;
// }
// }
//
// @Override
// public void drawInfo() {
// if (!this.itemStack.isEmpty()) {
// GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
// GlStateManager.enableRescaleNormal();
// RenderHelper.enableGUIStandardItemLighting();
//
// GlStateManager.translate(getX(), getY(), 0);
// if (!this.large) {
// GlStateManager.scale(0.5f, 0.5f, 0.5f);
// }
//
// final RenderItem renderItem = MINECRAFT.getRenderItem();
// final float zLevel = renderItem.zLevel;
// renderItem.zLevel = 300;
// renderItem.renderItemAndEffectIntoGUI(this.itemStack, 0, 0);
//
// if (ConfigurationHandler.showOverlayItemIcons) {
// renderItem.renderItemOverlayIntoGUI(MINECRAFT.fontRenderer, this.itemStack, 0, 0, "");
// }
//
// renderItem.zLevel = zLevel;
//
// if (!this.large) {
// GlStateManager.scale(2.0f, 2.0f, 2.0f);
// }
// GlStateManager.translate(-getX(), -getY(), 0);
//
// RenderHelper.disableStandardItemLighting();
// GlStateManager.disableRescaleNormal();
// GlStateManager.disableBlend();
// }
// }
//
// @Override
// public int getWidth() {
// return !this.itemStack.isEmpty() ? this.size : 0;
// }
//
// @Override
// public int getHeight() {
// return !this.itemStack.isEmpty() ? this.size : 0;
// }
//
// @Override
// public String toString() {
// return String.format("InfoItem{itemStack: %s, x: %d, y: %d, offsetX: %d, offsetY: %d, children: %s}", this.itemStack, this.x, this.y, this.offsetX, this.offsetY, this.children);
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/TagPlayerEquipment.java
import com.github.lunatrius.core.entity.EntityHelper;
import com.github.lunatrius.ingameinfo.client.gui.overlay.InfoItem;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBow;
import net.minecraft.item.ItemStack;
}
}
public static class Quantity extends TagPlayerEquipment {
public Quantity(final int slot) {
super(slot);
}
@Override
public String getValue() {
final ItemStack itemStack = getItemStack(this.slot);
if (itemStack.isEmpty()) {
return String.valueOf(0);
}
return String.valueOf(EntityHelper.getItemCountInInventory(player.inventory, itemStack.getItem(), itemStack.getItemDamage()));
}
}
public static class Icon extends TagPlayerEquipment {
private final boolean large;
public Icon(final int slot, final boolean large) {
super(slot);
this.large = large;
}
@Override
public String getValue() {
final ItemStack itemStack = getItemStack(this.slot);
|
final InfoItem item = new InfoItem(itemStack, this.large);
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/tag/TagPlayerEquipment.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/client/gui/overlay/InfoItem.java
// public class InfoItem extends Info {
// private static final Minecraft MINECRAFT = Minecraft.getMinecraft();
// private final ItemStack itemStack;
// private final boolean large;
// private final int size;
//
// public InfoItem(final ItemStack itemStack) {
// this(itemStack, false);
// }
//
// public InfoItem(final ItemStack itemStack, final boolean large) {
// this(itemStack, large, 0, 0);
// }
//
// public InfoItem(final ItemStack itemStack, final boolean large, final int x, final int y) {
// super(x, y);
// this.itemStack = itemStack;
// this.large = large;
// this.size = large ? 16 : 8;
// if (large) {
// this.y = -4;
// }
// }
//
// @Override
// public void drawInfo() {
// if (!this.itemStack.isEmpty()) {
// GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
// GlStateManager.enableRescaleNormal();
// RenderHelper.enableGUIStandardItemLighting();
//
// GlStateManager.translate(getX(), getY(), 0);
// if (!this.large) {
// GlStateManager.scale(0.5f, 0.5f, 0.5f);
// }
//
// final RenderItem renderItem = MINECRAFT.getRenderItem();
// final float zLevel = renderItem.zLevel;
// renderItem.zLevel = 300;
// renderItem.renderItemAndEffectIntoGUI(this.itemStack, 0, 0);
//
// if (ConfigurationHandler.showOverlayItemIcons) {
// renderItem.renderItemOverlayIntoGUI(MINECRAFT.fontRenderer, this.itemStack, 0, 0, "");
// }
//
// renderItem.zLevel = zLevel;
//
// if (!this.large) {
// GlStateManager.scale(2.0f, 2.0f, 2.0f);
// }
// GlStateManager.translate(-getX(), -getY(), 0);
//
// RenderHelper.disableStandardItemLighting();
// GlStateManager.disableRescaleNormal();
// GlStateManager.disableBlend();
// }
// }
//
// @Override
// public int getWidth() {
// return !this.itemStack.isEmpty() ? this.size : 0;
// }
//
// @Override
// public int getHeight() {
// return !this.itemStack.isEmpty() ? this.size : 0;
// }
//
// @Override
// public String toString() {
// return String.format("InfoItem{itemStack: %s, x: %d, y: %d, offsetX: %d, offsetY: %d, children: %s}", this.itemStack, this.x, this.y, this.offsetX, this.offsetY, this.children);
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
|
import com.github.lunatrius.core.entity.EntityHelper;
import com.github.lunatrius.ingameinfo.client.gui.overlay.InfoItem;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBow;
import net.minecraft.item.ItemStack;
|
@Override
public String getValue() {
final ItemStack itemStack = getItemStack(this.slot);
if (itemStack.isEmpty()) {
return String.valueOf(0);
}
return String.valueOf(EntityHelper.getItemCountInInventory(player.inventory, itemStack.getItem(), itemStack.getItemDamage()));
}
}
public static class Icon extends TagPlayerEquipment {
private final boolean large;
public Icon(final int slot, final boolean large) {
super(slot);
this.large = large;
}
@Override
public String getValue() {
final ItemStack itemStack = getItemStack(this.slot);
final InfoItem item = new InfoItem(itemStack, this.large);
info.add(item);
return getIconTag(item);
}
}
public static void register() {
for (int i = 0; i < TYPES.length; i++) {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/client/gui/overlay/InfoItem.java
// public class InfoItem extends Info {
// private static final Minecraft MINECRAFT = Minecraft.getMinecraft();
// private final ItemStack itemStack;
// private final boolean large;
// private final int size;
//
// public InfoItem(final ItemStack itemStack) {
// this(itemStack, false);
// }
//
// public InfoItem(final ItemStack itemStack, final boolean large) {
// this(itemStack, large, 0, 0);
// }
//
// public InfoItem(final ItemStack itemStack, final boolean large, final int x, final int y) {
// super(x, y);
// this.itemStack = itemStack;
// this.large = large;
// this.size = large ? 16 : 8;
// if (large) {
// this.y = -4;
// }
// }
//
// @Override
// public void drawInfo() {
// if (!this.itemStack.isEmpty()) {
// GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
// GlStateManager.enableRescaleNormal();
// RenderHelper.enableGUIStandardItemLighting();
//
// GlStateManager.translate(getX(), getY(), 0);
// if (!this.large) {
// GlStateManager.scale(0.5f, 0.5f, 0.5f);
// }
//
// final RenderItem renderItem = MINECRAFT.getRenderItem();
// final float zLevel = renderItem.zLevel;
// renderItem.zLevel = 300;
// renderItem.renderItemAndEffectIntoGUI(this.itemStack, 0, 0);
//
// if (ConfigurationHandler.showOverlayItemIcons) {
// renderItem.renderItemOverlayIntoGUI(MINECRAFT.fontRenderer, this.itemStack, 0, 0, "");
// }
//
// renderItem.zLevel = zLevel;
//
// if (!this.large) {
// GlStateManager.scale(2.0f, 2.0f, 2.0f);
// }
// GlStateManager.translate(-getX(), -getY(), 0);
//
// RenderHelper.disableStandardItemLighting();
// GlStateManager.disableRescaleNormal();
// GlStateManager.disableBlend();
// }
// }
//
// @Override
// public int getWidth() {
// return !this.itemStack.isEmpty() ? this.size : 0;
// }
//
// @Override
// public int getHeight() {
// return !this.itemStack.isEmpty() ? this.size : 0;
// }
//
// @Override
// public String toString() {
// return String.format("InfoItem{itemStack: %s, x: %d, y: %d, offsetX: %d, offsetY: %d, children: %s}", this.itemStack, this.x, this.y, this.offsetX, this.offsetY, this.children);
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/TagPlayerEquipment.java
import com.github.lunatrius.core.entity.EntityHelper;
import com.github.lunatrius.ingameinfo.client.gui.overlay.InfoItem;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBow;
import net.minecraft.item.ItemStack;
@Override
public String getValue() {
final ItemStack itemStack = getItemStack(this.slot);
if (itemStack.isEmpty()) {
return String.valueOf(0);
}
return String.valueOf(EntityHelper.getItemCountInInventory(player.inventory, itemStack.getItem(), itemStack.getItemDamage()));
}
}
public static class Icon extends TagPlayerEquipment {
private final boolean large;
public Icon(final int slot, final boolean large) {
super(slot);
this.large = large;
}
@Override
public String getValue() {
final ItemStack itemStack = getItemStack(this.slot);
final InfoItem item = new InfoItem(itemStack, this.large);
info.add(item);
return getIconTag(item);
}
}
public static void register() {
for (int i = 0; i < TYPES.length; i++) {
|
TagRegistry.INSTANCE.register(new Name(SLOTS[i]).setName(TYPES[i] + "name"));
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/client/gui/overlay/InfoIcon.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
|
import com.github.lunatrius.core.client.gui.GuiHelper;
import com.github.lunatrius.core.util.vector.Vector2f;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
|
public void setDisplayDimensions(final int displayX, final int displayY, final int displayWidth, final int displayHeight) {
this.displayWidth = displayWidth;
this.displayHeight = displayHeight;
this.xy0.set(displayX, displayY);
this.xy1.set(displayX + displayWidth, displayY + displayHeight);
}
public void setTextureData(final int iconX, final int iconY, final int iconWidth, final int iconHeight, final int textureWidth, final int textureHeight) {
this.uv0.set((float) iconX / textureWidth, (float) iconY / textureHeight);
this.uv1.set((float) (iconX + iconWidth) / textureWidth, (float) (iconY + iconHeight) / textureHeight);
}
@Override
public void drawInfo() {
try {
textureManager.bindTexture(this.resourceLocation);
GlStateManager.translate(getX(), getY(), 0);
final Tessellator tessellator = Tessellator.getInstance();
final BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
GuiHelper.drawTexturedRectangle(buffer, this.xy0.x, this.xy0.y, this.xy1.x, this.xy1.y, this.zLevel, this.uv0.x, this.uv0.y, this.uv1.x, this.uv1.y);
tessellator.draw();
GlStateManager.translate(-getX(), -getY(), 0);
} catch (final Exception e) {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/client/gui/overlay/InfoIcon.java
import com.github.lunatrius.core.client.gui.GuiHelper;
import com.github.lunatrius.core.util.vector.Vector2f;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public void setDisplayDimensions(final int displayX, final int displayY, final int displayWidth, final int displayHeight) {
this.displayWidth = displayWidth;
this.displayHeight = displayHeight;
this.xy0.set(displayX, displayY);
this.xy1.set(displayX + displayWidth, displayY + displayHeight);
}
public void setTextureData(final int iconX, final int iconY, final int iconWidth, final int iconHeight, final int textureWidth, final int textureHeight) {
this.uv0.set((float) iconX / textureWidth, (float) iconY / textureHeight);
this.uv1.set((float) (iconX + iconWidth) / textureWidth, (float) (iconY + iconHeight) / textureHeight);
}
@Override
public void drawInfo() {
try {
textureManager.bindTexture(this.resourceLocation);
GlStateManager.translate(getX(), getY(), 0);
final Tessellator tessellator = Tessellator.getInstance();
final BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
GuiHelper.drawTexturedRectangle(buffer, this.xy0.x, this.xy0.y, this.xy1.x, this.xy1.y, this.zLevel, this.uv0.x, this.uv0.y, this.uv1.x, this.uv1.y);
tessellator.draw();
GlStateManager.translate(-getX(), -getY(), 0);
} catch (final Exception e) {
|
Reference.logger.debug(e);
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/value/ValueSimple.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/value/registry/ValueRegistry.java
// public class ValueRegistry {
// public static final ValueRegistry INSTANCE = new ValueRegistry();
//
// private Map<String, Value> stringValueMap = new HashMap<String, Value>();
// private Map<String, Class<? extends Value>> stringClassMap = new HashMap<String, Class<? extends Value>>();
// private Map<Class<? extends Value>, String> classStringMap = new HashMap<Class<? extends Value>, String>();
//
// private void register(final String name, final Value value, final boolean isAlias) {
// if (this.stringValueMap.containsKey(name)) {
// Reference.logger.error("Duplicate value key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Value name cannot be null!");
// return;
// }
//
// final String nameLowerCase = name.toLowerCase(Locale.ENGLISH);
// this.stringValueMap.put(nameLowerCase, value);
// this.stringClassMap.put(nameLowerCase, value.getClass());
// if (!isAlias) {
// this.classStringMap.put(value.getClass(), nameLowerCase);
// }
// }
//
// public void register(final Value value) {
// register(value.getName(), value, false);
//
// for (final String name : value.getAliases()) {
// register(name, value, true);
// }
// }
//
// public Value forName(String name) {
// name = name.toLowerCase(Locale.ENGLISH);
// try {
// final Class<? extends Value> clazz = this.stringClassMap.get(name);
// if (clazz != null) {
// final Value value = clazz.newInstance();
// if (value != null) {
// return value;
// }
// }
// } catch (final Exception e) {
// Reference.logger.error(String.format("Failed to create an instance for %s!", name), e);
// return new ValueSimple.ValueInvalid();
// }
//
// Reference.logger.error(String.format("Failed to create an instance for %s!", name));
// return new ValueSimple.ValueInvalid();
// }
//
// public String forClass(final Class<? extends Value> clazz) {
// final String str = this.classStringMap.get(clazz);
// return str != null ? str : "invalid";
// }
//
// public void init() {
// ValueComplex.register();
// ValueLogic.register();
// ValueMath.register();
// ValueSimple.register();
// }
// }
|
import com.github.lunatrius.ingameinfo.value.registry.ValueRegistry;
|
package com.github.lunatrius.ingameinfo.value;
public abstract class ValueSimple extends Value {
@Override
public Value setRawValue(final String value, final boolean isText) {
this.value = value.replaceAll("\\$(?=[0-9a-fk-or])", "\u00a7");
if (isText) {
this.value = this.value.replaceAll("\\\\([<>\\[/\\]\\\\])", "$1");
}
return this;
}
@Override
public String getRawValue(final boolean isText) {
String str = this.value.replace("\u00a7", "$");
if (isText) {
str = str.replaceAll("([<>\\[/\\]\\\\])", "\\\\$1");
}
return str;
}
@Override
public boolean isSimple() {
return true;
}
@Override
public boolean isValidSize() {
return this.values.size() == 0;
}
public static class ValueString extends ValueSimple {
@Override
public String getType() {
if (this.value.matches("^-?\\d+(\\.\\d+)?$")) {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/value/registry/ValueRegistry.java
// public class ValueRegistry {
// public static final ValueRegistry INSTANCE = new ValueRegistry();
//
// private Map<String, Value> stringValueMap = new HashMap<String, Value>();
// private Map<String, Class<? extends Value>> stringClassMap = new HashMap<String, Class<? extends Value>>();
// private Map<Class<? extends Value>, String> classStringMap = new HashMap<Class<? extends Value>, String>();
//
// private void register(final String name, final Value value, final boolean isAlias) {
// if (this.stringValueMap.containsKey(name)) {
// Reference.logger.error("Duplicate value key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Value name cannot be null!");
// return;
// }
//
// final String nameLowerCase = name.toLowerCase(Locale.ENGLISH);
// this.stringValueMap.put(nameLowerCase, value);
// this.stringClassMap.put(nameLowerCase, value.getClass());
// if (!isAlias) {
// this.classStringMap.put(value.getClass(), nameLowerCase);
// }
// }
//
// public void register(final Value value) {
// register(value.getName(), value, false);
//
// for (final String name : value.getAliases()) {
// register(name, value, true);
// }
// }
//
// public Value forName(String name) {
// name = name.toLowerCase(Locale.ENGLISH);
// try {
// final Class<? extends Value> clazz = this.stringClassMap.get(name);
// if (clazz != null) {
// final Value value = clazz.newInstance();
// if (value != null) {
// return value;
// }
// }
// } catch (final Exception e) {
// Reference.logger.error(String.format("Failed to create an instance for %s!", name), e);
// return new ValueSimple.ValueInvalid();
// }
//
// Reference.logger.error(String.format("Failed to create an instance for %s!", name));
// return new ValueSimple.ValueInvalid();
// }
//
// public String forClass(final Class<? extends Value> clazz) {
// final String str = this.classStringMap.get(clazz);
// return str != null ? str : "invalid";
// }
//
// public void init() {
// ValueComplex.register();
// ValueLogic.register();
// ValueMath.register();
// ValueSimple.register();
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/value/ValueSimple.java
import com.github.lunatrius.ingameinfo.value.registry.ValueRegistry;
package com.github.lunatrius.ingameinfo.value;
public abstract class ValueSimple extends Value {
@Override
public Value setRawValue(final String value, final boolean isText) {
this.value = value.replaceAll("\\$(?=[0-9a-fk-or])", "\u00a7");
if (isText) {
this.value = this.value.replaceAll("\\\\([<>\\[/\\]\\\\])", "$1");
}
return this;
}
@Override
public String getRawValue(final boolean isText) {
String str = this.value.replace("\u00a7", "$");
if (isText) {
str = str.replaceAll("([<>\\[/\\]\\\\])", "\\\\$1");
}
return str;
}
@Override
public boolean isSimple() {
return true;
}
@Override
public boolean isValidSize() {
return this.values.size() == 0;
}
public static class ValueString extends ValueSimple {
@Override
public String getType() {
if (this.value.matches("^-?\\d+(\\.\\d+)?$")) {
|
return ValueRegistry.INSTANCE.forClass(ValueNumber.class);
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/parser/text/Tokenizer.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/parser/text/Token.java
// public static enum TokenType {
// EOF("$"),
// FUNC_HEAD("<"),
// FUNC_TAIL(">"),
// ARGS_HEAD("\\["),
// ARGS_SEPARATOR("/"),
// ARGS_TAIL("\\]"),
// NEWLINE("\\n+"),
// STRING("(\\\\[<>\\[/\\]\\\\]|[^<>\\[/\\]\\n])+");
//
// public final static EnumSet<TokenType> EXCEPTIONS = EnumSet.of(FUNC_TAIL, ARGS_HEAD, ARGS_SEPARATOR, ARGS_TAIL);
// private final Pattern pattern;
//
// private TokenType(final String regex) {
// this.pattern = Pattern.compile("^" + regex);
// }
//
// public Pattern getPattern() {
// return this.pattern;
// }
// }
|
import java.util.LinkedList;
import java.util.Locale;
import java.util.Queue;
import java.util.regex.Matcher;
import static com.github.lunatrius.ingameinfo.parser.text.Token.TokenType;
|
package com.github.lunatrius.ingameinfo.parser.text;
public class Tokenizer {
private final Queue<Token> tokens;
public Tokenizer() {
this.tokens = new LinkedList<Token>();
}
public void tokenize(String str) throws Exception {
Location start = new Location(0, 0);
final Location end = new Location(0, 0);
boolean match;
this.tokens.clear();
str = str.trim();
while (str.length() > 0) {
match = false;
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/parser/text/Token.java
// public static enum TokenType {
// EOF("$"),
// FUNC_HEAD("<"),
// FUNC_TAIL(">"),
// ARGS_HEAD("\\["),
// ARGS_SEPARATOR("/"),
// ARGS_TAIL("\\]"),
// NEWLINE("\\n+"),
// STRING("(\\\\[<>\\[/\\]\\\\]|[^<>\\[/\\]\\n])+");
//
// public final static EnumSet<TokenType> EXCEPTIONS = EnumSet.of(FUNC_TAIL, ARGS_HEAD, ARGS_SEPARATOR, ARGS_TAIL);
// private final Pattern pattern;
//
// private TokenType(final String regex) {
// this.pattern = Pattern.compile("^" + regex);
// }
//
// public Pattern getPattern() {
// return this.pattern;
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/parser/text/Tokenizer.java
import java.util.LinkedList;
import java.util.Locale;
import java.util.Queue;
import java.util.regex.Matcher;
import static com.github.lunatrius.ingameinfo.parser.text.Token.TokenType;
package com.github.lunatrius.ingameinfo.parser.text;
public class Tokenizer {
private final Queue<Token> tokens;
public Tokenizer() {
this.tokens = new LinkedList<Token>();
}
public void tokenize(String str) throws Exception {
Location start = new Location(0, 0);
final Location end = new Location(0, 0);
boolean match;
this.tokens.clear();
str = str.trim();
while (str.length() > 0) {
match = false;
|
for (final TokenType tokenType : TokenType.values()) {
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/handler/PlayerHandler.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/PacketHandler.java
// public class PacketHandler {
// public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
//
// public static void init() {
// INSTANCE.registerMessage(MessageSeed.class, MessageSeed.class, 0, Side.CLIENT);
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/message/MessageSeed.java
// public class MessageSeed implements IMessage, IMessageHandler<MessageSeed, IMessage> {
// public long seed;
//
// public MessageSeed() {
// this.seed = 0;
// }
//
// public MessageSeed(final long seed) {
// this.seed = seed;
// }
//
// @Override
// public void fromBytes(final ByteBuf buf) {
// this.seed = buf.readLong();
// }
//
// @Override
// public void toBytes(final ByteBuf buf) {
// buf.writeLong(this.seed);
// }
//
// @Override
// public IMessage onMessage(final MessageSeed message, final MessageContext ctx) {
// if (ctx.side == Side.CLIENT) {
// Tag.setSeed(message.seed);
// }
//
// return null;
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
|
import com.github.lunatrius.ingameinfo.network.PacketHandler;
import com.github.lunatrius.ingameinfo.network.message.MessageSeed;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
package com.github.lunatrius.ingameinfo.handler;
public class PlayerHandler {
@SubscribeEvent
public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) {
if (event.player instanceof EntityPlayerMP) {
try {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/PacketHandler.java
// public class PacketHandler {
// public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
//
// public static void init() {
// INSTANCE.registerMessage(MessageSeed.class, MessageSeed.class, 0, Side.CLIENT);
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/message/MessageSeed.java
// public class MessageSeed implements IMessage, IMessageHandler<MessageSeed, IMessage> {
// public long seed;
//
// public MessageSeed() {
// this.seed = 0;
// }
//
// public MessageSeed(final long seed) {
// this.seed = seed;
// }
//
// @Override
// public void fromBytes(final ByteBuf buf) {
// this.seed = buf.readLong();
// }
//
// @Override
// public void toBytes(final ByteBuf buf) {
// buf.writeLong(this.seed);
// }
//
// @Override
// public IMessage onMessage(final MessageSeed message, final MessageContext ctx) {
// if (ctx.side == Side.CLIENT) {
// Tag.setSeed(message.seed);
// }
//
// return null;
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/handler/PlayerHandler.java
import com.github.lunatrius.ingameinfo.network.PacketHandler;
import com.github.lunatrius.ingameinfo.network.message.MessageSeed;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
package com.github.lunatrius.ingameinfo.handler;
public class PlayerHandler {
@SubscribeEvent
public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) {
if (event.player instanceof EntityPlayerMP) {
try {
|
PacketHandler.INSTANCE.sendTo(new MessageSeed(event.player.world.getSeed()), (EntityPlayerMP) event.player);
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/handler/PlayerHandler.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/PacketHandler.java
// public class PacketHandler {
// public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
//
// public static void init() {
// INSTANCE.registerMessage(MessageSeed.class, MessageSeed.class, 0, Side.CLIENT);
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/message/MessageSeed.java
// public class MessageSeed implements IMessage, IMessageHandler<MessageSeed, IMessage> {
// public long seed;
//
// public MessageSeed() {
// this.seed = 0;
// }
//
// public MessageSeed(final long seed) {
// this.seed = seed;
// }
//
// @Override
// public void fromBytes(final ByteBuf buf) {
// this.seed = buf.readLong();
// }
//
// @Override
// public void toBytes(final ByteBuf buf) {
// buf.writeLong(this.seed);
// }
//
// @Override
// public IMessage onMessage(final MessageSeed message, final MessageContext ctx) {
// if (ctx.side == Side.CLIENT) {
// Tag.setSeed(message.seed);
// }
//
// return null;
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
|
import com.github.lunatrius.ingameinfo.network.PacketHandler;
import com.github.lunatrius.ingameinfo.network.message.MessageSeed;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
package com.github.lunatrius.ingameinfo.handler;
public class PlayerHandler {
@SubscribeEvent
public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) {
if (event.player instanceof EntityPlayerMP) {
try {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/PacketHandler.java
// public class PacketHandler {
// public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
//
// public static void init() {
// INSTANCE.registerMessage(MessageSeed.class, MessageSeed.class, 0, Side.CLIENT);
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/message/MessageSeed.java
// public class MessageSeed implements IMessage, IMessageHandler<MessageSeed, IMessage> {
// public long seed;
//
// public MessageSeed() {
// this.seed = 0;
// }
//
// public MessageSeed(final long seed) {
// this.seed = seed;
// }
//
// @Override
// public void fromBytes(final ByteBuf buf) {
// this.seed = buf.readLong();
// }
//
// @Override
// public void toBytes(final ByteBuf buf) {
// buf.writeLong(this.seed);
// }
//
// @Override
// public IMessage onMessage(final MessageSeed message, final MessageContext ctx) {
// if (ctx.side == Side.CLIENT) {
// Tag.setSeed(message.seed);
// }
//
// return null;
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/handler/PlayerHandler.java
import com.github.lunatrius.ingameinfo.network.PacketHandler;
import com.github.lunatrius.ingameinfo.network.message.MessageSeed;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
package com.github.lunatrius.ingameinfo.handler;
public class PlayerHandler {
@SubscribeEvent
public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) {
if (event.player instanceof EntityPlayerMP) {
try {
|
PacketHandler.INSTANCE.sendTo(new MessageSeed(event.player.world.getSeed()), (EntityPlayerMP) event.player);
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/handler/PlayerHandler.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/PacketHandler.java
// public class PacketHandler {
// public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
//
// public static void init() {
// INSTANCE.registerMessage(MessageSeed.class, MessageSeed.class, 0, Side.CLIENT);
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/message/MessageSeed.java
// public class MessageSeed implements IMessage, IMessageHandler<MessageSeed, IMessage> {
// public long seed;
//
// public MessageSeed() {
// this.seed = 0;
// }
//
// public MessageSeed(final long seed) {
// this.seed = seed;
// }
//
// @Override
// public void fromBytes(final ByteBuf buf) {
// this.seed = buf.readLong();
// }
//
// @Override
// public void toBytes(final ByteBuf buf) {
// buf.writeLong(this.seed);
// }
//
// @Override
// public IMessage onMessage(final MessageSeed message, final MessageContext ctx) {
// if (ctx.side == Side.CLIENT) {
// Tag.setSeed(message.seed);
// }
//
// return null;
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
|
import com.github.lunatrius.ingameinfo.network.PacketHandler;
import com.github.lunatrius.ingameinfo.network.message.MessageSeed;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
package com.github.lunatrius.ingameinfo.handler;
public class PlayerHandler {
@SubscribeEvent
public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) {
if (event.player instanceof EntityPlayerMP) {
try {
PacketHandler.INSTANCE.sendTo(new MessageSeed(event.player.world.getSeed()), (EntityPlayerMP) event.player);
} catch (final Exception ex) {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/PacketHandler.java
// public class PacketHandler {
// public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
//
// public static void init() {
// INSTANCE.registerMessage(MessageSeed.class, MessageSeed.class, 0, Side.CLIENT);
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/message/MessageSeed.java
// public class MessageSeed implements IMessage, IMessageHandler<MessageSeed, IMessage> {
// public long seed;
//
// public MessageSeed() {
// this.seed = 0;
// }
//
// public MessageSeed(final long seed) {
// this.seed = seed;
// }
//
// @Override
// public void fromBytes(final ByteBuf buf) {
// this.seed = buf.readLong();
// }
//
// @Override
// public void toBytes(final ByteBuf buf) {
// buf.writeLong(this.seed);
// }
//
// @Override
// public IMessage onMessage(final MessageSeed message, final MessageContext ctx) {
// if (ctx.side == Side.CLIENT) {
// Tag.setSeed(message.seed);
// }
//
// return null;
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/handler/PlayerHandler.java
import com.github.lunatrius.ingameinfo.network.PacketHandler;
import com.github.lunatrius.ingameinfo.network.message.MessageSeed;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
package com.github.lunatrius.ingameinfo.handler;
public class PlayerHandler {
@SubscribeEvent
public void onPlayerLogin(final PlayerEvent.PlayerLoggedInEvent event) {
if (event.player instanceof EntityPlayerMP) {
try {
PacketHandler.INSTANCE.sendTo(new MessageSeed(event.player.world.getSeed()), (EntityPlayerMP) event.player);
} catch (final Exception ex) {
|
Reference.logger.error("Failed to send the seed!", ex);
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/network/message/MessageSeed.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/Tag.java
// public abstract class Tag {
// protected static final Minecraft minecraft = Minecraft.getMinecraft();
// protected static final MBlockPos playerPosition = new MBlockPos();
// protected static final Vector3f playerMotion = new Vector3f();
// protected static MinecraftServer server;
// protected static World world;
// protected static EntityPlayerSP player;
// protected static List<Info> info;
// protected static boolean hasSeed = false;
// protected static long seed = 0;
//
// private String name = null;
// private String[] aliases = new String[0];
//
// public Tag setName(final String name) {
// this.name = name;
// return this;
// }
//
// public String getName() {
// return this.name;
// }
//
// public Tag setAliases(final String... aliases) {
// this.aliases = aliases;
// return this;
// }
//
// public String[] getAliases() {
// return this.aliases;
// }
//
// public boolean isIndexed() {
// return false;
// }
//
// public int getMaximumIndex() {
// return -1;
// }
//
// public String getRawName() {
// return this.name;
// }
//
// public String getFormattedName() {
// return this.name + (isIndexed() ? String.format("[0..%d]", getMaximumIndex()) : "");
// }
//
// public String getLocalizedCategory() {
// return I18n.format(Reference.MODID + ".tag.category." + getCategory() + ".name");
// }
//
// public String getLocalizedDescription() {
// return I18n.format(Reference.MODID + ".tag." + getRawName() + ".desc");
// }
//
// public abstract String getCategory();
//
// public abstract String getValue();
//
// public static void setServer(final MinecraftServer server) {
// Tag.server = server;
//
// try {
// setSeed(Tag.server.getWorld(0).getSeed());
// } catch (final Exception e) {
// unsetSeed();
// }
// }
//
// public static void setSeed(final long seed) {
// Tag.hasSeed = true;
// Tag.seed = seed;
// }
//
// public static void unsetSeed() {
// Tag.hasSeed = false;
// Tag.seed = 0;
// }
//
// public static void setWorld(final World world) {
// Tag.world = world;
// }
//
// public static void setPlayer(final EntityPlayerSP player) {
// Tag.player = player;
//
// if (player != null) {
// playerPosition.set(player);
// playerMotion.set((float) (player.posX - player.prevPosX), (float) (player.posY - player.prevPosY), (float) (player.posZ - player.prevPosZ));
// }
// }
//
// public static void setInfo(final List<Info> info) {
// Tag.info = info;
// }
//
// public static void releaseResources() {
// setWorld(null);
// setPlayer(null);
// TagNearbyPlayer.releaseResources();
// TagPlayerPotion.releaseResources();
// }
//
// public static String getIconTag(final Info info) {
// String str = "";
// for (int i = 0; i < info.getWidth() && minecraft.fontRenderer.getStringWidth(str) < info.getWidth(); i++) {
// str += " ";
// }
// return String.format("{ICON|%s}", str);
// }
// }
|
import com.github.lunatrius.ingameinfo.tag.Tag;
import io.netty.buffer.ByteBuf;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import net.minecraftforge.fml.relauncher.Side;
|
package com.github.lunatrius.ingameinfo.network.message;
public class MessageSeed implements IMessage, IMessageHandler<MessageSeed, IMessage> {
public long seed;
public MessageSeed() {
this.seed = 0;
}
public MessageSeed(final long seed) {
this.seed = seed;
}
@Override
public void fromBytes(final ByteBuf buf) {
this.seed = buf.readLong();
}
@Override
public void toBytes(final ByteBuf buf) {
buf.writeLong(this.seed);
}
@Override
public IMessage onMessage(final MessageSeed message, final MessageContext ctx) {
if (ctx.side == Side.CLIENT) {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/Tag.java
// public abstract class Tag {
// protected static final Minecraft minecraft = Minecraft.getMinecraft();
// protected static final MBlockPos playerPosition = new MBlockPos();
// protected static final Vector3f playerMotion = new Vector3f();
// protected static MinecraftServer server;
// protected static World world;
// protected static EntityPlayerSP player;
// protected static List<Info> info;
// protected static boolean hasSeed = false;
// protected static long seed = 0;
//
// private String name = null;
// private String[] aliases = new String[0];
//
// public Tag setName(final String name) {
// this.name = name;
// return this;
// }
//
// public String getName() {
// return this.name;
// }
//
// public Tag setAliases(final String... aliases) {
// this.aliases = aliases;
// return this;
// }
//
// public String[] getAliases() {
// return this.aliases;
// }
//
// public boolean isIndexed() {
// return false;
// }
//
// public int getMaximumIndex() {
// return -1;
// }
//
// public String getRawName() {
// return this.name;
// }
//
// public String getFormattedName() {
// return this.name + (isIndexed() ? String.format("[0..%d]", getMaximumIndex()) : "");
// }
//
// public String getLocalizedCategory() {
// return I18n.format(Reference.MODID + ".tag.category." + getCategory() + ".name");
// }
//
// public String getLocalizedDescription() {
// return I18n.format(Reference.MODID + ".tag." + getRawName() + ".desc");
// }
//
// public abstract String getCategory();
//
// public abstract String getValue();
//
// public static void setServer(final MinecraftServer server) {
// Tag.server = server;
//
// try {
// setSeed(Tag.server.getWorld(0).getSeed());
// } catch (final Exception e) {
// unsetSeed();
// }
// }
//
// public static void setSeed(final long seed) {
// Tag.hasSeed = true;
// Tag.seed = seed;
// }
//
// public static void unsetSeed() {
// Tag.hasSeed = false;
// Tag.seed = 0;
// }
//
// public static void setWorld(final World world) {
// Tag.world = world;
// }
//
// public static void setPlayer(final EntityPlayerSP player) {
// Tag.player = player;
//
// if (player != null) {
// playerPosition.set(player);
// playerMotion.set((float) (player.posX - player.prevPosX), (float) (player.posY - player.prevPosY), (float) (player.posZ - player.prevPosZ));
// }
// }
//
// public static void setInfo(final List<Info> info) {
// Tag.info = info;
// }
//
// public static void releaseResources() {
// setWorld(null);
// setPlayer(null);
// TagNearbyPlayer.releaseResources();
// TagPlayerPotion.releaseResources();
// }
//
// public static String getIconTag(final Info info) {
// String str = "";
// for (int i = 0; i < info.getWidth() && minecraft.fontRenderer.getStringWidth(str) < info.getWidth(); i++) {
// str += " ";
// }
// return String.format("{ICON|%s}", str);
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/message/MessageSeed.java
import com.github.lunatrius.ingameinfo.tag.Tag;
import io.netty.buffer.ByteBuf;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import net.minecraftforge.fml.relauncher.Side;
package com.github.lunatrius.ingameinfo.network.message;
public class MessageSeed implements IMessage, IMessageHandler<MessageSeed, IMessage> {
public long seed;
public MessageSeed() {
this.seed = 0;
}
public MessageSeed(final long seed) {
this.seed = seed;
}
@Override
public void fromBytes(final ByteBuf buf) {
this.seed = buf.readLong();
}
@Override
public void toBytes(final ByteBuf buf) {
buf.writeLong(this.seed);
}
@Override
public IMessage onMessage(final MessageSeed message, final MessageContext ctx) {
if (ctx.side == Side.CLIENT) {
|
Tag.setSeed(message.seed);
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/tag/TagTime.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
|
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
|
if (hour >= 12) {
hour -= 12;
ampm = "PM";
}
if (hour == 0) {
hour += 12;
}
return String.format(Locale.ENGLISH, "%02d:%02d %s", hour, minute, ampm);
}
}
public static class Real24 extends TagTime {
private SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");
@Override
public String getValue() {
return this.dateFormat.format(new Date());
}
}
public static class Real12 extends TagTime {
private SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm a");
@Override
public String getValue() {
return this.dateFormat.format(new Date());
}
}
public static void register() {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/TagTime.java
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
if (hour >= 12) {
hour -= 12;
ampm = "PM";
}
if (hour == 0) {
hour += 12;
}
return String.format(Locale.ENGLISH, "%02d:%02d %s", hour, minute, ampm);
}
}
public static class Real24 extends TagTime {
private SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");
@Override
public String getValue() {
return this.dateFormat.format(new Date());
}
}
public static class Real12 extends TagTime {
private SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm a");
@Override
public String getValue() {
return this.dateFormat.format(new Date());
}
}
public static void register() {
|
TagRegistry.INSTANCE.register(new MinecraftDay().setName("day"));
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/network/PacketHandler.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/message/MessageSeed.java
// public class MessageSeed implements IMessage, IMessageHandler<MessageSeed, IMessage> {
// public long seed;
//
// public MessageSeed() {
// this.seed = 0;
// }
//
// public MessageSeed(final long seed) {
// this.seed = seed;
// }
//
// @Override
// public void fromBytes(final ByteBuf buf) {
// this.seed = buf.readLong();
// }
//
// @Override
// public void toBytes(final ByteBuf buf) {
// buf.writeLong(this.seed);
// }
//
// @Override
// public IMessage onMessage(final MessageSeed message, final MessageContext ctx) {
// if (ctx.side == Side.CLIENT) {
// Tag.setSeed(message.seed);
// }
//
// return null;
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
|
import com.github.lunatrius.ingameinfo.network.message.MessageSeed;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.relauncher.Side;
|
package com.github.lunatrius.ingameinfo.network;
public class PacketHandler {
public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
public static void init() {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/message/MessageSeed.java
// public class MessageSeed implements IMessage, IMessageHandler<MessageSeed, IMessage> {
// public long seed;
//
// public MessageSeed() {
// this.seed = 0;
// }
//
// public MessageSeed(final long seed) {
// this.seed = seed;
// }
//
// @Override
// public void fromBytes(final ByteBuf buf) {
// this.seed = buf.readLong();
// }
//
// @Override
// public void toBytes(final ByteBuf buf) {
// buf.writeLong(this.seed);
// }
//
// @Override
// public IMessage onMessage(final MessageSeed message, final MessageContext ctx) {
// if (ctx.side == Side.CLIENT) {
// Tag.setSeed(message.seed);
// }
//
// return null;
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/network/PacketHandler.java
import com.github.lunatrius.ingameinfo.network.message.MessageSeed;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.relauncher.Side;
package com.github.lunatrius.ingameinfo.network;
public class PacketHandler {
public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
public static void init() {
|
INSTANCE.registerMessage(MessageSeed.class, MessageSeed.class, 0, Side.CLIENT);
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/tag/TagFormatting.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
|
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
|
public static class Strikethrough extends TagFormatting {
@Override
public String getValue() {
return SIGN + "m";
}
}
public static class Underline extends TagFormatting {
@Override
public String getValue() {
return SIGN + "n";
}
}
public static class Italic extends TagFormatting {
@Override
public String getValue() {
return SIGN + "o";
}
}
public static class Reset extends TagFormatting {
@Override
public String getValue() {
return SIGN + "r";
}
}
public static void register() {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/TagFormatting.java
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
public static class Strikethrough extends TagFormatting {
@Override
public String getValue() {
return SIGN + "m";
}
}
public static class Underline extends TagFormatting {
@Override
public String getValue() {
return SIGN + "n";
}
}
public static class Italic extends TagFormatting {
@Override
public String getValue() {
return SIGN + "o";
}
}
public static class Reset extends TagFormatting {
@Override
public String getValue() {
return SIGN + "r";
}
}
public static void register() {
|
TagRegistry.INSTANCE.register(new Black().setName("black"));
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/handler/KeyInputHandler.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Names.java
// @SuppressWarnings("HardCodedStringLiteral")
// public final class Names {
// public static final class Mods {
// public static final String BLOODMAGIC_MODID = "AWWayofTime";
// public static final String BLOODMAGIC_NAME = "Blood Magic";
//
// public static final String SIMPLYJETPACKS_MODID = "simplyjetpacks";
// public static final String SIMPLYJETPACKS_NAME = "Simply Jetpacks";
//
// public static final String TERRAFIRMACRAFT_MODID = "terrafirmacraft";
// public static final String TERRAFIRMACRAFT_NAME = "TerraFirmaCraft";
//
// public static final String THAUMCRAFT_MODID = "Thaumcraft";
// public static final String THAUMCRAFT_NAME = "Thaumcraft";
// }
//
// public static final class Command {
// public static final class Message {
// public static final String USAGE = "commands.ingameinfoxml.usage";
// public static final String RELOAD = "commands.ingameinfoxml.reload";
// public static final String LOAD = "commands.ingameinfoxml.load";
// public static final String SAVE = "commands.ingameinfoxml.save";
// public static final String SUCCESS = "commands.ingameinfoxml.success";
// public static final String FAILURE = "commands.ingameinfoxml.failure";
// public static final String ENABLE = "commands.ingameinfoxml.enable";
// public static final String DISABLE = "commands.ingameinfoxml.disable";
// }
//
// public static final String NAME = "igi";
// public static final String RELOAD = "reload";
// public static final String LOAD = "load";
// public static final String SAVE = "save";
// public static final String ENABLE = "enable";
// public static final String DISABLE = "disable";
// public static final String TAGLIST = "taglist";
// }
//
// public static final class Config {
// public static final class Category {
// public static final String GENERAL = "general";
// public static final String ALIGNMENT = "alignment";
// }
//
// public static final String FILENAME = "filename";
// public static final String FILENAME_DESC = "The configuration that should be loaded on startup.";
// public static final String REPLACE_DEBUG = "replaceDebug";
// public static final String REPLACE_DEBUG_DESC = "Replace the debug overlay (F3) with the InGameInfoXML overlay.";
// public static final String SHOW_IN_CHAT = "showInChat";
// public static final String SHOW_IN_CHAT_DESC = "Display the overlay in chat.";
// public static final String SHOW_ON_PLAYER_LIST = "showOnPlayerList";
// public static final String SHOW_ON_PLAYER_LIST_DESC = "Display the overlay on the player list.";
// public static final String SCALE = "scale";
// public static final String SCALE_DESC = "The overlay will be scaled by this amount.";
// public static final String FILE_INTERVAL = "fileInterval";
// public static final String FILE_INTERVAL_DESC = "The interval between file reads for the 'file' tag (in seconds).";
//
// public static final String SHOW_OVERLAY_POTIONS = "showOverlayPotions";
// public static final String SHOW_OVERLAY_POTIONS_DESC = "Display the vanilla potion overlay.";
//
// public static final String SHOW_OVERLAY_ITEM_ICONS = "showOverlayItemIcons";
// public static final String SHOW_OVERLAY_ITEM_ICONS_DESC = "Display the item overlay on icon (durability, stack size).";
//
// public static final String ALIGNMENT_DESC = "Offsets for %s (X<space>Y).";
//
// public static final String LANG_PREFIX = Reference.MODID + ".config";
// }
//
// public static final class Files {
// public static final String NAME = "InGameInfo";
//
// public static final String FILE_XML = "InGameInfo.xml";
// public static final String FILE_JSON = "InGameInfo.json";
// public static final String FILE_TXT = "InGameInfo.txt";
//
// public static final String EXT_XML = ".xml";
// public static final String EXT_JSON = ".json";
// public static final String EXT_TXT = ".txt";
// }
//
// public static final class Keys {
// public static final String CATEGORY = "ingameinfoxml.key.category";
// public static final String TOGGLE = "ingameinfoxml.key.toggle";
// }
// }
|
import com.github.lunatrius.ingameinfo.reference.Names;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import org.lwjgl.input.Keyboard;
|
package com.github.lunatrius.ingameinfo.handler;
public class KeyInputHandler {
public static final KeyInputHandler INSTANCE = new KeyInputHandler();
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Names.java
// @SuppressWarnings("HardCodedStringLiteral")
// public final class Names {
// public static final class Mods {
// public static final String BLOODMAGIC_MODID = "AWWayofTime";
// public static final String BLOODMAGIC_NAME = "Blood Magic";
//
// public static final String SIMPLYJETPACKS_MODID = "simplyjetpacks";
// public static final String SIMPLYJETPACKS_NAME = "Simply Jetpacks";
//
// public static final String TERRAFIRMACRAFT_MODID = "terrafirmacraft";
// public static final String TERRAFIRMACRAFT_NAME = "TerraFirmaCraft";
//
// public static final String THAUMCRAFT_MODID = "Thaumcraft";
// public static final String THAUMCRAFT_NAME = "Thaumcraft";
// }
//
// public static final class Command {
// public static final class Message {
// public static final String USAGE = "commands.ingameinfoxml.usage";
// public static final String RELOAD = "commands.ingameinfoxml.reload";
// public static final String LOAD = "commands.ingameinfoxml.load";
// public static final String SAVE = "commands.ingameinfoxml.save";
// public static final String SUCCESS = "commands.ingameinfoxml.success";
// public static final String FAILURE = "commands.ingameinfoxml.failure";
// public static final String ENABLE = "commands.ingameinfoxml.enable";
// public static final String DISABLE = "commands.ingameinfoxml.disable";
// }
//
// public static final String NAME = "igi";
// public static final String RELOAD = "reload";
// public static final String LOAD = "load";
// public static final String SAVE = "save";
// public static final String ENABLE = "enable";
// public static final String DISABLE = "disable";
// public static final String TAGLIST = "taglist";
// }
//
// public static final class Config {
// public static final class Category {
// public static final String GENERAL = "general";
// public static final String ALIGNMENT = "alignment";
// }
//
// public static final String FILENAME = "filename";
// public static final String FILENAME_DESC = "The configuration that should be loaded on startup.";
// public static final String REPLACE_DEBUG = "replaceDebug";
// public static final String REPLACE_DEBUG_DESC = "Replace the debug overlay (F3) with the InGameInfoXML overlay.";
// public static final String SHOW_IN_CHAT = "showInChat";
// public static final String SHOW_IN_CHAT_DESC = "Display the overlay in chat.";
// public static final String SHOW_ON_PLAYER_LIST = "showOnPlayerList";
// public static final String SHOW_ON_PLAYER_LIST_DESC = "Display the overlay on the player list.";
// public static final String SCALE = "scale";
// public static final String SCALE_DESC = "The overlay will be scaled by this amount.";
// public static final String FILE_INTERVAL = "fileInterval";
// public static final String FILE_INTERVAL_DESC = "The interval between file reads for the 'file' tag (in seconds).";
//
// public static final String SHOW_OVERLAY_POTIONS = "showOverlayPotions";
// public static final String SHOW_OVERLAY_POTIONS_DESC = "Display the vanilla potion overlay.";
//
// public static final String SHOW_OVERLAY_ITEM_ICONS = "showOverlayItemIcons";
// public static final String SHOW_OVERLAY_ITEM_ICONS_DESC = "Display the item overlay on icon (durability, stack size).";
//
// public static final String ALIGNMENT_DESC = "Offsets for %s (X<space>Y).";
//
// public static final String LANG_PREFIX = Reference.MODID + ".config";
// }
//
// public static final class Files {
// public static final String NAME = "InGameInfo";
//
// public static final String FILE_XML = "InGameInfo.xml";
// public static final String FILE_JSON = "InGameInfo.json";
// public static final String FILE_TXT = "InGameInfo.txt";
//
// public static final String EXT_XML = ".xml";
// public static final String EXT_JSON = ".json";
// public static final String EXT_TXT = ".txt";
// }
//
// public static final class Keys {
// public static final String CATEGORY = "ingameinfoxml.key.category";
// public static final String TOGGLE = "ingameinfoxml.key.toggle";
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/handler/KeyInputHandler.java
import com.github.lunatrius.ingameinfo.reference.Names;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import org.lwjgl.input.Keyboard;
package com.github.lunatrius.ingameinfo.handler;
public class KeyInputHandler {
public static final KeyInputHandler INSTANCE = new KeyInputHandler();
|
private static final KeyBinding KEY_BINDING_TOGGLE = new KeyBinding(Names.Keys.TOGGLE, Keyboard.KEY_NONE, Names.Keys.CATEGORY);
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/InGameInfoXML.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/proxy/CommonProxy.java
// public class CommonProxy {
// public void preInit(final FMLPreInitializationEvent event) {
// Reference.logger = event.getModLog();
// ConfigurationHandler.init(event.getSuggestedConfigurationFile());
//
// FMLInterModComms.sendMessage("LunatriusCore", "checkUpdate", Reference.FORGE);
// }
//
// public void init(final FMLInitializationEvent event) {
// PacketHandler.init();
// }
//
// public void postInit(final FMLPostInitializationEvent event) {
// }
//
// public void serverStarting(final FMLServerStartingEvent event) {
// }
//
// public void serverStopping(final FMLServerStoppingEvent event) {
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
|
import com.github.lunatrius.ingameinfo.proxy.CommonProxy;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
import net.minecraftforge.fml.common.network.NetworkCheckHandler;
import net.minecraftforge.fml.relauncher.Side;
import java.util.Map;
|
package com.github.lunatrius.ingameinfo;
@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, guiFactory = Reference.GUI_FACTORY)
public class InGameInfoXML {
@Instance(Reference.MODID)
public static InGameInfoXML instance;
@SidedProxy(serverSide = Reference.PROXY_SERVER, clientSide = Reference.PROXY_CLIENT)
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/proxy/CommonProxy.java
// public class CommonProxy {
// public void preInit(final FMLPreInitializationEvent event) {
// Reference.logger = event.getModLog();
// ConfigurationHandler.init(event.getSuggestedConfigurationFile());
//
// FMLInterModComms.sendMessage("LunatriusCore", "checkUpdate", Reference.FORGE);
// }
//
// public void init(final FMLInitializationEvent event) {
// PacketHandler.init();
// }
//
// public void postInit(final FMLPostInitializationEvent event) {
// }
//
// public void serverStarting(final FMLServerStartingEvent event) {
// }
//
// public void serverStopping(final FMLServerStoppingEvent event) {
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/InGameInfoXML.java
import com.github.lunatrius.ingameinfo.proxy.CommonProxy;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
import net.minecraftforge.fml.common.network.NetworkCheckHandler;
import net.minecraftforge.fml.relauncher.Side;
import java.util.Map;
package com.github.lunatrius.ingameinfo;
@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, guiFactory = Reference.GUI_FACTORY)
public class InGameInfoXML {
@Instance(Reference.MODID)
public static InGameInfoXML instance;
@SidedProxy(serverSide = Reference.PROXY_SERVER, clientSide = Reference.PROXY_CLIENT)
|
public static CommonProxy proxy;
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/tag/Tag.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/client/gui/overlay/Info.java
// public abstract class Info {
// public final List<Info> children = new ArrayList<Info>();
// public int x;
// public int y;
// public int offsetX;
// public int offsetY;
//
// protected Info(final int x, final int y) {
// this.x = x;
// this.y = y;
// this.offsetX = 0;
// this.offsetY = 0;
// }
//
// public void draw() {
// drawInfo();
//
// for (final Info child : this.children) {
// child.offsetX = this.x;
// child.offsetY = this.y;
//
// child.draw();
// }
// }
//
// public abstract void drawInfo();
//
// public int getX() {
// return this.x + this.offsetX;
// }
//
// public int getY() {
// return this.y + this.offsetY;
// }
//
// public int getWidth() {
// return 0;
// }
//
// public int getHeight() {
// return 0;
// }
//
// @Override
// public String toString() {
// return "Info";
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
|
import com.github.lunatrius.core.util.math.MBlockPos;
import com.github.lunatrius.core.util.vector.Vector3f;
import com.github.lunatrius.ingameinfo.client.gui.overlay.Info;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.resources.I18n;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import java.util.List;
|
package com.github.lunatrius.ingameinfo.tag;
public abstract class Tag {
protected static final Minecraft minecraft = Minecraft.getMinecraft();
protected static final MBlockPos playerPosition = new MBlockPos();
protected static final Vector3f playerMotion = new Vector3f();
protected static MinecraftServer server;
protected static World world;
protected static EntityPlayerSP player;
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/client/gui/overlay/Info.java
// public abstract class Info {
// public final List<Info> children = new ArrayList<Info>();
// public int x;
// public int y;
// public int offsetX;
// public int offsetY;
//
// protected Info(final int x, final int y) {
// this.x = x;
// this.y = y;
// this.offsetX = 0;
// this.offsetY = 0;
// }
//
// public void draw() {
// drawInfo();
//
// for (final Info child : this.children) {
// child.offsetX = this.x;
// child.offsetY = this.y;
//
// child.draw();
// }
// }
//
// public abstract void drawInfo();
//
// public int getX() {
// return this.x + this.offsetX;
// }
//
// public int getY() {
// return this.y + this.offsetY;
// }
//
// public int getWidth() {
// return 0;
// }
//
// public int getHeight() {
// return 0;
// }
//
// @Override
// public String toString() {
// return "Info";
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/Tag.java
import com.github.lunatrius.core.util.math.MBlockPos;
import com.github.lunatrius.core.util.vector.Vector3f;
import com.github.lunatrius.ingameinfo.client.gui.overlay.Info;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.resources.I18n;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import java.util.List;
package com.github.lunatrius.ingameinfo.tag;
public abstract class Tag {
protected static final Minecraft minecraft = Minecraft.getMinecraft();
protected static final MBlockPos playerPosition = new MBlockPos();
protected static final Vector3f playerMotion = new Vector3f();
protected static MinecraftServer server;
protected static World world;
protected static EntityPlayerSP player;
|
protected static List<Info> info;
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/tag/Tag.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/client/gui/overlay/Info.java
// public abstract class Info {
// public final List<Info> children = new ArrayList<Info>();
// public int x;
// public int y;
// public int offsetX;
// public int offsetY;
//
// protected Info(final int x, final int y) {
// this.x = x;
// this.y = y;
// this.offsetX = 0;
// this.offsetY = 0;
// }
//
// public void draw() {
// drawInfo();
//
// for (final Info child : this.children) {
// child.offsetX = this.x;
// child.offsetY = this.y;
//
// child.draw();
// }
// }
//
// public abstract void drawInfo();
//
// public int getX() {
// return this.x + this.offsetX;
// }
//
// public int getY() {
// return this.y + this.offsetY;
// }
//
// public int getWidth() {
// return 0;
// }
//
// public int getHeight() {
// return 0;
// }
//
// @Override
// public String toString() {
// return "Info";
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
|
import com.github.lunatrius.core.util.math.MBlockPos;
import com.github.lunatrius.core.util.vector.Vector3f;
import com.github.lunatrius.ingameinfo.client.gui.overlay.Info;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.resources.I18n;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import java.util.List;
|
public String getName() {
return this.name;
}
public Tag setAliases(final String... aliases) {
this.aliases = aliases;
return this;
}
public String[] getAliases() {
return this.aliases;
}
public boolean isIndexed() {
return false;
}
public int getMaximumIndex() {
return -1;
}
public String getRawName() {
return this.name;
}
public String getFormattedName() {
return this.name + (isIndexed() ? String.format("[0..%d]", getMaximumIndex()) : "");
}
public String getLocalizedCategory() {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/client/gui/overlay/Info.java
// public abstract class Info {
// public final List<Info> children = new ArrayList<Info>();
// public int x;
// public int y;
// public int offsetX;
// public int offsetY;
//
// protected Info(final int x, final int y) {
// this.x = x;
// this.y = y;
// this.offsetX = 0;
// this.offsetY = 0;
// }
//
// public void draw() {
// drawInfo();
//
// for (final Info child : this.children) {
// child.offsetX = this.x;
// child.offsetY = this.y;
//
// child.draw();
// }
// }
//
// public abstract void drawInfo();
//
// public int getX() {
// return this.x + this.offsetX;
// }
//
// public int getY() {
// return this.y + this.offsetY;
// }
//
// public int getWidth() {
// return 0;
// }
//
// public int getHeight() {
// return 0;
// }
//
// @Override
// public String toString() {
// return "Info";
// }
// }
//
// Path: src/main/java/com/github/lunatrius/ingameinfo/reference/Reference.java
// public class Reference {
// public static final String MODID = "ingameinfoxml";
// public static final String NAME = "InGame Info XML";
// public static final String VERSION = "${version}";
// public static final String FORGE = "${forgeversion}";
// public static final String MINECRAFT = "${mcversion}";
// public static final String PROXY_SERVER = "com.github.lunatrius.ingameinfo.proxy.ServerProxy";
// public static final String PROXY_CLIENT = "com.github.lunatrius.ingameinfo.proxy.ClientProxy";
// public static final String GUI_FACTORY = "com.github.lunatrius.ingameinfo.client.gui.config.GuiFactory";
//
// public static Logger logger = LogManager.getLogger(Reference.MODID);
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/Tag.java
import com.github.lunatrius.core.util.math.MBlockPos;
import com.github.lunatrius.core.util.vector.Vector3f;
import com.github.lunatrius.ingameinfo.client.gui.overlay.Info;
import com.github.lunatrius.ingameinfo.reference.Reference;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.resources.I18n;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import java.util.List;
public String getName() {
return this.name;
}
public Tag setAliases(final String... aliases) {
this.aliases = aliases;
return this;
}
public String[] getAliases() {
return this.aliases;
}
public boolean isIndexed() {
return false;
}
public int getMaximumIndex() {
return -1;
}
public String getRawName() {
return this.name;
}
public String getFormattedName() {
return this.name + (isIndexed() ? String.format("[0..%d]", getMaximumIndex()) : "");
}
public String getLocalizedCategory() {
|
return I18n.format(Reference.MODID + ".tag.category." + getCategory() + ".name");
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/tag/TagWorld.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
|
import com.github.lunatrius.core.world.chunk.ChunkHelper;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.client.resources.I18n;
import net.minecraft.init.Biomes;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.DimensionType;
import net.minecraft.world.WorldServer;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.common.DimensionManager;
import java.util.Locale;
|
public static class Hardcore extends TagWorld {
@Override
public String getValue() {
return String.valueOf(world.getWorldInfo().isHardcoreModeEnabled());
}
}
public static class Temperature extends TagWorld {
@Override
public String getValue() {
return String.format(Locale.ENGLISH, "%.0f", world.getBiome(playerPosition).getDefaultTemperature() * 100);
}
}
public static class LocalTemperature extends TagWorld {
@Override
public String getValue() {
return String.format(Locale.ENGLISH, "%.2f", world.getBiome(playerPosition).getTemperature(playerPosition) * 100);
}
}
public static class Humidity extends TagWorld {
@Override
public String getValue() {
return String.format(Locale.ENGLISH, "%.0f", world.getBiome(playerPosition).getRainfall() * 100);
}
}
public static void register() {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/TagWorld.java
import com.github.lunatrius.core.world.chunk.ChunkHelper;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.client.resources.I18n;
import net.minecraft.init.Biomes;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.DimensionType;
import net.minecraft.world.WorldServer;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.common.DimensionManager;
import java.util.Locale;
public static class Hardcore extends TagWorld {
@Override
public String getValue() {
return String.valueOf(world.getWorldInfo().isHardcoreModeEnabled());
}
}
public static class Temperature extends TagWorld {
@Override
public String getValue() {
return String.format(Locale.ENGLISH, "%.0f", world.getBiome(playerPosition).getDefaultTemperature() * 100);
}
}
public static class LocalTemperature extends TagWorld {
@Override
public String getValue() {
return String.format(Locale.ENGLISH, "%.2f", world.getBiome(playerPosition).getTemperature(playerPosition) * 100);
}
}
public static class Humidity extends TagWorld {
@Override
public String getValue() {
return String.format(Locale.ENGLISH, "%.0f", world.getBiome(playerPosition).getRainfall() * 100);
}
}
public static void register() {
|
TagRegistry.INSTANCE.register(new Name().setName("worldname"));
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/tag/TagPlayerGeneral.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
|
import com.github.lunatrius.core.util.math.MBlockPos;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.EnumSkyBlock;
import java.util.Locale;
|
@Override
public String getValue() {
return String.valueOf(player.isSneaking());
}
}
public static class Sprinting extends TagPlayerGeneral {
@Override
public String getValue() {
return String.valueOf(player.isSprinting());
}
}
public static class Invisible extends TagPlayerGeneral {
@Override
public String getValue() {
return String.valueOf(player.isInvisible());
}
}
public static class Eating extends TagPlayerGeneral {
@Override
public String getValue() {
// TODO: remove or fix
// return String.valueOf(player.isEating());
return String.valueOf(false);
}
}
public static void register() {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/registry/TagRegistry.java
// public class TagRegistry {
// public static final TagRegistry INSTANCE = new TagRegistry();
//
// private Map<String, Tag> stringTagMap = new HashMap<String, Tag>();
//
// private void register(final String name, final Tag tag) {
// if (this.stringTagMap.containsKey(name)) {
// Reference.logger.error("Duplicate tag key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Tag name cannot be null!");
// return;
// }
//
// this.stringTagMap.put(name.toLowerCase(Locale.ENGLISH), tag);
// }
//
// public void register(final Tag tag) {
// register(tag.getName(), tag);
//
// for (final String name : tag.getAliases()) {
// register(name, tag);
// }
// }
//
// public String getValue(final String name) {
// final Tag tag = this.stringTagMap.get(name.toLowerCase(Locale.ENGLISH));
// return tag != null ? tag.getValue() : null;
// }
//
// public List<Tag> getRegisteredTags() {
// final List<Tag> tags = new ArrayList<Tag>();
// for (final Map.Entry<String, Tag> entry : this.stringTagMap.entrySet()) {
// tags.add(entry.getValue());
// }
// return tags;
// }
//
// public void init() {
// TagFormatting.register();
// TagMisc.register();
// TagMouseOver.register();
// TagNearbyPlayer.register();
// TagPlayerEquipment.register();
// TagPlayerGeneral.register();
// TagPlayerPosition.register();
// TagPlayerPotion.register();
// TagRiding.register();
// TagTime.register();
// TagWorld.register();
//
// Reference.logger.info("Registered " + this.stringTagMap.size() + " tags.");
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/tag/TagPlayerGeneral.java
import com.github.lunatrius.core.util.math.MBlockPos;
import com.github.lunatrius.ingameinfo.tag.registry.TagRegistry;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.EnumSkyBlock;
import java.util.Locale;
@Override
public String getValue() {
return String.valueOf(player.isSneaking());
}
}
public static class Sprinting extends TagPlayerGeneral {
@Override
public String getValue() {
return String.valueOf(player.isSprinting());
}
}
public static class Invisible extends TagPlayerGeneral {
@Override
public String getValue() {
return String.valueOf(player.isInvisible());
}
}
public static class Eating extends TagPlayerGeneral {
@Override
public String getValue() {
// TODO: remove or fix
// return String.valueOf(player.isEating());
return String.valueOf(false);
}
}
public static void register() {
|
TagRegistry.INSTANCE.register(new Light().setName("light"));
|
Lunatrius/InGame-Info-XML
|
src/main/java/com/github/lunatrius/ingameinfo/value/ValueMath.java
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/value/registry/ValueRegistry.java
// public class ValueRegistry {
// public static final ValueRegistry INSTANCE = new ValueRegistry();
//
// private Map<String, Value> stringValueMap = new HashMap<String, Value>();
// private Map<String, Class<? extends Value>> stringClassMap = new HashMap<String, Class<? extends Value>>();
// private Map<Class<? extends Value>, String> classStringMap = new HashMap<Class<? extends Value>, String>();
//
// private void register(final String name, final Value value, final boolean isAlias) {
// if (this.stringValueMap.containsKey(name)) {
// Reference.logger.error("Duplicate value key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Value name cannot be null!");
// return;
// }
//
// final String nameLowerCase = name.toLowerCase(Locale.ENGLISH);
// this.stringValueMap.put(nameLowerCase, value);
// this.stringClassMap.put(nameLowerCase, value.getClass());
// if (!isAlias) {
// this.classStringMap.put(value.getClass(), nameLowerCase);
// }
// }
//
// public void register(final Value value) {
// register(value.getName(), value, false);
//
// for (final String name : value.getAliases()) {
// register(name, value, true);
// }
// }
//
// public Value forName(String name) {
// name = name.toLowerCase(Locale.ENGLISH);
// try {
// final Class<? extends Value> clazz = this.stringClassMap.get(name);
// if (clazz != null) {
// final Value value = clazz.newInstance();
// if (value != null) {
// return value;
// }
// }
// } catch (final Exception e) {
// Reference.logger.error(String.format("Failed to create an instance for %s!", name), e);
// return new ValueSimple.ValueInvalid();
// }
//
// Reference.logger.error(String.format("Failed to create an instance for %s!", name));
// return new ValueSimple.ValueInvalid();
// }
//
// public String forClass(final Class<? extends Value> clazz) {
// final String str = this.classStringMap.get(clazz);
// return str != null ? str : "invalid";
// }
//
// public void init() {
// ValueComplex.register();
// ValueLogic.register();
// ValueMath.register();
// ValueSimple.register();
// }
// }
|
import com.github.lunatrius.ingameinfo.value.registry.ValueRegistry;
import java.util.Locale;
|
}
}
public static class ValueModi extends ValueMath {
@Override
public String getValue() {
try {
final int arg0 = getIntValue(0);
final int arg1 = getIntValue(1);
return String.valueOf(arg0 % arg1);
} catch (final Exception e2) {
return "0";
}
}
}
public static class ValuePercent extends ValueMath {
@Override
public String getValue() {
try {
final double arg0 = getDoubleValue(0);
final double arg1 = getDoubleValue(1);
return String.valueOf(arg0 / arg1 * 100);
} catch (final Exception e) {
return "0";
}
}
}
public static void register() {
|
// Path: src/main/java/com/github/lunatrius/ingameinfo/value/registry/ValueRegistry.java
// public class ValueRegistry {
// public static final ValueRegistry INSTANCE = new ValueRegistry();
//
// private Map<String, Value> stringValueMap = new HashMap<String, Value>();
// private Map<String, Class<? extends Value>> stringClassMap = new HashMap<String, Class<? extends Value>>();
// private Map<Class<? extends Value>, String> classStringMap = new HashMap<Class<? extends Value>, String>();
//
// private void register(final String name, final Value value, final boolean isAlias) {
// if (this.stringValueMap.containsKey(name)) {
// Reference.logger.error("Duplicate value key '" + name + "'!");
// return;
// }
//
// if (name == null) {
// Reference.logger.error("Value name cannot be null!");
// return;
// }
//
// final String nameLowerCase = name.toLowerCase(Locale.ENGLISH);
// this.stringValueMap.put(nameLowerCase, value);
// this.stringClassMap.put(nameLowerCase, value.getClass());
// if (!isAlias) {
// this.classStringMap.put(value.getClass(), nameLowerCase);
// }
// }
//
// public void register(final Value value) {
// register(value.getName(), value, false);
//
// for (final String name : value.getAliases()) {
// register(name, value, true);
// }
// }
//
// public Value forName(String name) {
// name = name.toLowerCase(Locale.ENGLISH);
// try {
// final Class<? extends Value> clazz = this.stringClassMap.get(name);
// if (clazz != null) {
// final Value value = clazz.newInstance();
// if (value != null) {
// return value;
// }
// }
// } catch (final Exception e) {
// Reference.logger.error(String.format("Failed to create an instance for %s!", name), e);
// return new ValueSimple.ValueInvalid();
// }
//
// Reference.logger.error(String.format("Failed to create an instance for %s!", name));
// return new ValueSimple.ValueInvalid();
// }
//
// public String forClass(final Class<? extends Value> clazz) {
// final String str = this.classStringMap.get(clazz);
// return str != null ? str : "invalid";
// }
//
// public void init() {
// ValueComplex.register();
// ValueLogic.register();
// ValueMath.register();
// ValueSimple.register();
// }
// }
// Path: src/main/java/com/github/lunatrius/ingameinfo/value/ValueMath.java
import com.github.lunatrius.ingameinfo.value.registry.ValueRegistry;
import java.util.Locale;
}
}
public static class ValueModi extends ValueMath {
@Override
public String getValue() {
try {
final int arg0 = getIntValue(0);
final int arg1 = getIntValue(1);
return String.valueOf(arg0 % arg1);
} catch (final Exception e2) {
return "0";
}
}
}
public static class ValuePercent extends ValueMath {
@Override
public String getValue() {
try {
final double arg0 = getDoubleValue(0);
final double arg1 = getDoubleValue(1);
return String.valueOf(arg0 / arg1 * 100);
} catch (final Exception e) {
return "0";
}
}
}
public static void register() {
|
ValueRegistry.INSTANCE.register(new ValueAdd().setName("add"));
|
pulsarIO/druid-kafka-ext
|
kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/DefaultPartitionCoordinator.java
|
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/data/RebalanceResult.java
// public class RebalanceResult {
// /**
// * indicate how many partitions should be taken totally after each round rebalance for one consumer
// */
// private int shouldTaken=-1;
// /**
// * all the partitions which can be taken by consumer.
// * coordinator will take partitions from here until one of condition reached:
// * 1. <code>shouldTaken</code> == <code>getMyPartitions().size()</code>
// * 2. all <code>idlePartitions</code> be taken.
// */
// private Set<Integer> idlePartitions=Sets.newHashSet();
// /**
// * all the partitions which can be released by consumer.
// * coordinator will fetch partitions from here to release until one of codition reached.
// * 1. <code>shouldTaken</code> == <code>getMyPartitions().size()</code>
// * 2. all <code>shouldRelease</code> be taken.
// */
// private Set<Integer> shouldRelease=Sets.newHashSet();
// public int getShouldTaken() {
// return shouldTaken;
// }
// public void setShouldTaken(int shouldTaken) {
// this.shouldTaken = shouldTaken;
// }
// public Set<Integer> getIdlePartitions() {
// return idlePartitions;
// }
// public void setIdlePartitions(Set<Integer> idlePartitions) {
// this.idlePartitions = idlePartitions;
// }
// public Set<Integer> getShouldRelease() {
// return shouldRelease;
// }
// public void setShouldRelease(Set<Integer> shouldRelease) {
// this.shouldRelease = shouldRelease;
// }
//
//
// }
|
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.ebay.pulsar.druid.firehose.kafka.support.data.RebalanceResult;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
|
/*******************************************************************************
* Copyright © 2012-2015 eBay Software Foundation
* This program is licensed under the Apache 2.0 licenses.
* Please see LICENSE for more information.
*******************************************************************************/
package com.ebay.pulsar.druid.firehose.kafka.support;
/**
*@author qxing
*
**/
public class DefaultPartitionCoordinator extends BasePartitionCoordinator {
@Override
|
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/data/RebalanceResult.java
// public class RebalanceResult {
// /**
// * indicate how many partitions should be taken totally after each round rebalance for one consumer
// */
// private int shouldTaken=-1;
// /**
// * all the partitions which can be taken by consumer.
// * coordinator will take partitions from here until one of condition reached:
// * 1. <code>shouldTaken</code> == <code>getMyPartitions().size()</code>
// * 2. all <code>idlePartitions</code> be taken.
// */
// private Set<Integer> idlePartitions=Sets.newHashSet();
// /**
// * all the partitions which can be released by consumer.
// * coordinator will fetch partitions from here to release until one of codition reached.
// * 1. <code>shouldTaken</code> == <code>getMyPartitions().size()</code>
// * 2. all <code>shouldRelease</code> be taken.
// */
// private Set<Integer> shouldRelease=Sets.newHashSet();
// public int getShouldTaken() {
// return shouldTaken;
// }
// public void setShouldTaken(int shouldTaken) {
// this.shouldTaken = shouldTaken;
// }
// public Set<Integer> getIdlePartitions() {
// return idlePartitions;
// }
// public void setIdlePartitions(Set<Integer> idlePartitions) {
// this.idlePartitions = idlePartitions;
// }
// public Set<Integer> getShouldRelease() {
// return shouldRelease;
// }
// public void setShouldRelease(Set<Integer> shouldRelease) {
// this.shouldRelease = shouldRelease;
// }
//
//
// }
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/DefaultPartitionCoordinator.java
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.ebay.pulsar.druid.firehose.kafka.support.data.RebalanceResult;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
/*******************************************************************************
* Copyright © 2012-2015 eBay Software Foundation
* This program is licensed under the Apache 2.0 licenses.
* Please see LICENSE for more information.
*******************************************************************************/
package com.ebay.pulsar.druid.firehose.kafka.support;
/**
*@author qxing
*
**/
public class DefaultPartitionCoordinator extends BasePartitionCoordinator {
@Override
|
public RebalanceResult calculate(String consumerId, Set<Integer> allPartitions,List<String> allConsumers,Map<String,Set<Integer>> view){
|
pulsarIO/druid-kafka-ext
|
kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/api/KafkaConsumer.java
|
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/data/ConsumerId.java
// public final class ConsumerId {
// private String consumerGroupId;
// private String hostName;
// private String consumerUuid;
// public ConsumerId(String consumerGroupId) {
// this(consumerGroupId, null, null);
// }
//
// public ConsumerId(String consumerGroupId, String uniqueId) {
// this(consumerGroupId, null, uniqueId);
// }
//
// public ConsumerId(String consumerGroupId, String hostName, String uniqueId) {
// checkArgument(consumerGroupId!=null,"consumerGroupId can't be null.");
// this.consumerGroupId = consumerGroupId;
// UUID uuid = UUID.randomUUID();
// if (hostName == null) {
// try {
// InetAddress s = InetAddress.getLocalHost();
// this.hostName = s.getHostName();
// } catch (UnknownHostException e) {
// throw new RuntimeException("Can resolve local host name", e);
// }
// }
// consumerUuid = String.format("%s-%d-%s",
// this.hostName, System.currentTimeMillis(),
// Long.toHexString(uuid.getMostSignificantBits()).substring(0,8));
// }
//
// public String getConsumerGroupId() {
// return consumerGroupId;
// }
//
// public void setConsumerGroupId(String consumerGroupId) {
// this.consumerGroupId = consumerGroupId;
// }
//
// public String getHostName() {
// return hostName;
// }
//
// public void setHostName(String hostName) {
// this.hostName = hostName;
// }
// public String getConsumerUuid() {
// return consumerUuid;
// }
// public void setConsumerUuid(String consumerUuid) {
// this.consumerUuid = consumerUuid;
// }
//
// @Override
// public String toString() {
// return consumerGroupId+"_"+consumerUuid;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result
// + ((consumerGroupId == null) ? 0 : consumerGroupId.hashCode());
// result = prime * result
// + ((consumerUuid == null) ? 0 : consumerUuid.hashCode());
// result = prime * result
// + ((hostName == null) ? 0 : hostName.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ConsumerId other = (ConsumerId) obj;
// if (consumerGroupId == null) {
// if (other.consumerGroupId != null)
// return false;
// } else if (!consumerGroupId.equals(other.consumerGroupId))
// return false;
// if (consumerUuid == null) {
// if (other.consumerUuid != null)
// return false;
// } else if (!consumerUuid.equals(other.consumerUuid))
// return false;
// if (hostName == null) {
// if (other.hostName != null)
// return false;
// } else if (!hostName.equals(other.hostName))
// return false;
// return true;
// }
//
//
// }
//
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/exceptions/KafkaPartitionReaderException.java
// public class KafkaPartitionReaderException extends RuntimeException {
// private static final long serialVersionUID = -5969989670100717318L;
// private short code;
// public KafkaPartitionReaderException(short code){
// super("KafkaPartition Reader Exception.code="+code);
// this.code=code;
// }
// public KafkaPartitionReaderException(short code,String msg){
// super(msg);
// this.code=code;
// }
// public short getCode(){
// return code;
// }
// }
|
import com.ebay.pulsar.druid.firehose.kafka.support.exceptions.KafkaPartitionReaderException;
import com.ebay.pulsar.druid.firehose.kafka.support.data.ConsumerId;
|
/*******************************************************************************
* Copyright © 2012-2015 eBay Software Foundation
* This program is licensed under the Apache 2.0 licenses.
* Please see LICENSE for more information.
*******************************************************************************/
package com.ebay.pulsar.druid.firehose.kafka.support.api;
/**
*@author qxing
*
* 1. Manage PartitionAndOffset as well as topic
* 2. Delegate Read to PartitionReader
* 3. Manage Offset read and commit, as well as revert.
*
**/
public interface KafkaConsumer {
/**
* get consumer id which register to zookeeper.
*
* @return
*/
public ConsumerId getConsumerId() ;
/**
* handle all the partition reader exception.
*/
|
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/data/ConsumerId.java
// public final class ConsumerId {
// private String consumerGroupId;
// private String hostName;
// private String consumerUuid;
// public ConsumerId(String consumerGroupId) {
// this(consumerGroupId, null, null);
// }
//
// public ConsumerId(String consumerGroupId, String uniqueId) {
// this(consumerGroupId, null, uniqueId);
// }
//
// public ConsumerId(String consumerGroupId, String hostName, String uniqueId) {
// checkArgument(consumerGroupId!=null,"consumerGroupId can't be null.");
// this.consumerGroupId = consumerGroupId;
// UUID uuid = UUID.randomUUID();
// if (hostName == null) {
// try {
// InetAddress s = InetAddress.getLocalHost();
// this.hostName = s.getHostName();
// } catch (UnknownHostException e) {
// throw new RuntimeException("Can resolve local host name", e);
// }
// }
// consumerUuid = String.format("%s-%d-%s",
// this.hostName, System.currentTimeMillis(),
// Long.toHexString(uuid.getMostSignificantBits()).substring(0,8));
// }
//
// public String getConsumerGroupId() {
// return consumerGroupId;
// }
//
// public void setConsumerGroupId(String consumerGroupId) {
// this.consumerGroupId = consumerGroupId;
// }
//
// public String getHostName() {
// return hostName;
// }
//
// public void setHostName(String hostName) {
// this.hostName = hostName;
// }
// public String getConsumerUuid() {
// return consumerUuid;
// }
// public void setConsumerUuid(String consumerUuid) {
// this.consumerUuid = consumerUuid;
// }
//
// @Override
// public String toString() {
// return consumerGroupId+"_"+consumerUuid;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result
// + ((consumerGroupId == null) ? 0 : consumerGroupId.hashCode());
// result = prime * result
// + ((consumerUuid == null) ? 0 : consumerUuid.hashCode());
// result = prime * result
// + ((hostName == null) ? 0 : hostName.hashCode());
// return result;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// ConsumerId other = (ConsumerId) obj;
// if (consumerGroupId == null) {
// if (other.consumerGroupId != null)
// return false;
// } else if (!consumerGroupId.equals(other.consumerGroupId))
// return false;
// if (consumerUuid == null) {
// if (other.consumerUuid != null)
// return false;
// } else if (!consumerUuid.equals(other.consumerUuid))
// return false;
// if (hostName == null) {
// if (other.hostName != null)
// return false;
// } else if (!hostName.equals(other.hostName))
// return false;
// return true;
// }
//
//
// }
//
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/exceptions/KafkaPartitionReaderException.java
// public class KafkaPartitionReaderException extends RuntimeException {
// private static final long serialVersionUID = -5969989670100717318L;
// private short code;
// public KafkaPartitionReaderException(short code){
// super("KafkaPartition Reader Exception.code="+code);
// this.code=code;
// }
// public KafkaPartitionReaderException(short code,String msg){
// super(msg);
// this.code=code;
// }
// public short getCode(){
// return code;
// }
// }
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/api/KafkaConsumer.java
import com.ebay.pulsar.druid.firehose.kafka.support.exceptions.KafkaPartitionReaderException;
import com.ebay.pulsar.druid.firehose.kafka.support.data.ConsumerId;
/*******************************************************************************
* Copyright © 2012-2015 eBay Software Foundation
* This program is licensed under the Apache 2.0 licenses.
* Please see LICENSE for more information.
*******************************************************************************/
package com.ebay.pulsar.druid.firehose.kafka.support.api;
/**
*@author qxing
*
* 1. Manage PartitionAndOffset as well as topic
* 2. Delegate Read to PartitionReader
* 3. Manage Offset read and commit, as well as revert.
*
**/
public interface KafkaConsumer {
/**
* get consumer id which register to zookeeper.
*
* @return
*/
public ConsumerId getConsumerId() ;
/**
* handle all the partition reader exception.
*/
|
void handlePartitionReaderException(PartitionReader reader,KafkaPartitionReaderException e);
|
pulsarIO/druid-kafka-ext
|
kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/data/KafkaConsumerConfig.java
|
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/util/PropertiesUtils.java
// public class PropertiesUtils {
// public static int getInt(Properties props, String key, int defaultValue){
// String v = props.getProperty(key);
// return v==null?defaultValue:Integer.parseInt(v);
// }
// public static Integer getInt(Properties props, String key){
// String v = props.getProperty(key);
// return v==null?null:Integer.parseInt(v);
// }
// public static long getLong(Properties props, String key, long defaultValue){
// String v = props.getProperty(key);
// return v==null?defaultValue:Long.parseLong(v);
// }
// public static String getString(Properties props, String key, String defaultValue){
// return props.getProperty(key,defaultValue);
// }
// public static String getString(Properties props, String key){
// return props.getProperty(key);
// }
// public static boolean getBoolean(Properties props, String key, boolean defaultValue){
// String v = props.getProperty(key);
// return v==null?defaultValue:Boolean.parseBoolean(v);
// }
// }
|
import com.ebay.pulsar.druid.firehose.kafka.support.util.PropertiesUtils;
import kafka.consumer.ConsumerConfig;
import java.util.Properties;
|
/*******************************************************************************
* Copyright © 2012-2015 eBay Software Foundation
* This program is licensed under the Apache 2.0 licenses.
* Please see LICENSE for more information.
*******************************************************************************/
package com.ebay.pulsar.druid.firehose.kafka.support.data;
/**
* This is the config bean for the kafka consumer.
*
* Below is a configuration example.
*
*
* @author qxing
*
*/
public class KafkaConsumerConfig extends ConsumerConfig{
private int rebalanceableWaitInMs = 15000;
private int retryTimes=3;
private int sleepMsBetweenRetries=500;
public KafkaConsumerConfig(Properties originalProps) {
super(originalProps);
|
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/util/PropertiesUtils.java
// public class PropertiesUtils {
// public static int getInt(Properties props, String key, int defaultValue){
// String v = props.getProperty(key);
// return v==null?defaultValue:Integer.parseInt(v);
// }
// public static Integer getInt(Properties props, String key){
// String v = props.getProperty(key);
// return v==null?null:Integer.parseInt(v);
// }
// public static long getLong(Properties props, String key, long defaultValue){
// String v = props.getProperty(key);
// return v==null?defaultValue:Long.parseLong(v);
// }
// public static String getString(Properties props, String key, String defaultValue){
// return props.getProperty(key,defaultValue);
// }
// public static String getString(Properties props, String key){
// return props.getProperty(key);
// }
// public static boolean getBoolean(Properties props, String key, boolean defaultValue){
// String v = props.getProperty(key);
// return v==null?defaultValue:Boolean.parseBoolean(v);
// }
// }
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/data/KafkaConsumerConfig.java
import com.ebay.pulsar.druid.firehose.kafka.support.util.PropertiesUtils;
import kafka.consumer.ConsumerConfig;
import java.util.Properties;
/*******************************************************************************
* Copyright © 2012-2015 eBay Software Foundation
* This program is licensed under the Apache 2.0 licenses.
* Please see LICENSE for more information.
*******************************************************************************/
package com.ebay.pulsar.druid.firehose.kafka.support.data;
/**
* This is the config bean for the kafka consumer.
*
* Below is a configuration example.
*
*
* @author qxing
*
*/
public class KafkaConsumerConfig extends ConsumerConfig{
private int rebalanceableWaitInMs = 15000;
private int retryTimes=3;
private int sleepMsBetweenRetries=500;
public KafkaConsumerConfig(Properties originalProps) {
super(originalProps);
|
rebalanceableWaitInMs=PropertiesUtils.getInt(originalProps, "rebalance.first.wait.ms", 15000);
|
pulsarIO/druid-kafka-ext
|
kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/api/PartitionReader.java
|
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/exceptions/KafkaPartitionReaderException.java
// public class KafkaPartitionReaderException extends RuntimeException {
// private static final long serialVersionUID = -5969989670100717318L;
// private short code;
// public KafkaPartitionReaderException(short code){
// super("KafkaPartition Reader Exception.code="+code);
// this.code=code;
// }
// public KafkaPartitionReaderException(short code,String msg){
// super(msg);
// this.code=code;
// }
// public short getCode(){
// return code;
// }
// }
|
import com.ebay.pulsar.druid.firehose.kafka.support.exceptions.KafkaPartitionReaderException;
import kafka.message.MessageAndMetadata;
import java.util.List;
|
/*******************************************************************************
* Copyright © 2012-2015 eBay Software Foundation
* This program is licensed under the Apache 2.0 licenses.
* Please see LICENSE for more information.
*******************************************************************************/
package com.ebay.pulsar.druid.firehose.kafka.support.api;
/**
*@author qxing
* 1. Read event
* 2. Manage read offset
* 3. Manage commit offset
* 4. Be aware of group, topic, partition information.
**/
public interface PartitionReader extends Comparable<PartitionReader>{
public PartitionReader startFrom(long offset);
public void reinit();
/**
* read events.
*
* any errors occurred druing the read process are wrapped as KafkaPartitionReaderException which contains the error code
* the exception should be processed by consumer.
*
* @return
* @throws KafkaPartitionReaderException
*/
|
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/exceptions/KafkaPartitionReaderException.java
// public class KafkaPartitionReaderException extends RuntimeException {
// private static final long serialVersionUID = -5969989670100717318L;
// private short code;
// public KafkaPartitionReaderException(short code){
// super("KafkaPartition Reader Exception.code="+code);
// this.code=code;
// }
// public KafkaPartitionReaderException(short code,String msg){
// super(msg);
// this.code=code;
// }
// public short getCode(){
// return code;
// }
// }
// Path: kafka-eight-ex/src/main/java/com/ebay/pulsar/druid/firehose/kafka/support/api/PartitionReader.java
import com.ebay.pulsar.druid.firehose.kafka.support.exceptions.KafkaPartitionReaderException;
import kafka.message.MessageAndMetadata;
import java.util.List;
/*******************************************************************************
* Copyright © 2012-2015 eBay Software Foundation
* This program is licensed under the Apache 2.0 licenses.
* Please see LICENSE for more information.
*******************************************************************************/
package com.ebay.pulsar.druid.firehose.kafka.support.api;
/**
*@author qxing
* 1. Read event
* 2. Manage read offset
* 3. Manage commit offset
* 4. Be aware of group, topic, partition information.
**/
public interface PartitionReader extends Comparable<PartitionReader>{
public PartitionReader startFrom(long offset);
public void reinit();
/**
* read events.
*
* any errors occurred druing the read process are wrapped as KafkaPartitionReaderException which contains the error code
* the exception should be processed by consumer.
*
* @return
* @throws KafkaPartitionReaderException
*/
|
public List<MessageAndMetadata<byte[],byte[]>> readEvents() throws KafkaPartitionReaderException ;
|
n76/Local-GSM-Backend
|
app/src/main/java/org/fitchfamily/android/gsmlocation/ReqLocationPermActivity.java
|
// Path: app/src/main/java/org/fitchfamily/android/gsmlocation/LogUtils.java
// public static String makeLogTag(String str) {
// if (str.length() > MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH) {
// return LOG_PREFIX + str.substring(0, MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 1);
// } else {
// return LOG_PREFIX + str;
// }
// }
|
import android.Manifest;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.NotificationManager;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import static org.fitchfamily.android.gsmlocation.LogUtils.makeLogTag;
|
package org.fitchfamily.android.gsmlocation;
@TargetApi(23)
public class ReqLocationPermActivity extends Activity {
|
// Path: app/src/main/java/org/fitchfamily/android/gsmlocation/LogUtils.java
// public static String makeLogTag(String str) {
// if (str.length() > MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH) {
// return LOG_PREFIX + str.substring(0, MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 1);
// } else {
// return LOG_PREFIX + str;
// }
// }
// Path: app/src/main/java/org/fitchfamily/android/gsmlocation/ReqLocationPermActivity.java
import android.Manifest;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.NotificationManager;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import static org.fitchfamily.android.gsmlocation.LogUtils.makeLogTag;
package org.fitchfamily.android.gsmlocation;
@TargetApi(23)
public class ReqLocationPermActivity extends Activity {
|
private static final String TAG = makeLogTag(ReqLocationPermActivity.class);
|
n76/Local-GSM-Backend
|
app/src/main/java/org/fitchfamily/android/gsmlocation/ui/settings/mcc/AreaDialogFragment.java
|
// Path: app/src/main/java/org/fitchfamily/android/gsmlocation/util/LocaleUtil.java
// public abstract class LocaleUtil {
// private static final boolean DEBUG = BuildConfig.DEBUG;
//
// private static final String TAG = LogUtils.makeLogTag(LocaleUtil.class);
//
// private LocaleUtil() {
//
// }
//
// /**
// * Tries to get the name for the country
// *
// * @param code language code, for example en
// * @return the country name or the code
// */
// public static String getCountryName(@NonNull String code) {
// try {
// return LocaleUtils.toLocale("en_" + code.toUpperCase(Locale.ENGLISH)).getDisplayCountry();
// } catch (IllegalArgumentException ex) {
// if (DEBUG) {
// Log.i(TAG, "couldn't resolve " + code, ex);
// }
//
// return code;
// }
// }
//
// public static List<String> getCountryNames(Set<String> codes) {
// List<String> names = new ArrayList<>();
//
// for (String code : codes) {
// String resolved = getCountryName(code);
//
// if (!names.contains(resolved)) {
// names.add(resolved);
// }
// }
//
// Collections.sort(names);
//
// return Collections.unmodifiableList(names);
// }
// }
|
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AlertDialog;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.FragmentArg;
import org.fitchfamily.android.gsmlocation.util.LocaleUtil;
import java.util.TreeSet;
|
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
listener = (Listener) activity;
}
@Override
public void onDetach() {
super.onDetach();
listener = null;
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final String[] choices = new String[numbers.size()];
final boolean[] checked = new boolean[choices.length];
final int[] numbers = new int[choices.length];
int i = 0;
for (int number : this.numbers) {
choices[i] = String.valueOf(number);
checked[i] = listener.isMccEnabled(number);
numbers[i] = number;
i++;
}
return new AlertDialog.Builder(getActivity())
|
// Path: app/src/main/java/org/fitchfamily/android/gsmlocation/util/LocaleUtil.java
// public abstract class LocaleUtil {
// private static final boolean DEBUG = BuildConfig.DEBUG;
//
// private static final String TAG = LogUtils.makeLogTag(LocaleUtil.class);
//
// private LocaleUtil() {
//
// }
//
// /**
// * Tries to get the name for the country
// *
// * @param code language code, for example en
// * @return the country name or the code
// */
// public static String getCountryName(@NonNull String code) {
// try {
// return LocaleUtils.toLocale("en_" + code.toUpperCase(Locale.ENGLISH)).getDisplayCountry();
// } catch (IllegalArgumentException ex) {
// if (DEBUG) {
// Log.i(TAG, "couldn't resolve " + code, ex);
// }
//
// return code;
// }
// }
//
// public static List<String> getCountryNames(Set<String> codes) {
// List<String> names = new ArrayList<>();
//
// for (String code : codes) {
// String resolved = getCountryName(code);
//
// if (!names.contains(resolved)) {
// names.add(resolved);
// }
// }
//
// Collections.sort(names);
//
// return Collections.unmodifiableList(names);
// }
// }
// Path: app/src/main/java/org/fitchfamily/android/gsmlocation/ui/settings/mcc/AreaDialogFragment.java
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AlertDialog;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.FragmentArg;
import org.fitchfamily.android.gsmlocation.util.LocaleUtil;
import java.util.TreeSet;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
listener = (Listener) activity;
}
@Override
public void onDetach() {
super.onDetach();
listener = null;
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final String[] choices = new String[numbers.size()];
final boolean[] checked = new boolean[choices.length];
final int[] numbers = new int[choices.length];
int i = 0;
for (int number : this.numbers) {
choices[i] = String.valueOf(number);
checked[i] = listener.isMccEnabled(number);
numbers[i] = number;
i++;
}
return new AlertDialog.Builder(getActivity())
|
.setTitle(LocaleUtil.getCountryName(code))
|
n76/Local-GSM-Backend
|
app/src/main/java/org/fitchfamily/android/gsmlocation/util/LocaleUtil.java
|
// Path: app/src/main/java/org/fitchfamily/android/gsmlocation/LogUtils.java
// public class LogUtils {
// private static LogUtils instance;
// private static final Object lock = new Object();
//
// private static final String LOG_PREFIX = "gsmloc_";
// private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length();
// private static final int MAX_LOG_TAG_LENGTH = 25;
//
// public static String makeLogTag(String str) {
// if (str.length() > MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH) {
// return LOG_PREFIX + str.substring(0, MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 1);
// } else {
// return LOG_PREFIX + str;
// }
// }
//
// public static String makeLogTag(Class cls) {
// return makeLogTag(cls.getSimpleName());
// }
//
// public static LogUtils with(Context context) {
// if(instance == null) {
// synchronized (lock) {
// if(instance == null) {
// instance = new LogUtils(context);
// }
// }
// }
//
// return instance;
// }
//
// private Settings settings;
//
// private LogUtils(Context context) {
// settings = Settings.with(context);
// }
//
// public void appendToLog(String message) {
// if (!settings.logfile().exists()) {
// try {
// settings.logfile().createNewFile();
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// }
//
// try {
// BufferedWriter buf = new BufferedWriter(new FileWriter(settings.logfile(), true));
// buf.append(message);
// buf.newLine();
// buf.flush();
// buf.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// public void clearLog() {
// settings.logfile().delete();
// }
//
// private LogUtils() {
// }
// }
|
import android.support.annotation.NonNull;
import android.util.Log;
import org.apache.commons.lang3.LocaleUtils;
import org.fitchfamily.android.gsmlocation.BuildConfig;
import org.fitchfamily.android.gsmlocation.LogUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Set;
|
package org.fitchfamily.android.gsmlocation.util;
public abstract class LocaleUtil {
private static final boolean DEBUG = BuildConfig.DEBUG;
|
// Path: app/src/main/java/org/fitchfamily/android/gsmlocation/LogUtils.java
// public class LogUtils {
// private static LogUtils instance;
// private static final Object lock = new Object();
//
// private static final String LOG_PREFIX = "gsmloc_";
// private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length();
// private static final int MAX_LOG_TAG_LENGTH = 25;
//
// public static String makeLogTag(String str) {
// if (str.length() > MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH) {
// return LOG_PREFIX + str.substring(0, MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 1);
// } else {
// return LOG_PREFIX + str;
// }
// }
//
// public static String makeLogTag(Class cls) {
// return makeLogTag(cls.getSimpleName());
// }
//
// public static LogUtils with(Context context) {
// if(instance == null) {
// synchronized (lock) {
// if(instance == null) {
// instance = new LogUtils(context);
// }
// }
// }
//
// return instance;
// }
//
// private Settings settings;
//
// private LogUtils(Context context) {
// settings = Settings.with(context);
// }
//
// public void appendToLog(String message) {
// if (!settings.logfile().exists()) {
// try {
// settings.logfile().createNewFile();
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// }
//
// try {
// BufferedWriter buf = new BufferedWriter(new FileWriter(settings.logfile(), true));
// buf.append(message);
// buf.newLine();
// buf.flush();
// buf.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// public void clearLog() {
// settings.logfile().delete();
// }
//
// private LogUtils() {
// }
// }
// Path: app/src/main/java/org/fitchfamily/android/gsmlocation/util/LocaleUtil.java
import android.support.annotation.NonNull;
import android.util.Log;
import org.apache.commons.lang3.LocaleUtils;
import org.fitchfamily.android.gsmlocation.BuildConfig;
import org.fitchfamily.android.gsmlocation.LogUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Set;
package org.fitchfamily.android.gsmlocation.util;
public abstract class LocaleUtil {
private static final boolean DEBUG = BuildConfig.DEBUG;
|
private static final String TAG = LogUtils.makeLogTag(LocaleUtil.class);
|
fflewddur/archivo
|
src/net/straylightlabs/archivo/model/ArchiveStatus.java
|
// Path: src/net/straylightlabs/archivo/controller/ArchiveTaskException.java
// public class ArchiveTaskException extends RuntimeException {
// private final String tooltip;
//
// public ArchiveTaskException(String message) {
// super(message);
// tooltip = null;
// }
//
// public ArchiveTaskException(String message, String tooltip) {
// super(message);
// this.tooltip = tooltip;
// }
//
// public String getTooltip() {
// return tooltip;
// }
// }
|
import net.straylightlabs.archivo.controller.ArchiveTaskException;
|
public static ArchiveStatus createRemuxingStatus(double progress, int secondsRemaining) {
if (progress >= 1.0) {
progress = .99;
}
return new ArchiveStatus(TaskStatus.REMUXING, progress, secondsRemaining);
}
public static ArchiveStatus createFindingCommercialsStatus(double progress, int secondsRemaining) {
if (progress >= 1.0) {
progress = .99;
}
return new ArchiveStatus(TaskStatus.FINDING_COMMERCIALS, progress, secondsRemaining);
}
public static ArchiveStatus createRemovingCommercialsStatus(double progress, int secondsRemaining) {
if (progress >= 1.0) {
progress = .99;
}
return new ArchiveStatus(TaskStatus.REMOVING_COMMERCIALS, progress, secondsRemaining);
}
public static ArchiveStatus createTranscodingStatus(double progress, int secondsRemaining) {
if (progress >= 1.0) {
progress = .99;
}
return new ArchiveStatus(TaskStatus.TRANSCODING, progress, secondsRemaining);
}
public static ArchiveStatus createErrorStatus(Throwable e) {
|
// Path: src/net/straylightlabs/archivo/controller/ArchiveTaskException.java
// public class ArchiveTaskException extends RuntimeException {
// private final String tooltip;
//
// public ArchiveTaskException(String message) {
// super(message);
// tooltip = null;
// }
//
// public ArchiveTaskException(String message, String tooltip) {
// super(message);
// this.tooltip = tooltip;
// }
//
// public String getTooltip() {
// return tooltip;
// }
// }
// Path: src/net/straylightlabs/archivo/model/ArchiveStatus.java
import net.straylightlabs.archivo.controller.ArchiveTaskException;
public static ArchiveStatus createRemuxingStatus(double progress, int secondsRemaining) {
if (progress >= 1.0) {
progress = .99;
}
return new ArchiveStatus(TaskStatus.REMUXING, progress, secondsRemaining);
}
public static ArchiveStatus createFindingCommercialsStatus(double progress, int secondsRemaining) {
if (progress >= 1.0) {
progress = .99;
}
return new ArchiveStatus(TaskStatus.FINDING_COMMERCIALS, progress, secondsRemaining);
}
public static ArchiveStatus createRemovingCommercialsStatus(double progress, int secondsRemaining) {
if (progress >= 1.0) {
progress = .99;
}
return new ArchiveStatus(TaskStatus.REMOVING_COMMERCIALS, progress, secondsRemaining);
}
public static ArchiveStatus createTranscodingStatus(double progress, int secondsRemaining) {
if (progress >= 1.0) {
progress = .99;
}
return new ArchiveStatus(TaskStatus.TRANSCODING, progress, secondsRemaining);
}
public static ArchiveStatus createErrorStatus(Throwable e) {
|
if (e instanceof ArchiveTaskException) {
|
fflewddur/archivo
|
src/net/straylightlabs/archivo/model/FileType.java
|
// Path: src/net/straylightlabs/archivo/utilities/OSHelper.java
// public class OSHelper {
// private static final String osName;
// private static final Runtime runtime;
// private static int cpuThreads;
// private static Boolean isAMD64;
// private static String exeSuffix;
//
// @SuppressWarnings("unused")
// private final static Logger logger = LoggerFactory.getLogger(OSHelper.class);
//
// static {
// osName = System.getProperty("os.name").toLowerCase();
// runtime = Runtime.getRuntime();
// }
//
// public static boolean isWindows() {
// return osName.startsWith("windows");
// }
//
// public static boolean isMacOS() {
// return osName.startsWith("mac os");
// }
//
// public static String getExeSuffix() {
// if (exeSuffix == null) {
// if (isWindows()) {
// exeSuffix = ".exe";
// } else {
// exeSuffix = "";
// }
// }
// return exeSuffix;
// }
//
// public static String getArchSuffix() {
// if (isWindows()) {
// if (isAMD64()) {
// return "-64";
// } else {
// return "-32";
// }
// } else {
// return "";
// }
// }
//
// private static boolean isAMD64() {
// if (isAMD64 == null) {
// String arch = System.getenv("PROCESSOR_ARCHITECTURE");
// isAMD64 = arch.equalsIgnoreCase("amd64");
// }
// return isAMD64;
// }
//
// public static int getProcessorThreads() {
// if (cpuThreads == 0) {
// cpuThreads = runtime.availableProcessors();
// }
// return cpuThreads;
// }
//
// @SuppressWarnings("unused")
// public static Path getApplicationDirectory() {
// if (isWindows()) {
// String programFilesEnv = System.getenv("ProgramFiles");
// if (programFilesEnv != null) {
// return Paths.get(programFilesEnv);
// } else {
// return Paths.get("C:");
// }
// } else {
// return Paths.get("/");
// }
// }
//
// public static Path getDataDirectory() {
// Path dataDir;
//
// if (isWindows()) {
// dataDir = Paths.get(System.getenv("APPDATA"), "Archivo");
// } else if (isMacOS()) {
// dataDir = Paths.get(System.getProperty("user.home"), "Library", "Application Support", "Archivo");
// } else {
// dataDir = Paths.get(System.getProperty("user.home"), ".archivo");
// }
//
// return dataDir;
// }
//
// public static String getFileBrowserName() {
// if (isWindows()) {
// return "File Explorer";
// } else if (isMacOS()) {
// return "Finder";
// } else {
// return "File Browser";
// }
// }
// }
|
import java.util.HashMap;
import java.util.Map;
import net.straylightlabs.archivo.utilities.OSHelper;
import java.util.Collections;
|
"--normalize-mix 1 " +
"--modulus 2 -m --x265-preset veryfast ", getPlatformAudioEncoder());
map.put(H265, parseArgs(args));
return map;
}
private static Map<String, String> parseArgs(String argString) {
Map<String, String> map = new HashMap<>();
String[] args = argString.split("\\s+");
int i;
for (i = 0; i + 1 < args.length; i++) {
if (args[i + 1].startsWith("-")) {
// Single parameter
map.put(args[i], null);
} else {
// Parameter with a value
map.put(args[i], args[i + 1]);
i++;
}
}
if (i < args.length) {
map.put(args[i], null);
}
return map;
}
public static String getPlatformAudioEncoder() {
|
// Path: src/net/straylightlabs/archivo/utilities/OSHelper.java
// public class OSHelper {
// private static final String osName;
// private static final Runtime runtime;
// private static int cpuThreads;
// private static Boolean isAMD64;
// private static String exeSuffix;
//
// @SuppressWarnings("unused")
// private final static Logger logger = LoggerFactory.getLogger(OSHelper.class);
//
// static {
// osName = System.getProperty("os.name").toLowerCase();
// runtime = Runtime.getRuntime();
// }
//
// public static boolean isWindows() {
// return osName.startsWith("windows");
// }
//
// public static boolean isMacOS() {
// return osName.startsWith("mac os");
// }
//
// public static String getExeSuffix() {
// if (exeSuffix == null) {
// if (isWindows()) {
// exeSuffix = ".exe";
// } else {
// exeSuffix = "";
// }
// }
// return exeSuffix;
// }
//
// public static String getArchSuffix() {
// if (isWindows()) {
// if (isAMD64()) {
// return "-64";
// } else {
// return "-32";
// }
// } else {
// return "";
// }
// }
//
// private static boolean isAMD64() {
// if (isAMD64 == null) {
// String arch = System.getenv("PROCESSOR_ARCHITECTURE");
// isAMD64 = arch.equalsIgnoreCase("amd64");
// }
// return isAMD64;
// }
//
// public static int getProcessorThreads() {
// if (cpuThreads == 0) {
// cpuThreads = runtime.availableProcessors();
// }
// return cpuThreads;
// }
//
// @SuppressWarnings("unused")
// public static Path getApplicationDirectory() {
// if (isWindows()) {
// String programFilesEnv = System.getenv("ProgramFiles");
// if (programFilesEnv != null) {
// return Paths.get(programFilesEnv);
// } else {
// return Paths.get("C:");
// }
// } else {
// return Paths.get("/");
// }
// }
//
// public static Path getDataDirectory() {
// Path dataDir;
//
// if (isWindows()) {
// dataDir = Paths.get(System.getenv("APPDATA"), "Archivo");
// } else if (isMacOS()) {
// dataDir = Paths.get(System.getProperty("user.home"), "Library", "Application Support", "Archivo");
// } else {
// dataDir = Paths.get(System.getProperty("user.home"), ".archivo");
// }
//
// return dataDir;
// }
//
// public static String getFileBrowserName() {
// if (isWindows()) {
// return "File Explorer";
// } else if (isMacOS()) {
// return "Finder";
// } else {
// return "File Browser";
// }
// }
// }
// Path: src/net/straylightlabs/archivo/model/FileType.java
import java.util.HashMap;
import java.util.Map;
import net.straylightlabs.archivo.utilities.OSHelper;
import java.util.Collections;
"--normalize-mix 1 " +
"--modulus 2 -m --x265-preset veryfast ", getPlatformAudioEncoder());
map.put(H265, parseArgs(args));
return map;
}
private static Map<String, String> parseArgs(String argString) {
Map<String, String> map = new HashMap<>();
String[] args = argString.split("\\s+");
int i;
for (i = 0; i + 1 < args.length; i++) {
if (args[i + 1].startsWith("-")) {
// Single parameter
map.put(args[i], null);
} else {
// Parameter with a value
map.put(args[i], args[i + 1]);
i++;
}
}
if (i < args.length) {
map.put(args[i], null);
}
return map;
}
public static String getPlatformAudioEncoder() {
|
if (OSHelper.isMacOS()) {
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/Controllers/DashboardController.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/SecurityConfiguration.java
// @Configuration
// @EnableGlobalMethodSecurity(securedEnabled = true)
// public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
//
// static final String MANAGER = "MANAGER";
// static final String CLIENT = "CLIENT";
//
// @Autowired
// public UserRepositoryAuthenticationProvider authenticationProvider;
//
//
// @Override
// protected void configure(HttpSecurity http) throws Exception {
//
// // Login form configuration
// http.formLogin().loginPage("/");
// http.formLogin().usernameParameter("id");
// http.formLogin().passwordParameter("password");
// http.formLogin().defaultSuccessUrl("/");
//
// http.formLogin().failureUrl("/");
//
// // Logout
// http.logout().logoutUrl("/logout"); http.logout().logoutSuccessUrl("/");
//
// // Public routes
// http.authorizeRequests().antMatchers("/").permitAll();
// http.authorizeRequests().antMatchers("/resources/**").permitAll();
//
// // Dashboard access (Veterinary management)
// http.authorizeRequests().antMatchers("/dashboard/**").hasAnyRole("MANAGER");
//
//
// // Disable CSRF by the moment
// http.csrf().disable();
//
// }
//
// @Override
// protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// // Database authentication provider
// auth.authenticationProvider(authenticationProvider);
// // Users
//
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
|
import es.urjc.etsii.mtenrero.SecurityConfiguration;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
|
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class DashboardController {
@RequestMapping("/dashboard")
public String getLanding(Model model) {
|
// Path: src/main/java/es/urjc/etsii/mtenrero/SecurityConfiguration.java
// @Configuration
// @EnableGlobalMethodSecurity(securedEnabled = true)
// public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
//
// static final String MANAGER = "MANAGER";
// static final String CLIENT = "CLIENT";
//
// @Autowired
// public UserRepositoryAuthenticationProvider authenticationProvider;
//
//
// @Override
// protected void configure(HttpSecurity http) throws Exception {
//
// // Login form configuration
// http.formLogin().loginPage("/");
// http.formLogin().usernameParameter("id");
// http.formLogin().passwordParameter("password");
// http.formLogin().defaultSuccessUrl("/");
//
// http.formLogin().failureUrl("/");
//
// // Logout
// http.logout().logoutUrl("/logout"); http.logout().logoutSuccessUrl("/");
//
// // Public routes
// http.authorizeRequests().antMatchers("/").permitAll();
// http.authorizeRequests().antMatchers("/resources/**").permitAll();
//
// // Dashboard access (Veterinary management)
// http.authorizeRequests().antMatchers("/dashboard/**").hasAnyRole("MANAGER");
//
//
// // Disable CSRF by the moment
// http.csrf().disable();
//
// }
//
// @Override
// protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// // Database authentication provider
// auth.authenticationProvider(authenticationProvider);
// // Users
//
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/Controllers/DashboardController.java
import es.urjc.etsii.mtenrero.SecurityConfiguration;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class DashboardController {
@RequestMapping("/dashboard")
public String getLanding(Model model) {
|
model.addAttribute("title", VetmanagerApplication.appName + ": Dashboard");
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/Controllers/InventoryController.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Entities/Item.java
// @Entity
// public class Item implements Serializable{
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private long id;
// private String name;
// private String factory;
// private int quantity;
// private long price;
// private String definition;
// private String diseases;
// private String caducity;
// private String category;
// private String species;
// public String getName() {
// return name;
// }
//
// public Item() {
//
// }
//
// public Item(String name, String factory, int quantity, long price, String definition) {
// this.name = name;
// this.factory = factory;
// this.quantity = quantity;
// this.price = price;
// this.definition = definition;
//
// }
//
//
//
// public long getId() {
// return id;
// }
//
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getFactory() {
// return factory;
// }
//
// public void setFactory(String factory) {
// this.factory = factory;
// }
//
// public int getQuantity() {
// return quantity;
// }
//
// public void setQuantity(int quantity) {
// this.quantity = quantity;
// }
//
// public long getPrice() {
// return price;
// }
//
// public void setPrice(long price) {
// this.price = price;
// }
//
// public String getDefinition() {
// return definition;
// }
//
// public void setDefinition(String definition) {
// this.definition = definition;
// }
//
// public String getCaducity() {
// return caducity;
// }
//
// public void setCaducity(String caducity) {
// this.caducity = caducity;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getSpecies() {
// return species;
// }
//
// public void setSpecies(String species) {
// this.species = species;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getDiseases() {
// return diseases;
// }
//
// public void setDiseases(String diseases) {
// this.diseases = diseases;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ItemRepository.java
// public interface ItemRepository extends JpaRepository<Item,Long> {
// @CachePut("vetmanager")
// Item save(Item item);
// @Cacheable("vetmanager")
// Item findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
|
import es.urjc.etsii.mtenrero.Entities.Item;
import es.urjc.etsii.mtenrero.Repositories.ItemRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.awt.print.Pageable;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
|
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class InventoryController {
@Autowired
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Entities/Item.java
// @Entity
// public class Item implements Serializable{
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private long id;
// private String name;
// private String factory;
// private int quantity;
// private long price;
// private String definition;
// private String diseases;
// private String caducity;
// private String category;
// private String species;
// public String getName() {
// return name;
// }
//
// public Item() {
//
// }
//
// public Item(String name, String factory, int quantity, long price, String definition) {
// this.name = name;
// this.factory = factory;
// this.quantity = quantity;
// this.price = price;
// this.definition = definition;
//
// }
//
//
//
// public long getId() {
// return id;
// }
//
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getFactory() {
// return factory;
// }
//
// public void setFactory(String factory) {
// this.factory = factory;
// }
//
// public int getQuantity() {
// return quantity;
// }
//
// public void setQuantity(int quantity) {
// this.quantity = quantity;
// }
//
// public long getPrice() {
// return price;
// }
//
// public void setPrice(long price) {
// this.price = price;
// }
//
// public String getDefinition() {
// return definition;
// }
//
// public void setDefinition(String definition) {
// this.definition = definition;
// }
//
// public String getCaducity() {
// return caducity;
// }
//
// public void setCaducity(String caducity) {
// this.caducity = caducity;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getSpecies() {
// return species;
// }
//
// public void setSpecies(String species) {
// this.species = species;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getDiseases() {
// return diseases;
// }
//
// public void setDiseases(String diseases) {
// this.diseases = diseases;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ItemRepository.java
// public interface ItemRepository extends JpaRepository<Item,Long> {
// @CachePut("vetmanager")
// Item save(Item item);
// @Cacheable("vetmanager")
// Item findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/Controllers/InventoryController.java
import es.urjc.etsii.mtenrero.Entities.Item;
import es.urjc.etsii.mtenrero.Repositories.ItemRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.awt.print.Pageable;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class InventoryController {
@Autowired
|
ItemRepository itemRepository;
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/Controllers/InventoryController.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Entities/Item.java
// @Entity
// public class Item implements Serializable{
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private long id;
// private String name;
// private String factory;
// private int quantity;
// private long price;
// private String definition;
// private String diseases;
// private String caducity;
// private String category;
// private String species;
// public String getName() {
// return name;
// }
//
// public Item() {
//
// }
//
// public Item(String name, String factory, int quantity, long price, String definition) {
// this.name = name;
// this.factory = factory;
// this.quantity = quantity;
// this.price = price;
// this.definition = definition;
//
// }
//
//
//
// public long getId() {
// return id;
// }
//
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getFactory() {
// return factory;
// }
//
// public void setFactory(String factory) {
// this.factory = factory;
// }
//
// public int getQuantity() {
// return quantity;
// }
//
// public void setQuantity(int quantity) {
// this.quantity = quantity;
// }
//
// public long getPrice() {
// return price;
// }
//
// public void setPrice(long price) {
// this.price = price;
// }
//
// public String getDefinition() {
// return definition;
// }
//
// public void setDefinition(String definition) {
// this.definition = definition;
// }
//
// public String getCaducity() {
// return caducity;
// }
//
// public void setCaducity(String caducity) {
// this.caducity = caducity;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getSpecies() {
// return species;
// }
//
// public void setSpecies(String species) {
// this.species = species;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getDiseases() {
// return diseases;
// }
//
// public void setDiseases(String diseases) {
// this.diseases = diseases;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ItemRepository.java
// public interface ItemRepository extends JpaRepository<Item,Long> {
// @CachePut("vetmanager")
// Item save(Item item);
// @Cacheable("vetmanager")
// Item findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
|
import es.urjc.etsii.mtenrero.Entities.Item;
import es.urjc.etsii.mtenrero.Repositories.ItemRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.awt.print.Pageable;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
|
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class InventoryController {
@Autowired
ItemRepository itemRepository;
@RequestMapping("/dashboard/inventory")
public String getLanding(Model model, Pageable page) {
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Entities/Item.java
// @Entity
// public class Item implements Serializable{
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private long id;
// private String name;
// private String factory;
// private int quantity;
// private long price;
// private String definition;
// private String diseases;
// private String caducity;
// private String category;
// private String species;
// public String getName() {
// return name;
// }
//
// public Item() {
//
// }
//
// public Item(String name, String factory, int quantity, long price, String definition) {
// this.name = name;
// this.factory = factory;
// this.quantity = quantity;
// this.price = price;
// this.definition = definition;
//
// }
//
//
//
// public long getId() {
// return id;
// }
//
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getFactory() {
// return factory;
// }
//
// public void setFactory(String factory) {
// this.factory = factory;
// }
//
// public int getQuantity() {
// return quantity;
// }
//
// public void setQuantity(int quantity) {
// this.quantity = quantity;
// }
//
// public long getPrice() {
// return price;
// }
//
// public void setPrice(long price) {
// this.price = price;
// }
//
// public String getDefinition() {
// return definition;
// }
//
// public void setDefinition(String definition) {
// this.definition = definition;
// }
//
// public String getCaducity() {
// return caducity;
// }
//
// public void setCaducity(String caducity) {
// this.caducity = caducity;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getSpecies() {
// return species;
// }
//
// public void setSpecies(String species) {
// this.species = species;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getDiseases() {
// return diseases;
// }
//
// public void setDiseases(String diseases) {
// this.diseases = diseases;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ItemRepository.java
// public interface ItemRepository extends JpaRepository<Item,Long> {
// @CachePut("vetmanager")
// Item save(Item item);
// @Cacheable("vetmanager")
// Item findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/Controllers/InventoryController.java
import es.urjc.etsii.mtenrero.Entities.Item;
import es.urjc.etsii.mtenrero.Repositories.ItemRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.awt.print.Pageable;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class InventoryController {
@Autowired
ItemRepository itemRepository;
@RequestMapping("/dashboard/inventory")
public String getLanding(Model model, Pageable page) {
|
model.addAttribute("title", VetmanagerApplication.appName + ": Inventory");
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/Controllers/InventoryController.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Entities/Item.java
// @Entity
// public class Item implements Serializable{
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private long id;
// private String name;
// private String factory;
// private int quantity;
// private long price;
// private String definition;
// private String diseases;
// private String caducity;
// private String category;
// private String species;
// public String getName() {
// return name;
// }
//
// public Item() {
//
// }
//
// public Item(String name, String factory, int quantity, long price, String definition) {
// this.name = name;
// this.factory = factory;
// this.quantity = quantity;
// this.price = price;
// this.definition = definition;
//
// }
//
//
//
// public long getId() {
// return id;
// }
//
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getFactory() {
// return factory;
// }
//
// public void setFactory(String factory) {
// this.factory = factory;
// }
//
// public int getQuantity() {
// return quantity;
// }
//
// public void setQuantity(int quantity) {
// this.quantity = quantity;
// }
//
// public long getPrice() {
// return price;
// }
//
// public void setPrice(long price) {
// this.price = price;
// }
//
// public String getDefinition() {
// return definition;
// }
//
// public void setDefinition(String definition) {
// this.definition = definition;
// }
//
// public String getCaducity() {
// return caducity;
// }
//
// public void setCaducity(String caducity) {
// this.caducity = caducity;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getSpecies() {
// return species;
// }
//
// public void setSpecies(String species) {
// this.species = species;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getDiseases() {
// return diseases;
// }
//
// public void setDiseases(String diseases) {
// this.diseases = diseases;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ItemRepository.java
// public interface ItemRepository extends JpaRepository<Item,Long> {
// @CachePut("vetmanager")
// Item save(Item item);
// @Cacheable("vetmanager")
// Item findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
|
import es.urjc.etsii.mtenrero.Entities.Item;
import es.urjc.etsii.mtenrero.Repositories.ItemRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.awt.print.Pageable;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
|
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class InventoryController {
@Autowired
ItemRepository itemRepository;
@RequestMapping("/dashboard/inventory")
public String getLanding(Model model, Pageable page) {
model.addAttribute("title", VetmanagerApplication.appName + ": Inventory");
model.addAttribute("navInventory", true);
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Entities/Item.java
// @Entity
// public class Item implements Serializable{
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private long id;
// private String name;
// private String factory;
// private int quantity;
// private long price;
// private String definition;
// private String diseases;
// private String caducity;
// private String category;
// private String species;
// public String getName() {
// return name;
// }
//
// public Item() {
//
// }
//
// public Item(String name, String factory, int quantity, long price, String definition) {
// this.name = name;
// this.factory = factory;
// this.quantity = quantity;
// this.price = price;
// this.definition = definition;
//
// }
//
//
//
// public long getId() {
// return id;
// }
//
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getFactory() {
// return factory;
// }
//
// public void setFactory(String factory) {
// this.factory = factory;
// }
//
// public int getQuantity() {
// return quantity;
// }
//
// public void setQuantity(int quantity) {
// this.quantity = quantity;
// }
//
// public long getPrice() {
// return price;
// }
//
// public void setPrice(long price) {
// this.price = price;
// }
//
// public String getDefinition() {
// return definition;
// }
//
// public void setDefinition(String definition) {
// this.definition = definition;
// }
//
// public String getCaducity() {
// return caducity;
// }
//
// public void setCaducity(String caducity) {
// this.caducity = caducity;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getSpecies() {
// return species;
// }
//
// public void setSpecies(String species) {
// this.species = species;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getDiseases() {
// return diseases;
// }
//
// public void setDiseases(String diseases) {
// this.diseases = diseases;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ItemRepository.java
// public interface ItemRepository extends JpaRepository<Item,Long> {
// @CachePut("vetmanager")
// Item save(Item item);
// @Cacheable("vetmanager")
// Item findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/Controllers/InventoryController.java
import es.urjc.etsii.mtenrero.Entities.Item;
import es.urjc.etsii.mtenrero.Repositories.ItemRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.awt.print.Pageable;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class InventoryController {
@Autowired
ItemRepository itemRepository;
@RequestMapping("/dashboard/inventory")
public String getLanding(Model model, Pageable page) {
model.addAttribute("title", VetmanagerApplication.appName + ": Inventory");
model.addAttribute("navInventory", true);
|
model.addAttribute("Item",itemRepository.findAll());
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/UserRepositoryAuthenticationProvider.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/BusinessLogic/Helpers/ParseHelper.java
// public class ParseHelper {
// /** Return a List with all words in a given String **/
// public static List<String> stringSplitter(String string) {
// String[] words = string.split(" ");
// return Arrays.asList(words);
// }
//
// /** Check if a String can be casted to Integer **/
// public static boolean isInteger(String string) {
// boolean isNumber = true;
// try {
// Integer.parseInt(string);
// } catch (final NumberFormatException exception) {
// isNumber = false;
// }
// return isNumber;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Entities/User.java
// @MappedSuperclass
// public abstract class User implements Serializable {
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private long id;
// @Column(unique=true)
// private String logon;
// private String password;
// @ElementCollection(fetch = FetchType.EAGER)
// private List<String> roles;
//
// public User() {
// this.roles = new ArrayList<>();
// }
//
// public User(String name, String password, String... roles) {
// this.logon = name;
// this.password = new BCryptPasswordEncoder().encode(password);
// this.roles = new ArrayList<>(Arrays.asList(roles));
// }
//
// public String getLogon() {
// return logon;
// }
//
// public void setLogon(String logon) {
// this.logon = logon;
// }
//
// public String getPasswordHash() {
// return password;
// }
//
// public void setPasswordHash(String password) {
// this.password = new BCryptPasswordEncoder().encode(password);
// }
//
// public void setRoles(String... roles) {
// this.roles = new ArrayList<>(Arrays.asList(roles));
// }
//
// public List<String> getRoles() {
// return roles;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ManagerRepository.java
// @Transactional
// public interface ManagerRepository extends UserRepository<Manager> {
// }
|
import es.urjc.etsii.mtenrero.BusinessLogic.Helpers.ParseHelper;
import es.urjc.etsii.mtenrero.Entities.User;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.ManagerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
|
package es.urjc.etsii.mtenrero;
/**
* Created by was12 on 14/03/2017.
*/
@Component
public class UserRepositoryAuthenticationProvider implements AuthenticationProvider {
@Autowired
|
// Path: src/main/java/es/urjc/etsii/mtenrero/BusinessLogic/Helpers/ParseHelper.java
// public class ParseHelper {
// /** Return a List with all words in a given String **/
// public static List<String> stringSplitter(String string) {
// String[] words = string.split(" ");
// return Arrays.asList(words);
// }
//
// /** Check if a String can be casted to Integer **/
// public static boolean isInteger(String string) {
// boolean isNumber = true;
// try {
// Integer.parseInt(string);
// } catch (final NumberFormatException exception) {
// isNumber = false;
// }
// return isNumber;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Entities/User.java
// @MappedSuperclass
// public abstract class User implements Serializable {
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private long id;
// @Column(unique=true)
// private String logon;
// private String password;
// @ElementCollection(fetch = FetchType.EAGER)
// private List<String> roles;
//
// public User() {
// this.roles = new ArrayList<>();
// }
//
// public User(String name, String password, String... roles) {
// this.logon = name;
// this.password = new BCryptPasswordEncoder().encode(password);
// this.roles = new ArrayList<>(Arrays.asList(roles));
// }
//
// public String getLogon() {
// return logon;
// }
//
// public void setLogon(String logon) {
// this.logon = logon;
// }
//
// public String getPasswordHash() {
// return password;
// }
//
// public void setPasswordHash(String password) {
// this.password = new BCryptPasswordEncoder().encode(password);
// }
//
// public void setRoles(String... roles) {
// this.roles = new ArrayList<>(Arrays.asList(roles));
// }
//
// public List<String> getRoles() {
// return roles;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ManagerRepository.java
// @Transactional
// public interface ManagerRepository extends UserRepository<Manager> {
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/UserRepositoryAuthenticationProvider.java
import es.urjc.etsii.mtenrero.BusinessLogic.Helpers.ParseHelper;
import es.urjc.etsii.mtenrero.Entities.User;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.ManagerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
package es.urjc.etsii.mtenrero;
/**
* Created by was12 on 14/03/2017.
*/
@Component
public class UserRepositoryAuthenticationProvider implements AuthenticationProvider {
@Autowired
|
private ClientRepository clientRepository;
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/UserRepositoryAuthenticationProvider.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/BusinessLogic/Helpers/ParseHelper.java
// public class ParseHelper {
// /** Return a List with all words in a given String **/
// public static List<String> stringSplitter(String string) {
// String[] words = string.split(" ");
// return Arrays.asList(words);
// }
//
// /** Check if a String can be casted to Integer **/
// public static boolean isInteger(String string) {
// boolean isNumber = true;
// try {
// Integer.parseInt(string);
// } catch (final NumberFormatException exception) {
// isNumber = false;
// }
// return isNumber;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Entities/User.java
// @MappedSuperclass
// public abstract class User implements Serializable {
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private long id;
// @Column(unique=true)
// private String logon;
// private String password;
// @ElementCollection(fetch = FetchType.EAGER)
// private List<String> roles;
//
// public User() {
// this.roles = new ArrayList<>();
// }
//
// public User(String name, String password, String... roles) {
// this.logon = name;
// this.password = new BCryptPasswordEncoder().encode(password);
// this.roles = new ArrayList<>(Arrays.asList(roles));
// }
//
// public String getLogon() {
// return logon;
// }
//
// public void setLogon(String logon) {
// this.logon = logon;
// }
//
// public String getPasswordHash() {
// return password;
// }
//
// public void setPasswordHash(String password) {
// this.password = new BCryptPasswordEncoder().encode(password);
// }
//
// public void setRoles(String... roles) {
// this.roles = new ArrayList<>(Arrays.asList(roles));
// }
//
// public List<String> getRoles() {
// return roles;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ManagerRepository.java
// @Transactional
// public interface ManagerRepository extends UserRepository<Manager> {
// }
|
import es.urjc.etsii.mtenrero.BusinessLogic.Helpers.ParseHelper;
import es.urjc.etsii.mtenrero.Entities.User;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.ManagerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
|
package es.urjc.etsii.mtenrero;
/**
* Created by was12 on 14/03/2017.
*/
@Component
public class UserRepositoryAuthenticationProvider implements AuthenticationProvider {
@Autowired
private ClientRepository clientRepository;
@Autowired
|
// Path: src/main/java/es/urjc/etsii/mtenrero/BusinessLogic/Helpers/ParseHelper.java
// public class ParseHelper {
// /** Return a List with all words in a given String **/
// public static List<String> stringSplitter(String string) {
// String[] words = string.split(" ");
// return Arrays.asList(words);
// }
//
// /** Check if a String can be casted to Integer **/
// public static boolean isInteger(String string) {
// boolean isNumber = true;
// try {
// Integer.parseInt(string);
// } catch (final NumberFormatException exception) {
// isNumber = false;
// }
// return isNumber;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Entities/User.java
// @MappedSuperclass
// public abstract class User implements Serializable {
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private long id;
// @Column(unique=true)
// private String logon;
// private String password;
// @ElementCollection(fetch = FetchType.EAGER)
// private List<String> roles;
//
// public User() {
// this.roles = new ArrayList<>();
// }
//
// public User(String name, String password, String... roles) {
// this.logon = name;
// this.password = new BCryptPasswordEncoder().encode(password);
// this.roles = new ArrayList<>(Arrays.asList(roles));
// }
//
// public String getLogon() {
// return logon;
// }
//
// public void setLogon(String logon) {
// this.logon = logon;
// }
//
// public String getPasswordHash() {
// return password;
// }
//
// public void setPasswordHash(String password) {
// this.password = new BCryptPasswordEncoder().encode(password);
// }
//
// public void setRoles(String... roles) {
// this.roles = new ArrayList<>(Arrays.asList(roles));
// }
//
// public List<String> getRoles() {
// return roles;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ManagerRepository.java
// @Transactional
// public interface ManagerRepository extends UserRepository<Manager> {
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/UserRepositoryAuthenticationProvider.java
import es.urjc.etsii.mtenrero.BusinessLogic.Helpers.ParseHelper;
import es.urjc.etsii.mtenrero.Entities.User;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.ManagerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
package es.urjc.etsii.mtenrero;
/**
* Created by was12 on 14/03/2017.
*/
@Component
public class UserRepositoryAuthenticationProvider implements AuthenticationProvider {
@Autowired
private ClientRepository clientRepository;
@Autowired
|
private ManagerRepository managerRepository;
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/UserRepositoryAuthenticationProvider.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/BusinessLogic/Helpers/ParseHelper.java
// public class ParseHelper {
// /** Return a List with all words in a given String **/
// public static List<String> stringSplitter(String string) {
// String[] words = string.split(" ");
// return Arrays.asList(words);
// }
//
// /** Check if a String can be casted to Integer **/
// public static boolean isInteger(String string) {
// boolean isNumber = true;
// try {
// Integer.parseInt(string);
// } catch (final NumberFormatException exception) {
// isNumber = false;
// }
// return isNumber;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Entities/User.java
// @MappedSuperclass
// public abstract class User implements Serializable {
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private long id;
// @Column(unique=true)
// private String logon;
// private String password;
// @ElementCollection(fetch = FetchType.EAGER)
// private List<String> roles;
//
// public User() {
// this.roles = new ArrayList<>();
// }
//
// public User(String name, String password, String... roles) {
// this.logon = name;
// this.password = new BCryptPasswordEncoder().encode(password);
// this.roles = new ArrayList<>(Arrays.asList(roles));
// }
//
// public String getLogon() {
// return logon;
// }
//
// public void setLogon(String logon) {
// this.logon = logon;
// }
//
// public String getPasswordHash() {
// return password;
// }
//
// public void setPasswordHash(String password) {
// this.password = new BCryptPasswordEncoder().encode(password);
// }
//
// public void setRoles(String... roles) {
// this.roles = new ArrayList<>(Arrays.asList(roles));
// }
//
// public List<String> getRoles() {
// return roles;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ManagerRepository.java
// @Transactional
// public interface ManagerRepository extends UserRepository<Manager> {
// }
|
import es.urjc.etsii.mtenrero.BusinessLogic.Helpers.ParseHelper;
import es.urjc.etsii.mtenrero.Entities.User;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.ManagerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
|
package es.urjc.etsii.mtenrero;
/**
* Created by was12 on 14/03/2017.
*/
@Component
public class UserRepositoryAuthenticationProvider implements AuthenticationProvider {
@Autowired
private ClientRepository clientRepository;
@Autowired
private ManagerRepository managerRepository;
@Override
public Authentication authenticate(Authentication auth) throws AuthenticationException {
|
// Path: src/main/java/es/urjc/etsii/mtenrero/BusinessLogic/Helpers/ParseHelper.java
// public class ParseHelper {
// /** Return a List with all words in a given String **/
// public static List<String> stringSplitter(String string) {
// String[] words = string.split(" ");
// return Arrays.asList(words);
// }
//
// /** Check if a String can be casted to Integer **/
// public static boolean isInteger(String string) {
// boolean isNumber = true;
// try {
// Integer.parseInt(string);
// } catch (final NumberFormatException exception) {
// isNumber = false;
// }
// return isNumber;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Entities/User.java
// @MappedSuperclass
// public abstract class User implements Serializable {
// @Id
// @GeneratedValue(strategy = GenerationType.AUTO)
// private long id;
// @Column(unique=true)
// private String logon;
// private String password;
// @ElementCollection(fetch = FetchType.EAGER)
// private List<String> roles;
//
// public User() {
// this.roles = new ArrayList<>();
// }
//
// public User(String name, String password, String... roles) {
// this.logon = name;
// this.password = new BCryptPasswordEncoder().encode(password);
// this.roles = new ArrayList<>(Arrays.asList(roles));
// }
//
// public String getLogon() {
// return logon;
// }
//
// public void setLogon(String logon) {
// this.logon = logon;
// }
//
// public String getPasswordHash() {
// return password;
// }
//
// public void setPasswordHash(String password) {
// this.password = new BCryptPasswordEncoder().encode(password);
// }
//
// public void setRoles(String... roles) {
// this.roles = new ArrayList<>(Arrays.asList(roles));
// }
//
// public List<String> getRoles() {
// return roles;
// }
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ManagerRepository.java
// @Transactional
// public interface ManagerRepository extends UserRepository<Manager> {
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/UserRepositoryAuthenticationProvider.java
import es.urjc.etsii.mtenrero.BusinessLogic.Helpers.ParseHelper;
import es.urjc.etsii.mtenrero.Entities.User;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.ManagerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
package es.urjc.etsii.mtenrero;
/**
* Created by was12 on 14/03/2017.
*/
@Component
public class UserRepositoryAuthenticationProvider implements AuthenticationProvider {
@Autowired
private ClientRepository clientRepository;
@Autowired
private ManagerRepository managerRepository;
@Override
public Authentication authenticate(Authentication auth) throws AuthenticationException {
|
User user = findUser(auth.getName());
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/Controllers/PetsController.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/PetRepository.java
// public interface PetRepository extends JpaRepository<Pet, Long> {
// @CachePut("vetmanager")
// Pet save(Pet pet);
// @Cacheable("vetmanager")
// Pet findById(long id);
//
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_BreedRepository.java
// public interface Pet_BreedRepository extends JpaRepository<Pet_Breed, Long> {
// List<Pet_Breed> findByBreed(String breed);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_WeightHistoryRepository.java
// public interface Pet_WeightHistoryRepository extends JpaRepository<Pet_WeightHistory, Long> {
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
|
import es.urjc.etsii.mtenrero.Entities.*;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.PetRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_BreedRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_WeightHistoryRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import java.text.DateFormat;
import java.util.List;
import java.util.Optional;
|
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class PetsController {
@Autowired
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/PetRepository.java
// public interface PetRepository extends JpaRepository<Pet, Long> {
// @CachePut("vetmanager")
// Pet save(Pet pet);
// @Cacheable("vetmanager")
// Pet findById(long id);
//
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_BreedRepository.java
// public interface Pet_BreedRepository extends JpaRepository<Pet_Breed, Long> {
// List<Pet_Breed> findByBreed(String breed);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_WeightHistoryRepository.java
// public interface Pet_WeightHistoryRepository extends JpaRepository<Pet_WeightHistory, Long> {
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/Controllers/PetsController.java
import es.urjc.etsii.mtenrero.Entities.*;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.PetRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_BreedRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_WeightHistoryRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import java.text.DateFormat;
import java.util.List;
import java.util.Optional;
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class PetsController {
@Autowired
|
private PetRepository petRepository;
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/Controllers/PetsController.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/PetRepository.java
// public interface PetRepository extends JpaRepository<Pet, Long> {
// @CachePut("vetmanager")
// Pet save(Pet pet);
// @Cacheable("vetmanager")
// Pet findById(long id);
//
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_BreedRepository.java
// public interface Pet_BreedRepository extends JpaRepository<Pet_Breed, Long> {
// List<Pet_Breed> findByBreed(String breed);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_WeightHistoryRepository.java
// public interface Pet_WeightHistoryRepository extends JpaRepository<Pet_WeightHistory, Long> {
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
|
import es.urjc.etsii.mtenrero.Entities.*;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.PetRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_BreedRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_WeightHistoryRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import java.text.DateFormat;
import java.util.List;
import java.util.Optional;
|
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class PetsController {
@Autowired
private PetRepository petRepository;
@Autowired
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/PetRepository.java
// public interface PetRepository extends JpaRepository<Pet, Long> {
// @CachePut("vetmanager")
// Pet save(Pet pet);
// @Cacheable("vetmanager")
// Pet findById(long id);
//
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_BreedRepository.java
// public interface Pet_BreedRepository extends JpaRepository<Pet_Breed, Long> {
// List<Pet_Breed> findByBreed(String breed);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_WeightHistoryRepository.java
// public interface Pet_WeightHistoryRepository extends JpaRepository<Pet_WeightHistory, Long> {
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/Controllers/PetsController.java
import es.urjc.etsii.mtenrero.Entities.*;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.PetRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_BreedRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_WeightHistoryRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import java.text.DateFormat;
import java.util.List;
import java.util.Optional;
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class PetsController {
@Autowired
private PetRepository petRepository;
@Autowired
|
private ClientRepository clientRepository;
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/Controllers/PetsController.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/PetRepository.java
// public interface PetRepository extends JpaRepository<Pet, Long> {
// @CachePut("vetmanager")
// Pet save(Pet pet);
// @Cacheable("vetmanager")
// Pet findById(long id);
//
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_BreedRepository.java
// public interface Pet_BreedRepository extends JpaRepository<Pet_Breed, Long> {
// List<Pet_Breed> findByBreed(String breed);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_WeightHistoryRepository.java
// public interface Pet_WeightHistoryRepository extends JpaRepository<Pet_WeightHistory, Long> {
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
|
import es.urjc.etsii.mtenrero.Entities.*;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.PetRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_BreedRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_WeightHistoryRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import java.text.DateFormat;
import java.util.List;
import java.util.Optional;
|
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class PetsController {
@Autowired
private PetRepository petRepository;
@Autowired
private ClientRepository clientRepository;
@Autowired
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/PetRepository.java
// public interface PetRepository extends JpaRepository<Pet, Long> {
// @CachePut("vetmanager")
// Pet save(Pet pet);
// @Cacheable("vetmanager")
// Pet findById(long id);
//
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_BreedRepository.java
// public interface Pet_BreedRepository extends JpaRepository<Pet_Breed, Long> {
// List<Pet_Breed> findByBreed(String breed);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_WeightHistoryRepository.java
// public interface Pet_WeightHistoryRepository extends JpaRepository<Pet_WeightHistory, Long> {
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/Controllers/PetsController.java
import es.urjc.etsii.mtenrero.Entities.*;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.PetRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_BreedRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_WeightHistoryRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import java.text.DateFormat;
import java.util.List;
import java.util.Optional;
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class PetsController {
@Autowired
private PetRepository petRepository;
@Autowired
private ClientRepository clientRepository;
@Autowired
|
private Pet_WeightHistoryRepository petWeightHistoryRepository;
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/Controllers/PetsController.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/PetRepository.java
// public interface PetRepository extends JpaRepository<Pet, Long> {
// @CachePut("vetmanager")
// Pet save(Pet pet);
// @Cacheable("vetmanager")
// Pet findById(long id);
//
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_BreedRepository.java
// public interface Pet_BreedRepository extends JpaRepository<Pet_Breed, Long> {
// List<Pet_Breed> findByBreed(String breed);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_WeightHistoryRepository.java
// public interface Pet_WeightHistoryRepository extends JpaRepository<Pet_WeightHistory, Long> {
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
|
import es.urjc.etsii.mtenrero.Entities.*;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.PetRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_BreedRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_WeightHistoryRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import java.text.DateFormat;
import java.util.List;
import java.util.Optional;
|
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class PetsController {
@Autowired
private PetRepository petRepository;
@Autowired
private ClientRepository clientRepository;
@Autowired
private Pet_WeightHistoryRepository petWeightHistoryRepository;
@Autowired
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/PetRepository.java
// public interface PetRepository extends JpaRepository<Pet, Long> {
// @CachePut("vetmanager")
// Pet save(Pet pet);
// @Cacheable("vetmanager")
// Pet findById(long id);
//
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_BreedRepository.java
// public interface Pet_BreedRepository extends JpaRepository<Pet_Breed, Long> {
// List<Pet_Breed> findByBreed(String breed);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_WeightHistoryRepository.java
// public interface Pet_WeightHistoryRepository extends JpaRepository<Pet_WeightHistory, Long> {
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/Controllers/PetsController.java
import es.urjc.etsii.mtenrero.Entities.*;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.PetRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_BreedRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_WeightHistoryRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import java.text.DateFormat;
import java.util.List;
import java.util.Optional;
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class PetsController {
@Autowired
private PetRepository petRepository;
@Autowired
private ClientRepository clientRepository;
@Autowired
private Pet_WeightHistoryRepository petWeightHistoryRepository;
@Autowired
|
private Pet_BreedRepository pet_breedRepository;
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/Controllers/PetsController.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/PetRepository.java
// public interface PetRepository extends JpaRepository<Pet, Long> {
// @CachePut("vetmanager")
// Pet save(Pet pet);
// @Cacheable("vetmanager")
// Pet findById(long id);
//
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_BreedRepository.java
// public interface Pet_BreedRepository extends JpaRepository<Pet_Breed, Long> {
// List<Pet_Breed> findByBreed(String breed);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_WeightHistoryRepository.java
// public interface Pet_WeightHistoryRepository extends JpaRepository<Pet_WeightHistory, Long> {
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
|
import es.urjc.etsii.mtenrero.Entities.*;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.PetRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_BreedRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_WeightHistoryRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import java.text.DateFormat;
import java.util.List;
import java.util.Optional;
|
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class PetsController {
@Autowired
private PetRepository petRepository;
@Autowired
private ClientRepository clientRepository;
@Autowired
private Pet_WeightHistoryRepository petWeightHistoryRepository;
@Autowired
private Pet_BreedRepository pet_breedRepository;
@PostConstruct
public void init() {
/**
Client client=new Client(02, "caracola","sjsj", 1212, "XXXX");
clientRepository.save(client);
Pet pet=new Pet(1, "Hola aracola", "XXX");
pet.setClient(client);
petRepository.save(pet);**/
}
@GetMapping("/dashboard/pets")
public String getLanding(Model model, Pageable page) {
|
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/ClientRepository.java
// public interface ClientRepository extends UserRepository<Client> {
// @CachePut("vetmanager")
// Client save(Client client);
// @Cacheable("vetmanager")
// Client findByLegalID(int legalID);
//
// Collection<? extends Client> findFirst10ByPhone1(int i);
//
// Collection<? extends Client> findFirst10ByLastNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByFirstNameContainingIgnoreCase(String word);
//
// Collection<? extends Client> findFirst10ByLegalID(int i);
// @Cacheable("vetmanager")
// Client findById(long id);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/PetRepository.java
// public interface PetRepository extends JpaRepository<Pet, Long> {
// @CachePut("vetmanager")
// Pet save(Pet pet);
// @Cacheable("vetmanager")
// Pet findById(long id);
//
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_BreedRepository.java
// public interface Pet_BreedRepository extends JpaRepository<Pet_Breed, Long> {
// List<Pet_Breed> findByBreed(String breed);
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/Repositories/Pet_WeightHistoryRepository.java
// public interface Pet_WeightHistoryRepository extends JpaRepository<Pet_WeightHistory, Long> {
// }
//
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/Controllers/PetsController.java
import es.urjc.etsii.mtenrero.Entities.*;
import es.urjc.etsii.mtenrero.Repositories.ClientRepository;
import es.urjc.etsii.mtenrero.Repositories.PetRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_BreedRepository;
import es.urjc.etsii.mtenrero.Repositories.Pet_WeightHistoryRepository;
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import java.text.DateFormat;
import java.util.List;
import java.util.Optional;
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by mtenrero on 28/01/2017.
*/
@Controller
public class PetsController {
@Autowired
private PetRepository petRepository;
@Autowired
private ClientRepository clientRepository;
@Autowired
private Pet_WeightHistoryRepository petWeightHistoryRepository;
@Autowired
private Pet_BreedRepository pet_breedRepository;
@PostConstruct
public void init() {
/**
Client client=new Client(02, "caracola","sjsj", 1212, "XXXX");
clientRepository.save(client);
Pet pet=new Pet(1, "Hola aracola", "XXX");
pet.setClient(client);
petRepository.save(pet);**/
}
@GetMapping("/dashboard/pets")
public String getLanding(Model model, Pageable page) {
|
model.addAttribute("title", VetmanagerApplication.appName + ": Pets");
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/Controllers/LandingController.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
|
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
|
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by Marcos on 26/01/2017.
*/
@Controller
public class LandingController {
@RequestMapping("/")
public String getLanding(HttpServletRequest request,Model model) {
|
// Path: src/main/java/es/urjc/etsii/mtenrero/VetmanagerApplication.java
// @SpringBootApplication
// public class VetmanagerApplication extends SpringBootServletInitializer {
//
// @Autowired
// static
// ClientRepository clientRepository;
//
// @Autowired
// static
// AppointmentRepository appointmentRepository;
//
//
//
// @Override
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
// return application.sources(VetmanagerApplication.class);
// }
//
// public static String appName = "VetManager";
//
// public static void main(String[] args) {
// SpringApplication.run(VetmanagerApplication.class, args);
//
// HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
// public boolean verify(String hostname, SSLSession session) {
// return true;
// }
// });
//
//
// ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor();
// ses.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.print("HOOOOLA");
// List<Appointment> appointments = appointmentRepository.findAll();
//
// // for (Appointment appointment : appointments) {
// // LocalDate dateBefore;
// // LocalDate dateAfter appointment.g;
// // long daysBetween = HOURS.between(dateBefore, dateAfter);
// // //if (client.getHoursBeforeNotification())
// // }
//
//
// }
// }, 0, 1, TimeUnit.DAYS);
// }
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/Controllers/LandingController.java
import es.urjc.etsii.mtenrero.VetmanagerApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
package es.urjc.etsii.mtenrero.Controllers;
/**
* Created by Marcos on 26/01/2017.
*/
@Controller
public class LandingController {
@RequestMapping("/")
public String getLanding(HttpServletRequest request,Model model) {
|
model.addAttribute("title", VetmanagerApplication.appName);
|
mtenrero/vetManager
|
src/main/java/es/urjc/etsii/mtenrero/Communication.java
|
// Path: src/main/java/es/urjc/etsii/mtenrero/ServicioInterno/MailerResponse.java
// public class MailerResponse {
// boolean ok;
// String message;
//
// public boolean isOk() {
// return ok;
// }
//
// public void setOk(boolean ok) {
// this.ok = ok;
// }
//
// public String getMessage() {
// return message;
// }
//
// public void setMessage(String message) {
// this.message = message;
// }
//
// public MailerResponse() {}
//
// @Autowired
// public MailerResponse(boolean ok, String message) {
// this.ok = ok;
// this.message = message;
// }
// }
|
import es.urjc.etsii.mtenrero.ServicioInterno.MailerResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import javax.net.ssl.SSLSocketFactory;
import javax.xml.ws.Response;
import java.io.*;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Date;
|
package es.urjc.etsii.mtenrero;
/**
* Created by was12 on 15/03/2017.
*/
public class Communication {
public void main(String email,String subject,String body) throws UnknownHostException, IOException{
RestTemplate restTemplate = new RestTemplate();
MultiValueMap<String, String> map= new LinkedMultiValueMap<String, String>();
map.add("email", email);
map.add("subject", subject);
map.add("body", body);
String requestUrl = "http://"+System.getenv("HAPROXY")+":8083/sendEmail";
System.out.println("REQUESTT_>>>>");
System.out.println(requestUrl);
System.out.println(email);
System.out.println(subject);
System.out.println(body);
|
// Path: src/main/java/es/urjc/etsii/mtenrero/ServicioInterno/MailerResponse.java
// public class MailerResponse {
// boolean ok;
// String message;
//
// public boolean isOk() {
// return ok;
// }
//
// public void setOk(boolean ok) {
// this.ok = ok;
// }
//
// public String getMessage() {
// return message;
// }
//
// public void setMessage(String message) {
// this.message = message;
// }
//
// public MailerResponse() {}
//
// @Autowired
// public MailerResponse(boolean ok, String message) {
// this.ok = ok;
// this.message = message;
// }
// }
// Path: src/main/java/es/urjc/etsii/mtenrero/Communication.java
import es.urjc.etsii.mtenrero.ServicioInterno.MailerResponse;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import javax.net.ssl.SSLSocketFactory;
import javax.xml.ws.Response;
import java.io.*;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Date;
package es.urjc.etsii.mtenrero;
/**
* Created by was12 on 15/03/2017.
*/
public class Communication {
public void main(String email,String subject,String body) throws UnknownHostException, IOException{
RestTemplate restTemplate = new RestTemplate();
MultiValueMap<String, String> map= new LinkedMultiValueMap<String, String>();
map.add("email", email);
map.add("subject", subject);
map.add("body", body);
String requestUrl = "http://"+System.getenv("HAPROXY")+":8083/sendEmail";
System.out.println("REQUESTT_>>>>");
System.out.println(requestUrl);
System.out.println(email);
System.out.println(subject);
System.out.println(body);
|
ResponseEntity<MailerResponse> response = restTemplate.postForEntity(requestUrl,map,MailerResponse.class);
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextNaiveBays.java
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
|
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
|
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextNaiveBays {
void LoadDataset(File arffFileName) throws IOException;
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextNaiveBays.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextNaiveBays {
void LoadDataset(File arffFileName) throws IOException;
|
List<Classification> EvaluateNaiveBays() throws Exception;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextDecisionTree.java
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
|
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
|
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextDecisionTree {
void LoadDataset(File arffFileName) throws IOException;
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextDecisionTree.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextDecisionTree {
void LoadDataset(File arffFileName) throws IOException;
|
List<Classification> EvaluateDecisionTree() throws Exception;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/INumberJaccardSimilarity.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
|
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.ExtractNumberSimilarity;
|
package unsw.curation.api.domain.abstraction;
public interface INumberJaccardSimilarity {
double Jaccard_Vector_Vector(double [] number1,double [] number2);
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/INumberJaccardSimilarity.java
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.ExtractNumberSimilarity;
package unsw.curation.api.domain.abstraction;
public interface INumberJaccardSimilarity {
double Jaccard_Vector_Vector(double [] number1,double [] number2);
|
List<ExtractNumberSimilarity> Jaccard_Vector_VectorS(String filePath) throws IOException;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/INumberEuclideanSimilarity.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
|
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.ExtractNumberSimilarity;
|
package unsw.curation.api.domain.abstraction;
public interface INumberEuclideanSimilarity {
double Euclidean_Vector_Vector(double [] number1,double [] number2);
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/INumberEuclideanSimilarity.java
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.ExtractNumberSimilarity;
package unsw.curation.api.domain.abstraction;
public interface INumberEuclideanSimilarity {
double Euclidean_Vector_Vector(double [] number1,double [] number2);
|
List<ExtractNumberSimilarity> Euclidean_Vector_VectorS(String filePath) throws IOException;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/extractsimilarity/ExtractTextJaccardSimilarityImpl.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractTextSimilarity.java
// public class ExtractTextSimilarity {
//
// private String word;
// public void setWord(String word)
// {
// this.word=word;
// }
// public String getWord()
// {
// return this.word;
// }
// private String candidate;
// public void setCandidate(String candidate)
// {
// this.candidate=candidate;
// }
// public String getCandidate()
// {
// return this.candidate;
// }
// private double similarity;
// public void setSimilarity(double similarity)
// {
// this.similarity=similarity;
// }
// public double getSimilarity()
// {
// return this.similarity;
// }
// public ExtractTextSimilarity(){}
// public ExtractTextSimilarity (String Word, String Candidate, double Similarity)
// {
// this.word=Word;
// this.candidate=Candidate;
// this.similarity=Similarity;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/ITextJaccardSimilarity.java
// public interface ITextJaccardSimilarity {
//
// double Jaccard_Word_Word(String word1, String word2);
// List<ExtractTextSimilarity> Jaccard_Word_Document(String word, String filePath) throws IOException;
// double Jaccard_Document_Document(String file1,String file2) throws IOException;
// //List<ExtractTextSimilarity> Jaccard_Document_DocumentS(File filePath, String directoryPath) throws IOException;
//
// }
|
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractTextSimilarity;
import unsw.curation.api.domain.abstraction.ITextJaccardSimilarity;
|
package unsw.curation.api.extractsimilarity;
public class ExtractTextJaccardSimilarityImpl implements ITextJaccardSimilarity
{
@Override
public double Jaccard_Word_Word(String word1, String word2)
{
String [] arrWord1=word1.toLowerCase().split("");
String [] arrWord2=word2.toLowerCase().split("");
HashSet<String> lstUnion=new HashSet<>();
lstUnion.addAll(Arrays.asList(arrWord1));
lstUnion.addAll(Arrays.asList(arrWord2));
HashSet<String> lstIntersect=new HashSet<>();
lstIntersect.addAll(Arrays.asList(arrWord1));
lstIntersect.retainAll(Arrays.asList(arrWord2));
double lstUnoinSize=(double)lstUnion.size();
double lstIntersectSize=(double)lstIntersect.size();
double JaccardSimilarity=lstIntersectSize/lstUnoinSize;
return JaccardSimilarity;
}
@Override
|
// Path: src/main/java/unsw/curation/api/domain/ExtractTextSimilarity.java
// public class ExtractTextSimilarity {
//
// private String word;
// public void setWord(String word)
// {
// this.word=word;
// }
// public String getWord()
// {
// return this.word;
// }
// private String candidate;
// public void setCandidate(String candidate)
// {
// this.candidate=candidate;
// }
// public String getCandidate()
// {
// return this.candidate;
// }
// private double similarity;
// public void setSimilarity(double similarity)
// {
// this.similarity=similarity;
// }
// public double getSimilarity()
// {
// return this.similarity;
// }
// public ExtractTextSimilarity(){}
// public ExtractTextSimilarity (String Word, String Candidate, double Similarity)
// {
// this.word=Word;
// this.candidate=Candidate;
// this.similarity=Similarity;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/ITextJaccardSimilarity.java
// public interface ITextJaccardSimilarity {
//
// double Jaccard_Word_Word(String word1, String word2);
// List<ExtractTextSimilarity> Jaccard_Word_Document(String word, String filePath) throws IOException;
// double Jaccard_Document_Document(String file1,String file2) throws IOException;
// //List<ExtractTextSimilarity> Jaccard_Document_DocumentS(File filePath, String directoryPath) throws IOException;
//
// }
// Path: src/main/java/unsw/curation/api/extractsimilarity/ExtractTextJaccardSimilarityImpl.java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractTextSimilarity;
import unsw.curation.api.domain.abstraction.ITextJaccardSimilarity;
package unsw.curation.api.extractsimilarity;
public class ExtractTextJaccardSimilarityImpl implements ITextJaccardSimilarity
{
@Override
public double Jaccard_Word_Word(String word1, String word2)
{
String [] arrWord1=word1.toLowerCase().split("");
String [] arrWord2=word2.toLowerCase().split("");
HashSet<String> lstUnion=new HashSet<>();
lstUnion.addAll(Arrays.asList(arrWord1));
lstUnion.addAll(Arrays.asList(arrWord2));
HashSet<String> lstIntersect=new HashSet<>();
lstIntersect.addAll(Arrays.asList(arrWord1));
lstIntersect.retainAll(Arrays.asList(arrWord2));
double lstUnoinSize=(double)lstUnion.size();
double lstIntersectSize=(double)lstIntersect.size();
double JaccardSimilarity=lstIntersectSize/lstUnoinSize;
return JaccardSimilarity;
}
@Override
|
public List<ExtractTextSimilarity> Jaccard_Word_Document(String word, String filePath) throws IOException
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextLogisticRegression.java
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
|
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
|
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextLogisticRegression {
void LoadDataset(File arffFileName) throws IOException;
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextLogisticRegression.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextLogisticRegression {
void LoadDataset(File arffFileName) throws IOException;
|
List<Classification> EvaluateLogisticRegression() throws Exception;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/INumberDiceSimilarity.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
|
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.ExtractNumberSimilarity;
|
package unsw.curation.api.domain.abstraction;
public interface INumberDiceSimilarity {
double Dice_Vector_Vector(double [] number1,double [] number2);
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/INumberDiceSimilarity.java
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.ExtractNumberSimilarity;
package unsw.curation.api.domain.abstraction;
public interface INumberDiceSimilarity {
double Dice_Vector_Vector(double [] number1,double [] number2);
|
List<ExtractNumberSimilarity> Dice_Vector_VectorS(String filePath) throws IOException;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextSVM.java
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
|
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
|
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextSVM {
void LoadDataset(File arffFileName) throws IOException;
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextSVM.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextSVM {
void LoadDataset(File arffFileName) throws IOException;
|
List<Classification> EvaluateSVM() throws Exception;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/IKeywordEx.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractionKeyword.java
// public class ExtractionKeyword {
//
// public ExtractionKeyword(){}
// public ExtractionKeyword(String tweet,String keyword)
// {
// this.tweet=tweet;
// this.keyword=keyword;
// }
// public ExtractionKeyword(String keyword)
// {
// this.keyword=keyword;
// }
// public String tweet;
// public String keyword;
// public String inputSentence;
// public String inputTweet;
//
//
// public void setInputSentence(String inputSentence)
// {
// this.inputSentence=inputSentence;
// }
//
// public String getInputSentence()
// {
// return inputSentence;
// }
// public void setInputTweet(String inputTweet)
// {
// this.inputTweet=inputTweet;
// }
// public String getInputTweet()
// {
// return inputTweet;
// }
// public void setTweet(String tweet)
// {
// this.tweet=tweet;
// }
// public String getTweet()
// {
// return tweet;
// }
//
// public void setKeyword(String keyword)
// {
// this.keyword=keyword;
// }
// public String getKeyword()
// {
// return keyword;
// }
//
// }
|
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.ExtractionKeyword;
|
package unsw.curation.api.domain.abstraction;
public interface IKeywordEx {
String ExtractTweetKeyword(String inputTweet,File stopWordList) throws Exception;
|
// Path: src/main/java/unsw/curation/api/domain/ExtractionKeyword.java
// public class ExtractionKeyword {
//
// public ExtractionKeyword(){}
// public ExtractionKeyword(String tweet,String keyword)
// {
// this.tweet=tweet;
// this.keyword=keyword;
// }
// public ExtractionKeyword(String keyword)
// {
// this.keyword=keyword;
// }
// public String tweet;
// public String keyword;
// public String inputSentence;
// public String inputTweet;
//
//
// public void setInputSentence(String inputSentence)
// {
// this.inputSentence=inputSentence;
// }
//
// public String getInputSentence()
// {
// return inputSentence;
// }
// public void setInputTweet(String inputTweet)
// {
// this.inputTweet=inputTweet;
// }
// public String getInputTweet()
// {
// return inputTweet;
// }
// public void setTweet(String tweet)
// {
// this.tweet=tweet;
// }
// public String getTweet()
// {
// return tweet;
// }
//
// public void setKeyword(String keyword)
// {
// this.keyword=keyword;
// }
// public String getKeyword()
// {
// return keyword;
// }
//
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/IKeywordEx.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.ExtractionKeyword;
package unsw.curation.api.domain.abstraction;
public interface IKeywordEx {
String ExtractTweetKeyword(String inputTweet,File stopWordList) throws Exception;
|
List<ExtractionKeyword> ExtractTweetKeywordFromFile(File fileName, File stopWordList) throws FileNotFoundException, IOException;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/extractsimilarity/ExtractTextLevenshtainImpl.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractTextSimilarity.java
// public class ExtractTextSimilarity {
//
// private String word;
// public void setWord(String word)
// {
// this.word=word;
// }
// public String getWord()
// {
// return this.word;
// }
// private String candidate;
// public void setCandidate(String candidate)
// {
// this.candidate=candidate;
// }
// public String getCandidate()
// {
// return this.candidate;
// }
// private double similarity;
// public void setSimilarity(double similarity)
// {
// this.similarity=similarity;
// }
// public double getSimilarity()
// {
// return this.similarity;
// }
// public ExtractTextSimilarity(){}
// public ExtractTextSimilarity (String Word, String Candidate, double Similarity)
// {
// this.word=Word;
// this.candidate=Candidate;
// this.similarity=Similarity;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/ITextLevenshtainSimilarity.java
// public interface ITextLevenshtainSimilarity
// {
//
// List<ExtractTextSimilarity> Leveneshtain_Word_Document(String word1, String filePath) throws IOException;
// int Leveneshtain_Word_Word(String word1, String word2);
// }
|
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractTextSimilarity;
import unsw.curation.api.domain.abstraction.ITextLevenshtainSimilarity;
|
package unsw.curation.api.extractsimilarity;
public class ExtractTextLevenshtainImpl implements ITextLevenshtainSimilarity {
public int Leveneshtain_Word_Word(String word1, String word2)
{
word1 = word1.toLowerCase();
word2 = word2.toLowerCase();
int[] costs = new int[word2.length() + 1];
for (int j = 0; j < costs.length; j++)
costs[j] = j;
for (int i = 1; i <= word1.length(); i++)
{
costs[0] = i;
int nw = i - 1;
for (int j = 1; j <= word2.length(); j++)
{
int cj = Math.min(1 + Math.min(costs[j], costs[j - 1]),
word1.charAt(i - 1) == word2.charAt(j - 1) ? nw : nw + 1);
nw = costs[j];
costs[j] = cj;
}
}
return costs[word2.length()];
}
|
// Path: src/main/java/unsw/curation/api/domain/ExtractTextSimilarity.java
// public class ExtractTextSimilarity {
//
// private String word;
// public void setWord(String word)
// {
// this.word=word;
// }
// public String getWord()
// {
// return this.word;
// }
// private String candidate;
// public void setCandidate(String candidate)
// {
// this.candidate=candidate;
// }
// public String getCandidate()
// {
// return this.candidate;
// }
// private double similarity;
// public void setSimilarity(double similarity)
// {
// this.similarity=similarity;
// }
// public double getSimilarity()
// {
// return this.similarity;
// }
// public ExtractTextSimilarity(){}
// public ExtractTextSimilarity (String Word, String Candidate, double Similarity)
// {
// this.word=Word;
// this.candidate=Candidate;
// this.similarity=Similarity;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/ITextLevenshtainSimilarity.java
// public interface ITextLevenshtainSimilarity
// {
//
// List<ExtractTextSimilarity> Leveneshtain_Word_Document(String word1, String filePath) throws IOException;
// int Leveneshtain_Word_Word(String word1, String word2);
// }
// Path: src/main/java/unsw/curation/api/extractsimilarity/ExtractTextLevenshtainImpl.java
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractTextSimilarity;
import unsw.curation.api.domain.abstraction.ITextLevenshtainSimilarity;
package unsw.curation.api.extractsimilarity;
public class ExtractTextLevenshtainImpl implements ITextLevenshtainSimilarity {
public int Leveneshtain_Word_Word(String word1, String word2)
{
word1 = word1.toLowerCase();
word2 = word2.toLowerCase();
int[] costs = new int[word2.length() + 1];
for (int j = 0; j < costs.length; j++)
costs[j] = j;
for (int i = 1; i <= word1.length(); i++)
{
costs[0] = i;
int nw = i - 1;
for (int j = 1; j <= word2.length(); j++)
{
int cj = Math.min(1 + Math.min(costs[j], costs[j - 1]),
word1.charAt(i - 1) == word2.charAt(j - 1) ? nw : nw + 1);
nw = costs[j];
costs[j] = cj;
}
}
return costs[word2.length()];
}
|
public List<ExtractTextSimilarity> Leveneshtain_Word_Document(String word1, String filePath) throws IOException
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/ITextJaccardSimilarity.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractTextSimilarity.java
// public class ExtractTextSimilarity {
//
// private String word;
// public void setWord(String word)
// {
// this.word=word;
// }
// public String getWord()
// {
// return this.word;
// }
// private String candidate;
// public void setCandidate(String candidate)
// {
// this.candidate=candidate;
// }
// public String getCandidate()
// {
// return this.candidate;
// }
// private double similarity;
// public void setSimilarity(double similarity)
// {
// this.similarity=similarity;
// }
// public double getSimilarity()
// {
// return this.similarity;
// }
// public ExtractTextSimilarity(){}
// public ExtractTextSimilarity (String Word, String Candidate, double Similarity)
// {
// this.word=Word;
// this.candidate=Candidate;
// this.similarity=Similarity;
// }
// }
|
import java.io.File;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.ExtractTextSimilarity;
|
package unsw.curation.api.domain.abstraction;
public interface ITextJaccardSimilarity {
double Jaccard_Word_Word(String word1, String word2);
|
// Path: src/main/java/unsw/curation/api/domain/ExtractTextSimilarity.java
// public class ExtractTextSimilarity {
//
// private String word;
// public void setWord(String word)
// {
// this.word=word;
// }
// public String getWord()
// {
// return this.word;
// }
// private String candidate;
// public void setCandidate(String candidate)
// {
// this.candidate=candidate;
// }
// public String getCandidate()
// {
// return this.candidate;
// }
// private double similarity;
// public void setSimilarity(double similarity)
// {
// this.similarity=similarity;
// }
// public double getSimilarity()
// {
// return this.similarity;
// }
// public ExtractTextSimilarity(){}
// public ExtractTextSimilarity (String Word, String Candidate, double Similarity)
// {
// this.word=Word;
// this.candidate=Candidate;
// this.similarity=Similarity;
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/ITextJaccardSimilarity.java
import java.io.File;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.ExtractTextSimilarity;
package unsw.curation.api.domain.abstraction;
public interface ITextJaccardSimilarity {
double Jaccard_Word_Word(String word1, String word2);
|
List<ExtractTextSimilarity> Jaccard_Word_Document(String word, String filePath) throws IOException;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/ITextTfidfSimilarity.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractTextTfidfSimilarity.java
// public class ExtractTextTfidfSimilarity {
//
// private String query;
//
// private String sentence;
// private String similarSentence;
// private String score;
// public ExtractTextTfidfSimilarity(){}
//
// public ExtractTextTfidfSimilarity(String searchText, String similarSentence, String score) {
// this.sentence=searchText;
// this.similarSentence=similarSentence;
// this.score=score;
// }
// public void setQuery(String query)
// {
// this.query=query;
// }
// public String getQuery()
// {
// return this.query;
// }
// public void setSentence(String sentence)
// {
// this.sentence=sentence;
// }
// public String getSentence()
// {
// return this.sentence;
// }
//
// public void setSimilaritySentence(String similaritySentence)
// {
// this.similarSentence=similaritySentence;
// }
//
// public String getSimilaritySentence()
// {
// return this.similarSentence;
// }
//
// public void serScore(String score)
// {
// this.score=score;
// }
// public String getScore()
// {
// return this.score;
// }
// }
|
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.apache.lucene.queryparser.classic.ParseException;
import unsw.curation.api.domain.ExtractTextTfidfSimilarity;
|
package unsw.curation.api.domain.abstraction;
public interface ITextTfidfSimilarity
{
//List<ExtractTextTfidfSimilarity> SearchFile(String FilePath) throws IOException, ParseException;
|
// Path: src/main/java/unsw/curation/api/domain/ExtractTextTfidfSimilarity.java
// public class ExtractTextTfidfSimilarity {
//
// private String query;
//
// private String sentence;
// private String similarSentence;
// private String score;
// public ExtractTextTfidfSimilarity(){}
//
// public ExtractTextTfidfSimilarity(String searchText, String similarSentence, String score) {
// this.sentence=searchText;
// this.similarSentence=similarSentence;
// this.score=score;
// }
// public void setQuery(String query)
// {
// this.query=query;
// }
// public String getQuery()
// {
// return this.query;
// }
// public void setSentence(String sentence)
// {
// this.sentence=sentence;
// }
// public String getSentence()
// {
// return this.sentence;
// }
//
// public void setSimilaritySentence(String similaritySentence)
// {
// this.similarSentence=similaritySentence;
// }
//
// public String getSimilaritySentence()
// {
// return this.similarSentence;
// }
//
// public void serScore(String score)
// {
// this.score=score;
// }
// public String getScore()
// {
// return this.score;
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/ITextTfidfSimilarity.java
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.apache.lucene.queryparser.classic.ParseException;
import unsw.curation.api.domain.ExtractTextTfidfSimilarity;
package unsw.curation.api.domain.abstraction;
public interface ITextTfidfSimilarity
{
//List<ExtractTextTfidfSimilarity> SearchFile(String FilePath) throws IOException, ParseException;
|
List<ExtractTextTfidfSimilarity> SearchText(String searchText) throws IOException, ParseException;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/IStem.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractStem.java
// public class ExtractStem {
//
// private String word1;
// public void setWord1(String word)
// {
// this.word1=word;
// }
// public String getWord1()
// {
// return word1;
// }
// private String derived1;
// public void setDerived1(String derived)
// {
// this.derived1=derived;
// }
// public String getDerived1()
// {
// return this.derived1;
// }
// private String word2;
// public void setWord2(String word)
// {
// this.word2=word;
// }
// public String getWord2()
// {
// return word2;
// }
// private String derived2;
// public void setDerived2(String derived)
// {
// this.derived2=derived;
// }
// public String getDerived2()
// {
// return this.derived2;
// }
// public ExtractStem(String word1,String derived1,String word2,String derived2)
// {
// this.word1=word1;
// this.word2=word2;
// this.derived1=derived1;
// this.derived2=derived2;
// }
// public ExtractStem() {
// // TODO Auto-generated constructor stub
// }
// }
|
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;
import unsw.curation.api.domain.ExtractStem;
|
package unsw.curation.api.domain.abstraction;
public interface IStem {
void ReadDataset() throws FileNotFoundException, IOException, URISyntaxException;
|
// Path: src/main/java/unsw/curation/api/domain/ExtractStem.java
// public class ExtractStem {
//
// private String word1;
// public void setWord1(String word)
// {
// this.word1=word;
// }
// public String getWord1()
// {
// return word1;
// }
// private String derived1;
// public void setDerived1(String derived)
// {
// this.derived1=derived;
// }
// public String getDerived1()
// {
// return this.derived1;
// }
// private String word2;
// public void setWord2(String word)
// {
// this.word2=word;
// }
// public String getWord2()
// {
// return word2;
// }
// private String derived2;
// public void setDerived2(String derived)
// {
// this.derived2=derived;
// }
// public String getDerived2()
// {
// return this.derived2;
// }
// public ExtractStem(String word1,String derived1,String word2,String derived2)
// {
// this.word1=word1;
// this.word2=word2;
// this.derived1=derived1;
// this.derived2=derived2;
// }
// public ExtractStem() {
// // TODO Auto-generated constructor stub
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/IStem.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;
import unsw.curation.api.domain.ExtractStem;
package unsw.curation.api.domain.abstraction;
public interface IStem {
void ReadDataset() throws FileNotFoundException, IOException, URISyntaxException;
|
List<ExtractStem> FindWordDerivedForms(String word) throws FileNotFoundException, IOException, URISyntaxException;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/twitter/URLExtraction.java
|
// Path: src/main/java/unsw/curation/api/twitterdomain/UrlDomain.java
// public class UrlDomain
// {
// private String pageTitle;
//
// public void setPageTitle(String pageTitle)
// {
// this.pageTitle=pageTitle;
// }
// public String getPageTitle()
// {
// return this.pageTitle;
// }
// }
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import unsw.curation.api.twitterdomain.UrlDomain;
|
package unsw.curation.api.twitter;
/**
*
* @author Alireza
*/
public class URLExtraction {
private Document docPub;
|
// Path: src/main/java/unsw/curation/api/twitterdomain/UrlDomain.java
// public class UrlDomain
// {
// private String pageTitle;
//
// public void setPageTitle(String pageTitle)
// {
// this.pageTitle=pageTitle;
// }
// public String getPageTitle()
// {
// return this.pageTitle;
// }
// }
// Path: src/main/java/unsw/curation/api/twitter/URLExtraction.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import unsw.curation.api.twitterdomain.UrlDomain;
package unsw.curation.api.twitter;
/**
*
* @author Alireza
*/
public class URLExtraction {
private Document docPub;
|
UrlDomain urlDomain;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/extractsimilarity/ExtractNumberDiceSimilarityImpl.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/INumberDiceSimilarity.java
// public interface INumberDiceSimilarity {
//
// double Dice_Vector_Vector(double [] number1,double [] number2);
// List<ExtractNumberSimilarity> Dice_Vector_VectorS(String filePath) throws IOException;
// List<ExtractNumberSimilarity> Dice_Vector_VectorS(Double [] vector,String filePath) throws IOException;
// }
|
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractNumberSimilarity;
import unsw.curation.api.domain.abstraction.INumberDiceSimilarity;
|
package unsw.curation.api.extractsimilarity;
public class ExtractNumberDiceSimilarityImpl implements INumberDiceSimilarity{
@Override
public double Dice_Vector_Vector(double[] number1, double[] number2) {
List<String> lstarr1=new ArrayList<>();
List<String> lstarr2=new ArrayList<>();
for(double num:number1)
{
lstarr1.add(String.valueOf(num));
}
for(double num:number2)
{
lstarr2.add(String.valueOf(num));
}
List<String> lstUnique=new ArrayList<>();
lstUnique.addAll(lstarr1);
lstUnique.addAll(lstarr2);
HashSet<String> lstIntersect=new HashSet<>();
lstIntersect.addAll(lstarr1);
lstIntersect.retainAll(lstarr2);
double intersectSize=lstIntersect.size();
double uniqueSize=lstUnique.size();
double DiceSimlarity=(2*intersectSize)/uniqueSize;
return DiceSimlarity;
}
@Override
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/INumberDiceSimilarity.java
// public interface INumberDiceSimilarity {
//
// double Dice_Vector_Vector(double [] number1,double [] number2);
// List<ExtractNumberSimilarity> Dice_Vector_VectorS(String filePath) throws IOException;
// List<ExtractNumberSimilarity> Dice_Vector_VectorS(Double [] vector,String filePath) throws IOException;
// }
// Path: src/main/java/unsw/curation/api/extractsimilarity/ExtractNumberDiceSimilarityImpl.java
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractNumberSimilarity;
import unsw.curation.api.domain.abstraction.INumberDiceSimilarity;
package unsw.curation.api.extractsimilarity;
public class ExtractNumberDiceSimilarityImpl implements INumberDiceSimilarity{
@Override
public double Dice_Vector_Vector(double[] number1, double[] number2) {
List<String> lstarr1=new ArrayList<>();
List<String> lstarr2=new ArrayList<>();
for(double num:number1)
{
lstarr1.add(String.valueOf(num));
}
for(double num:number2)
{
lstarr2.add(String.valueOf(num));
}
List<String> lstUnique=new ArrayList<>();
lstUnique.addAll(lstarr1);
lstUnique.addAll(lstarr2);
HashSet<String> lstIntersect=new HashSet<>();
lstIntersect.addAll(lstarr1);
lstIntersect.retainAll(lstarr2);
double intersectSize=lstIntersect.size();
double uniqueSize=lstUnique.size();
double DiceSimlarity=(2*intersectSize)/uniqueSize;
return DiceSimlarity;
}
@Override
|
public List<ExtractNumberSimilarity> Dice_Vector_VectorS(String filePath) throws IOException {
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/extractsynonym/WordNetFile.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractSynonym.java
// public class ExtractSynonym {
//
// public ExtractSynonym(){}
// public ExtractSynonym(String word,String synset)
// {
// this.word=word;
// this.synset=synset;
// }
// private String word;
//
// private String synset;
//
// public String getWord() {
// return word;
// }
//
// public void setWord(String word) {
// this.word = word;
// }
//
// public String getSynset() {
// return synset;
// }
//
// public void setSynset(String synset) {
// this.synset = synset;
// }
//
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/ISynonym.java
// public interface ISynonym {
//
// List<String> ExtractSynonymWord(String word) throws URISyntaxException, IOException;
// List<String> ExtractHypernymWord(String word);
// }
|
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import edu.mit.jwi.Dictionary;
import edu.mit.jwi.IDictionary;
import edu.mit.jwi.item.IIndexWord;
import edu.mit.jwi.item.ISynset;
import edu.mit.jwi.item.ISynsetID;
import edu.mit.jwi.item.IWord;
import edu.mit.jwi.item.IWordID;
import edu.mit.jwi.item.POS;
import edu.mit.jwi.item.Pointer;
import edu.mit.jwi.morph.WordnetStemmer;
import unsw.curation.api.domain.ExtractSynonym;
import unsw.curation.api.domain.abstraction.ISynonym;
|
dict.open();
WordnetStemmer stemmer=new WordnetStemmer(dict);
List<String> lstStem=stemmer.findStems(word, POS.NOUN);
for(int j=0;j<1000;j++)
{
IIndexWord idxWord = dict.getIndexWord(lstStem.get(0),POS.NOUN);
IWordID wordID = idxWord.getWordIDs().get (j) ;
IWord mywords = dict . getWord (wordID);
ISynset sen=mywords.getSynset();
List <ISynsetID> hypernyms = sen.getRelatedSynsets (Pointer.HYPERNYM);
List<IWord> words;
for(ISynsetID sid : hypernyms)
{
words = dict . getSynset (sid). getWords ();
for( Iterator <IWord > i = words . iterator (); i. hasNext () ;)
{
lstHypernym.add((i. next (). getLemma ()));
//if(i. hasNext ())
// strHypernym+=",";
}
}
}
}
catch(Exception ex)
{
}
return lstHypernym;
}
|
// Path: src/main/java/unsw/curation/api/domain/ExtractSynonym.java
// public class ExtractSynonym {
//
// public ExtractSynonym(){}
// public ExtractSynonym(String word,String synset)
// {
// this.word=word;
// this.synset=synset;
// }
// private String word;
//
// private String synset;
//
// public String getWord() {
// return word;
// }
//
// public void setWord(String word) {
// this.word = word;
// }
//
// public String getSynset() {
// return synset;
// }
//
// public void setSynset(String synset) {
// this.synset = synset;
// }
//
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/ISynonym.java
// public interface ISynonym {
//
// List<String> ExtractSynonymWord(String word) throws URISyntaxException, IOException;
// List<String> ExtractHypernymWord(String word);
// }
// Path: src/main/java/unsw/curation/api/extractsynonym/WordNetFile.java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import edu.mit.jwi.Dictionary;
import edu.mit.jwi.IDictionary;
import edu.mit.jwi.item.IIndexWord;
import edu.mit.jwi.item.ISynset;
import edu.mit.jwi.item.ISynsetID;
import edu.mit.jwi.item.IWord;
import edu.mit.jwi.item.IWordID;
import edu.mit.jwi.item.POS;
import edu.mit.jwi.item.Pointer;
import edu.mit.jwi.morph.WordnetStemmer;
import unsw.curation.api.domain.ExtractSynonym;
import unsw.curation.api.domain.abstraction.ISynonym;
dict.open();
WordnetStemmer stemmer=new WordnetStemmer(dict);
List<String> lstStem=stemmer.findStems(word, POS.NOUN);
for(int j=0;j<1000;j++)
{
IIndexWord idxWord = dict.getIndexWord(lstStem.get(0),POS.NOUN);
IWordID wordID = idxWord.getWordIDs().get (j) ;
IWord mywords = dict . getWord (wordID);
ISynset sen=mywords.getSynset();
List <ISynsetID> hypernyms = sen.getRelatedSynsets (Pointer.HYPERNYM);
List<IWord> words;
for(ISynsetID sid : hypernyms)
{
words = dict . getSynset (sid). getWords ();
for( Iterator <IWord > i = words . iterator (); i. hasNext () ;)
{
lstHypernym.add((i. next (). getLemma ()));
//if(i. hasNext ())
// strHypernym+=",";
}
}
}
}
catch(Exception ex)
{
}
return lstHypernym;
}
|
public List<ExtractSynonym> ExtractSynonymFile(File filePath) throws MalformedURLException, IOException
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextRandomForest.java
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
|
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
|
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextRandomForest
{
void LoadDataset(File arffFileName) throws IOException;
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextRandomForest.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextRandomForest
{
void LoadDataset(File arffFileName) throws IOException;
|
List<Classification> EvaluateRandomForest() throws Exception;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/extractsimilarity/ExtractNumberCosineSimilarityImpl.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/INumberCosineSimilarity.java
// public interface INumberCosineSimilarity {
//
// double Cosine_Vector_Vector(double [] number1,double [] number2);
// List<ExtractNumberSimilarity> Cosine_Vector_VectorS(String filePath) throws IOException;
// List<ExtractNumberSimilarity> Cosine_Vector_VectorS(double [] vector,String filePath) throws IOException;
//
// }
|
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractNumberSimilarity;
import unsw.curation.api.domain.abstraction.INumberCosineSimilarity;
|
package unsw.curation.api.extractsimilarity;
public class ExtractNumberCosineSimilarityImpl implements INumberCosineSimilarity
{
@Override
public double Cosine_Vector_Vector(double [] vector1, double [] vector2)
{
double dotProduct=0.0;
double vector1Len=0.0;
double vector2Len=0.0;
for(int i=0;i<vector1.length;i++)
{
dotProduct+=vector1[i]*vector2[i];
vector1Len+=Math.pow(vector1[i],2);
vector2Len+=Math.pow(vector2[i],2);
}
return 1-(dotProduct/ (Math.sqrt(vector1Len)* Math.sqrt(vector2Len)));
}
@Override
//dar meghdar bazgashti dobareh check kon
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/INumberCosineSimilarity.java
// public interface INumberCosineSimilarity {
//
// double Cosine_Vector_Vector(double [] number1,double [] number2);
// List<ExtractNumberSimilarity> Cosine_Vector_VectorS(String filePath) throws IOException;
// List<ExtractNumberSimilarity> Cosine_Vector_VectorS(double [] vector,String filePath) throws IOException;
//
// }
// Path: src/main/java/unsw/curation/api/extractsimilarity/ExtractNumberCosineSimilarityImpl.java
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractNumberSimilarity;
import unsw.curation.api.domain.abstraction.INumberCosineSimilarity;
package unsw.curation.api.extractsimilarity;
public class ExtractNumberCosineSimilarityImpl implements INumberCosineSimilarity
{
@Override
public double Cosine_Vector_Vector(double [] vector1, double [] vector2)
{
double dotProduct=0.0;
double vector1Len=0.0;
double vector2Len=0.0;
for(int i=0;i<vector1.length;i++)
{
dotProduct+=vector1[i]*vector2[i];
vector1Len+=Math.pow(vector1[i],2);
vector2Len+=Math.pow(vector2[i],2);
}
return 1-(dotProduct/ (Math.sqrt(vector1Len)* Math.sqrt(vector2Len)));
}
@Override
//dar meghdar bazgashti dobareh check kon
|
public List<ExtractNumberSimilarity> Cosine_Vector_VectorS(double [] vector1, String fileName) throws IOException
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/tokenization/ExtractionKeywordImpl.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractionKeyword.java
// public class ExtractionKeyword {
//
// public ExtractionKeyword(){}
// public ExtractionKeyword(String tweet,String keyword)
// {
// this.tweet=tweet;
// this.keyword=keyword;
// }
// public ExtractionKeyword(String keyword)
// {
// this.keyword=keyword;
// }
// public String tweet;
// public String keyword;
// public String inputSentence;
// public String inputTweet;
//
//
// public void setInputSentence(String inputSentence)
// {
// this.inputSentence=inputSentence;
// }
//
// public String getInputSentence()
// {
// return inputSentence;
// }
// public void setInputTweet(String inputTweet)
// {
// this.inputTweet=inputTweet;
// }
// public String getInputTweet()
// {
// return inputTweet;
// }
// public void setTweet(String tweet)
// {
// this.tweet=tweet;
// }
// public String getTweet()
// {
// return tweet;
// }
//
// public void setKeyword(String keyword)
// {
// this.keyword=keyword;
// }
// public String getKeyword()
// {
// return keyword;
// }
//
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/IKeywordEx.java
// public interface IKeywordEx {
//
// String ExtractTweetKeyword(String inputTweet,File stopWordList) throws Exception;
// List<ExtractionKeyword> ExtractTweetKeywordFromFile(File fileName, File stopWordList) throws FileNotFoundException, IOException;
// String ExtractSentenceKeyword(String inputSentence, File stopWordList) throws Exception;
// //String ExtractSentenceKeyPhrase(String inputSentence,File stopWordList) throws Exception;
// String ExtractFileKeyword(File fileName, File stopWordList) throws FileNotFoundException, IOException;
// /*ExtractionKeyword ExtractSentenceKeywords(String inputSentence) throws Exception;
// ExtractionKeyword ExtractFileKeywords(String inputFilePath) throws Exception;*/
// }
|
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.core.StopFilter;
import org.apache.lucene.analysis.standard.StandardTokenizer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.util.CharArraySet;
import edu.stanford.nlp.patterns.surface.CreatePatterns.CreatePatternsThread;
import opennlp.tools.sentdetect.SentenceDetector;
import opennlp.tools.sentdetect.SentenceDetectorME;
import opennlp.tools.sentdetect.SentenceModel;
import unsw.curation.api.domain.ExtractionKeyword;
import unsw.curation.api.domain.abstraction.IKeywordEx;
|
}
return Line;
}
String Patternn="(http:|https:|ftp)[:-_?\\a-zA-Z\\d.*//]+";
private List<String> lstStopWords=new ArrayList<>();
@Override
public String ExtractTweetKeyword(String inputTweet, File stopwordList) throws Exception
{
lstStopWords=ReadRawData(stopwordList);
String trimmedText=inputTweet.replaceAll(Patternn, "");
trimmedText=trimmedText.replaceAll("\\d", "");
String values=preProcessTweet(trimmedText);
CharArraySet stopWords=new CharArraySet(org.apache.lucene.util.Version.LUCENE_46,lstStopWords,true);
TokenStream tokenStreamer = new
StandardTokenizer(org.apache.lucene.util.Version.LUCENE_46, new StringReader(values));
tokenStreamer = new StopFilter(org.apache.lucene.util.Version.LUCENE_46, tokenStreamer, stopWords);
StringBuilder sb = new StringBuilder();
CharTermAttribute charTermAttribute = tokenStreamer.addAttribute(CharTermAttribute.class);
tokenStreamer.reset();
while (tokenStreamer.incrementToken())
{
String term = charTermAttribute.toString();
sb.append(term).append(",");
}
return sb.toString();
}
@Override
|
// Path: src/main/java/unsw/curation/api/domain/ExtractionKeyword.java
// public class ExtractionKeyword {
//
// public ExtractionKeyword(){}
// public ExtractionKeyword(String tweet,String keyword)
// {
// this.tweet=tweet;
// this.keyword=keyword;
// }
// public ExtractionKeyword(String keyword)
// {
// this.keyword=keyword;
// }
// public String tweet;
// public String keyword;
// public String inputSentence;
// public String inputTweet;
//
//
// public void setInputSentence(String inputSentence)
// {
// this.inputSentence=inputSentence;
// }
//
// public String getInputSentence()
// {
// return inputSentence;
// }
// public void setInputTweet(String inputTweet)
// {
// this.inputTweet=inputTweet;
// }
// public String getInputTweet()
// {
// return inputTweet;
// }
// public void setTweet(String tweet)
// {
// this.tweet=tweet;
// }
// public String getTweet()
// {
// return tweet;
// }
//
// public void setKeyword(String keyword)
// {
// this.keyword=keyword;
// }
// public String getKeyword()
// {
// return keyword;
// }
//
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/IKeywordEx.java
// public interface IKeywordEx {
//
// String ExtractTweetKeyword(String inputTweet,File stopWordList) throws Exception;
// List<ExtractionKeyword> ExtractTweetKeywordFromFile(File fileName, File stopWordList) throws FileNotFoundException, IOException;
// String ExtractSentenceKeyword(String inputSentence, File stopWordList) throws Exception;
// //String ExtractSentenceKeyPhrase(String inputSentence,File stopWordList) throws Exception;
// String ExtractFileKeyword(File fileName, File stopWordList) throws FileNotFoundException, IOException;
// /*ExtractionKeyword ExtractSentenceKeywords(String inputSentence) throws Exception;
// ExtractionKeyword ExtractFileKeywords(String inputFilePath) throws Exception;*/
// }
// Path: src/main/java/unsw/curation/api/tokenization/ExtractionKeywordImpl.java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.core.StopFilter;
import org.apache.lucene.analysis.standard.StandardTokenizer;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.util.CharArraySet;
import edu.stanford.nlp.patterns.surface.CreatePatterns.CreatePatternsThread;
import opennlp.tools.sentdetect.SentenceDetector;
import opennlp.tools.sentdetect.SentenceDetectorME;
import opennlp.tools.sentdetect.SentenceModel;
import unsw.curation.api.domain.ExtractionKeyword;
import unsw.curation.api.domain.abstraction.IKeywordEx;
}
return Line;
}
String Patternn="(http:|https:|ftp)[:-_?\\a-zA-Z\\d.*//]+";
private List<String> lstStopWords=new ArrayList<>();
@Override
public String ExtractTweetKeyword(String inputTweet, File stopwordList) throws Exception
{
lstStopWords=ReadRawData(stopwordList);
String trimmedText=inputTweet.replaceAll(Patternn, "");
trimmedText=trimmedText.replaceAll("\\d", "");
String values=preProcessTweet(trimmedText);
CharArraySet stopWords=new CharArraySet(org.apache.lucene.util.Version.LUCENE_46,lstStopWords,true);
TokenStream tokenStreamer = new
StandardTokenizer(org.apache.lucene.util.Version.LUCENE_46, new StringReader(values));
tokenStreamer = new StopFilter(org.apache.lucene.util.Version.LUCENE_46, tokenStreamer, stopWords);
StringBuilder sb = new StringBuilder();
CharTermAttribute charTermAttribute = tokenStreamer.addAttribute(CharTermAttribute.class);
tokenStreamer.reset();
while (tokenStreamer.incrementToken())
{
String term = charTermAttribute.toString();
sb.append(term).append(",");
}
return sb.toString();
}
@Override
|
public List<ExtractionKeyword> ExtractTweetKeywordFromFile(File fileName, File stopwordList) throws FileNotFoundException, IOException
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextKNN.java
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
|
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
|
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextKNN {
void LoadDataset(File arffFileName) throws IOException;
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextKNN.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextKNN {
void LoadDataset(File arffFileName) throws IOException;
|
List<Classification> EvaluateKNN() throws Exception;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/extractsimilarity/ExtractNumberJaccardSimilarityImpl.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/INumberJaccardSimilarity.java
// public interface INumberJaccardSimilarity {
//
// double Jaccard_Vector_Vector(double [] number1,double [] number2);
// List<ExtractNumberSimilarity> Jaccard_Vector_VectorS(String filePath) throws IOException;
// List<ExtractNumberSimilarity> Jaccard_Vector_VectorS(Double [] vector,String filePath) throws IOException;
// }
|
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractNumberSimilarity;
import unsw.curation.api.domain.abstraction.INumberJaccardSimilarity;
|
package unsw.curation.api.extractsimilarity;
public class ExtractNumberJaccardSimilarityImpl implements INumberJaccardSimilarity{
@Override
public double Jaccard_Vector_Vector(double[] number1, double[] number2) {
List<String> lstarr1=new ArrayList<>();
List<String> lstarr2=new ArrayList<>();
for(double num:number1)
{
lstarr1.add(String.valueOf(num));
}
for(double num:number2)
{
lstarr2.add(String.valueOf(num));
}
HashSet<String> lstUnique=new HashSet<>();
lstUnique.addAll(lstarr1);
lstUnique.addAll(lstarr2);
HashSet<String> lstIntersect=new HashSet<>();
lstIntersect.addAll(lstarr1);
lstIntersect.retainAll(lstarr2);
double intersectSize=lstIntersect.size();
double uniqueSize=lstUnique.size();
double JaccardSimilarity=intersectSize/uniqueSize;
return JaccardSimilarity;
}
@Override
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/INumberJaccardSimilarity.java
// public interface INumberJaccardSimilarity {
//
// double Jaccard_Vector_Vector(double [] number1,double [] number2);
// List<ExtractNumberSimilarity> Jaccard_Vector_VectorS(String filePath) throws IOException;
// List<ExtractNumberSimilarity> Jaccard_Vector_VectorS(Double [] vector,String filePath) throws IOException;
// }
// Path: src/main/java/unsw/curation/api/extractsimilarity/ExtractNumberJaccardSimilarityImpl.java
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import unsw.curation.api.domain.ExtractNumberSimilarity;
import unsw.curation.api.domain.abstraction.INumberJaccardSimilarity;
package unsw.curation.api.extractsimilarity;
public class ExtractNumberJaccardSimilarityImpl implements INumberJaccardSimilarity{
@Override
public double Jaccard_Vector_Vector(double[] number1, double[] number2) {
List<String> lstarr1=new ArrayList<>();
List<String> lstarr2=new ArrayList<>();
for(double num:number1)
{
lstarr1.add(String.valueOf(num));
}
for(double num:number2)
{
lstarr2.add(String.valueOf(num));
}
HashSet<String> lstUnique=new HashSet<>();
lstUnique.addAll(lstarr1);
lstUnique.addAll(lstarr2);
HashSet<String> lstIntersect=new HashSet<>();
lstIntersect.addAll(lstarr1);
lstIntersect.retainAll(lstarr2);
double intersectSize=lstIntersect.size();
double uniqueSize=lstUnique.size();
double JaccardSimilarity=intersectSize/uniqueSize;
return JaccardSimilarity;
}
@Override
|
public List<ExtractNumberSimilarity> Jaccard_Vector_VectorS(String filePath) throws IOException {
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/extractnamedentity/ExtractEntityFile.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNamedEntity.java
// public class ExtractNamedEntity {
//
// public ExtractNamedEntity()
// {
//
// }
//
// public String word;
// public String ner;
// public int position;
// /*public ExtractNamedEntity(String word,String ner)
// {
// this.word=word;
// this.ner=ner;
// }*/
// public ExtractNamedEntity(String word,String ner,int position)
// {
// this.word=word;
// this.ner=ner;
// this.position=position;
// }
// public int getPosition() {
// return position;
// }
// public void setPosition(int position) {
// this.position = position;
// }
// public void setWord(String word)
// {
// this.word=word;
// }
// public String getWord()
// {
// return this.word;
// }
//
// public void setNer(String ner)
// {
// this.ner=ner;
// }
// public String getNer()
// {
// return this.ner;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/INamedEntity.java
// public interface INamedEntity {
//
// List<ExtractNamedEntity>ExtractNamedEntityFile(File filePath) throws Exception;
// //List<ExtractNamedEntity>ExtractNamedEntity(boolean useRegexNer,List<String> lstData) throws Exception;
// List<ExtractNamedEntity> ExtractNamedEntitySentence(String inputSentence) throws Exception;
// List<String> ExtractOrganization(String inputSentence) throws URISyntaxException, Exception;
// List<String> ExtractPerson(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractLocation(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractDate(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractMoney(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractCity(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractState(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractCountry(String inputSentence)throws URISyntaxException, FileNotFoundException, IOException, Exception;
// List<String> ExtractContinent(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractCrime(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractSport(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractHoliday(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractCompany(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractNaturalDisaster(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractDrug(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractProduct(String inputSentence)throws URISyntaxException, Exception;
// //List<String> ExtractRadioProgram(String inputSentence)throws URISyntaxException, Exception;
// //List<String> ExtractRadioStation(String inputSentence)throws URISyntaxException, Exception;
// //List<String> ExtractTvShows(String inputSentence)throws URISyntaxException;
// List<String> ExtractMedia(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractOperatingSystem(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractDegree(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractSportEvents(String inputSentence)throws URISyntaxException, Exception;
// //List<String> ExtractRegion(String inputSentence)throws URISyntaxException;
// //List<String> ExtractGeographicFeature(String inputSentence)throws URISyntaxException;
// List<String> ReadRawData(File filePath) throws Exception;
//
//
//
// }
|
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.stream.Collectors;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.ling.CoreAnnotations.NamedEntityTagAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.SentencesAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.TextAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.TokensAnnotation;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.util.CoreMap;
import unsw.curation.api.domain.ExtractNamedEntity;
import unsw.curation.api.domain.abstraction.INamedEntity;
|
package unsw.curation.api.extractnamedentity;
public class ExtractEntityFile implements INamedEntity {
@Override
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNamedEntity.java
// public class ExtractNamedEntity {
//
// public ExtractNamedEntity()
// {
//
// }
//
// public String word;
// public String ner;
// public int position;
// /*public ExtractNamedEntity(String word,String ner)
// {
// this.word=word;
// this.ner=ner;
// }*/
// public ExtractNamedEntity(String word,String ner,int position)
// {
// this.word=word;
// this.ner=ner;
// this.position=position;
// }
// public int getPosition() {
// return position;
// }
// public void setPosition(int position) {
// this.position = position;
// }
// public void setWord(String word)
// {
// this.word=word;
// }
// public String getWord()
// {
// return this.word;
// }
//
// public void setNer(String ner)
// {
// this.ner=ner;
// }
// public String getNer()
// {
// return this.ner;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/INamedEntity.java
// public interface INamedEntity {
//
// List<ExtractNamedEntity>ExtractNamedEntityFile(File filePath) throws Exception;
// //List<ExtractNamedEntity>ExtractNamedEntity(boolean useRegexNer,List<String> lstData) throws Exception;
// List<ExtractNamedEntity> ExtractNamedEntitySentence(String inputSentence) throws Exception;
// List<String> ExtractOrganization(String inputSentence) throws URISyntaxException, Exception;
// List<String> ExtractPerson(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractLocation(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractDate(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractMoney(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractCity(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractState(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractCountry(String inputSentence)throws URISyntaxException, FileNotFoundException, IOException, Exception;
// List<String> ExtractContinent(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractCrime(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractSport(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractHoliday(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractCompany(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractNaturalDisaster(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractDrug(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractProduct(String inputSentence)throws URISyntaxException, Exception;
// //List<String> ExtractRadioProgram(String inputSentence)throws URISyntaxException, Exception;
// //List<String> ExtractRadioStation(String inputSentence)throws URISyntaxException, Exception;
// //List<String> ExtractTvShows(String inputSentence)throws URISyntaxException;
// List<String> ExtractMedia(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractOperatingSystem(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractDegree(String inputSentence)throws URISyntaxException, Exception;
// List<String> ExtractSportEvents(String inputSentence)throws URISyntaxException, Exception;
// //List<String> ExtractRegion(String inputSentence)throws URISyntaxException;
// //List<String> ExtractGeographicFeature(String inputSentence)throws URISyntaxException;
// List<String> ReadRawData(File filePath) throws Exception;
//
//
//
// }
// Path: src/main/java/unsw/curation/api/extractnamedentity/ExtractEntityFile.java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.stream.Collectors;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.ling.CoreAnnotations.NamedEntityTagAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.SentencesAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.TextAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.TokensAnnotation;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.util.CoreMap;
import unsw.curation.api.domain.ExtractNamedEntity;
import unsw.curation.api.domain.abstraction.INamedEntity;
package unsw.curation.api.extractnamedentity;
public class ExtractEntityFile implements INamedEntity {
@Override
|
public List<ExtractNamedEntity> ExtractNamedEntityFile(File filePath) throws Exception {
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/INumberCosineSimilarity.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
|
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.ExtractNumberSimilarity;
|
package unsw.curation.api.domain.abstraction;
public interface INumberCosineSimilarity {
double Cosine_Vector_Vector(double [] number1,double [] number2);
|
// Path: src/main/java/unsw/curation/api/domain/ExtractNumberSimilarity.java
// public class ExtractNumberSimilarity {
//
// private String vector1;
// private String vector2;
// private double score;
//
// public ExtractNumberSimilarity(){}
//
// public ExtractNumberSimilarity(String vector1,String vector2,double score)
// {
// this.vector1=vector1;
// this.vector2=vector2;
// this.score=score;
// }
//
// public void setVector1(String vector1)
// {
// this.vector1=vector1;
// }
// public String getVector1()
// {
// return this.vector1;
// }
//
// public void setVecor2(String vector2)
// {
// this.vector2=vector2;
// }
// public String getVector2()
// {
// return this.vector2;
// }
// public void setScore(double score)
// {
// this.score=score;
// }
// public double getScore()
// {
// return this.score;
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/INumberCosineSimilarity.java
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.ExtractNumberSimilarity;
package unsw.curation.api.domain.abstraction;
public interface INumberCosineSimilarity {
double Cosine_Vector_Vector(double [] number1,double [] number2);
|
List<ExtractNumberSimilarity> Cosine_Vector_VectorS(String filePath) throws IOException;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextNeuralNetwork.java
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
|
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
|
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextNeuralNetwork {
void LoadDataset(File arffFileName) throws IOException;
|
// Path: src/main/java/unsw/curation/api/domain/Classification.java
// public class Classification {
//
// public Classification(){}
// public Classification(double pre,double recall,double auc,double correct,double inCorrect, double errorRate,
// double fn,double fp,double tn,double tp,double kappa,double MAbsError,
// double numInstances,double relAbsErorr,double fMeasure)
// {
// this.precision=pre;
// this.recall=recall;
// this.auc=auc;
// this.incorrect=inCorrect;
// this.correct=correct;
// this.errorRate=errorRate;
// this.fn=fn;
// this.fp=fp;
// this.tn=tn;
// this.tp=tp;
// this.kappa=kappa;
// this.meanAbsoluteError=MAbsError;
// this.numInstances=numInstances;
// this.relativeAbsoluteError=relAbsErorr;
// this.fMeasure=fMeasure;
// }
// private double precision;
// private double recall;
// private double auc;
// private double correct;
// private double incorrect;
// private double errorRate;
// private double fn;
// private double fp;
// private double tn;
// private double tp;
// private double kappa;
// private double meanAbsoluteError;
// private double numInstances;
// private double relativeAbsoluteError;
// private double fMeasure;
//
// public void setInCorrect(double incorrect)
// {
// this.incorrect=incorrect;
// }
// public double getInCorrect()
// {
// return this.incorrect;
// }
//
// public void setCorrect(double correct)
// {
// this.correct=correct;
// }
// public double getCorrect()
// {
// return this.correct;
// }
// public void setPrecision(double precision)
// {
// this.precision=precision;
// }
// public double getPrecision()
// {
// return this.precision;
// }
// public void setRecall(double recall)
// {
// this.recall=recall;
// }
// public double getRecall()
// {
// return this.recall;
// }
// public void setAuc(double auc)
// {
// this.auc=auc;
// }
// public double getAuc()
// {
// return this.auc;
// }
// public void setErrorRate(double errorRate)
// {
// this.errorRate=errorRate;
// }
// public double getErrorRate()
// {
// return this.errorRate;
// }
// public void setFn(double fn)
// {
// this.fn=fn;
// }
// public double getFn()
// {
// return this.fn;
// }
// public void setFp(double fp)
// {
// this.fp=fp;
// }
// public double getFp()
// {
// return this.fp;
// }
// public void setTn(double tn)
// {
// this.tn=tn;
// }
// public double getTn()
// {
// return this.tn;
// }
// public void setTp(double tp)
// {
// this.tp=tp;
// }
// public double getTp()
// {
// return tp;
// }
// public void setKappa(double kappa)
// {
// this.kappa=kappa;
// }
// public double getKappa()
// {
// return this.kappa;
// }
// public void setMeanAbsoluteError(double meanAbsoluteError)
// {
// this.meanAbsoluteError=meanAbsoluteError;
// }
// public double getMeanAbsoluteError()
// {
// return this.meanAbsoluteError;
// }
// public void setNumInstances(double d)
// {
// this.numInstances=d;
// }
// public double getNumInstances()
// {
// return this.numInstances;
// }
// public void setRelativeAbsoluteError(double relativeAbsoluteError)
// {
// this.relativeAbsoluteError=relativeAbsoluteError;
// }
// public double getRelativeAbsoluteError()
// {
// return this.relativeAbsoluteError;
// }
// public void setFMeasure(double fMeasure)
// {
// this.fMeasure=fMeasure;
// }
// public double getFMeasure()
// {
// return this.fMeasure;
// }
// }
// Path: src/main/java/unsw/curation/api/domain/abstraction/IClassificationTextNeuralNetwork.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import unsw.curation.api.domain.Classification;
package unsw.curation.api.domain.abstraction;
public interface IClassificationTextNeuralNetwork {
void LoadDataset(File arffFileName) throws IOException;
|
List<Classification> EvaluateNeuralNetwork() throws Exception;
|
unsw-cse-soc/Data-curation-API
|
src/main/java/unsw/curation/api/extractpostag/ExtractPosTagData.java
|
// Path: src/main/java/unsw/curation/api/domain/ExtractPosTag.java
// public class ExtractPosTag {
//
// public ExtractPosTag(){}
// public ExtractPosTag(String wordPart,String tag)
// {
// this.wordPart=wordPart;
// this.tag=tag;
// }
// private String wordPart;
// private String tag;
// private int itemCount;
//
// public void setWordPart(String wordPart)
// {
// this.wordPart=wordPart;
// }
// public String getWordPart()
// {
// return this.wordPart;
// }
// public void setTag(String tag)
// {
// this.tag=tag;
// }
// public String getTag()
// {
// return this.tag;
// }
// public void setItemCount(int itemCount)
// {
// this.itemCount=itemCount;
// }
// public int getItemCount()
// {
// return this.itemCount;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/IPosTag.java
// public interface IPosTag {
//
// List<ExtractPosTag> ExtractNoun(String sentence);
// List<ExtractPosTag> ExtractAdjective(String sentence);
// List<ExtractPosTag> ExtractAdverb(String sentence);
// List<ExtractPosTag> ExtractVerb(String sentence);
// List<ExtractPosTag> ExtractQuotaion(String sentence);
// List<String> ExtractPhrase(String sentence);
// List<ExtractPosTag> ExtractNoun(File filePath)throws Exception;
// List<ExtractPosTag> ExtractAdjective(File filePath)throws Exception;
// List<ExtractPosTag> ExtractAdverb(File filePath) throws Exception;
// List<ExtractPosTag> ExtractVerb(File filePath) throws Exception;
//
// List<ExtractPosTag> ExtractPosTagsSentence(String sentence);
// List<ExtractPosTag> ExtractPosTagsSentenceNew(String sentence);
// List<ExtractPosTag> ExtractPosTagsFile(File filePath) throws Exception;
//
// List<String> ExtractData(File filePath) throws Exception;
// List<ExtractPosTag> ExtractPosTags(List<String> inputData);
// }
|
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.ling.CoreAnnotations.PartOfSpeechAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.TokensAnnotation;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.trees.TreeCoreAnnotations.TreeAnnotation;
import edu.stanford.nlp.trees.tregex.TregexMatcher;
import edu.stanford.nlp.trees.tregex.TregexPattern;
import edu.stanford.nlp.util.CoreMap;
import unsw.curation.api.domain.ExtractPosTag;
import unsw.curation.api.domain.abstraction.IPosTag;
|
package unsw.curation.api.extractpostag;
public class ExtractPosTagData implements IPosTag {
@Override
|
// Path: src/main/java/unsw/curation/api/domain/ExtractPosTag.java
// public class ExtractPosTag {
//
// public ExtractPosTag(){}
// public ExtractPosTag(String wordPart,String tag)
// {
// this.wordPart=wordPart;
// this.tag=tag;
// }
// private String wordPart;
// private String tag;
// private int itemCount;
//
// public void setWordPart(String wordPart)
// {
// this.wordPart=wordPart;
// }
// public String getWordPart()
// {
// return this.wordPart;
// }
// public void setTag(String tag)
// {
// this.tag=tag;
// }
// public String getTag()
// {
// return this.tag;
// }
// public void setItemCount(int itemCount)
// {
// this.itemCount=itemCount;
// }
// public int getItemCount()
// {
// return this.itemCount;
// }
// }
//
// Path: src/main/java/unsw/curation/api/domain/abstraction/IPosTag.java
// public interface IPosTag {
//
// List<ExtractPosTag> ExtractNoun(String sentence);
// List<ExtractPosTag> ExtractAdjective(String sentence);
// List<ExtractPosTag> ExtractAdverb(String sentence);
// List<ExtractPosTag> ExtractVerb(String sentence);
// List<ExtractPosTag> ExtractQuotaion(String sentence);
// List<String> ExtractPhrase(String sentence);
// List<ExtractPosTag> ExtractNoun(File filePath)throws Exception;
// List<ExtractPosTag> ExtractAdjective(File filePath)throws Exception;
// List<ExtractPosTag> ExtractAdverb(File filePath) throws Exception;
// List<ExtractPosTag> ExtractVerb(File filePath) throws Exception;
//
// List<ExtractPosTag> ExtractPosTagsSentence(String sentence);
// List<ExtractPosTag> ExtractPosTagsSentenceNew(String sentence);
// List<ExtractPosTag> ExtractPosTagsFile(File filePath) throws Exception;
//
// List<String> ExtractData(File filePath) throws Exception;
// List<ExtractPosTag> ExtractPosTags(List<String> inputData);
// }
// Path: src/main/java/unsw/curation/api/extractpostag/ExtractPosTagData.java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.ling.CoreAnnotations.PartOfSpeechAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.TokensAnnotation;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.trees.TreeCoreAnnotations.TreeAnnotation;
import edu.stanford.nlp.trees.tregex.TregexMatcher;
import edu.stanford.nlp.trees.tregex.TregexPattern;
import edu.stanford.nlp.util.CoreMap;
import unsw.curation.api.domain.ExtractPosTag;
import unsw.curation.api.domain.abstraction.IPosTag;
package unsw.curation.api.extractpostag;
public class ExtractPosTagData implements IPosTag {
@Override
|
public List<ExtractPosTag> ExtractNoun(String sentence) {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.