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 |
|---|---|---|---|---|---|---|
reportportal/service-authorization | src/main/java/com/epam/reportportal/auth/integration/handler/impl/strategy/AuthIntegrationStrategy.java | // Path: src/main/java/com/epam/reportportal/auth/integration/builder/AuthIntegrationBuilder.java
// public class AuthIntegrationBuilder {
//
// private final Integration integration;
//
// public AuthIntegrationBuilder() {
// integration = new Integration();
// }
//
// public AuthIntegrationBuilder(Integration integration) {
// this.integration = integration;
// }
//
// public AuthIntegrationBuilder addCreator(String username) {
// integration.setCreator(username);
// return this;
// }
//
// public AuthIntegrationBuilder addIntegrationType(IntegrationType type) {
// integration.setType(type);
// return this;
// }
//
// public AuthIntegrationBuilder addCreationDate(LocalDateTime creationDate) {
// integration.setCreationDate(creationDate);
// return this;
// }
//
// public @NotNull Integration build() {
// return integration;
// }
// }
//
// Path: src/main/java/com/epam/reportportal/auth/integration/validator/duplicate/IntegrationDuplicateValidator.java
// public interface IntegrationDuplicateValidator {
//
// void validate(Integration integration);
// }
//
// Path: src/main/java/com/epam/reportportal/auth/integration/validator/request/AuthRequestValidator.java
// public interface AuthRequestValidator<T> {
//
// void validate(T authRequest);
// }
| import com.epam.reportportal.auth.integration.builder.AuthIntegrationBuilder;
import com.epam.reportportal.auth.integration.validator.duplicate.IntegrationDuplicateValidator;
import com.epam.reportportal.auth.integration.validator.request.AuthRequestValidator;
import com.epam.ta.reportportal.dao.IntegrationRepository;
import com.epam.ta.reportportal.entity.integration.Integration;
import com.epam.ta.reportportal.entity.integration.IntegrationType;
import com.epam.ta.reportportal.exception.ReportPortalException;
import com.epam.ta.reportportal.ws.model.ErrorType;
import com.epam.ta.reportportal.ws.model.integration.auth.UpdateAuthRQ;
import java.time.LocalDateTime;
import java.time.ZoneOffset; | /*
* Copyright 2019 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.epam.reportportal.auth.integration.handler.impl.strategy;
/**
* @author <a href="mailto:ihar_kahadouski@epam.com">Ihar Kahadouski</a>
*/
public abstract class AuthIntegrationStrategy {
private final IntegrationRepository integrationRepository;
private final AuthRequestValidator<UpdateAuthRQ> updateAuthRequestValidator;
private final IntegrationDuplicateValidator integrationDuplicateValidator;
public AuthIntegrationStrategy(IntegrationRepository integrationRepository,
AuthRequestValidator<UpdateAuthRQ> updateAuthRequestValidator, IntegrationDuplicateValidator integrationDuplicateValidator) {
this.integrationRepository = integrationRepository;
this.updateAuthRequestValidator = updateAuthRequestValidator;
this.integrationDuplicateValidator = integrationDuplicateValidator;
}
protected abstract void fill(Integration integration, UpdateAuthRQ updateRequest);
public Integration createIntegration(IntegrationType integrationType, UpdateAuthRQ request, String username) {
updateAuthRequestValidator.validate(request);
| // Path: src/main/java/com/epam/reportportal/auth/integration/builder/AuthIntegrationBuilder.java
// public class AuthIntegrationBuilder {
//
// private final Integration integration;
//
// public AuthIntegrationBuilder() {
// integration = new Integration();
// }
//
// public AuthIntegrationBuilder(Integration integration) {
// this.integration = integration;
// }
//
// public AuthIntegrationBuilder addCreator(String username) {
// integration.setCreator(username);
// return this;
// }
//
// public AuthIntegrationBuilder addIntegrationType(IntegrationType type) {
// integration.setType(type);
// return this;
// }
//
// public AuthIntegrationBuilder addCreationDate(LocalDateTime creationDate) {
// integration.setCreationDate(creationDate);
// return this;
// }
//
// public @NotNull Integration build() {
// return integration;
// }
// }
//
// Path: src/main/java/com/epam/reportportal/auth/integration/validator/duplicate/IntegrationDuplicateValidator.java
// public interface IntegrationDuplicateValidator {
//
// void validate(Integration integration);
// }
//
// Path: src/main/java/com/epam/reportportal/auth/integration/validator/request/AuthRequestValidator.java
// public interface AuthRequestValidator<T> {
//
// void validate(T authRequest);
// }
// Path: src/main/java/com/epam/reportportal/auth/integration/handler/impl/strategy/AuthIntegrationStrategy.java
import com.epam.reportportal.auth.integration.builder.AuthIntegrationBuilder;
import com.epam.reportportal.auth.integration.validator.duplicate.IntegrationDuplicateValidator;
import com.epam.reportportal.auth.integration.validator.request.AuthRequestValidator;
import com.epam.ta.reportportal.dao.IntegrationRepository;
import com.epam.ta.reportportal.entity.integration.Integration;
import com.epam.ta.reportportal.entity.integration.IntegrationType;
import com.epam.ta.reportportal.exception.ReportPortalException;
import com.epam.ta.reportportal.ws.model.ErrorType;
import com.epam.ta.reportportal.ws.model.integration.auth.UpdateAuthRQ;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
/*
* Copyright 2019 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.epam.reportportal.auth.integration.handler.impl.strategy;
/**
* @author <a href="mailto:ihar_kahadouski@epam.com">Ihar Kahadouski</a>
*/
public abstract class AuthIntegrationStrategy {
private final IntegrationRepository integrationRepository;
private final AuthRequestValidator<UpdateAuthRQ> updateAuthRequestValidator;
private final IntegrationDuplicateValidator integrationDuplicateValidator;
public AuthIntegrationStrategy(IntegrationRepository integrationRepository,
AuthRequestValidator<UpdateAuthRQ> updateAuthRequestValidator, IntegrationDuplicateValidator integrationDuplicateValidator) {
this.integrationRepository = integrationRepository;
this.updateAuthRequestValidator = updateAuthRequestValidator;
this.integrationDuplicateValidator = integrationDuplicateValidator;
}
protected abstract void fill(Integration integration, UpdateAuthRQ updateRequest);
public Integration createIntegration(IntegrationType integrationType, UpdateAuthRQ request, String username) {
updateAuthRequestValidator.validate(request);
| final Integration integration = new AuthIntegrationBuilder().addCreator(username) |
reportportal/service-authorization | src/main/java/com/epam/reportportal/auth/store/MutableClientRegistrationRepository.java | // Path: src/main/java/com/epam/reportportal/auth/integration/converter/OAuthRegistrationConverters.java
// public static final Function<OAuthRegistration, ClientRegistration> TO_SPRING = registration -> ClientRegistration.withRegistrationId(
// registration.getClientName())
// .clientId(registration.getClientId())
// .clientSecret(registration.getClientSecret())
// .clientAuthenticationMethod(new ClientAuthenticationMethod(registration.getClientAuthMethod()))
// .authorizationGrantType(new AuthorizationGrantType(registration.getAuthGrantType()))
// .redirectUriTemplate(registration.getRedirectUrlTemplate())
// .authorizationUri(registration.getAuthorizationUri())
// .tokenUri(registration.getTokenUri())
// .userInfoUri(registration.getUserInfoEndpointUri())
// .userNameAttributeName(registration.getUserInfoEndpointNameAttribute())
// .jwkSetUri(registration.getJwkSetUri())
// .clientName(registration.getClientName())
// .scope(ofNullable(registration.getScopes()).map(scopes -> scopes.stream()
// .map(OAuthRegistrationScope::getScope)
// .toArray(String[]::new)).orElse(ArrayUtils.EMPTY_STRING_ARRAY))
// .build();
| import com.epam.ta.reportportal.commons.validation.Suppliers;
import com.epam.ta.reportportal.dao.OAuthRegistrationRepository;
import com.epam.ta.reportportal.entity.oauth.OAuthRegistration;
import com.epam.ta.reportportal.exception.ReportPortalException;
import com.epam.ta.reportportal.ws.model.ErrorType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.client.registration.ClientRegistration;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.Optional;
import static com.epam.reportportal.auth.integration.converter.OAuthRegistrationConverters.TO_SPRING; | /*
* Copyright 2019 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.epam.reportportal.auth.store;
@Component("mutableClientRegistrationRepository")
public class MutableClientRegistrationRepository implements ClientRegistrationRepository {
private final OAuthRegistrationRepository oAuthRegistrationRepository;
@Autowired
public MutableClientRegistrationRepository(OAuthRegistrationRepository oAuthRegistrationRepository) {
this.oAuthRegistrationRepository = oAuthRegistrationRepository;
}
@Override
public ClientRegistration findByRegistrationId(String registrationId) { | // Path: src/main/java/com/epam/reportportal/auth/integration/converter/OAuthRegistrationConverters.java
// public static final Function<OAuthRegistration, ClientRegistration> TO_SPRING = registration -> ClientRegistration.withRegistrationId(
// registration.getClientName())
// .clientId(registration.getClientId())
// .clientSecret(registration.getClientSecret())
// .clientAuthenticationMethod(new ClientAuthenticationMethod(registration.getClientAuthMethod()))
// .authorizationGrantType(new AuthorizationGrantType(registration.getAuthGrantType()))
// .redirectUriTemplate(registration.getRedirectUrlTemplate())
// .authorizationUri(registration.getAuthorizationUri())
// .tokenUri(registration.getTokenUri())
// .userInfoUri(registration.getUserInfoEndpointUri())
// .userNameAttributeName(registration.getUserInfoEndpointNameAttribute())
// .jwkSetUri(registration.getJwkSetUri())
// .clientName(registration.getClientName())
// .scope(ofNullable(registration.getScopes()).map(scopes -> scopes.stream()
// .map(OAuthRegistrationScope::getScope)
// .toArray(String[]::new)).orElse(ArrayUtils.EMPTY_STRING_ARRAY))
// .build();
// Path: src/main/java/com/epam/reportportal/auth/store/MutableClientRegistrationRepository.java
import com.epam.ta.reportportal.commons.validation.Suppliers;
import com.epam.ta.reportportal.dao.OAuthRegistrationRepository;
import com.epam.ta.reportportal.entity.oauth.OAuthRegistration;
import com.epam.ta.reportportal.exception.ReportPortalException;
import com.epam.ta.reportportal.ws.model.ErrorType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.client.registration.ClientRegistration;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.Optional;
import static com.epam.reportportal.auth.integration.converter.OAuthRegistrationConverters.TO_SPRING;
/*
* Copyright 2019 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.epam.reportportal.auth.store;
@Component("mutableClientRegistrationRepository")
public class MutableClientRegistrationRepository implements ClientRegistrationRepository {
private final OAuthRegistrationRepository oAuthRegistrationRepository;
@Autowired
public MutableClientRegistrationRepository(OAuthRegistrationRepository oAuthRegistrationRepository) {
this.oAuthRegistrationRepository = oAuthRegistrationRepository;
}
@Override
public ClientRegistration findByRegistrationId(String registrationId) { | return this.oAuthRegistrationRepository.findById(registrationId).map(TO_SPRING).orElseThrow(() -> new ReportPortalException( |
i2p/i2p.itoopie | src/net/i2p/itoopie/gui/component/chart/RateStatTracker.java | // Path: src/com/thetransactioncompany/jsonrpc2/client/JSONRPC2SessionException.java
// public class JSONRPC2SessionException extends Exception {
//
//
// /**
// * The exception cause is network or I/O related.
// */
// public static final int NETWORK_EXCEPTION = 1;
//
//
// /**
// * Unexpected "Content-Type" header value of the HTTP response.
// */
// public static final int UNEXPECTED_CONTENT_TYPE = 2;
//
//
// /**
// * Invalid JSON-RPC 2.0 response.
// */
// public static final int BAD_RESPONSE = 3;
//
//
// /**
// * Indicates the type of cause for this exception, see
// * constants.
// */
// private int causeType;
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message and cause type.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// */
// public JSONRPC2SessionException(final String message, final int causeType) {
//
// super(message);
// this.causeType = causeType;
// }
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message, cause type and cause.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// * @param cause The original exception.
// */
// public JSONRPC2SessionException(final String message, final int causeType, final Throwable cause) {
//
// super(message, cause);
// this.causeType = causeType;
// }
//
//
// /**
// * Returns the exception cause type.
// *
// * @return The cause type constant.
// */
// public int getCauseType() {
//
// return causeType;
// }
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidParametersException.java
// public class InvalidParametersException extends Exception {
//
// /**
// * Signifies that the paramers we sent were invalid for the used JSONRPC2
// * method.
// */
// private static final long serialVersionUID = 4044188679464846005L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidPasswordException.java
// public class InvalidPasswordException extends Exception {
//
// /**
// * The remote I2PControl server is rejecting the provided password.
// */
// private static final long serialVersionUID = 8461972369522962046L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/methods/GetRateStat.java
// public class GetRateStat{
//
// @SuppressWarnings("unchecked")
// public static Double execute(String stat, long period)
// throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException {
//
// JSONRPC2Request req = new JSONRPC2Request("GetRate", JSONRPC2Interface.incrNonce());
// @SuppressWarnings("rawtypes")
// Map params = new HashMap();
// params.put("Stat", stat);
// params.put("Period", period);
// req.setParams(params);
//
// JSONRPC2Response resp = null;
// try {
// resp = JSONRPC2Interface.sendReq(req);
// HashMap inParams = (HashMap) resp.getResult();
//
// if (inParams == null)
// return 0D;
//
// try {
// Double dbl = (Double) inParams.get("Result");
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a BigDecimal as Double");
// }
// try {
// BigDecimal bigNum = (BigDecimal) inParams.get("Result");
// Double dbl = bigNum.doubleValue();
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a double as a BigDecimal");
// }
// }catch (UnrecoverableFailedRequestException e) {
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.error("getRateStat failed.", e);
// }
// return new Double(0);
// }
// }
| import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
import net.i2p.itoopie.i2pcontrol.methods.GetRateStat; | package net.i2p.itoopie.gui.component.chart;
/**
* Unused
*/
public class RateStatTracker extends Thread implements Tracker {
/** Last read bw */
private double m_value = 0;
private final int updateInterval;
/** Which RateStat to measure from the router */
private String rateStat;
/** Which period of a stat to measure */
private long period;
/**
* Start daemon that checks to current inbound bandwidth of the router.
*/
public RateStatTracker(String rateStat, long period, int interval) {
super("IToopie-RST");
this.rateStat = rateStat;
this.period = period;
updateInterval = interval;
this.setDaemon(true);
this.start();
}
/**
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
while (true) {
try { | // Path: src/com/thetransactioncompany/jsonrpc2/client/JSONRPC2SessionException.java
// public class JSONRPC2SessionException extends Exception {
//
//
// /**
// * The exception cause is network or I/O related.
// */
// public static final int NETWORK_EXCEPTION = 1;
//
//
// /**
// * Unexpected "Content-Type" header value of the HTTP response.
// */
// public static final int UNEXPECTED_CONTENT_TYPE = 2;
//
//
// /**
// * Invalid JSON-RPC 2.0 response.
// */
// public static final int BAD_RESPONSE = 3;
//
//
// /**
// * Indicates the type of cause for this exception, see
// * constants.
// */
// private int causeType;
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message and cause type.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// */
// public JSONRPC2SessionException(final String message, final int causeType) {
//
// super(message);
// this.causeType = causeType;
// }
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message, cause type and cause.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// * @param cause The original exception.
// */
// public JSONRPC2SessionException(final String message, final int causeType, final Throwable cause) {
//
// super(message, cause);
// this.causeType = causeType;
// }
//
//
// /**
// * Returns the exception cause type.
// *
// * @return The cause type constant.
// */
// public int getCauseType() {
//
// return causeType;
// }
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidParametersException.java
// public class InvalidParametersException extends Exception {
//
// /**
// * Signifies that the paramers we sent were invalid for the used JSONRPC2
// * method.
// */
// private static final long serialVersionUID = 4044188679464846005L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidPasswordException.java
// public class InvalidPasswordException extends Exception {
//
// /**
// * The remote I2PControl server is rejecting the provided password.
// */
// private static final long serialVersionUID = 8461972369522962046L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/methods/GetRateStat.java
// public class GetRateStat{
//
// @SuppressWarnings("unchecked")
// public static Double execute(String stat, long period)
// throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException {
//
// JSONRPC2Request req = new JSONRPC2Request("GetRate", JSONRPC2Interface.incrNonce());
// @SuppressWarnings("rawtypes")
// Map params = new HashMap();
// params.put("Stat", stat);
// params.put("Period", period);
// req.setParams(params);
//
// JSONRPC2Response resp = null;
// try {
// resp = JSONRPC2Interface.sendReq(req);
// HashMap inParams = (HashMap) resp.getResult();
//
// if (inParams == null)
// return 0D;
//
// try {
// Double dbl = (Double) inParams.get("Result");
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a BigDecimal as Double");
// }
// try {
// BigDecimal bigNum = (BigDecimal) inParams.get("Result");
// Double dbl = bigNum.doubleValue();
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a double as a BigDecimal");
// }
// }catch (UnrecoverableFailedRequestException e) {
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.error("getRateStat failed.", e);
// }
// return new Double(0);
// }
// }
// Path: src/net/i2p/itoopie/gui/component/chart/RateStatTracker.java
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
import net.i2p.itoopie.i2pcontrol.methods.GetRateStat;
package net.i2p.itoopie.gui.component.chart;
/**
* Unused
*/
public class RateStatTracker extends Thread implements Tracker {
/** Last read bw */
private double m_value = 0;
private final int updateInterval;
/** Which RateStat to measure from the router */
private String rateStat;
/** Which period of a stat to measure */
private long period;
/**
* Start daemon that checks to current inbound bandwidth of the router.
*/
public RateStatTracker(String rateStat, long period, int interval) {
super("IToopie-RST");
this.rateStat = rateStat;
this.period = period;
updateInterval = interval;
this.setDaemon(true);
this.start();
}
/**
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
while (true) {
try { | m_value = GetRateStat.execute(rateStat, period); |
i2p/i2p.itoopie | src/net/i2p/itoopie/gui/component/chart/RateStatTracker.java | // Path: src/com/thetransactioncompany/jsonrpc2/client/JSONRPC2SessionException.java
// public class JSONRPC2SessionException extends Exception {
//
//
// /**
// * The exception cause is network or I/O related.
// */
// public static final int NETWORK_EXCEPTION = 1;
//
//
// /**
// * Unexpected "Content-Type" header value of the HTTP response.
// */
// public static final int UNEXPECTED_CONTENT_TYPE = 2;
//
//
// /**
// * Invalid JSON-RPC 2.0 response.
// */
// public static final int BAD_RESPONSE = 3;
//
//
// /**
// * Indicates the type of cause for this exception, see
// * constants.
// */
// private int causeType;
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message and cause type.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// */
// public JSONRPC2SessionException(final String message, final int causeType) {
//
// super(message);
// this.causeType = causeType;
// }
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message, cause type and cause.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// * @param cause The original exception.
// */
// public JSONRPC2SessionException(final String message, final int causeType, final Throwable cause) {
//
// super(message, cause);
// this.causeType = causeType;
// }
//
//
// /**
// * Returns the exception cause type.
// *
// * @return The cause type constant.
// */
// public int getCauseType() {
//
// return causeType;
// }
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidParametersException.java
// public class InvalidParametersException extends Exception {
//
// /**
// * Signifies that the paramers we sent were invalid for the used JSONRPC2
// * method.
// */
// private static final long serialVersionUID = 4044188679464846005L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidPasswordException.java
// public class InvalidPasswordException extends Exception {
//
// /**
// * The remote I2PControl server is rejecting the provided password.
// */
// private static final long serialVersionUID = 8461972369522962046L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/methods/GetRateStat.java
// public class GetRateStat{
//
// @SuppressWarnings("unchecked")
// public static Double execute(String stat, long period)
// throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException {
//
// JSONRPC2Request req = new JSONRPC2Request("GetRate", JSONRPC2Interface.incrNonce());
// @SuppressWarnings("rawtypes")
// Map params = new HashMap();
// params.put("Stat", stat);
// params.put("Period", period);
// req.setParams(params);
//
// JSONRPC2Response resp = null;
// try {
// resp = JSONRPC2Interface.sendReq(req);
// HashMap inParams = (HashMap) resp.getResult();
//
// if (inParams == null)
// return 0D;
//
// try {
// Double dbl = (Double) inParams.get("Result");
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a BigDecimal as Double");
// }
// try {
// BigDecimal bigNum = (BigDecimal) inParams.get("Result");
// Double dbl = bigNum.doubleValue();
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a double as a BigDecimal");
// }
// }catch (UnrecoverableFailedRequestException e) {
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.error("getRateStat failed.", e);
// }
// return new Double(0);
// }
// }
| import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
import net.i2p.itoopie.i2pcontrol.methods.GetRateStat; | package net.i2p.itoopie.gui.component.chart;
/**
* Unused
*/
public class RateStatTracker extends Thread implements Tracker {
/** Last read bw */
private double m_value = 0;
private final int updateInterval;
/** Which RateStat to measure from the router */
private String rateStat;
/** Which period of a stat to measure */
private long period;
/**
* Start daemon that checks to current inbound bandwidth of the router.
*/
public RateStatTracker(String rateStat, long period, int interval) {
super("IToopie-RST");
this.rateStat = rateStat;
this.period = period;
updateInterval = interval;
this.setDaemon(true);
this.start();
}
/**
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
while (true) {
try {
m_value = GetRateStat.execute(rateStat, period); | // Path: src/com/thetransactioncompany/jsonrpc2/client/JSONRPC2SessionException.java
// public class JSONRPC2SessionException extends Exception {
//
//
// /**
// * The exception cause is network or I/O related.
// */
// public static final int NETWORK_EXCEPTION = 1;
//
//
// /**
// * Unexpected "Content-Type" header value of the HTTP response.
// */
// public static final int UNEXPECTED_CONTENT_TYPE = 2;
//
//
// /**
// * Invalid JSON-RPC 2.0 response.
// */
// public static final int BAD_RESPONSE = 3;
//
//
// /**
// * Indicates the type of cause for this exception, see
// * constants.
// */
// private int causeType;
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message and cause type.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// */
// public JSONRPC2SessionException(final String message, final int causeType) {
//
// super(message);
// this.causeType = causeType;
// }
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message, cause type and cause.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// * @param cause The original exception.
// */
// public JSONRPC2SessionException(final String message, final int causeType, final Throwable cause) {
//
// super(message, cause);
// this.causeType = causeType;
// }
//
//
// /**
// * Returns the exception cause type.
// *
// * @return The cause type constant.
// */
// public int getCauseType() {
//
// return causeType;
// }
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidParametersException.java
// public class InvalidParametersException extends Exception {
//
// /**
// * Signifies that the paramers we sent were invalid for the used JSONRPC2
// * method.
// */
// private static final long serialVersionUID = 4044188679464846005L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidPasswordException.java
// public class InvalidPasswordException extends Exception {
//
// /**
// * The remote I2PControl server is rejecting the provided password.
// */
// private static final long serialVersionUID = 8461972369522962046L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/methods/GetRateStat.java
// public class GetRateStat{
//
// @SuppressWarnings("unchecked")
// public static Double execute(String stat, long period)
// throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException {
//
// JSONRPC2Request req = new JSONRPC2Request("GetRate", JSONRPC2Interface.incrNonce());
// @SuppressWarnings("rawtypes")
// Map params = new HashMap();
// params.put("Stat", stat);
// params.put("Period", period);
// req.setParams(params);
//
// JSONRPC2Response resp = null;
// try {
// resp = JSONRPC2Interface.sendReq(req);
// HashMap inParams = (HashMap) resp.getResult();
//
// if (inParams == null)
// return 0D;
//
// try {
// Double dbl = (Double) inParams.get("Result");
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a BigDecimal as Double");
// }
// try {
// BigDecimal bigNum = (BigDecimal) inParams.get("Result");
// Double dbl = bigNum.doubleValue();
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a double as a BigDecimal");
// }
// }catch (UnrecoverableFailedRequestException e) {
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.error("getRateStat failed.", e);
// }
// return new Double(0);
// }
// }
// Path: src/net/i2p/itoopie/gui/component/chart/RateStatTracker.java
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
import net.i2p.itoopie.i2pcontrol.methods.GetRateStat;
package net.i2p.itoopie.gui.component.chart;
/**
* Unused
*/
public class RateStatTracker extends Thread implements Tracker {
/** Last read bw */
private double m_value = 0;
private final int updateInterval;
/** Which RateStat to measure from the router */
private String rateStat;
/** Which period of a stat to measure */
private long period;
/**
* Start daemon that checks to current inbound bandwidth of the router.
*/
public RateStatTracker(String rateStat, long period, int interval) {
super("IToopie-RST");
this.rateStat = rateStat;
this.period = period;
updateInterval = interval;
this.setDaemon(true);
this.start();
}
/**
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
while (true) {
try {
m_value = GetRateStat.execute(rateStat, period); | } catch (InvalidPasswordException e1) { |
i2p/i2p.itoopie | src/net/i2p/itoopie/gui/component/chart/RateStatTracker.java | // Path: src/com/thetransactioncompany/jsonrpc2/client/JSONRPC2SessionException.java
// public class JSONRPC2SessionException extends Exception {
//
//
// /**
// * The exception cause is network or I/O related.
// */
// public static final int NETWORK_EXCEPTION = 1;
//
//
// /**
// * Unexpected "Content-Type" header value of the HTTP response.
// */
// public static final int UNEXPECTED_CONTENT_TYPE = 2;
//
//
// /**
// * Invalid JSON-RPC 2.0 response.
// */
// public static final int BAD_RESPONSE = 3;
//
//
// /**
// * Indicates the type of cause for this exception, see
// * constants.
// */
// private int causeType;
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message and cause type.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// */
// public JSONRPC2SessionException(final String message, final int causeType) {
//
// super(message);
// this.causeType = causeType;
// }
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message, cause type and cause.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// * @param cause The original exception.
// */
// public JSONRPC2SessionException(final String message, final int causeType, final Throwable cause) {
//
// super(message, cause);
// this.causeType = causeType;
// }
//
//
// /**
// * Returns the exception cause type.
// *
// * @return The cause type constant.
// */
// public int getCauseType() {
//
// return causeType;
// }
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidParametersException.java
// public class InvalidParametersException extends Exception {
//
// /**
// * Signifies that the paramers we sent were invalid for the used JSONRPC2
// * method.
// */
// private static final long serialVersionUID = 4044188679464846005L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidPasswordException.java
// public class InvalidPasswordException extends Exception {
//
// /**
// * The remote I2PControl server is rejecting the provided password.
// */
// private static final long serialVersionUID = 8461972369522962046L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/methods/GetRateStat.java
// public class GetRateStat{
//
// @SuppressWarnings("unchecked")
// public static Double execute(String stat, long period)
// throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException {
//
// JSONRPC2Request req = new JSONRPC2Request("GetRate", JSONRPC2Interface.incrNonce());
// @SuppressWarnings("rawtypes")
// Map params = new HashMap();
// params.put("Stat", stat);
// params.put("Period", period);
// req.setParams(params);
//
// JSONRPC2Response resp = null;
// try {
// resp = JSONRPC2Interface.sendReq(req);
// HashMap inParams = (HashMap) resp.getResult();
//
// if (inParams == null)
// return 0D;
//
// try {
// Double dbl = (Double) inParams.get("Result");
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a BigDecimal as Double");
// }
// try {
// BigDecimal bigNum = (BigDecimal) inParams.get("Result");
// Double dbl = bigNum.doubleValue();
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a double as a BigDecimal");
// }
// }catch (UnrecoverableFailedRequestException e) {
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.error("getRateStat failed.", e);
// }
// return new Double(0);
// }
// }
| import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
import net.i2p.itoopie.i2pcontrol.methods.GetRateStat; | package net.i2p.itoopie.gui.component.chart;
/**
* Unused
*/
public class RateStatTracker extends Thread implements Tracker {
/** Last read bw */
private double m_value = 0;
private final int updateInterval;
/** Which RateStat to measure from the router */
private String rateStat;
/** Which period of a stat to measure */
private long period;
/**
* Start daemon that checks to current inbound bandwidth of the router.
*/
public RateStatTracker(String rateStat, long period, int interval) {
super("IToopie-RST");
this.rateStat = rateStat;
this.period = period;
updateInterval = interval;
this.setDaemon(true);
this.start();
}
/**
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
while (true) {
try {
m_value = GetRateStat.execute(rateStat, period);
} catch (InvalidPasswordException e1) { | // Path: src/com/thetransactioncompany/jsonrpc2/client/JSONRPC2SessionException.java
// public class JSONRPC2SessionException extends Exception {
//
//
// /**
// * The exception cause is network or I/O related.
// */
// public static final int NETWORK_EXCEPTION = 1;
//
//
// /**
// * Unexpected "Content-Type" header value of the HTTP response.
// */
// public static final int UNEXPECTED_CONTENT_TYPE = 2;
//
//
// /**
// * Invalid JSON-RPC 2.0 response.
// */
// public static final int BAD_RESPONSE = 3;
//
//
// /**
// * Indicates the type of cause for this exception, see
// * constants.
// */
// private int causeType;
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message and cause type.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// */
// public JSONRPC2SessionException(final String message, final int causeType) {
//
// super(message);
// this.causeType = causeType;
// }
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message, cause type and cause.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// * @param cause The original exception.
// */
// public JSONRPC2SessionException(final String message, final int causeType, final Throwable cause) {
//
// super(message, cause);
// this.causeType = causeType;
// }
//
//
// /**
// * Returns the exception cause type.
// *
// * @return The cause type constant.
// */
// public int getCauseType() {
//
// return causeType;
// }
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidParametersException.java
// public class InvalidParametersException extends Exception {
//
// /**
// * Signifies that the paramers we sent were invalid for the used JSONRPC2
// * method.
// */
// private static final long serialVersionUID = 4044188679464846005L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidPasswordException.java
// public class InvalidPasswordException extends Exception {
//
// /**
// * The remote I2PControl server is rejecting the provided password.
// */
// private static final long serialVersionUID = 8461972369522962046L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/methods/GetRateStat.java
// public class GetRateStat{
//
// @SuppressWarnings("unchecked")
// public static Double execute(String stat, long period)
// throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException {
//
// JSONRPC2Request req = new JSONRPC2Request("GetRate", JSONRPC2Interface.incrNonce());
// @SuppressWarnings("rawtypes")
// Map params = new HashMap();
// params.put("Stat", stat);
// params.put("Period", period);
// req.setParams(params);
//
// JSONRPC2Response resp = null;
// try {
// resp = JSONRPC2Interface.sendReq(req);
// HashMap inParams = (HashMap) resp.getResult();
//
// if (inParams == null)
// return 0D;
//
// try {
// Double dbl = (Double) inParams.get("Result");
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a BigDecimal as Double");
// }
// try {
// BigDecimal bigNum = (BigDecimal) inParams.get("Result");
// Double dbl = bigNum.doubleValue();
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a double as a BigDecimal");
// }
// }catch (UnrecoverableFailedRequestException e) {
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.error("getRateStat failed.", e);
// }
// return new Double(0);
// }
// }
// Path: src/net/i2p/itoopie/gui/component/chart/RateStatTracker.java
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
import net.i2p.itoopie.i2pcontrol.methods.GetRateStat;
package net.i2p.itoopie.gui.component.chart;
/**
* Unused
*/
public class RateStatTracker extends Thread implements Tracker {
/** Last read bw */
private double m_value = 0;
private final int updateInterval;
/** Which RateStat to measure from the router */
private String rateStat;
/** Which period of a stat to measure */
private long period;
/**
* Start daemon that checks to current inbound bandwidth of the router.
*/
public RateStatTracker(String rateStat, long period, int interval) {
super("IToopie-RST");
this.rateStat = rateStat;
this.period = period;
updateInterval = interval;
this.setDaemon(true);
this.start();
}
/**
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
while (true) {
try {
m_value = GetRateStat.execute(rateStat, period);
} catch (InvalidPasswordException e1) { | } catch (JSONRPC2SessionException e1) { |
i2p/i2p.itoopie | src/net/i2p/itoopie/gui/component/chart/RateStatTracker.java | // Path: src/com/thetransactioncompany/jsonrpc2/client/JSONRPC2SessionException.java
// public class JSONRPC2SessionException extends Exception {
//
//
// /**
// * The exception cause is network or I/O related.
// */
// public static final int NETWORK_EXCEPTION = 1;
//
//
// /**
// * Unexpected "Content-Type" header value of the HTTP response.
// */
// public static final int UNEXPECTED_CONTENT_TYPE = 2;
//
//
// /**
// * Invalid JSON-RPC 2.0 response.
// */
// public static final int BAD_RESPONSE = 3;
//
//
// /**
// * Indicates the type of cause for this exception, see
// * constants.
// */
// private int causeType;
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message and cause type.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// */
// public JSONRPC2SessionException(final String message, final int causeType) {
//
// super(message);
// this.causeType = causeType;
// }
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message, cause type and cause.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// * @param cause The original exception.
// */
// public JSONRPC2SessionException(final String message, final int causeType, final Throwable cause) {
//
// super(message, cause);
// this.causeType = causeType;
// }
//
//
// /**
// * Returns the exception cause type.
// *
// * @return The cause type constant.
// */
// public int getCauseType() {
//
// return causeType;
// }
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidParametersException.java
// public class InvalidParametersException extends Exception {
//
// /**
// * Signifies that the paramers we sent were invalid for the used JSONRPC2
// * method.
// */
// private static final long serialVersionUID = 4044188679464846005L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidPasswordException.java
// public class InvalidPasswordException extends Exception {
//
// /**
// * The remote I2PControl server is rejecting the provided password.
// */
// private static final long serialVersionUID = 8461972369522962046L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/methods/GetRateStat.java
// public class GetRateStat{
//
// @SuppressWarnings("unchecked")
// public static Double execute(String stat, long period)
// throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException {
//
// JSONRPC2Request req = new JSONRPC2Request("GetRate", JSONRPC2Interface.incrNonce());
// @SuppressWarnings("rawtypes")
// Map params = new HashMap();
// params.put("Stat", stat);
// params.put("Period", period);
// req.setParams(params);
//
// JSONRPC2Response resp = null;
// try {
// resp = JSONRPC2Interface.sendReq(req);
// HashMap inParams = (HashMap) resp.getResult();
//
// if (inParams == null)
// return 0D;
//
// try {
// Double dbl = (Double) inParams.get("Result");
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a BigDecimal as Double");
// }
// try {
// BigDecimal bigNum = (BigDecimal) inParams.get("Result");
// Double dbl = bigNum.doubleValue();
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a double as a BigDecimal");
// }
// }catch (UnrecoverableFailedRequestException e) {
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.error("getRateStat failed.", e);
// }
// return new Double(0);
// }
// }
| import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
import net.i2p.itoopie.i2pcontrol.methods.GetRateStat; | package net.i2p.itoopie.gui.component.chart;
/**
* Unused
*/
public class RateStatTracker extends Thread implements Tracker {
/** Last read bw */
private double m_value = 0;
private final int updateInterval;
/** Which RateStat to measure from the router */
private String rateStat;
/** Which period of a stat to measure */
private long period;
/**
* Start daemon that checks to current inbound bandwidth of the router.
*/
public RateStatTracker(String rateStat, long period, int interval) {
super("IToopie-RST");
this.rateStat = rateStat;
this.period = period;
updateInterval = interval;
this.setDaemon(true);
this.start();
}
/**
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
while (true) {
try {
m_value = GetRateStat.execute(rateStat, period);
} catch (InvalidPasswordException e1) {
} catch (JSONRPC2SessionException e1) { | // Path: src/com/thetransactioncompany/jsonrpc2/client/JSONRPC2SessionException.java
// public class JSONRPC2SessionException extends Exception {
//
//
// /**
// * The exception cause is network or I/O related.
// */
// public static final int NETWORK_EXCEPTION = 1;
//
//
// /**
// * Unexpected "Content-Type" header value of the HTTP response.
// */
// public static final int UNEXPECTED_CONTENT_TYPE = 2;
//
//
// /**
// * Invalid JSON-RPC 2.0 response.
// */
// public static final int BAD_RESPONSE = 3;
//
//
// /**
// * Indicates the type of cause for this exception, see
// * constants.
// */
// private int causeType;
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message and cause type.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// */
// public JSONRPC2SessionException(final String message, final int causeType) {
//
// super(message);
// this.causeType = causeType;
// }
//
//
// /**
// * Creates a new JSON-RPC 2.0 session exception with the specified
// * message, cause type and cause.
// *
// * @param message The message.
// * @param causeType The cause type, see the constants.
// * @param cause The original exception.
// */
// public JSONRPC2SessionException(final String message, final int causeType, final Throwable cause) {
//
// super(message, cause);
// this.causeType = causeType;
// }
//
//
// /**
// * Returns the exception cause type.
// *
// * @return The cause type constant.
// */
// public int getCauseType() {
//
// return causeType;
// }
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidParametersException.java
// public class InvalidParametersException extends Exception {
//
// /**
// * Signifies that the paramers we sent were invalid for the used JSONRPC2
// * method.
// */
// private static final long serialVersionUID = 4044188679464846005L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/InvalidPasswordException.java
// public class InvalidPasswordException extends Exception {
//
// /**
// * The remote I2PControl server is rejecting the provided password.
// */
// private static final long serialVersionUID = 8461972369522962046L;
//
// }
//
// Path: src/net/i2p/itoopie/i2pcontrol/methods/GetRateStat.java
// public class GetRateStat{
//
// @SuppressWarnings("unchecked")
// public static Double execute(String stat, long period)
// throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException {
//
// JSONRPC2Request req = new JSONRPC2Request("GetRate", JSONRPC2Interface.incrNonce());
// @SuppressWarnings("rawtypes")
// Map params = new HashMap();
// params.put("Stat", stat);
// params.put("Period", period);
// req.setParams(params);
//
// JSONRPC2Response resp = null;
// try {
// resp = JSONRPC2Interface.sendReq(req);
// HashMap inParams = (HashMap) resp.getResult();
//
// if (inParams == null)
// return 0D;
//
// try {
// Double dbl = (Double) inParams.get("Result");
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a BigDecimal as Double");
// }
// try {
// BigDecimal bigNum = (BigDecimal) inParams.get("Result");
// Double dbl = bigNum.doubleValue();
// return dbl;
// } catch (ClassCastException e){
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.debug("Error: Tried to cast a double as a BigDecimal");
// }
// }catch (UnrecoverableFailedRequestException e) {
// Log _log = LogFactory.getLog(GetRateStat.class);
// _log.error("getRateStat failed.", e);
// }
// return new Double(0);
// }
// }
// Path: src/net/i2p/itoopie/gui/component/chart/RateStatTracker.java
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
import net.i2p.itoopie.i2pcontrol.InvalidParametersException;
import net.i2p.itoopie.i2pcontrol.InvalidPasswordException;
import net.i2p.itoopie.i2pcontrol.methods.GetRateStat;
package net.i2p.itoopie.gui.component.chart;
/**
* Unused
*/
public class RateStatTracker extends Thread implements Tracker {
/** Last read bw */
private double m_value = 0;
private final int updateInterval;
/** Which RateStat to measure from the router */
private String rateStat;
/** Which period of a stat to measure */
private long period;
/**
* Start daemon that checks to current inbound bandwidth of the router.
*/
public RateStatTracker(String rateStat, long period, int interval) {
super("IToopie-RST");
this.rateStat = rateStat;
this.period = period;
updateInterval = interval;
this.setDaemon(true);
this.start();
}
/**
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
while (true) {
try {
m_value = GetRateStat.execute(rateStat, period);
} catch (InvalidPasswordException e1) {
} catch (JSONRPC2SessionException e1) { | } catch (InvalidParametersException e1) { |
i2p/i2p.itoopie | src/net/i2p/itoopie/gui/component/multilinelabel/MultiLineLabelUI.java | // Path: src/net/i2p/itoopie/gui/component/MultiLineLabel.java
// public class MultiLineLabel extends JLabel {
//
// /** Default serial version UID. */
// private static final long serialVersionUID = 1L;
//
// /** Horizontal text alignment. */
// private int halign = LEFT;
//
// /** Vertical text alignment. */
// private int valign = CENTER;
//
// /** Cache to save heap allocations. */
// private Rectangle bounds;
//
// /**
// * Creates a new empty label.
// */
// public MultiLineLabel() {
// super();
// setUI(MultiLineLabelUI.labelUI);
// }
//
// /**
// * Creates a new label with <code>text</code> value.
// *
// * @param text
// * the value of the label
// */
// public MultiLineLabel(String text) {
// this();
// setText(text);
// }
//
// /** {@inheritDoc} */
// public Rectangle getBounds() {
// if (bounds == null) {
// bounds = new Rectangle();
// }
// return super.getBounds(bounds);
// }
//
// /**
// * Set the vertical text alignment.
// *
// * @param alignment
// * vertical alignment
// */
// public void setVerticalTextAlignment(int alignment) {
// firePropertyChange("verticalTextAlignment", valign, alignment);
// valign = alignment;
// }
//
// /**
// * Set the horizontal text alignment.
// *
// * @param alignment
// * horizontal alignment
// */
// public void setHorizontalTextAlignment(int alignment) {
// firePropertyChange("horizontalTextAlignment", halign, alignment);
// halign = alignment;
// }
//
// /**
// * Get the vertical text alignment.
// *
// * @return vertical text alignment
// */
// public int getVerticalTextAlignment() {
// return valign;
// }
//
// /**
// * Get the horizontal text alignment.
// *
// * @return horizontal text alignment
// */
// public int getHorizontalTextAlignment() {
// return halign;
// }
// }
| import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.LabelUI;
import javax.swing.plaf.basic.BasicLabelUI;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.PlainDocument;
import javax.swing.text.Segment;
import javax.swing.text.Utilities;
import javax.swing.text.View;
import net.i2p.itoopie.gui.component.MultiLineLabel; | * the text bounds
* @return the clipped string
*/
protected String clip(String text, FontMetrics fm, Rectangle bounds) {
// Fast and lazy way to insert a clip indication is to simply replace
// the last characters in the string with the clip indication.
// A better way would be to use metrics and calculate how many (if any)
// characters that need to be replaced.
if (text.length() < 3) {
return "...";
}
return text.substring(0, text.length() - 3) + "...";
}
/**
* Establish the vertical text alignment. The default alignment is to center
* the text in the label.
*
* @param label
* the label to paint
* @param fm
* font metrics
* @param bounds
* the text bounds rectangle
* @return the vertical text alignment, defaults to CENTER.
*/
protected int alignmentY(JLabel label, FontMetrics fm, Rectangle bounds) {
final int height = getAvailableHeight(label);
int textHeight = bounds.height;
| // Path: src/net/i2p/itoopie/gui/component/MultiLineLabel.java
// public class MultiLineLabel extends JLabel {
//
// /** Default serial version UID. */
// private static final long serialVersionUID = 1L;
//
// /** Horizontal text alignment. */
// private int halign = LEFT;
//
// /** Vertical text alignment. */
// private int valign = CENTER;
//
// /** Cache to save heap allocations. */
// private Rectangle bounds;
//
// /**
// * Creates a new empty label.
// */
// public MultiLineLabel() {
// super();
// setUI(MultiLineLabelUI.labelUI);
// }
//
// /**
// * Creates a new label with <code>text</code> value.
// *
// * @param text
// * the value of the label
// */
// public MultiLineLabel(String text) {
// this();
// setText(text);
// }
//
// /** {@inheritDoc} */
// public Rectangle getBounds() {
// if (bounds == null) {
// bounds = new Rectangle();
// }
// return super.getBounds(bounds);
// }
//
// /**
// * Set the vertical text alignment.
// *
// * @param alignment
// * vertical alignment
// */
// public void setVerticalTextAlignment(int alignment) {
// firePropertyChange("verticalTextAlignment", valign, alignment);
// valign = alignment;
// }
//
// /**
// * Set the horizontal text alignment.
// *
// * @param alignment
// * horizontal alignment
// */
// public void setHorizontalTextAlignment(int alignment) {
// firePropertyChange("horizontalTextAlignment", halign, alignment);
// halign = alignment;
// }
//
// /**
// * Get the vertical text alignment.
// *
// * @return vertical text alignment
// */
// public int getVerticalTextAlignment() {
// return valign;
// }
//
// /**
// * Get the horizontal text alignment.
// *
// * @return horizontal text alignment
// */
// public int getHorizontalTextAlignment() {
// return halign;
// }
// }
// Path: src/net/i2p/itoopie/gui/component/multilinelabel/MultiLineLabelUI.java
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.LabelUI;
import javax.swing.plaf.basic.BasicLabelUI;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.PlainDocument;
import javax.swing.text.Segment;
import javax.swing.text.Utilities;
import javax.swing.text.View;
import net.i2p.itoopie.gui.component.MultiLineLabel;
* the text bounds
* @return the clipped string
*/
protected String clip(String text, FontMetrics fm, Rectangle bounds) {
// Fast and lazy way to insert a clip indication is to simply replace
// the last characters in the string with the clip indication.
// A better way would be to use metrics and calculate how many (if any)
// characters that need to be replaced.
if (text.length() < 3) {
return "...";
}
return text.substring(0, text.length() - 3) + "...";
}
/**
* Establish the vertical text alignment. The default alignment is to center
* the text in the label.
*
* @param label
* the label to paint
* @param fm
* font metrics
* @param bounds
* the text bounds rectangle
* @return the vertical text alignment, defaults to CENTER.
*/
protected int alignmentY(JLabel label, FontMetrics fm, Rectangle bounds) {
final int height = getAvailableHeight(label);
int textHeight = bounds.height;
| if (label instanceof MultiLineLabel) { |
i2p/i2p.itoopie | src/net/i2p/itoopie/gui/component/GradientPanel.java | // Path: src/net/i2p/itoopie/gui/GUIHelper.java
// public class GUIHelper {
// public final static Color VERY_LIGHT = new Color(230,230,230);
// public final static Color LIGHT = new Color(215,215,215);
// public final static Color MEDIUM_LIGHT_LIGHT = new Color(205,205,205);
// public final static Color MEDIUM_LIGHT = new Color(195,195,195);
// public final static Color MEDIUM = new Color (175,175,175);
// public final static Color DARK = new Color(145,145,145);
// public final static FontUIResource DEFAULT_FONT = new FontUIResource(Font.SANS_SERIF,Font.PLAIN,12);
//
// public static void setDefaultStyle(){
// //Selected tab
// UIManager.put("TabbedPane.focus", VERY_LIGHT);
// UIManager.put("TabbedPane.selected", LIGHT);
// UIManager.put("TabbedPane.selectHighlight", Color.BLACK);
// //General shadow around each tab
// UIManager.put("TabbedPane.light", Color.WHITE);
// //Panel inside of tab
// UIManager.put("TabbedPane.contentAreaColor", VERY_LIGHT);
// //Button and unselected tab background
// UIManager.put("Button.background", Color.WHITE);
//
// setDefaultFonts();
// setTabLooks();
// }
//
// private static void setDefaultFonts(){
// UIManager.put("Button.font", DEFAULT_FONT);
// UIManager.put("ToggleButton.font", DEFAULT_FONT);
// UIManager.put("RadioButton.font", DEFAULT_FONT);
// UIManager.put("CheckBox.font", DEFAULT_FONT);
// UIManager.put("ColorChooser.font", DEFAULT_FONT);
// UIManager.put("ComboBox.font", DEFAULT_FONT);
// UIManager.put("Label.font", DEFAULT_FONT);
// UIManager.put("List.font", DEFAULT_FONT);
// UIManager.put("MenuBar.font", DEFAULT_FONT);
// UIManager.put("MenuItem.font", DEFAULT_FONT);
// UIManager.put("RadioButtonMenuItem.font", DEFAULT_FONT);
// UIManager.put("CheckBoxMenuItem.font", DEFAULT_FONT);
// UIManager.put("Menu.font", DEFAULT_FONT);
// UIManager.put("PopupMenu.font", DEFAULT_FONT);
// UIManager.put("OptionPane.font", DEFAULT_FONT);
// UIManager.put("Panel.font", DEFAULT_FONT);
// UIManager.put("ProgressBar.font", DEFAULT_FONT);
// UIManager.put("ScrollPane.font", DEFAULT_FONT);
// UIManager.put("Viewport.font", DEFAULT_FONT);
// UIManager.put("TabbedPane.font", DEFAULT_FONT);
// UIManager.put("Table.font", DEFAULT_FONT);
// UIManager.put("TableHeader.font", DEFAULT_FONT);
// UIManager.put("TextField.font", DEFAULT_FONT);
// UIManager.put("PasswordField.font", DEFAULT_FONT);
// UIManager.put("TextArea.font", DEFAULT_FONT);
// UIManager.put("TextPane.font", DEFAULT_FONT);
// UIManager.put("EditorPane.font", DEFAULT_FONT);
// UIManager.put("TitledBorder.font", DEFAULT_FONT);
// UIManager.put("ToolBar.font", DEFAULT_FONT);
// UIManager.put("ToolTip.font", DEFAULT_FONT);
// UIManager.put("Tree.font", DEFAULT_FONT);
// }
//
// public static void setTabLooks(){
// UIManager.put("TabbedPane.font",new FontUIResource(Font.SANS_SERIF,Font.PLAIN,13));
// UIManager.put("TabbedPane.contentBorderInsets", new InsetsUIResource(2, 2, 3, 3));
// UIManager.put("TabbedPane.tabAreaInsets", new InsetsUIResource(3,2,0,2));
// UIManager.put("TabbedPane.tabInsets", new InsetsUIResource(6,4,2,4));
// UIManager.put("TabbedPane.textIconGap", 4);
// //UIManager.put(key, value)
// }
// }
| import java.awt.*;
import javax.swing.JPanel;
import net.i2p.itoopie.gui.GUIHelper; | package net.i2p.itoopie.gui.component;
public class GradientPanel extends JPanel {
private static final long serialVersionUID = -8423076211079261636L;
public final static int HORIZONTAL = 0;
public final static int VERTICAL = 1;
public final static int DIAGONAL_LEFT = 2;
public final static int DIAGONAL_RIGHT = 3;
private Color startColor = Color.WHITE; | // Path: src/net/i2p/itoopie/gui/GUIHelper.java
// public class GUIHelper {
// public final static Color VERY_LIGHT = new Color(230,230,230);
// public final static Color LIGHT = new Color(215,215,215);
// public final static Color MEDIUM_LIGHT_LIGHT = new Color(205,205,205);
// public final static Color MEDIUM_LIGHT = new Color(195,195,195);
// public final static Color MEDIUM = new Color (175,175,175);
// public final static Color DARK = new Color(145,145,145);
// public final static FontUIResource DEFAULT_FONT = new FontUIResource(Font.SANS_SERIF,Font.PLAIN,12);
//
// public static void setDefaultStyle(){
// //Selected tab
// UIManager.put("TabbedPane.focus", VERY_LIGHT);
// UIManager.put("TabbedPane.selected", LIGHT);
// UIManager.put("TabbedPane.selectHighlight", Color.BLACK);
// //General shadow around each tab
// UIManager.put("TabbedPane.light", Color.WHITE);
// //Panel inside of tab
// UIManager.put("TabbedPane.contentAreaColor", VERY_LIGHT);
// //Button and unselected tab background
// UIManager.put("Button.background", Color.WHITE);
//
// setDefaultFonts();
// setTabLooks();
// }
//
// private static void setDefaultFonts(){
// UIManager.put("Button.font", DEFAULT_FONT);
// UIManager.put("ToggleButton.font", DEFAULT_FONT);
// UIManager.put("RadioButton.font", DEFAULT_FONT);
// UIManager.put("CheckBox.font", DEFAULT_FONT);
// UIManager.put("ColorChooser.font", DEFAULT_FONT);
// UIManager.put("ComboBox.font", DEFAULT_FONT);
// UIManager.put("Label.font", DEFAULT_FONT);
// UIManager.put("List.font", DEFAULT_FONT);
// UIManager.put("MenuBar.font", DEFAULT_FONT);
// UIManager.put("MenuItem.font", DEFAULT_FONT);
// UIManager.put("RadioButtonMenuItem.font", DEFAULT_FONT);
// UIManager.put("CheckBoxMenuItem.font", DEFAULT_FONT);
// UIManager.put("Menu.font", DEFAULT_FONT);
// UIManager.put("PopupMenu.font", DEFAULT_FONT);
// UIManager.put("OptionPane.font", DEFAULT_FONT);
// UIManager.put("Panel.font", DEFAULT_FONT);
// UIManager.put("ProgressBar.font", DEFAULT_FONT);
// UIManager.put("ScrollPane.font", DEFAULT_FONT);
// UIManager.put("Viewport.font", DEFAULT_FONT);
// UIManager.put("TabbedPane.font", DEFAULT_FONT);
// UIManager.put("Table.font", DEFAULT_FONT);
// UIManager.put("TableHeader.font", DEFAULT_FONT);
// UIManager.put("TextField.font", DEFAULT_FONT);
// UIManager.put("PasswordField.font", DEFAULT_FONT);
// UIManager.put("TextArea.font", DEFAULT_FONT);
// UIManager.put("TextPane.font", DEFAULT_FONT);
// UIManager.put("EditorPane.font", DEFAULT_FONT);
// UIManager.put("TitledBorder.font", DEFAULT_FONT);
// UIManager.put("ToolBar.font", DEFAULT_FONT);
// UIManager.put("ToolTip.font", DEFAULT_FONT);
// UIManager.put("Tree.font", DEFAULT_FONT);
// }
//
// public static void setTabLooks(){
// UIManager.put("TabbedPane.font",new FontUIResource(Font.SANS_SERIF,Font.PLAIN,13));
// UIManager.put("TabbedPane.contentBorderInsets", new InsetsUIResource(2, 2, 3, 3));
// UIManager.put("TabbedPane.tabAreaInsets", new InsetsUIResource(3,2,0,2));
// UIManager.put("TabbedPane.tabInsets", new InsetsUIResource(6,4,2,4));
// UIManager.put("TabbedPane.textIconGap", 4);
// //UIManager.put(key, value)
// }
// }
// Path: src/net/i2p/itoopie/gui/component/GradientPanel.java
import java.awt.*;
import javax.swing.JPanel;
import net.i2p.itoopie.gui.GUIHelper;
package net.i2p.itoopie.gui.component;
public class GradientPanel extends JPanel {
private static final long serialVersionUID = -8423076211079261636L;
public final static int HORIZONTAL = 0;
public final static int VERTICAL = 1;
public final static int DIAGONAL_LEFT = 2;
public final static int DIAGONAL_RIGHT = 3;
private Color startColor = Color.WHITE; | private Color endColor = GUIHelper.MEDIUM_LIGHT_LIGHT; |
i2p/i2p.itoopie | src/net/i2p/itoopie/i2pcontrol/methods/I2PControl.java | // Path: src/net/i2p/itoopie/i18n/Transl.java
// public class Transl {
//
// public static final String BUNDLE_NAME = "net.i2p.itoopie.messages";
//
//
// public static String _t(String s) {
// return Translate.getString(s, BUNDLE_NAME);
// }
//
//
// /**
// * translate a string with a parameter
// * This is a lot more expensive than getString(s, ctx), so use sparingly.
// *
// * @param s string to be translated containing {0}
// * The {0} will be replaced by the parameter.
// * Single quotes must be doubled, i.e. ' -> '' in the string.
// * @param o parameter, not translated.
// * To tranlslate parameter also, use _t("foo {0} bar", _t("baz"))
// * Do not double the single quotes in the parameter.
// * Use autoboxing to call with ints, longs, floats, etc.
// */
// public static String _t(String s, Object o) {
// return Translate.getString(s, o, BUNDLE_NAME);
// }
//
// /** for {0} and {1} */
// public static String _t(String s, Object o, Object o2){
// return Translate.getString(s, o, o2, BUNDLE_NAME);
// }
//
// /**
// * Use GNU ngettext
// * For .po file format see http://www.gnu.org/software/gettext/manual/gettext.html.gz#Translating-plural-forms
// *
// * @param n how many
// * @param s singluar string, optionally with {0} e.g. "one tunnel"
// * @param p plural string optionally with {0} e.g. "{0} tunnels"
// */
// public static String _t(int n, String s, String p) {
// return Translate.getString( n, s, p, BUNDLE_NAME);
// }
//
// }
| import java.util.HashMap;
import net.i2p.itoopie.i18n.Transl; | package net.i2p.itoopie.i2pcontrol.methods;
/**
* Describes the ways a I2P router operation can be altered.
* @author hottuna
*/
public class I2PControl{
private final static HashMap<String,I2P_CONTROL> enumMap;
private static final HashMap<String, ADDRESSES> reverseAddressMap;
private interface Address { public String getAddress();}
/**
* Describes the ways a I2P router operation can be altered.
* @author hottuna
*/
public enum I2P_CONTROL implements Remote{
PASSWORD { public boolean isReadable(){ return false;}
public boolean isWritable(){ return true;}
public String toString() { return "i2pcontrol.password"; }},
PORT { public boolean isReadable(){ return false;}
public boolean isWritable(){ return true;}
public String toString() { return "i2pcontrol.port"; }},
ADDRESS { public boolean isReadable(){ return true;}
public boolean isWritable(){ return true;}
public String toString() { return "i2pcontrol.address"; }}
};
public enum ADDRESSES implements Address {
LOCAL { public String getAddress(){ return "127.0.0.1";} | // Path: src/net/i2p/itoopie/i18n/Transl.java
// public class Transl {
//
// public static final String BUNDLE_NAME = "net.i2p.itoopie.messages";
//
//
// public static String _t(String s) {
// return Translate.getString(s, BUNDLE_NAME);
// }
//
//
// /**
// * translate a string with a parameter
// * This is a lot more expensive than getString(s, ctx), so use sparingly.
// *
// * @param s string to be translated containing {0}
// * The {0} will be replaced by the parameter.
// * Single quotes must be doubled, i.e. ' -> '' in the string.
// * @param o parameter, not translated.
// * To tranlslate parameter also, use _t("foo {0} bar", _t("baz"))
// * Do not double the single quotes in the parameter.
// * Use autoboxing to call with ints, longs, floats, etc.
// */
// public static String _t(String s, Object o) {
// return Translate.getString(s, o, BUNDLE_NAME);
// }
//
// /** for {0} and {1} */
// public static String _t(String s, Object o, Object o2){
// return Translate.getString(s, o, o2, BUNDLE_NAME);
// }
//
// /**
// * Use GNU ngettext
// * For .po file format see http://www.gnu.org/software/gettext/manual/gettext.html.gz#Translating-plural-forms
// *
// * @param n how many
// * @param s singluar string, optionally with {0} e.g. "one tunnel"
// * @param p plural string optionally with {0} e.g. "{0} tunnels"
// */
// public static String _t(int n, String s, String p) {
// return Translate.getString( n, s, p, BUNDLE_NAME);
// }
//
// }
// Path: src/net/i2p/itoopie/i2pcontrol/methods/I2PControl.java
import java.util.HashMap;
import net.i2p.itoopie.i18n.Transl;
package net.i2p.itoopie.i2pcontrol.methods;
/**
* Describes the ways a I2P router operation can be altered.
* @author hottuna
*/
public class I2PControl{
private final static HashMap<String,I2P_CONTROL> enumMap;
private static final HashMap<String, ADDRESSES> reverseAddressMap;
private interface Address { public String getAddress();}
/**
* Describes the ways a I2P router operation can be altered.
* @author hottuna
*/
public enum I2P_CONTROL implements Remote{
PASSWORD { public boolean isReadable(){ return false;}
public boolean isWritable(){ return true;}
public String toString() { return "i2pcontrol.password"; }},
PORT { public boolean isReadable(){ return false;}
public boolean isWritable(){ return true;}
public String toString() { return "i2pcontrol.port"; }},
ADDRESS { public boolean isReadable(){ return true;}
public boolean isWritable(){ return true;}
public String toString() { return "i2pcontrol.address"; }}
};
public enum ADDRESSES implements Address {
LOCAL { public String getAddress(){ return "127.0.0.1";} | public String toString(){ return Transl._t("local host (127.0.0.1)"); }}, |
i2p/i2p.itoopie | src/net/i2p/itoopie/gui/AboutTab.java | // Path: src/net/i2p/itoopie/ItoopieVersion.java
// public class ItoopieVersion {
//
// /** Version of itoopie */
// public static final String VERSION = "0.0.4";
//
// /** Version of the I2PControl API implemented */
// public static final int I2PCONTROL_API_VERSION = 1;
// }
//
// Path: src/net/i2p/itoopie/gui/component/MultiLineLabel.java
// public class MultiLineLabel extends JLabel {
//
// /** Default serial version UID. */
// private static final long serialVersionUID = 1L;
//
// /** Horizontal text alignment. */
// private int halign = LEFT;
//
// /** Vertical text alignment. */
// private int valign = CENTER;
//
// /** Cache to save heap allocations. */
// private Rectangle bounds;
//
// /**
// * Creates a new empty label.
// */
// public MultiLineLabel() {
// super();
// setUI(MultiLineLabelUI.labelUI);
// }
//
// /**
// * Creates a new label with <code>text</code> value.
// *
// * @param text
// * the value of the label
// */
// public MultiLineLabel(String text) {
// this();
// setText(text);
// }
//
// /** {@inheritDoc} */
// public Rectangle getBounds() {
// if (bounds == null) {
// bounds = new Rectangle();
// }
// return super.getBounds(bounds);
// }
//
// /**
// * Set the vertical text alignment.
// *
// * @param alignment
// * vertical alignment
// */
// public void setVerticalTextAlignment(int alignment) {
// firePropertyChange("verticalTextAlignment", valign, alignment);
// valign = alignment;
// }
//
// /**
// * Set the horizontal text alignment.
// *
// * @param alignment
// * horizontal alignment
// */
// public void setHorizontalTextAlignment(int alignment) {
// firePropertyChange("horizontalTextAlignment", halign, alignment);
// halign = alignment;
// }
//
// /**
// * Get the vertical text alignment.
// *
// * @return vertical text alignment
// */
// public int getVerticalTextAlignment() {
// return valign;
// }
//
// /**
// * Get the horizontal text alignment.
// *
// * @return horizontal text alignment
// */
// public int getHorizontalTextAlignment() {
// return halign;
// }
// }
//
// Path: src/net/i2p/itoopie/gui/component/TabLogoPanel.java
// public abstract class TabLogoPanel extends LogoPanel {
//
// private static final long serialVersionUID = 4526458659908868337L;
//
// public TabLogoPanel(String imageName) {
// super(imageName);
// }
//
// public abstract void onTabFocus(ChangeEvent e);
//
// public void destroy() {};
// }
//
// Path: src/net/i2p/itoopie/i18n/Transl.java
// public class Transl {
//
// public static final String BUNDLE_NAME = "net.i2p.itoopie.messages";
//
//
// public static String _t(String s) {
// return Translate.getString(s, BUNDLE_NAME);
// }
//
//
// /**
// * translate a string with a parameter
// * This is a lot more expensive than getString(s, ctx), so use sparingly.
// *
// * @param s string to be translated containing {0}
// * The {0} will be replaced by the parameter.
// * Single quotes must be doubled, i.e. ' -> '' in the string.
// * @param o parameter, not translated.
// * To tranlslate parameter also, use _t("foo {0} bar", _t("baz"))
// * Do not double the single quotes in the parameter.
// * Use autoboxing to call with ints, longs, floats, etc.
// */
// public static String _t(String s, Object o) {
// return Translate.getString(s, o, BUNDLE_NAME);
// }
//
// /** for {0} and {1} */
// public static String _t(String s, Object o, Object o2){
// return Translate.getString(s, o, o2, BUNDLE_NAME);
// }
//
// /**
// * Use GNU ngettext
// * For .po file format see http://www.gnu.org/software/gettext/manual/gettext.html.gz#Translating-plural-forms
// *
// * @param n how many
// * @param s singluar string, optionally with {0} e.g. "one tunnel"
// * @param p plural string optionally with {0} e.g. "{0} tunnels"
// */
// public static String _t(int n, String s, String p) {
// return Translate.getString( n, s, p, BUNDLE_NAME);
// }
//
// }
| import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import net.i2p.itoopie.ItoopieVersion;
import net.i2p.itoopie.gui.component.MultiLineLabel;
import net.i2p.itoopie.gui.component.TabLogoPanel;
import net.i2p.itoopie.i18n.Transl; | package net.i2p.itoopie.gui;
public class AboutTab extends TabLogoPanel {
MultiLineLabel lblThankYou;
JLabel lblitoopie;
JLabel lblVersion;
JLabel lblVersionSpecified;
public AboutTab(String imageName) {
super(imageName);
setLayout(null);
lblThankYou = new MultiLineLabel();
add(lblThankYou);
lblThankYou.setBounds(10, 30, 250, 250);
lblThankYou.setVerticalTextAlignment(JLabel.TOP); | // Path: src/net/i2p/itoopie/ItoopieVersion.java
// public class ItoopieVersion {
//
// /** Version of itoopie */
// public static final String VERSION = "0.0.4";
//
// /** Version of the I2PControl API implemented */
// public static final int I2PCONTROL_API_VERSION = 1;
// }
//
// Path: src/net/i2p/itoopie/gui/component/MultiLineLabel.java
// public class MultiLineLabel extends JLabel {
//
// /** Default serial version UID. */
// private static final long serialVersionUID = 1L;
//
// /** Horizontal text alignment. */
// private int halign = LEFT;
//
// /** Vertical text alignment. */
// private int valign = CENTER;
//
// /** Cache to save heap allocations. */
// private Rectangle bounds;
//
// /**
// * Creates a new empty label.
// */
// public MultiLineLabel() {
// super();
// setUI(MultiLineLabelUI.labelUI);
// }
//
// /**
// * Creates a new label with <code>text</code> value.
// *
// * @param text
// * the value of the label
// */
// public MultiLineLabel(String text) {
// this();
// setText(text);
// }
//
// /** {@inheritDoc} */
// public Rectangle getBounds() {
// if (bounds == null) {
// bounds = new Rectangle();
// }
// return super.getBounds(bounds);
// }
//
// /**
// * Set the vertical text alignment.
// *
// * @param alignment
// * vertical alignment
// */
// public void setVerticalTextAlignment(int alignment) {
// firePropertyChange("verticalTextAlignment", valign, alignment);
// valign = alignment;
// }
//
// /**
// * Set the horizontal text alignment.
// *
// * @param alignment
// * horizontal alignment
// */
// public void setHorizontalTextAlignment(int alignment) {
// firePropertyChange("horizontalTextAlignment", halign, alignment);
// halign = alignment;
// }
//
// /**
// * Get the vertical text alignment.
// *
// * @return vertical text alignment
// */
// public int getVerticalTextAlignment() {
// return valign;
// }
//
// /**
// * Get the horizontal text alignment.
// *
// * @return horizontal text alignment
// */
// public int getHorizontalTextAlignment() {
// return halign;
// }
// }
//
// Path: src/net/i2p/itoopie/gui/component/TabLogoPanel.java
// public abstract class TabLogoPanel extends LogoPanel {
//
// private static final long serialVersionUID = 4526458659908868337L;
//
// public TabLogoPanel(String imageName) {
// super(imageName);
// }
//
// public abstract void onTabFocus(ChangeEvent e);
//
// public void destroy() {};
// }
//
// Path: src/net/i2p/itoopie/i18n/Transl.java
// public class Transl {
//
// public static final String BUNDLE_NAME = "net.i2p.itoopie.messages";
//
//
// public static String _t(String s) {
// return Translate.getString(s, BUNDLE_NAME);
// }
//
//
// /**
// * translate a string with a parameter
// * This is a lot more expensive than getString(s, ctx), so use sparingly.
// *
// * @param s string to be translated containing {0}
// * The {0} will be replaced by the parameter.
// * Single quotes must be doubled, i.e. ' -> '' in the string.
// * @param o parameter, not translated.
// * To tranlslate parameter also, use _t("foo {0} bar", _t("baz"))
// * Do not double the single quotes in the parameter.
// * Use autoboxing to call with ints, longs, floats, etc.
// */
// public static String _t(String s, Object o) {
// return Translate.getString(s, o, BUNDLE_NAME);
// }
//
// /** for {0} and {1} */
// public static String _t(String s, Object o, Object o2){
// return Translate.getString(s, o, o2, BUNDLE_NAME);
// }
//
// /**
// * Use GNU ngettext
// * For .po file format see http://www.gnu.org/software/gettext/manual/gettext.html.gz#Translating-plural-forms
// *
// * @param n how many
// * @param s singluar string, optionally with {0} e.g. "one tunnel"
// * @param p plural string optionally with {0} e.g. "{0} tunnels"
// */
// public static String _t(int n, String s, String p) {
// return Translate.getString( n, s, p, BUNDLE_NAME);
// }
//
// }
// Path: src/net/i2p/itoopie/gui/AboutTab.java
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import net.i2p.itoopie.ItoopieVersion;
import net.i2p.itoopie.gui.component.MultiLineLabel;
import net.i2p.itoopie.gui.component.TabLogoPanel;
import net.i2p.itoopie.i18n.Transl;
package net.i2p.itoopie.gui;
public class AboutTab extends TabLogoPanel {
MultiLineLabel lblThankYou;
JLabel lblitoopie;
JLabel lblVersion;
JLabel lblVersionSpecified;
public AboutTab(String imageName) {
super(imageName);
setLayout(null);
lblThankYou = new MultiLineLabel();
add(lblThankYou);
lblThankYou.setBounds(10, 30, 250, 250);
lblThankYou.setVerticalTextAlignment(JLabel.TOP); | lblThankYou.setText(Transl._t("itoopie and I2PControl were sponsored by Relakks & Ipredator.\n" + |
i2p/i2p.itoopie | src/net/i2p/itoopie/gui/component/RegisteredFrame.java | // Path: src/net/i2p/itoopie/gui/WindowHandler.java
// public class WindowHandler {
// private final HashSet<JFrame> _frames = new HashSet<JFrame>();
// private RegisteredFrame mainFrame;
// private boolean areFramesShown;
// private final ConfigurationManager _conf;
//
// public WindowHandler(ConfigurationManager conf) {
// _conf = conf;
// }
//
// public void register(JFrame frame){
// _frames.add(frame);
// }
//
// public void registerMain(RegisteredFrame frame){
// mainFrame = frame;
// }
//
// public void destroyMain() {
// if (mainFrame != null) {
// mainFrame.kill();
// _frames.remove(mainFrame);
// mainFrame = null;
// }
// }
//
// public void deRegister(JFrame frame){
// // don't remove the main frame when
// // the user clicks on the X, so we have the updated
// // graph when the user clicks on the icon again
// if (frame == mainFrame)
// hideFrames();
// else
// _frames.remove(frame);
// }
//
// public void hideFrames(){
// for (JFrame frame : _frames){
// frame.setVisible(false);
// }
// if (mainFrame != null){
// mainFrame.setVisible(false);
// }
// areFramesShown = false;
// }
//
// public void showFrames(){
// for (JFrame frame : _frames){
// frame.setVisible(true);
// }
// if (mainFrame != null){
// mainFrame.setVisible(true);
// }
// areFramesShown = true;
// }
//
// public void toggleFrames(){
// if (_frames.isEmpty()){
// new Main(this, _conf);
// } else {
// if (areFramesShown){
// hideFrames();
// } else {
// showFrames();
// }
// }
// }
// }
//
// Path: src/net/i2p/itoopie/util/IconLoader.java
// public class IconLoader {
//
// /**
// * Get tray icon image from the itoopie resources in the jar file.
// * @return image used for the tray icon
// */
// public static Image getTrayImage() {
//
// // Assume square icons.
// int icoHeight = (int) SystemTray.getSystemTray().getTrayIconSize().getHeight();
// int desiredHeight;
// if (icoHeight == 16 ||
// icoHeight == 24 ||
// icoHeight == 32 ||
// icoHeight == 48 ||
// icoHeight == 64 ||
// icoHeight == 128 ||
// icoHeight == 256 ||
// icoHeight == 512){
// desiredHeight = icoHeight;
// } else {
// desiredHeight = 512;
// }
//
// if (IsJar.isRunningJar()){
// Class classurl = (new IsJarTester()).getClass();
// URL url = classurl.getResource("/resources/images/itoopie-"+desiredHeight+".png");
// return Toolkit.getDefaultToolkit().getImage(url);
// } else {
// return Toolkit.getDefaultToolkit().getImage("resources/images/itoopie-"+desiredHeight+".png");
// }
// }
//
// /**
// * Get tray icon image from the itoopie resources in the jar file.
// * @return image used for the tray icon
// */
// public static Image getIcon(String iconName, int icoHeight) {
//
// // Assume square icons.
// int desiredHeight;
// if (icoHeight == 16 ||
// icoHeight == 24 ||
// icoHeight == 32 ||
// icoHeight == 48 ||
// icoHeight == 64 ||
// icoHeight == 128 ||
// icoHeight == 256 ||
// icoHeight == 512){
// desiredHeight = icoHeight;
// } else {
// desiredHeight = 512;
// }
//
// if (IsJar.isRunningJar()){
// Class classurl = (new IsJarTester()).getClass();
// URL url = classurl.getResource("/resources/images/" + iconName + "-" + desiredHeight + ".png");
// return Toolkit.getDefaultToolkit().getImage(url);
// } else {
// return Toolkit.getDefaultToolkit().getImage("resources/images/" + iconName + "-" + desiredHeight + ".png");
// }
// }
// }
| import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFrame;
import net.i2p.itoopie.gui.WindowHandler;
import net.i2p.itoopie.util.IconLoader; | package net.i2p.itoopie.gui.component;
public class RegisteredFrame extends JFrame implements WindowListener{
private static final long serialVersionUID = 3351260168651061327L; | // Path: src/net/i2p/itoopie/gui/WindowHandler.java
// public class WindowHandler {
// private final HashSet<JFrame> _frames = new HashSet<JFrame>();
// private RegisteredFrame mainFrame;
// private boolean areFramesShown;
// private final ConfigurationManager _conf;
//
// public WindowHandler(ConfigurationManager conf) {
// _conf = conf;
// }
//
// public void register(JFrame frame){
// _frames.add(frame);
// }
//
// public void registerMain(RegisteredFrame frame){
// mainFrame = frame;
// }
//
// public void destroyMain() {
// if (mainFrame != null) {
// mainFrame.kill();
// _frames.remove(mainFrame);
// mainFrame = null;
// }
// }
//
// public void deRegister(JFrame frame){
// // don't remove the main frame when
// // the user clicks on the X, so we have the updated
// // graph when the user clicks on the icon again
// if (frame == mainFrame)
// hideFrames();
// else
// _frames.remove(frame);
// }
//
// public void hideFrames(){
// for (JFrame frame : _frames){
// frame.setVisible(false);
// }
// if (mainFrame != null){
// mainFrame.setVisible(false);
// }
// areFramesShown = false;
// }
//
// public void showFrames(){
// for (JFrame frame : _frames){
// frame.setVisible(true);
// }
// if (mainFrame != null){
// mainFrame.setVisible(true);
// }
// areFramesShown = true;
// }
//
// public void toggleFrames(){
// if (_frames.isEmpty()){
// new Main(this, _conf);
// } else {
// if (areFramesShown){
// hideFrames();
// } else {
// showFrames();
// }
// }
// }
// }
//
// Path: src/net/i2p/itoopie/util/IconLoader.java
// public class IconLoader {
//
// /**
// * Get tray icon image from the itoopie resources in the jar file.
// * @return image used for the tray icon
// */
// public static Image getTrayImage() {
//
// // Assume square icons.
// int icoHeight = (int) SystemTray.getSystemTray().getTrayIconSize().getHeight();
// int desiredHeight;
// if (icoHeight == 16 ||
// icoHeight == 24 ||
// icoHeight == 32 ||
// icoHeight == 48 ||
// icoHeight == 64 ||
// icoHeight == 128 ||
// icoHeight == 256 ||
// icoHeight == 512){
// desiredHeight = icoHeight;
// } else {
// desiredHeight = 512;
// }
//
// if (IsJar.isRunningJar()){
// Class classurl = (new IsJarTester()).getClass();
// URL url = classurl.getResource("/resources/images/itoopie-"+desiredHeight+".png");
// return Toolkit.getDefaultToolkit().getImage(url);
// } else {
// return Toolkit.getDefaultToolkit().getImage("resources/images/itoopie-"+desiredHeight+".png");
// }
// }
//
// /**
// * Get tray icon image from the itoopie resources in the jar file.
// * @return image used for the tray icon
// */
// public static Image getIcon(String iconName, int icoHeight) {
//
// // Assume square icons.
// int desiredHeight;
// if (icoHeight == 16 ||
// icoHeight == 24 ||
// icoHeight == 32 ||
// icoHeight == 48 ||
// icoHeight == 64 ||
// icoHeight == 128 ||
// icoHeight == 256 ||
// icoHeight == 512){
// desiredHeight = icoHeight;
// } else {
// desiredHeight = 512;
// }
//
// if (IsJar.isRunningJar()){
// Class classurl = (new IsJarTester()).getClass();
// URL url = classurl.getResource("/resources/images/" + iconName + "-" + desiredHeight + ".png");
// return Toolkit.getDefaultToolkit().getImage(url);
// } else {
// return Toolkit.getDefaultToolkit().getImage("resources/images/" + iconName + "-" + desiredHeight + ".png");
// }
// }
// }
// Path: src/net/i2p/itoopie/gui/component/RegisteredFrame.java
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFrame;
import net.i2p.itoopie.gui.WindowHandler;
import net.i2p.itoopie.util.IconLoader;
package net.i2p.itoopie.gui.component;
public class RegisteredFrame extends JFrame implements WindowListener{
private static final long serialVersionUID = 3351260168651061327L; | private final WindowHandler windowHandler; |
i2p/i2p.itoopie | src/net/i2p/itoopie/gui/component/RegisteredFrame.java | // Path: src/net/i2p/itoopie/gui/WindowHandler.java
// public class WindowHandler {
// private final HashSet<JFrame> _frames = new HashSet<JFrame>();
// private RegisteredFrame mainFrame;
// private boolean areFramesShown;
// private final ConfigurationManager _conf;
//
// public WindowHandler(ConfigurationManager conf) {
// _conf = conf;
// }
//
// public void register(JFrame frame){
// _frames.add(frame);
// }
//
// public void registerMain(RegisteredFrame frame){
// mainFrame = frame;
// }
//
// public void destroyMain() {
// if (mainFrame != null) {
// mainFrame.kill();
// _frames.remove(mainFrame);
// mainFrame = null;
// }
// }
//
// public void deRegister(JFrame frame){
// // don't remove the main frame when
// // the user clicks on the X, so we have the updated
// // graph when the user clicks on the icon again
// if (frame == mainFrame)
// hideFrames();
// else
// _frames.remove(frame);
// }
//
// public void hideFrames(){
// for (JFrame frame : _frames){
// frame.setVisible(false);
// }
// if (mainFrame != null){
// mainFrame.setVisible(false);
// }
// areFramesShown = false;
// }
//
// public void showFrames(){
// for (JFrame frame : _frames){
// frame.setVisible(true);
// }
// if (mainFrame != null){
// mainFrame.setVisible(true);
// }
// areFramesShown = true;
// }
//
// public void toggleFrames(){
// if (_frames.isEmpty()){
// new Main(this, _conf);
// } else {
// if (areFramesShown){
// hideFrames();
// } else {
// showFrames();
// }
// }
// }
// }
//
// Path: src/net/i2p/itoopie/util/IconLoader.java
// public class IconLoader {
//
// /**
// * Get tray icon image from the itoopie resources in the jar file.
// * @return image used for the tray icon
// */
// public static Image getTrayImage() {
//
// // Assume square icons.
// int icoHeight = (int) SystemTray.getSystemTray().getTrayIconSize().getHeight();
// int desiredHeight;
// if (icoHeight == 16 ||
// icoHeight == 24 ||
// icoHeight == 32 ||
// icoHeight == 48 ||
// icoHeight == 64 ||
// icoHeight == 128 ||
// icoHeight == 256 ||
// icoHeight == 512){
// desiredHeight = icoHeight;
// } else {
// desiredHeight = 512;
// }
//
// if (IsJar.isRunningJar()){
// Class classurl = (new IsJarTester()).getClass();
// URL url = classurl.getResource("/resources/images/itoopie-"+desiredHeight+".png");
// return Toolkit.getDefaultToolkit().getImage(url);
// } else {
// return Toolkit.getDefaultToolkit().getImage("resources/images/itoopie-"+desiredHeight+".png");
// }
// }
//
// /**
// * Get tray icon image from the itoopie resources in the jar file.
// * @return image used for the tray icon
// */
// public static Image getIcon(String iconName, int icoHeight) {
//
// // Assume square icons.
// int desiredHeight;
// if (icoHeight == 16 ||
// icoHeight == 24 ||
// icoHeight == 32 ||
// icoHeight == 48 ||
// icoHeight == 64 ||
// icoHeight == 128 ||
// icoHeight == 256 ||
// icoHeight == 512){
// desiredHeight = icoHeight;
// } else {
// desiredHeight = 512;
// }
//
// if (IsJar.isRunningJar()){
// Class classurl = (new IsJarTester()).getClass();
// URL url = classurl.getResource("/resources/images/" + iconName + "-" + desiredHeight + ".png");
// return Toolkit.getDefaultToolkit().getImage(url);
// } else {
// return Toolkit.getDefaultToolkit().getImage("resources/images/" + iconName + "-" + desiredHeight + ".png");
// }
// }
// }
| import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFrame;
import net.i2p.itoopie.gui.WindowHandler;
import net.i2p.itoopie.util.IconLoader; | package net.i2p.itoopie.gui.component;
public class RegisteredFrame extends JFrame implements WindowListener{
private static final long serialVersionUID = 3351260168651061327L;
private final WindowHandler windowHandler;
public RegisteredFrame(String name, WindowHandler wh) {
super(name);
super.addWindowListener(this);
windowHandler = wh;
windowHandler.register(this); | // Path: src/net/i2p/itoopie/gui/WindowHandler.java
// public class WindowHandler {
// private final HashSet<JFrame> _frames = new HashSet<JFrame>();
// private RegisteredFrame mainFrame;
// private boolean areFramesShown;
// private final ConfigurationManager _conf;
//
// public WindowHandler(ConfigurationManager conf) {
// _conf = conf;
// }
//
// public void register(JFrame frame){
// _frames.add(frame);
// }
//
// public void registerMain(RegisteredFrame frame){
// mainFrame = frame;
// }
//
// public void destroyMain() {
// if (mainFrame != null) {
// mainFrame.kill();
// _frames.remove(mainFrame);
// mainFrame = null;
// }
// }
//
// public void deRegister(JFrame frame){
// // don't remove the main frame when
// // the user clicks on the X, so we have the updated
// // graph when the user clicks on the icon again
// if (frame == mainFrame)
// hideFrames();
// else
// _frames.remove(frame);
// }
//
// public void hideFrames(){
// for (JFrame frame : _frames){
// frame.setVisible(false);
// }
// if (mainFrame != null){
// mainFrame.setVisible(false);
// }
// areFramesShown = false;
// }
//
// public void showFrames(){
// for (JFrame frame : _frames){
// frame.setVisible(true);
// }
// if (mainFrame != null){
// mainFrame.setVisible(true);
// }
// areFramesShown = true;
// }
//
// public void toggleFrames(){
// if (_frames.isEmpty()){
// new Main(this, _conf);
// } else {
// if (areFramesShown){
// hideFrames();
// } else {
// showFrames();
// }
// }
// }
// }
//
// Path: src/net/i2p/itoopie/util/IconLoader.java
// public class IconLoader {
//
// /**
// * Get tray icon image from the itoopie resources in the jar file.
// * @return image used for the tray icon
// */
// public static Image getTrayImage() {
//
// // Assume square icons.
// int icoHeight = (int) SystemTray.getSystemTray().getTrayIconSize().getHeight();
// int desiredHeight;
// if (icoHeight == 16 ||
// icoHeight == 24 ||
// icoHeight == 32 ||
// icoHeight == 48 ||
// icoHeight == 64 ||
// icoHeight == 128 ||
// icoHeight == 256 ||
// icoHeight == 512){
// desiredHeight = icoHeight;
// } else {
// desiredHeight = 512;
// }
//
// if (IsJar.isRunningJar()){
// Class classurl = (new IsJarTester()).getClass();
// URL url = classurl.getResource("/resources/images/itoopie-"+desiredHeight+".png");
// return Toolkit.getDefaultToolkit().getImage(url);
// } else {
// return Toolkit.getDefaultToolkit().getImage("resources/images/itoopie-"+desiredHeight+".png");
// }
// }
//
// /**
// * Get tray icon image from the itoopie resources in the jar file.
// * @return image used for the tray icon
// */
// public static Image getIcon(String iconName, int icoHeight) {
//
// // Assume square icons.
// int desiredHeight;
// if (icoHeight == 16 ||
// icoHeight == 24 ||
// icoHeight == 32 ||
// icoHeight == 48 ||
// icoHeight == 64 ||
// icoHeight == 128 ||
// icoHeight == 256 ||
// icoHeight == 512){
// desiredHeight = icoHeight;
// } else {
// desiredHeight = 512;
// }
//
// if (IsJar.isRunningJar()){
// Class classurl = (new IsJarTester()).getClass();
// URL url = classurl.getResource("/resources/images/" + iconName + "-" + desiredHeight + ".png");
// return Toolkit.getDefaultToolkit().getImage(url);
// } else {
// return Toolkit.getDefaultToolkit().getImage("resources/images/" + iconName + "-" + desiredHeight + ".png");
// }
// }
// }
// Path: src/net/i2p/itoopie/gui/component/RegisteredFrame.java
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFrame;
import net.i2p.itoopie.gui.WindowHandler;
import net.i2p.itoopie.util.IconLoader;
package net.i2p.itoopie.gui.component;
public class RegisteredFrame extends JFrame implements WindowListener{
private static final long serialVersionUID = 3351260168651061327L;
private final WindowHandler windowHandler;
public RegisteredFrame(String name, WindowHandler wh) {
super(name);
super.addWindowListener(this);
windowHandler = wh;
windowHandler.register(this); | this.setIconImage(IconLoader.getIcon("itoopie", 128)); |
i2p/i2p.itoopie | src/net/i2p/itoopie/gui/StatusHandler.java | // Path: src/net/i2p/itoopie/i18n/Transl.java
// public class Transl {
//
// public static final String BUNDLE_NAME = "net.i2p.itoopie.messages";
//
//
// public static String _t(String s) {
// return Translate.getString(s, BUNDLE_NAME);
// }
//
//
// /**
// * translate a string with a parameter
// * This is a lot more expensive than getString(s, ctx), so use sparingly.
// *
// * @param s string to be translated containing {0}
// * The {0} will be replaced by the parameter.
// * Single quotes must be doubled, i.e. ' -> '' in the string.
// * @param o parameter, not translated.
// * To tranlslate parameter also, use _t("foo {0} bar", _t("baz"))
// * Do not double the single quotes in the parameter.
// * Use autoboxing to call with ints, longs, floats, etc.
// */
// public static String _t(String s, Object o) {
// return Translate.getString(s, o, BUNDLE_NAME);
// }
//
// /** for {0} and {1} */
// public static String _t(String s, Object o, Object o2){
// return Translate.getString(s, o, o2, BUNDLE_NAME);
// }
//
// /**
// * Use GNU ngettext
// * For .po file format see http://www.gnu.org/software/gettext/manual/gettext.html.gz#Translating-plural-forms
// *
// * @param n how many
// * @param s singluar string, optionally with {0} e.g. "one tunnel"
// * @param p plural string optionally with {0} e.g. "{0} tunnels"
// */
// public static String _t(int n, String s, String p) {
// return Translate.getString( n, s, p, BUNDLE_NAME);
// }
//
// }
| import javax.swing.JLabel;
import net.i2p.itoopie.i18n.Transl; | package net.i2p.itoopie.gui;
public class StatusHandler {
private static final JLabel statusLbl;
private static final String DEFAULT_STATUS = "Status";
private interface StatusMessage{ public String getStatusMessage(); };
public static enum DEFAULT_STATUS implements StatusMessage { | // Path: src/net/i2p/itoopie/i18n/Transl.java
// public class Transl {
//
// public static final String BUNDLE_NAME = "net.i2p.itoopie.messages";
//
//
// public static String _t(String s) {
// return Translate.getString(s, BUNDLE_NAME);
// }
//
//
// /**
// * translate a string with a parameter
// * This is a lot more expensive than getString(s, ctx), so use sparingly.
// *
// * @param s string to be translated containing {0}
// * The {0} will be replaced by the parameter.
// * Single quotes must be doubled, i.e. ' -> '' in the string.
// * @param o parameter, not translated.
// * To tranlslate parameter also, use _t("foo {0} bar", _t("baz"))
// * Do not double the single quotes in the parameter.
// * Use autoboxing to call with ints, longs, floats, etc.
// */
// public static String _t(String s, Object o) {
// return Translate.getString(s, o, BUNDLE_NAME);
// }
//
// /** for {0} and {1} */
// public static String _t(String s, Object o, Object o2){
// return Translate.getString(s, o, o2, BUNDLE_NAME);
// }
//
// /**
// * Use GNU ngettext
// * For .po file format see http://www.gnu.org/software/gettext/manual/gettext.html.gz#Translating-plural-forms
// *
// * @param n how many
// * @param s singluar string, optionally with {0} e.g. "one tunnel"
// * @param p plural string optionally with {0} e.g. "{0} tunnels"
// */
// public static String _t(int n, String s, String p) {
// return Translate.getString( n, s, p, BUNDLE_NAME);
// }
//
// }
// Path: src/net/i2p/itoopie/gui/StatusHandler.java
import javax.swing.JLabel;
import net.i2p.itoopie.i18n.Transl;
package net.i2p.itoopie.gui;
public class StatusHandler {
private static final JLabel statusLbl;
private static final String DEFAULT_STATUS = "Status";
private interface StatusMessage{ public String getStatusMessage(); };
public static enum DEFAULT_STATUS implements StatusMessage { | CONNECTED { public String getStatusMessage(){ return Transl._t("Connected to I2P router."); }}, |
i2p/i2p.itoopie | src/net/i2p/itoopie/gui/component/LogoPanel.java | // Path: src/net/i2p/itoopie/util/IconLoader.java
// public class IconLoader {
//
// /**
// * Get tray icon image from the itoopie resources in the jar file.
// * @return image used for the tray icon
// */
// public static Image getTrayImage() {
//
// // Assume square icons.
// int icoHeight = (int) SystemTray.getSystemTray().getTrayIconSize().getHeight();
// int desiredHeight;
// if (icoHeight == 16 ||
// icoHeight == 24 ||
// icoHeight == 32 ||
// icoHeight == 48 ||
// icoHeight == 64 ||
// icoHeight == 128 ||
// icoHeight == 256 ||
// icoHeight == 512){
// desiredHeight = icoHeight;
// } else {
// desiredHeight = 512;
// }
//
// if (IsJar.isRunningJar()){
// Class classurl = (new IsJarTester()).getClass();
// URL url = classurl.getResource("/resources/images/itoopie-"+desiredHeight+".png");
// return Toolkit.getDefaultToolkit().getImage(url);
// } else {
// return Toolkit.getDefaultToolkit().getImage("resources/images/itoopie-"+desiredHeight+".png");
// }
// }
//
// /**
// * Get tray icon image from the itoopie resources in the jar file.
// * @return image used for the tray icon
// */
// public static Image getIcon(String iconName, int icoHeight) {
//
// // Assume square icons.
// int desiredHeight;
// if (icoHeight == 16 ||
// icoHeight == 24 ||
// icoHeight == 32 ||
// icoHeight == 48 ||
// icoHeight == 64 ||
// icoHeight == 128 ||
// icoHeight == 256 ||
// icoHeight == 512){
// desiredHeight = icoHeight;
// } else {
// desiredHeight = 512;
// }
//
// if (IsJar.isRunningJar()){
// Class classurl = (new IsJarTester()).getClass();
// URL url = classurl.getResource("/resources/images/" + iconName + "-" + desiredHeight + ".png");
// return Toolkit.getDefaultToolkit().getImage(url);
// } else {
// return Toolkit.getDefaultToolkit().getImage("resources/images/" + iconName + "-" + desiredHeight + ".png");
// }
// }
// }
| import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import net.i2p.itoopie.util.IconLoader; | package net.i2p.itoopie.gui.component;
public class LogoPanel extends GradientPanel {
private final static int IMAGE_SIZE = 128;
private Image bg;
/**
* An ordinary panel, but with a logotype added.
*/
private static final long serialVersionUID = 5619646652656877782L;
public LogoPanel(final String imageName) {
super();
SwingUtilities.invokeLater(new Runnable() {
public void run() { | // Path: src/net/i2p/itoopie/util/IconLoader.java
// public class IconLoader {
//
// /**
// * Get tray icon image from the itoopie resources in the jar file.
// * @return image used for the tray icon
// */
// public static Image getTrayImage() {
//
// // Assume square icons.
// int icoHeight = (int) SystemTray.getSystemTray().getTrayIconSize().getHeight();
// int desiredHeight;
// if (icoHeight == 16 ||
// icoHeight == 24 ||
// icoHeight == 32 ||
// icoHeight == 48 ||
// icoHeight == 64 ||
// icoHeight == 128 ||
// icoHeight == 256 ||
// icoHeight == 512){
// desiredHeight = icoHeight;
// } else {
// desiredHeight = 512;
// }
//
// if (IsJar.isRunningJar()){
// Class classurl = (new IsJarTester()).getClass();
// URL url = classurl.getResource("/resources/images/itoopie-"+desiredHeight+".png");
// return Toolkit.getDefaultToolkit().getImage(url);
// } else {
// return Toolkit.getDefaultToolkit().getImage("resources/images/itoopie-"+desiredHeight+".png");
// }
// }
//
// /**
// * Get tray icon image from the itoopie resources in the jar file.
// * @return image used for the tray icon
// */
// public static Image getIcon(String iconName, int icoHeight) {
//
// // Assume square icons.
// int desiredHeight;
// if (icoHeight == 16 ||
// icoHeight == 24 ||
// icoHeight == 32 ||
// icoHeight == 48 ||
// icoHeight == 64 ||
// icoHeight == 128 ||
// icoHeight == 256 ||
// icoHeight == 512){
// desiredHeight = icoHeight;
// } else {
// desiredHeight = 512;
// }
//
// if (IsJar.isRunningJar()){
// Class classurl = (new IsJarTester()).getClass();
// URL url = classurl.getResource("/resources/images/" + iconName + "-" + desiredHeight + ".png");
// return Toolkit.getDefaultToolkit().getImage(url);
// } else {
// return Toolkit.getDefaultToolkit().getImage("resources/images/" + iconName + "-" + desiredHeight + ".png");
// }
// }
// }
// Path: src/net/i2p/itoopie/gui/component/LogoPanel.java
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import net.i2p.itoopie.util.IconLoader;
package net.i2p.itoopie.gui.component;
public class LogoPanel extends GradientPanel {
private final static int IMAGE_SIZE = 128;
private Image bg;
/**
* An ordinary panel, but with a logotype added.
*/
private static final long serialVersionUID = 5619646652656877782L;
public LogoPanel(final String imageName) {
super();
SwingUtilities.invokeLater(new Runnable() {
public void run() { | bg = IconLoader.getIcon(imageName, 128); |
hishidama/embulk-parser-poi_excel | src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelColorVisitor.java | // Path: src/main/java/org/embulk/parser/poi_excel/visitor/embulk/CellVisitor.java
// public abstract class CellVisitor {
//
// protected final PoiExcelVisitorValue visitorValue;
// protected final PageBuilder pageBuilder;
//
// public CellVisitor(PoiExcelVisitorValue visitorValue) {
// this.visitorValue = visitorValue;
// this.pageBuilder = visitorValue.getPageBuilder();
// }
//
// public abstract void visitCellValueNumeric(Column column, Object source, double value);
//
// public abstract void visitCellValueString(Column column, Object source, String value);
//
// public void visitCellValueBlank(Column column, Object source) {
// pageBuilder.setNull(column);
// }
//
// public abstract void visitCellValueBoolean(Column column, Object source, boolean value);
//
// public abstract void visitCellValueError(Column column, Object source, int code);
//
// public void visitCellFormula(Column column, Cell cell) {
// pageBuilder.setString(column, cell.getCellFormula());
// }
//
// public abstract void visitValueLong(Column column, Object source, long value);
//
// public abstract void visitSheetName(Column column);
//
// public abstract void visitSheetName(Column column, Sheet sheet);
//
// public abstract void visitRowNumber(Column column, int index1);
//
// public abstract void visitColumnNumber(Column column, int index1);
//
// protected void doConvertError(Column column, Object srcValue, Throwable t) {
// PoiExcelColumnBean bean = visitorValue.getColumnBean(column);
// ErrorStrategy strategy = bean.getConvertErrorStrategy();
// switch (strategy.getStrategy()) {
// default:
// break;
// case CONSTANT:
// String value = strategy.getValue();
// if (value == null) {
// pageBuilder.setNull(column);
// } else {
// try {
// doConvertErrorConstant(column, value);
// } catch (Exception e) {
// throw new ConfigException(MessageFormat.format("constant value convert error. value={0}", value), e);
// }
// }
// return;
// }
//
// throw new RuntimeException(MessageFormat.format("convert error. value={0}", srcValue), t);
// }
//
// protected abstract void doConvertErrorConstant(Column column, String value) throws Exception;
// }
| import java.text.MessageFormat;
import org.apache.poi.hssf.usermodel.HSSFPalette;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.Color;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFColor;
import org.embulk.parser.poi_excel.visitor.embulk.CellVisitor;
import org.embulk.spi.Column;
import org.embulk.spi.PageBuilder;
import org.embulk.spi.type.StringType;
| package org.embulk.parser.poi_excel.visitor;
public class PoiExcelColorVisitor {
protected final PoiExcelVisitorValue visitorValue;
public PoiExcelColorVisitor(PoiExcelVisitorValue visitorValue) {
this.visitorValue = visitorValue;
}
| // Path: src/main/java/org/embulk/parser/poi_excel/visitor/embulk/CellVisitor.java
// public abstract class CellVisitor {
//
// protected final PoiExcelVisitorValue visitorValue;
// protected final PageBuilder pageBuilder;
//
// public CellVisitor(PoiExcelVisitorValue visitorValue) {
// this.visitorValue = visitorValue;
// this.pageBuilder = visitorValue.getPageBuilder();
// }
//
// public abstract void visitCellValueNumeric(Column column, Object source, double value);
//
// public abstract void visitCellValueString(Column column, Object source, String value);
//
// public void visitCellValueBlank(Column column, Object source) {
// pageBuilder.setNull(column);
// }
//
// public abstract void visitCellValueBoolean(Column column, Object source, boolean value);
//
// public abstract void visitCellValueError(Column column, Object source, int code);
//
// public void visitCellFormula(Column column, Cell cell) {
// pageBuilder.setString(column, cell.getCellFormula());
// }
//
// public abstract void visitValueLong(Column column, Object source, long value);
//
// public abstract void visitSheetName(Column column);
//
// public abstract void visitSheetName(Column column, Sheet sheet);
//
// public abstract void visitRowNumber(Column column, int index1);
//
// public abstract void visitColumnNumber(Column column, int index1);
//
// protected void doConvertError(Column column, Object srcValue, Throwable t) {
// PoiExcelColumnBean bean = visitorValue.getColumnBean(column);
// ErrorStrategy strategy = bean.getConvertErrorStrategy();
// switch (strategy.getStrategy()) {
// default:
// break;
// case CONSTANT:
// String value = strategy.getValue();
// if (value == null) {
// pageBuilder.setNull(column);
// } else {
// try {
// doConvertErrorConstant(column, value);
// } catch (Exception e) {
// throw new ConfigException(MessageFormat.format("constant value convert error. value={0}", value), e);
// }
// }
// return;
// }
//
// throw new RuntimeException(MessageFormat.format("convert error. value={0}", srcValue), t);
// }
//
// protected abstract void doConvertErrorConstant(Column column, String value) throws Exception;
// }
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelColorVisitor.java
import java.text.MessageFormat;
import org.apache.poi.hssf.usermodel.HSSFPalette;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.Color;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFColor;
import org.embulk.parser.poi_excel.visitor.embulk.CellVisitor;
import org.embulk.spi.Column;
import org.embulk.spi.PageBuilder;
import org.embulk.spi.type.StringType;
package org.embulk.parser.poi_excel.visitor;
public class PoiExcelColorVisitor {
protected final PoiExcelVisitorValue visitorValue;
public PoiExcelColorVisitor(PoiExcelVisitorValue visitorValue) {
this.visitorValue = visitorValue;
}
| public void visitCellColor(Column column, short colorIndex, CellVisitor visitor) {
|
hishidama/embulk-parser-poi_excel | src/main/java/org/embulk/parser/poi_excel/visitor/embulk/TimestampCellVisitor.java | // Path: src/main/java/org/embulk/parser/poi_excel/PoiExcelParserPlugin.java
// public interface PluginTask extends Task, TimestampParser.Task, SheetCommonOptionTask {
// @Config("sheet")
// @ConfigDefault("null")
// public Optional<String> getSheet();
//
// @Config("sheets")
// @ConfigDefault("[]")
// public List<String> getSheets();
//
// @Config("ignore_sheet_not_found")
// @ConfigDefault("false")
// public boolean getIgnoreSheetNotFound();
//
// @Config("sheet_options")
// @ConfigDefault("{}")
// public Map<String, SheetOptionTask> getSheetOptions();
//
// @Config("columns")
// public SchemaConfig getColumns();
//
// @Config("flush_count")
// @ConfigDefault("100")
// public int getFlushCount();
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelVisitorValue.java
// public class PoiExcelVisitorValue {
// private final PluginTask task;
// private final Sheet sheet;
// private final PageBuilder pageBuilder;
// private final PoiExcelSheetBean sheetBean;
// private PoiExcelVisitorFactory factory;
//
// public PoiExcelVisitorValue(PluginTask task, Schema schema, Sheet sheet, PageBuilder pageBuilder) {
// this.task = task;
// this.sheet = sheet;
// this.pageBuilder = pageBuilder;
// this.sheetBean = new PoiExcelSheetBean(task, schema, sheet);
// }
//
// public PluginTask getPluginTask() {
// return task;
// }
//
// public Sheet getSheet() {
// return sheet;
// }
//
// public PageBuilder getPageBuilder() {
// return pageBuilder;
// }
//
// public void setVisitorFactory(PoiExcelVisitorFactory factory) {
// this.factory = factory;
// }
//
// public PoiExcelVisitorFactory getVisitorFactory() {
// return factory;
// }
//
// public PoiExcelSheetBean getSheetBean() {
// return sheetBean;
// }
//
// public PoiExcelColumnBean getColumnBean(Column column) {
// return sheetBean.getColumnBean(column);
// }
// }
| import java.util.Date;
import java.util.TimeZone;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Sheet;
import org.embulk.parser.poi_excel.PoiExcelParserPlugin.PluginTask;
import org.embulk.parser.poi_excel.visitor.PoiExcelVisitorValue;
import org.embulk.spi.Column;
import org.embulk.spi.time.Timestamp;
import org.embulk.spi.time.TimestampParseException;
import org.embulk.spi.time.TimestampParser;
import org.embulk.spi.util.Timestamps;
| }
@Override
public void visitSheetName(Column column, Sheet sheet) {
doConvertError(column, sheet.getSheetName(), new UnsupportedOperationException(
"unsupported conversion sheet_name to Embulk timestamp"));
}
@Override
public void visitRowNumber(Column column, int index1) {
doConvertError(column, index1, new UnsupportedOperationException(
"unsupported conversion row_number to Embulk timestamp"));
}
@Override
public void visitColumnNumber(Column column, int index1) {
doConvertError(column, index1, new UnsupportedOperationException(
"unsupported conversion column_number to Embulk timestamp"));
}
@Override
protected void doConvertErrorConstant(Column column, String value) throws Exception {
TimestampParser parser = getTimestampParser(column);
pageBuilder.setTimestamp(column, parser.parse(value));
}
private TimestampParser[] timestampParsers;
protected final TimestampParser getTimestampParser(Column column) {
if (timestampParsers == null) {
| // Path: src/main/java/org/embulk/parser/poi_excel/PoiExcelParserPlugin.java
// public interface PluginTask extends Task, TimestampParser.Task, SheetCommonOptionTask {
// @Config("sheet")
// @ConfigDefault("null")
// public Optional<String> getSheet();
//
// @Config("sheets")
// @ConfigDefault("[]")
// public List<String> getSheets();
//
// @Config("ignore_sheet_not_found")
// @ConfigDefault("false")
// public boolean getIgnoreSheetNotFound();
//
// @Config("sheet_options")
// @ConfigDefault("{}")
// public Map<String, SheetOptionTask> getSheetOptions();
//
// @Config("columns")
// public SchemaConfig getColumns();
//
// @Config("flush_count")
// @ConfigDefault("100")
// public int getFlushCount();
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/PoiExcelVisitorValue.java
// public class PoiExcelVisitorValue {
// private final PluginTask task;
// private final Sheet sheet;
// private final PageBuilder pageBuilder;
// private final PoiExcelSheetBean sheetBean;
// private PoiExcelVisitorFactory factory;
//
// public PoiExcelVisitorValue(PluginTask task, Schema schema, Sheet sheet, PageBuilder pageBuilder) {
// this.task = task;
// this.sheet = sheet;
// this.pageBuilder = pageBuilder;
// this.sheetBean = new PoiExcelSheetBean(task, schema, sheet);
// }
//
// public PluginTask getPluginTask() {
// return task;
// }
//
// public Sheet getSheet() {
// return sheet;
// }
//
// public PageBuilder getPageBuilder() {
// return pageBuilder;
// }
//
// public void setVisitorFactory(PoiExcelVisitorFactory factory) {
// this.factory = factory;
// }
//
// public PoiExcelVisitorFactory getVisitorFactory() {
// return factory;
// }
//
// public PoiExcelSheetBean getSheetBean() {
// return sheetBean;
// }
//
// public PoiExcelColumnBean getColumnBean(Column column) {
// return sheetBean.getColumnBean(column);
// }
// }
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/embulk/TimestampCellVisitor.java
import java.util.Date;
import java.util.TimeZone;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Sheet;
import org.embulk.parser.poi_excel.PoiExcelParserPlugin.PluginTask;
import org.embulk.parser.poi_excel.visitor.PoiExcelVisitorValue;
import org.embulk.spi.Column;
import org.embulk.spi.time.Timestamp;
import org.embulk.spi.time.TimestampParseException;
import org.embulk.spi.time.TimestampParser;
import org.embulk.spi.util.Timestamps;
}
@Override
public void visitSheetName(Column column, Sheet sheet) {
doConvertError(column, sheet.getSheetName(), new UnsupportedOperationException(
"unsupported conversion sheet_name to Embulk timestamp"));
}
@Override
public void visitRowNumber(Column column, int index1) {
doConvertError(column, index1, new UnsupportedOperationException(
"unsupported conversion row_number to Embulk timestamp"));
}
@Override
public void visitColumnNumber(Column column, int index1) {
doConvertError(column, index1, new UnsupportedOperationException(
"unsupported conversion column_number to Embulk timestamp"));
}
@Override
protected void doConvertErrorConstant(Column column, String value) throws Exception {
TimestampParser parser = getTimestampParser(column);
pageBuilder.setTimestamp(column, parser.parse(value));
}
private TimestampParser[] timestampParsers;
protected final TimestampParser getTimestampParser(Column column) {
if (timestampParsers == null) {
| PluginTask task = visitorValue.getPluginTask();
|
hishidama/embulk-parser-poi_excel | src/main/java/org/embulk/parser/poi_excel/bean/util/PoiExcelCellAddress.java | // Path: src/main/java/org/embulk/parser/poi_excel/bean/record/PoiExcelRecord.java
// public abstract class PoiExcelRecord {
//
// // loop record
//
// private Sheet sheet;
//
// public final void initialize(Sheet sheet, int skipHeaderLines) {
// this.sheet = sheet;
// initializeLoop(skipHeaderLines);
// }
//
// protected abstract void initializeLoop(int skipHeaderLines);
//
// public final Sheet getSheet() {
// return sheet;
// }
//
// public abstract boolean exists();
//
// public abstract void moveNext();
//
// // current record
//
// public final void logStart() {
// logStartEnd("start");
// }
//
// public final void logEnd() {
// logStartEnd("end");
// }
//
// protected abstract void logStartEnd(String part);
//
// public abstract int getRowIndex(PoiExcelColumnBean bean);
//
// public abstract int getColumnIndex(PoiExcelColumnBean bean);
//
// public abstract Cell getCell(PoiExcelColumnBean bean);
//
// public CellReference getCellReference(PoiExcelColumnBean bean) {
// int rowIndex = getRowIndex(bean);
// int columnIndex = getColumnIndex(bean);
// return new CellReference(rowIndex, columnIndex);
// }
// }
| import java.text.MessageFormat;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellReference;
import org.embulk.parser.poi_excel.bean.record.PoiExcelRecord;
| package org.embulk.parser.poi_excel.bean.util;
public class PoiExcelCellAddress {
private final CellReference cellReference;
public PoiExcelCellAddress(CellReference cellReference) {
this.cellReference = cellReference;
}
public String getSheetName() {
return cellReference.getSheetName();
}
| // Path: src/main/java/org/embulk/parser/poi_excel/bean/record/PoiExcelRecord.java
// public abstract class PoiExcelRecord {
//
// // loop record
//
// private Sheet sheet;
//
// public final void initialize(Sheet sheet, int skipHeaderLines) {
// this.sheet = sheet;
// initializeLoop(skipHeaderLines);
// }
//
// protected abstract void initializeLoop(int skipHeaderLines);
//
// public final Sheet getSheet() {
// return sheet;
// }
//
// public abstract boolean exists();
//
// public abstract void moveNext();
//
// // current record
//
// public final void logStart() {
// logStartEnd("start");
// }
//
// public final void logEnd() {
// logStartEnd("end");
// }
//
// protected abstract void logStartEnd(String part);
//
// public abstract int getRowIndex(PoiExcelColumnBean bean);
//
// public abstract int getColumnIndex(PoiExcelColumnBean bean);
//
// public abstract Cell getCell(PoiExcelColumnBean bean);
//
// public CellReference getCellReference(PoiExcelColumnBean bean) {
// int rowIndex = getRowIndex(bean);
// int columnIndex = getColumnIndex(bean);
// return new CellReference(rowIndex, columnIndex);
// }
// }
// Path: src/main/java/org/embulk/parser/poi_excel/bean/util/PoiExcelCellAddress.java
import java.text.MessageFormat;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellReference;
import org.embulk.parser.poi_excel.bean.record.PoiExcelRecord;
package org.embulk.parser.poi_excel.bean.util;
public class PoiExcelCellAddress {
private final CellReference cellReference;
public PoiExcelCellAddress(CellReference cellReference) {
this.cellReference = cellReference;
}
public String getSheetName() {
return cellReference.getSheetName();
}
| public Sheet getSheet(PoiExcelRecord record) {
|
hishidama/embulk-parser-poi_excel | src/test/java/org/embulk/parser/EmbulkPluginTester.java | // Path: src/test/java/org/embulk/parser/EmbulkTestOutputPlugin.java
// public static class OutputRecord {
// private Map<String, Object> map = new LinkedHashMap<>();
//
// public void set(String name, Object value) {
// map.put(name, value);
// }
//
// public String getAsString(String name) {
// try {
// return (String) map.get(name);
// } catch (Exception e) {
// throw new RuntimeException(MessageFormat.format("name={0}", name), e);
// }
// }
//
// public Long getAsLong(String name) {
// try {
// return (Long) map.get(name);
// } catch (Exception e) {
// throw new RuntimeException(MessageFormat.format("name={0}", name), e);
// }
// }
//
// public Double getAsDouble(String name) {
// try {
// return (Double) map.get(name);
// } catch (Exception e) {
// throw new RuntimeException(MessageFormat.format("name={0}", name), e);
// }
// }
//
// public Boolean getAsBoolean(String name) {
// try {
// return (Boolean) map.get(name);
// } catch (Exception e) {
// throw new RuntimeException(MessageFormat.format("name={0}", name), e);
// }
// }
//
// public Timestamp getAsTimestamp(String name) {
// try {
// return (Timestamp) map.get(name);
// } catch (Exception e) {
// throw new RuntimeException(MessageFormat.format("name={0}", name), e);
// }
// }
//
// @Override
// public String toString() {
// return map.toString();
// }
// }
| import java.io.Closeable;
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.embulk.EmbulkEmbed;
import org.embulk.EmbulkEmbed.Bootstrap;
import org.embulk.config.ConfigLoader;
import org.embulk.config.ConfigSource;
import org.embulk.parser.EmbulkTestOutputPlugin.OutputRecord;
import org.embulk.plugin.InjectedPluginSource;
import org.embulk.spi.InputPlugin;
import org.embulk.spi.OutputPlugin;
import org.embulk.spi.ParserPlugin;
import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Provider;
|
// output plugins
InjectedPluginSource.registerPluginTo(binder, OutputPlugin.class, EmbulkTestOutputPlugin.TYPE,
EmbulkTestOutputPlugin.class);
binder.bind(EmbulkTestOutputPlugin.class).toProvider(new Provider<EmbulkTestOutputPlugin>() {
@Override
public EmbulkTestOutputPlugin get() {
return embulkTestOutputPlugin;
}
});
}
public ConfigLoader getConfigLoader() {
if (configLoader == null) {
configLoader = getEmbulkEmbed().newConfigLoader();
}
return configLoader;
}
public ConfigSource newConfigSource() {
return getConfigLoader().newConfigSource();
}
public EmbulkTestParserConfig newParserConfig(String type) {
EmbulkTestParserConfig parser = new EmbulkTestParserConfig();
parser.setType(type);
return parser;
}
| // Path: src/test/java/org/embulk/parser/EmbulkTestOutputPlugin.java
// public static class OutputRecord {
// private Map<String, Object> map = new LinkedHashMap<>();
//
// public void set(String name, Object value) {
// map.put(name, value);
// }
//
// public String getAsString(String name) {
// try {
// return (String) map.get(name);
// } catch (Exception e) {
// throw new RuntimeException(MessageFormat.format("name={0}", name), e);
// }
// }
//
// public Long getAsLong(String name) {
// try {
// return (Long) map.get(name);
// } catch (Exception e) {
// throw new RuntimeException(MessageFormat.format("name={0}", name), e);
// }
// }
//
// public Double getAsDouble(String name) {
// try {
// return (Double) map.get(name);
// } catch (Exception e) {
// throw new RuntimeException(MessageFormat.format("name={0}", name), e);
// }
// }
//
// public Boolean getAsBoolean(String name) {
// try {
// return (Boolean) map.get(name);
// } catch (Exception e) {
// throw new RuntimeException(MessageFormat.format("name={0}", name), e);
// }
// }
//
// public Timestamp getAsTimestamp(String name) {
// try {
// return (Timestamp) map.get(name);
// } catch (Exception e) {
// throw new RuntimeException(MessageFormat.format("name={0}", name), e);
// }
// }
//
// @Override
// public String toString() {
// return map.toString();
// }
// }
// Path: src/test/java/org/embulk/parser/EmbulkPluginTester.java
import java.io.Closeable;
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.embulk.EmbulkEmbed;
import org.embulk.EmbulkEmbed.Bootstrap;
import org.embulk.config.ConfigLoader;
import org.embulk.config.ConfigSource;
import org.embulk.parser.EmbulkTestOutputPlugin.OutputRecord;
import org.embulk.plugin.InjectedPluginSource;
import org.embulk.spi.InputPlugin;
import org.embulk.spi.OutputPlugin;
import org.embulk.spi.ParserPlugin;
import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Provider;
// output plugins
InjectedPluginSource.registerPluginTo(binder, OutputPlugin.class, EmbulkTestOutputPlugin.TYPE,
EmbulkTestOutputPlugin.class);
binder.bind(EmbulkTestOutputPlugin.class).toProvider(new Provider<EmbulkTestOutputPlugin>() {
@Override
public EmbulkTestOutputPlugin get() {
return embulkTestOutputPlugin;
}
});
}
public ConfigLoader getConfigLoader() {
if (configLoader == null) {
configLoader = getEmbulkEmbed().newConfigLoader();
}
return configLoader;
}
public ConfigSource newConfigSource() {
return getConfigLoader().newConfigSource();
}
public EmbulkTestParserConfig newParserConfig(String type) {
EmbulkTestParserConfig parser = new EmbulkTestParserConfig();
parser.setType(type);
return parser;
}
| public List<OutputRecord> runParser(URL inFile, EmbulkTestParserConfig parser) {
|
hishidama/embulk-parser-poi_excel | src/main/java/org/embulk/parser/poi_excel/bean/util/SearchMergedCell.java | // Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionFinder.java
// public interface MergedRegionFinder {
//
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex);
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionList.java
// public class MergedRegionList implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// int size = sheet.getNumMergedRegions();
// for (int i = 0; i < size; i++) {
// CellRangeAddress region = sheet.getMergedRegion(i);
// if (region.isInRange(rowIndex, columnIndex)) {
// return region;
// }
// }
//
// return null;
// }
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionMap.java
// public abstract class MergedRegionMap implements MergedRegionFinder {
//
// private final Map<Sheet, Map<Integer, Map<Integer, CellRangeAddress>>> sheetMap = new ConcurrentHashMap<>();
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = sheetMap.get(sheet);
// if (rowMap == null) {
// synchronized (sheet) {
// rowMap = createRowMap(sheet);
// sheetMap.put(sheet, rowMap);
// }
// }
//
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(rowIndex);
// if (columnMap == null) {
// return null;
// }
// return columnMap.get(columnIndex);
// }
//
// protected Map<Integer, Map<Integer, CellRangeAddress>> createRowMap(Sheet sheet) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = newRowMap();
//
// for (int i = sheet.getNumMergedRegions() - 1; i >= 0; i--) {
// CellRangeAddress region = sheet.getMergedRegion(i);
//
// for (int r = region.getFirstRow(); r <= region.getLastRow(); r++) {
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(r);
// if (columnMap == null) {
// columnMap = newColumnMap();
// rowMap.put(r, columnMap);
// }
//
// for (int c = region.getFirstColumn(); c <= region.getLastColumn(); c++) {
// columnMap.put(c, region);
// }
// }
// }
//
// return rowMap;
// }
//
// protected abstract Map<Integer, Map<Integer, CellRangeAddress>> newRowMap();
//
// protected abstract Map<Integer, CellRangeAddress> newColumnMap();
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionNothing.java
// public class MergedRegionNothing implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// return null;
// }
// }
| import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import org.apache.poi.ss.util.CellRangeAddress;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionFinder;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionList;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionMap;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionNothing;
| package org.embulk.parser.poi_excel.bean.util;
public enum SearchMergedCell {
NONE {
@Override
| // Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionFinder.java
// public interface MergedRegionFinder {
//
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex);
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionList.java
// public class MergedRegionList implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// int size = sheet.getNumMergedRegions();
// for (int i = 0; i < size; i++) {
// CellRangeAddress region = sheet.getMergedRegion(i);
// if (region.isInRange(rowIndex, columnIndex)) {
// return region;
// }
// }
//
// return null;
// }
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionMap.java
// public abstract class MergedRegionMap implements MergedRegionFinder {
//
// private final Map<Sheet, Map<Integer, Map<Integer, CellRangeAddress>>> sheetMap = new ConcurrentHashMap<>();
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = sheetMap.get(sheet);
// if (rowMap == null) {
// synchronized (sheet) {
// rowMap = createRowMap(sheet);
// sheetMap.put(sheet, rowMap);
// }
// }
//
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(rowIndex);
// if (columnMap == null) {
// return null;
// }
// return columnMap.get(columnIndex);
// }
//
// protected Map<Integer, Map<Integer, CellRangeAddress>> createRowMap(Sheet sheet) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = newRowMap();
//
// for (int i = sheet.getNumMergedRegions() - 1; i >= 0; i--) {
// CellRangeAddress region = sheet.getMergedRegion(i);
//
// for (int r = region.getFirstRow(); r <= region.getLastRow(); r++) {
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(r);
// if (columnMap == null) {
// columnMap = newColumnMap();
// rowMap.put(r, columnMap);
// }
//
// for (int c = region.getFirstColumn(); c <= region.getLastColumn(); c++) {
// columnMap.put(c, region);
// }
// }
// }
//
// return rowMap;
// }
//
// protected abstract Map<Integer, Map<Integer, CellRangeAddress>> newRowMap();
//
// protected abstract Map<Integer, CellRangeAddress> newColumnMap();
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionNothing.java
// public class MergedRegionNothing implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// return null;
// }
// }
// Path: src/main/java/org/embulk/parser/poi_excel/bean/util/SearchMergedCell.java
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import org.apache.poi.ss.util.CellRangeAddress;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionFinder;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionList;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionMap;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionNothing;
package org.embulk.parser.poi_excel.bean.util;
public enum SearchMergedCell {
NONE {
@Override
| public MergedRegionFinder createMergedRegionFinder() {
|
hishidama/embulk-parser-poi_excel | src/main/java/org/embulk/parser/poi_excel/bean/util/SearchMergedCell.java | // Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionFinder.java
// public interface MergedRegionFinder {
//
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex);
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionList.java
// public class MergedRegionList implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// int size = sheet.getNumMergedRegions();
// for (int i = 0; i < size; i++) {
// CellRangeAddress region = sheet.getMergedRegion(i);
// if (region.isInRange(rowIndex, columnIndex)) {
// return region;
// }
// }
//
// return null;
// }
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionMap.java
// public abstract class MergedRegionMap implements MergedRegionFinder {
//
// private final Map<Sheet, Map<Integer, Map<Integer, CellRangeAddress>>> sheetMap = new ConcurrentHashMap<>();
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = sheetMap.get(sheet);
// if (rowMap == null) {
// synchronized (sheet) {
// rowMap = createRowMap(sheet);
// sheetMap.put(sheet, rowMap);
// }
// }
//
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(rowIndex);
// if (columnMap == null) {
// return null;
// }
// return columnMap.get(columnIndex);
// }
//
// protected Map<Integer, Map<Integer, CellRangeAddress>> createRowMap(Sheet sheet) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = newRowMap();
//
// for (int i = sheet.getNumMergedRegions() - 1; i >= 0; i--) {
// CellRangeAddress region = sheet.getMergedRegion(i);
//
// for (int r = region.getFirstRow(); r <= region.getLastRow(); r++) {
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(r);
// if (columnMap == null) {
// columnMap = newColumnMap();
// rowMap.put(r, columnMap);
// }
//
// for (int c = region.getFirstColumn(); c <= region.getLastColumn(); c++) {
// columnMap.put(c, region);
// }
// }
// }
//
// return rowMap;
// }
//
// protected abstract Map<Integer, Map<Integer, CellRangeAddress>> newRowMap();
//
// protected abstract Map<Integer, CellRangeAddress> newColumnMap();
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionNothing.java
// public class MergedRegionNothing implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// return null;
// }
// }
| import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import org.apache.poi.ss.util.CellRangeAddress;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionFinder;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionList;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionMap;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionNothing;
| package org.embulk.parser.poi_excel.bean.util;
public enum SearchMergedCell {
NONE {
@Override
public MergedRegionFinder createMergedRegionFinder() {
| // Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionFinder.java
// public interface MergedRegionFinder {
//
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex);
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionList.java
// public class MergedRegionList implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// int size = sheet.getNumMergedRegions();
// for (int i = 0; i < size; i++) {
// CellRangeAddress region = sheet.getMergedRegion(i);
// if (region.isInRange(rowIndex, columnIndex)) {
// return region;
// }
// }
//
// return null;
// }
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionMap.java
// public abstract class MergedRegionMap implements MergedRegionFinder {
//
// private final Map<Sheet, Map<Integer, Map<Integer, CellRangeAddress>>> sheetMap = new ConcurrentHashMap<>();
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = sheetMap.get(sheet);
// if (rowMap == null) {
// synchronized (sheet) {
// rowMap = createRowMap(sheet);
// sheetMap.put(sheet, rowMap);
// }
// }
//
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(rowIndex);
// if (columnMap == null) {
// return null;
// }
// return columnMap.get(columnIndex);
// }
//
// protected Map<Integer, Map<Integer, CellRangeAddress>> createRowMap(Sheet sheet) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = newRowMap();
//
// for (int i = sheet.getNumMergedRegions() - 1; i >= 0; i--) {
// CellRangeAddress region = sheet.getMergedRegion(i);
//
// for (int r = region.getFirstRow(); r <= region.getLastRow(); r++) {
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(r);
// if (columnMap == null) {
// columnMap = newColumnMap();
// rowMap.put(r, columnMap);
// }
//
// for (int c = region.getFirstColumn(); c <= region.getLastColumn(); c++) {
// columnMap.put(c, region);
// }
// }
// }
//
// return rowMap;
// }
//
// protected abstract Map<Integer, Map<Integer, CellRangeAddress>> newRowMap();
//
// protected abstract Map<Integer, CellRangeAddress> newColumnMap();
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionNothing.java
// public class MergedRegionNothing implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// return null;
// }
// }
// Path: src/main/java/org/embulk/parser/poi_excel/bean/util/SearchMergedCell.java
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import org.apache.poi.ss.util.CellRangeAddress;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionFinder;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionList;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionMap;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionNothing;
package org.embulk.parser.poi_excel.bean.util;
public enum SearchMergedCell {
NONE {
@Override
public MergedRegionFinder createMergedRegionFinder() {
| return new MergedRegionNothing();
|
hishidama/embulk-parser-poi_excel | src/main/java/org/embulk/parser/poi_excel/bean/util/SearchMergedCell.java | // Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionFinder.java
// public interface MergedRegionFinder {
//
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex);
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionList.java
// public class MergedRegionList implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// int size = sheet.getNumMergedRegions();
// for (int i = 0; i < size; i++) {
// CellRangeAddress region = sheet.getMergedRegion(i);
// if (region.isInRange(rowIndex, columnIndex)) {
// return region;
// }
// }
//
// return null;
// }
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionMap.java
// public abstract class MergedRegionMap implements MergedRegionFinder {
//
// private final Map<Sheet, Map<Integer, Map<Integer, CellRangeAddress>>> sheetMap = new ConcurrentHashMap<>();
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = sheetMap.get(sheet);
// if (rowMap == null) {
// synchronized (sheet) {
// rowMap = createRowMap(sheet);
// sheetMap.put(sheet, rowMap);
// }
// }
//
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(rowIndex);
// if (columnMap == null) {
// return null;
// }
// return columnMap.get(columnIndex);
// }
//
// protected Map<Integer, Map<Integer, CellRangeAddress>> createRowMap(Sheet sheet) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = newRowMap();
//
// for (int i = sheet.getNumMergedRegions() - 1; i >= 0; i--) {
// CellRangeAddress region = sheet.getMergedRegion(i);
//
// for (int r = region.getFirstRow(); r <= region.getLastRow(); r++) {
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(r);
// if (columnMap == null) {
// columnMap = newColumnMap();
// rowMap.put(r, columnMap);
// }
//
// for (int c = region.getFirstColumn(); c <= region.getLastColumn(); c++) {
// columnMap.put(c, region);
// }
// }
// }
//
// return rowMap;
// }
//
// protected abstract Map<Integer, Map<Integer, CellRangeAddress>> newRowMap();
//
// protected abstract Map<Integer, CellRangeAddress> newColumnMap();
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionNothing.java
// public class MergedRegionNothing implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// return null;
// }
// }
| import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import org.apache.poi.ss.util.CellRangeAddress;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionFinder;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionList;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionMap;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionNothing;
| package org.embulk.parser.poi_excel.bean.util;
public enum SearchMergedCell {
NONE {
@Override
public MergedRegionFinder createMergedRegionFinder() {
return new MergedRegionNothing();
}
},
LINEAR_SEARCH {
@Override
public MergedRegionFinder createMergedRegionFinder() {
| // Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionFinder.java
// public interface MergedRegionFinder {
//
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex);
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionList.java
// public class MergedRegionList implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// int size = sheet.getNumMergedRegions();
// for (int i = 0; i < size; i++) {
// CellRangeAddress region = sheet.getMergedRegion(i);
// if (region.isInRange(rowIndex, columnIndex)) {
// return region;
// }
// }
//
// return null;
// }
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionMap.java
// public abstract class MergedRegionMap implements MergedRegionFinder {
//
// private final Map<Sheet, Map<Integer, Map<Integer, CellRangeAddress>>> sheetMap = new ConcurrentHashMap<>();
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = sheetMap.get(sheet);
// if (rowMap == null) {
// synchronized (sheet) {
// rowMap = createRowMap(sheet);
// sheetMap.put(sheet, rowMap);
// }
// }
//
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(rowIndex);
// if (columnMap == null) {
// return null;
// }
// return columnMap.get(columnIndex);
// }
//
// protected Map<Integer, Map<Integer, CellRangeAddress>> createRowMap(Sheet sheet) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = newRowMap();
//
// for (int i = sheet.getNumMergedRegions() - 1; i >= 0; i--) {
// CellRangeAddress region = sheet.getMergedRegion(i);
//
// for (int r = region.getFirstRow(); r <= region.getLastRow(); r++) {
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(r);
// if (columnMap == null) {
// columnMap = newColumnMap();
// rowMap.put(r, columnMap);
// }
//
// for (int c = region.getFirstColumn(); c <= region.getLastColumn(); c++) {
// columnMap.put(c, region);
// }
// }
// }
//
// return rowMap;
// }
//
// protected abstract Map<Integer, Map<Integer, CellRangeAddress>> newRowMap();
//
// protected abstract Map<Integer, CellRangeAddress> newColumnMap();
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionNothing.java
// public class MergedRegionNothing implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// return null;
// }
// }
// Path: src/main/java/org/embulk/parser/poi_excel/bean/util/SearchMergedCell.java
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import org.apache.poi.ss.util.CellRangeAddress;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionFinder;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionList;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionMap;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionNothing;
package org.embulk.parser.poi_excel.bean.util;
public enum SearchMergedCell {
NONE {
@Override
public MergedRegionFinder createMergedRegionFinder() {
return new MergedRegionNothing();
}
},
LINEAR_SEARCH {
@Override
public MergedRegionFinder createMergedRegionFinder() {
| return new MergedRegionList();
|
hishidama/embulk-parser-poi_excel | src/main/java/org/embulk/parser/poi_excel/bean/util/SearchMergedCell.java | // Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionFinder.java
// public interface MergedRegionFinder {
//
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex);
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionList.java
// public class MergedRegionList implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// int size = sheet.getNumMergedRegions();
// for (int i = 0; i < size; i++) {
// CellRangeAddress region = sheet.getMergedRegion(i);
// if (region.isInRange(rowIndex, columnIndex)) {
// return region;
// }
// }
//
// return null;
// }
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionMap.java
// public abstract class MergedRegionMap implements MergedRegionFinder {
//
// private final Map<Sheet, Map<Integer, Map<Integer, CellRangeAddress>>> sheetMap = new ConcurrentHashMap<>();
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = sheetMap.get(sheet);
// if (rowMap == null) {
// synchronized (sheet) {
// rowMap = createRowMap(sheet);
// sheetMap.put(sheet, rowMap);
// }
// }
//
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(rowIndex);
// if (columnMap == null) {
// return null;
// }
// return columnMap.get(columnIndex);
// }
//
// protected Map<Integer, Map<Integer, CellRangeAddress>> createRowMap(Sheet sheet) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = newRowMap();
//
// for (int i = sheet.getNumMergedRegions() - 1; i >= 0; i--) {
// CellRangeAddress region = sheet.getMergedRegion(i);
//
// for (int r = region.getFirstRow(); r <= region.getLastRow(); r++) {
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(r);
// if (columnMap == null) {
// columnMap = newColumnMap();
// rowMap.put(r, columnMap);
// }
//
// for (int c = region.getFirstColumn(); c <= region.getLastColumn(); c++) {
// columnMap.put(c, region);
// }
// }
// }
//
// return rowMap;
// }
//
// protected abstract Map<Integer, Map<Integer, CellRangeAddress>> newRowMap();
//
// protected abstract Map<Integer, CellRangeAddress> newColumnMap();
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionNothing.java
// public class MergedRegionNothing implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// return null;
// }
// }
| import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import org.apache.poi.ss.util.CellRangeAddress;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionFinder;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionList;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionMap;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionNothing;
| package org.embulk.parser.poi_excel.bean.util;
public enum SearchMergedCell {
NONE {
@Override
public MergedRegionFinder createMergedRegionFinder() {
return new MergedRegionNothing();
}
},
LINEAR_SEARCH {
@Override
public MergedRegionFinder createMergedRegionFinder() {
return new MergedRegionList();
}
},
TREE_SEARCH {
@Override
public MergedRegionFinder createMergedRegionFinder() {
| // Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionFinder.java
// public interface MergedRegionFinder {
//
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex);
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionList.java
// public class MergedRegionList implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// int size = sheet.getNumMergedRegions();
// for (int i = 0; i < size; i++) {
// CellRangeAddress region = sheet.getMergedRegion(i);
// if (region.isInRange(rowIndex, columnIndex)) {
// return region;
// }
// }
//
// return null;
// }
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionMap.java
// public abstract class MergedRegionMap implements MergedRegionFinder {
//
// private final Map<Sheet, Map<Integer, Map<Integer, CellRangeAddress>>> sheetMap = new ConcurrentHashMap<>();
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = sheetMap.get(sheet);
// if (rowMap == null) {
// synchronized (sheet) {
// rowMap = createRowMap(sheet);
// sheetMap.put(sheet, rowMap);
// }
// }
//
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(rowIndex);
// if (columnMap == null) {
// return null;
// }
// return columnMap.get(columnIndex);
// }
//
// protected Map<Integer, Map<Integer, CellRangeAddress>> createRowMap(Sheet sheet) {
// Map<Integer, Map<Integer, CellRangeAddress>> rowMap = newRowMap();
//
// for (int i = sheet.getNumMergedRegions() - 1; i >= 0; i--) {
// CellRangeAddress region = sheet.getMergedRegion(i);
//
// for (int r = region.getFirstRow(); r <= region.getLastRow(); r++) {
// Map<Integer, CellRangeAddress> columnMap = rowMap.get(r);
// if (columnMap == null) {
// columnMap = newColumnMap();
// rowMap.put(r, columnMap);
// }
//
// for (int c = region.getFirstColumn(); c <= region.getLastColumn(); c++) {
// columnMap.put(c, region);
// }
// }
// }
//
// return rowMap;
// }
//
// protected abstract Map<Integer, Map<Integer, CellRangeAddress>> newRowMap();
//
// protected abstract Map<Integer, CellRangeAddress> newColumnMap();
// }
//
// Path: src/main/java/org/embulk/parser/poi_excel/visitor/util/MergedRegionNothing.java
// public class MergedRegionNothing implements MergedRegionFinder {
//
// @Override
// public CellRangeAddress get(Sheet sheet, int rowIndex, int columnIndex) {
// return null;
// }
// }
// Path: src/main/java/org/embulk/parser/poi_excel/bean/util/SearchMergedCell.java
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import org.apache.poi.ss.util.CellRangeAddress;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionFinder;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionList;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionMap;
import org.embulk.parser.poi_excel.visitor.util.MergedRegionNothing;
package org.embulk.parser.poi_excel.bean.util;
public enum SearchMergedCell {
NONE {
@Override
public MergedRegionFinder createMergedRegionFinder() {
return new MergedRegionNothing();
}
},
LINEAR_SEARCH {
@Override
public MergedRegionFinder createMergedRegionFinder() {
return new MergedRegionList();
}
},
TREE_SEARCH {
@Override
public MergedRegionFinder createMergedRegionFinder() {
| return new MergedRegionMap() {
|
graceland/graceland-core | graceland-platform/src/test/java/io/graceland/application/ModalApplicationTest.java | // Path: graceland-platform/src/main/java/io/graceland/plugin/Plugin.java
// public interface Plugin extends Module {
// }
//
// Path: graceland-platform/src/test/java/io/graceland/testing/TestModes.java
// public enum TestModes {
// DEV,
// PROD
// }
| import java.util.List;
import org.junit.Test;
import io.graceland.plugin.Plugin;
import io.graceland.testing.TestModes;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock; | package io.graceland.application;
public class ModalApplicationTest extends ApplicationTest {
private static final String[] ARGS_MISSING = new String[]{"server", "config.yml"};
private static final String[] ARGS_DEV = new String[]{"server", "config.yml", "--DEV"};
private static final String[] ARGS_PROD = new String[]{"server", "config.yml", "--PROD"};
private static final String[] ARGS_NOT_VALID = new String[]{"server", "config.yml", "--NOTFOUND"};
private static final String[] ARGS_BAD_CASE = new String[]{"server", "config.yml", "--dev"};
| // Path: graceland-platform/src/main/java/io/graceland/plugin/Plugin.java
// public interface Plugin extends Module {
// }
//
// Path: graceland-platform/src/test/java/io/graceland/testing/TestModes.java
// public enum TestModes {
// DEV,
// PROD
// }
// Path: graceland-platform/src/test/java/io/graceland/application/ModalApplicationTest.java
import java.util.List;
import org.junit.Test;
import io.graceland.plugin.Plugin;
import io.graceland.testing.TestModes;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
package io.graceland.application;
public class ModalApplicationTest extends ApplicationTest {
private static final String[] ARGS_MISSING = new String[]{"server", "config.yml"};
private static final String[] ARGS_DEV = new String[]{"server", "config.yml", "--DEV"};
private static final String[] ARGS_PROD = new String[]{"server", "config.yml", "--PROD"};
private static final String[] ARGS_NOT_VALID = new String[]{"server", "config.yml", "--NOTFOUND"};
private static final String[] ARGS_BAD_CASE = new String[]{"server", "config.yml", "--dev"};
| private Plugin plugin1 = mock(Plugin.class); |
graceland/graceland-core | graceland-platform/src/test/java/io/graceland/application/ModalApplicationTest.java | // Path: graceland-platform/src/main/java/io/graceland/plugin/Plugin.java
// public interface Plugin extends Module {
// }
//
// Path: graceland-platform/src/test/java/io/graceland/testing/TestModes.java
// public enum TestModes {
// DEV,
// PROD
// }
| import java.util.List;
import org.junit.Test;
import io.graceland.plugin.Plugin;
import io.graceland.testing.TestModes;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock; | package io.graceland.application;
public class ModalApplicationTest extends ApplicationTest {
private static final String[] ARGS_MISSING = new String[]{"server", "config.yml"};
private static final String[] ARGS_DEV = new String[]{"server", "config.yml", "--DEV"};
private static final String[] ARGS_PROD = new String[]{"server", "config.yml", "--PROD"};
private static final String[] ARGS_NOT_VALID = new String[]{"server", "config.yml", "--NOTFOUND"};
private static final String[] ARGS_BAD_CASE = new String[]{"server", "config.yml", "--dev"};
private Plugin plugin1 = mock(Plugin.class);
private Plugin plugin2 = mock(Plugin.class);
private Plugin plugin3 = mock(Plugin.class);
private Plugin plugin4 = mock(Plugin.class);
@Override
protected Application newApplication() { | // Path: graceland-platform/src/main/java/io/graceland/plugin/Plugin.java
// public interface Plugin extends Module {
// }
//
// Path: graceland-platform/src/test/java/io/graceland/testing/TestModes.java
// public enum TestModes {
// DEV,
// PROD
// }
// Path: graceland-platform/src/test/java/io/graceland/application/ModalApplicationTest.java
import java.util.List;
import org.junit.Test;
import io.graceland.plugin.Plugin;
import io.graceland.testing.TestModes;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
package io.graceland.application;
public class ModalApplicationTest extends ApplicationTest {
private static final String[] ARGS_MISSING = new String[]{"server", "config.yml"};
private static final String[] ARGS_DEV = new String[]{"server", "config.yml", "--DEV"};
private static final String[] ARGS_PROD = new String[]{"server", "config.yml", "--PROD"};
private static final String[] ARGS_NOT_VALID = new String[]{"server", "config.yml", "--NOTFOUND"};
private static final String[] ARGS_BAD_CASE = new String[]{"server", "config.yml", "--dev"};
private Plugin plugin1 = mock(Plugin.class);
private Plugin plugin2 = mock(Plugin.class);
private Plugin plugin3 = mock(Plugin.class);
private Plugin plugin4 = mock(Plugin.class);
@Override
protected Application newApplication() { | return new ModalApplication<TestModes>(TestModes.class, TestModes.PROD, ARGS_MISSING) { |
graceland/graceland-core | graceland-platform/src/test/java/io/graceland/plugin/loaders/NativePluginLoaderTest.java | // Path: graceland-platform/src/main/java/io/graceland/plugin/Plugin.java
// public interface Plugin extends Module {
// }
| import java.util.ServiceLoader;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.google.common.collect.ImmutableList;
import io.graceland.plugin.Plugin;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; | package io.graceland.plugin.loaders;
@RunWith(PowerMockRunner.class)
@PrepareForTest(NativePluginLoader.class)
public class NativePluginLoaderTest extends PluginLoaderTest<NativePluginLoader> {
@Override
protected NativePluginLoader newPluginLoader() {
return NativePluginLoader.newLoader();
}
@Test
public void gets_plugins_from_serviceloader() { | // Path: graceland-platform/src/main/java/io/graceland/plugin/Plugin.java
// public interface Plugin extends Module {
// }
// Path: graceland-platform/src/test/java/io/graceland/plugin/loaders/NativePluginLoaderTest.java
import java.util.ServiceLoader;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import com.google.common.collect.ImmutableList;
import io.graceland.plugin.Plugin;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
package io.graceland.plugin.loaders;
@RunWith(PowerMockRunner.class)
@PrepareForTest(NativePluginLoader.class)
public class NativePluginLoaderTest extends PluginLoaderTest<NativePluginLoader> {
@Override
protected NativePluginLoader newPluginLoader() {
return NativePluginLoader.newLoader();
}
@Test
public void gets_plugins_from_serviceloader() { | Plugin plugin1 = mock(Plugin.class); |
graceland/graceland-core | graceland-platform/src/main/java/io/graceland/plugin/loaders/NativePluginLoader.java | // Path: graceland-platform/src/main/java/io/graceland/application/Application.java
// public interface Application {
//
// /**
// * Adds the plugin to the list of plugins that will be loaded.
// *
// * @param plugin The plugin to load.
// */
// void loadPlugin(Plugin plugin);
//
// /**
// * Provides a list of loaded plugins for this application. Once requested, the list of plugins should not change.
// * <p/>
// * At least one plugin must be loaded.
// *
// * @return A list of plugins.
// */
// ImmutableList<Plugin> getPlugins();
// }
//
// Path: graceland-platform/src/main/java/io/graceland/plugin/Plugin.java
// public interface Plugin extends Module {
// }
| import java.util.ServiceLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import io.graceland.application.Application;
import io.graceland.plugin.Plugin; | package io.graceland.plugin.loaders;
/**
* Uses the java {@link java.util.ServiceLoader} to discover plugins and loads them into the
* {@link io.graceland.application.Application}.
*/
public class NativePluginLoader implements PluginLoader {
private static final Logger LOGGER = LoggerFactory.getLogger(NativePluginLoader.class);
NativePluginLoader() {
// do nothing
}
public static NativePluginLoader newLoader() {
return new NativePluginLoader();
}
@Override | // Path: graceland-platform/src/main/java/io/graceland/application/Application.java
// public interface Application {
//
// /**
// * Adds the plugin to the list of plugins that will be loaded.
// *
// * @param plugin The plugin to load.
// */
// void loadPlugin(Plugin plugin);
//
// /**
// * Provides a list of loaded plugins for this application. Once requested, the list of plugins should not change.
// * <p/>
// * At least one plugin must be loaded.
// *
// * @return A list of plugins.
// */
// ImmutableList<Plugin> getPlugins();
// }
//
// Path: graceland-platform/src/main/java/io/graceland/plugin/Plugin.java
// public interface Plugin extends Module {
// }
// Path: graceland-platform/src/main/java/io/graceland/plugin/loaders/NativePluginLoader.java
import java.util.ServiceLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import io.graceland.application.Application;
import io.graceland.plugin.Plugin;
package io.graceland.plugin.loaders;
/**
* Uses the java {@link java.util.ServiceLoader} to discover plugins and loads them into the
* {@link io.graceland.application.Application}.
*/
public class NativePluginLoader implements PluginLoader {
private static final Logger LOGGER = LoggerFactory.getLogger(NativePluginLoader.class);
NativePluginLoader() {
// do nothing
}
public static NativePluginLoader newLoader() {
return new NativePluginLoader();
}
@Override | public void loadInto(Application application) { |
graceland/graceland-core | graceland-platform/src/main/java/io/graceland/plugin/loaders/NativePluginLoader.java | // Path: graceland-platform/src/main/java/io/graceland/application/Application.java
// public interface Application {
//
// /**
// * Adds the plugin to the list of plugins that will be loaded.
// *
// * @param plugin The plugin to load.
// */
// void loadPlugin(Plugin plugin);
//
// /**
// * Provides a list of loaded plugins for this application. Once requested, the list of plugins should not change.
// * <p/>
// * At least one plugin must be loaded.
// *
// * @return A list of plugins.
// */
// ImmutableList<Plugin> getPlugins();
// }
//
// Path: graceland-platform/src/main/java/io/graceland/plugin/Plugin.java
// public interface Plugin extends Module {
// }
| import java.util.ServiceLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import io.graceland.application.Application;
import io.graceland.plugin.Plugin; | package io.graceland.plugin.loaders;
/**
* Uses the java {@link java.util.ServiceLoader} to discover plugins and loads them into the
* {@link io.graceland.application.Application}.
*/
public class NativePluginLoader implements PluginLoader {
private static final Logger LOGGER = LoggerFactory.getLogger(NativePluginLoader.class);
NativePluginLoader() {
// do nothing
}
public static NativePluginLoader newLoader() {
return new NativePluginLoader();
}
@Override
public void loadInto(Application application) {
Preconditions.checkNotNull(application, "Application cannot be null.");
LOGGER.info("Loading plugins using the native ServiceLoader.");
| // Path: graceland-platform/src/main/java/io/graceland/application/Application.java
// public interface Application {
//
// /**
// * Adds the plugin to the list of plugins that will be loaded.
// *
// * @param plugin The plugin to load.
// */
// void loadPlugin(Plugin plugin);
//
// /**
// * Provides a list of loaded plugins for this application. Once requested, the list of plugins should not change.
// * <p/>
// * At least one plugin must be loaded.
// *
// * @return A list of plugins.
// */
// ImmutableList<Plugin> getPlugins();
// }
//
// Path: graceland-platform/src/main/java/io/graceland/plugin/Plugin.java
// public interface Plugin extends Module {
// }
// Path: graceland-platform/src/main/java/io/graceland/plugin/loaders/NativePluginLoader.java
import java.util.ServiceLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import io.graceland.application.Application;
import io.graceland.plugin.Plugin;
package io.graceland.plugin.loaders;
/**
* Uses the java {@link java.util.ServiceLoader} to discover plugins and loads them into the
* {@link io.graceland.application.Application}.
*/
public class NativePluginLoader implements PluginLoader {
private static final Logger LOGGER = LoggerFactory.getLogger(NativePluginLoader.class);
NativePluginLoader() {
// do nothing
}
public static NativePluginLoader newLoader() {
return new NativePluginLoader();
}
@Override
public void loadInto(Application application) {
Preconditions.checkNotNull(application, "Application cannot be null.");
LOGGER.info("Loading plugins using the native ServiceLoader.");
| for (Plugin plugin : ServiceLoader.load(Plugin.class)) { |
graceland/graceland-core | graceland-platform/src/test/java/io/graceland/configuration/ConfigurationBinderTest.java | // Path: graceland-platform/src/test/java/io/graceland/testing/TestConfiguration.java
// public class TestConfiguration implements Configuration {
// }
//
// Path: graceland-platform/src/test/java/io/graceland/testing/TestFileConfiguration.java
// public class TestFileConfiguration implements Configuration {
//
// private final int abc;
// private final String test;
//
// @JsonCreator
// public TestFileConfiguration(
// @JsonProperty("abc") int abc,
// @JsonProperty("test") String test) {
//
// this.abc = abc;
// this.test = test;
// }
//
// public int getAbc() {
// return abc;
// }
//
// public String getTest() {
// return test;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// TestFileConfiguration that = (TestFileConfiguration) o;
//
// if (abc != that.abc) return false;
// if (test != null ? !test.equals(that.test) : that.test != null) return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = abc;
// result = 31 * result + (test != null ? test.hashCode() : 0);
// return result;
// }
// }
| import org.junit.Test;
import com.google.inject.AbstractModule;
import com.google.inject.Binder;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
import io.graceland.testing.TestAnnotation;
import io.graceland.testing.TestConfiguration;
import io.graceland.testing.TestFileConfiguration;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock; | package io.graceland.configuration;
public class ConfigurationBinderTest {
@Test(expected = NullPointerException.class)
public void constructor_class_cannot_be_null() {
ConfigurationBinder.forClass(null, mock(Binder.class));
}
@Test(expected = NullPointerException.class)
public void constructor_binder_cannot_be_null() { | // Path: graceland-platform/src/test/java/io/graceland/testing/TestConfiguration.java
// public class TestConfiguration implements Configuration {
// }
//
// Path: graceland-platform/src/test/java/io/graceland/testing/TestFileConfiguration.java
// public class TestFileConfiguration implements Configuration {
//
// private final int abc;
// private final String test;
//
// @JsonCreator
// public TestFileConfiguration(
// @JsonProperty("abc") int abc,
// @JsonProperty("test") String test) {
//
// this.abc = abc;
// this.test = test;
// }
//
// public int getAbc() {
// return abc;
// }
//
// public String getTest() {
// return test;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// TestFileConfiguration that = (TestFileConfiguration) o;
//
// if (abc != that.abc) return false;
// if (test != null ? !test.equals(that.test) : that.test != null) return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = abc;
// result = 31 * result + (test != null ? test.hashCode() : 0);
// return result;
// }
// }
// Path: graceland-platform/src/test/java/io/graceland/configuration/ConfigurationBinderTest.java
import org.junit.Test;
import com.google.inject.AbstractModule;
import com.google.inject.Binder;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
import io.graceland.testing.TestAnnotation;
import io.graceland.testing.TestConfiguration;
import io.graceland.testing.TestFileConfiguration;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
package io.graceland.configuration;
public class ConfigurationBinderTest {
@Test(expected = NullPointerException.class)
public void constructor_class_cannot_be_null() {
ConfigurationBinder.forClass(null, mock(Binder.class));
}
@Test(expected = NullPointerException.class)
public void constructor_binder_cannot_be_null() { | ConfigurationBinder.forClass(TestConfiguration.class, null); |
graceland/graceland-core | graceland-platform/src/test/java/io/graceland/configuration/ConfigurationBinderTest.java | // Path: graceland-platform/src/test/java/io/graceland/testing/TestConfiguration.java
// public class TestConfiguration implements Configuration {
// }
//
// Path: graceland-platform/src/test/java/io/graceland/testing/TestFileConfiguration.java
// public class TestFileConfiguration implements Configuration {
//
// private final int abc;
// private final String test;
//
// @JsonCreator
// public TestFileConfiguration(
// @JsonProperty("abc") int abc,
// @JsonProperty("test") String test) {
//
// this.abc = abc;
// this.test = test;
// }
//
// public int getAbc() {
// return abc;
// }
//
// public String getTest() {
// return test;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// TestFileConfiguration that = (TestFileConfiguration) o;
//
// if (abc != that.abc) return false;
// if (test != null ? !test.equals(that.test) : that.test != null) return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = abc;
// result = 31 * result + (test != null ? test.hashCode() : 0);
// return result;
// }
// }
| import org.junit.Test;
import com.google.inject.AbstractModule;
import com.google.inject.Binder;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
import io.graceland.testing.TestAnnotation;
import io.graceland.testing.TestConfiguration;
import io.graceland.testing.TestFileConfiguration;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock; | }
@Test
public void toInstance_binds_an_annotated_instance() {
final TestConfiguration expectedConfiguration = new TestConfiguration();
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
ConfigurationBinder
.forClass(TestConfiguration.class, binder())
.annotatedWith(TestAnnotation.class).toInstance(expectedConfiguration);
}
});
assertThat(
injector.getInstance(Key.get(TestConfiguration.class, TestAnnotation.class)),
is(expectedConfiguration));
}
@Test(expected = NullPointerException.class)
public void toFile_cannot_bind_null() {
ConfigurationBinder
.forClass(TestConfiguration.class, mock(Binder.class))
.toFile(null);
}
@Test(expected = IllegalArgumentException.class)
public void toFile_file_must_exist() {
ConfigurationBinder | // Path: graceland-platform/src/test/java/io/graceland/testing/TestConfiguration.java
// public class TestConfiguration implements Configuration {
// }
//
// Path: graceland-platform/src/test/java/io/graceland/testing/TestFileConfiguration.java
// public class TestFileConfiguration implements Configuration {
//
// private final int abc;
// private final String test;
//
// @JsonCreator
// public TestFileConfiguration(
// @JsonProperty("abc") int abc,
// @JsonProperty("test") String test) {
//
// this.abc = abc;
// this.test = test;
// }
//
// public int getAbc() {
// return abc;
// }
//
// public String getTest() {
// return test;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
//
// TestFileConfiguration that = (TestFileConfiguration) o;
//
// if (abc != that.abc) return false;
// if (test != null ? !test.equals(that.test) : that.test != null) return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = abc;
// result = 31 * result + (test != null ? test.hashCode() : 0);
// return result;
// }
// }
// Path: graceland-platform/src/test/java/io/graceland/configuration/ConfigurationBinderTest.java
import org.junit.Test;
import com.google.inject.AbstractModule;
import com.google.inject.Binder;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
import io.graceland.testing.TestAnnotation;
import io.graceland.testing.TestConfiguration;
import io.graceland.testing.TestFileConfiguration;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
}
@Test
public void toInstance_binds_an_annotated_instance() {
final TestConfiguration expectedConfiguration = new TestConfiguration();
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
ConfigurationBinder
.forClass(TestConfiguration.class, binder())
.annotatedWith(TestAnnotation.class).toInstance(expectedConfiguration);
}
});
assertThat(
injector.getInstance(Key.get(TestConfiguration.class, TestAnnotation.class)),
is(expectedConfiguration));
}
@Test(expected = NullPointerException.class)
public void toFile_cannot_bind_null() {
ConfigurationBinder
.forClass(TestConfiguration.class, mock(Binder.class))
.toFile(null);
}
@Test(expected = IllegalArgumentException.class)
public void toFile_file_must_exist() {
ConfigurationBinder | .forClass(TestFileConfiguration.class, mock(Binder.class)) |
graceland/graceland-core | graceland-platform/src/test/java/io/graceland/filter/FilterBinderTest.java | // Path: graceland-platform/src/main/java/io/graceland/inject/Keys.java
// public final class Keys {
//
// protected Keys() {
// // utility class
// }
//
// // ===================
// // Guice Injector Keys
// // ===================
//
// // Managed Objects
// public static final Key<Set<Managed>> ManagedObjects = Key.get(TypeLiterals.ManagedSet, Graceland.class);
// public static final Key<Set<Class<? extends Managed>>> ManagedObjectClasses = Key.get(TypeLiterals.ManagedClassSet, Graceland.class);
//
// // Jersey Components
// public static final Key<Set<Object>> JerseyComponents = Key.get(TypeLiterals.ObjectSet, Graceland.class);
//
// // Health Checks
// public static final Key<Set<HealthCheck>> HealthChecks = Key.get(TypeLiterals.HealthCheckSet, Graceland.class);
// public static final Key<Set<Class<? extends HealthCheck>>> HealthCheckClasses = Key.get(TypeLiterals.HealthCheckClassSet, Graceland.class);
//
// // Tasks
// public static final Key<Set<Task>> Tasks = Key.get(TypeLiterals.TaskSet, Graceland.class);
// public static final Key<Set<Class<? extends Task>>> TaskClasses = Key.get(TypeLiterals.TaskClassSet, Graceland.class);
//
// // Bundles
// public static final Key<Set<Bundle>> Bundles = Key.get(TypeLiterals.BundleSet, Graceland.class);
// public static final Key<Set<Class<? extends Bundle>>> BundleClasses = Key.get(TypeLiterals.BundleClassSet, Graceland.class);
//
// // Commands
// public static final Key<Set<Command>> Commands = Key.get(TypeLiterals.CommandSet, Graceland.class);
// public static final Key<Set<Class<? extends Command>>> CommandClasses = Key.get(TypeLiterals.CommandClassSet, Graceland.class);
//
// // Initializers
// public static final Key<Set<Initializer>> Initializers = Key.get(TypeLiterals.InitializerSet, Graceland.class);
// public static final Key<Set<Class<? extends Initializer>>> InitializerClasses = Key.get(TypeLiterals.InitializerClassSet, Graceland.class);
//
// // Configurators
// public static final Key<Set<Configurator>> Configurators = Key.get(TypeLiterals.ConfiguratorSet, Graceland.class);
// public static final Key<Set<Class<? extends Configurator>>> ConfiguratorClasses = Key.get(TypeLiterals.ConfiguratorClassSet, Graceland.class);
//
// // Filter Specs
// public static final Key<Set<FilterSpec>> FilterSpecs = Key.get(TypeLiterals.FilterSpecSet, Graceland.class);
// }
//
// Path: graceland-platform/src/test/java/io/graceland/testing/TestFilter.java
// public class TestFilter implements Filter {
// @Override
// public void init(FilterConfig filterConfig) throws ServletException {
// // do nothing
// }
//
// @Override
// public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
// // do nothing
// }
//
// @Override
// public void destroy() {
// // do nothing
// }
// }
| import org.junit.Test;
import com.google.common.collect.Iterables;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import io.graceland.inject.Keys;
import io.graceland.testing.TestFilter;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock; |
@Test
public void can_add_more_than_one_patterns() {
final FilterPattern pattern1 = mock(FilterPattern.class);
final FilterPattern pattern2 = mock(FilterPattern.class);
AbstractModule abstractModule = new AbstractModule() {
@Override
protected void configure() {
FilterBinder
.forClass(binder(), TestFilter.class)
.withPriority(filterPriority)
.addPattern(pattern1)
.addPattern(pattern2)
.withName(filterName)
.bind();
}
};
verifyInjectedValue(abstractModule, filterPriority, filterName, pattern1, pattern2);
}
private void verifyInjectedValue(
AbstractModule abstractModule,
int priority,
String name,
FilterPattern... patterns) {
Injector injector = Guice.createInjector(abstractModule);
| // Path: graceland-platform/src/main/java/io/graceland/inject/Keys.java
// public final class Keys {
//
// protected Keys() {
// // utility class
// }
//
// // ===================
// // Guice Injector Keys
// // ===================
//
// // Managed Objects
// public static final Key<Set<Managed>> ManagedObjects = Key.get(TypeLiterals.ManagedSet, Graceland.class);
// public static final Key<Set<Class<? extends Managed>>> ManagedObjectClasses = Key.get(TypeLiterals.ManagedClassSet, Graceland.class);
//
// // Jersey Components
// public static final Key<Set<Object>> JerseyComponents = Key.get(TypeLiterals.ObjectSet, Graceland.class);
//
// // Health Checks
// public static final Key<Set<HealthCheck>> HealthChecks = Key.get(TypeLiterals.HealthCheckSet, Graceland.class);
// public static final Key<Set<Class<? extends HealthCheck>>> HealthCheckClasses = Key.get(TypeLiterals.HealthCheckClassSet, Graceland.class);
//
// // Tasks
// public static final Key<Set<Task>> Tasks = Key.get(TypeLiterals.TaskSet, Graceland.class);
// public static final Key<Set<Class<? extends Task>>> TaskClasses = Key.get(TypeLiterals.TaskClassSet, Graceland.class);
//
// // Bundles
// public static final Key<Set<Bundle>> Bundles = Key.get(TypeLiterals.BundleSet, Graceland.class);
// public static final Key<Set<Class<? extends Bundle>>> BundleClasses = Key.get(TypeLiterals.BundleClassSet, Graceland.class);
//
// // Commands
// public static final Key<Set<Command>> Commands = Key.get(TypeLiterals.CommandSet, Graceland.class);
// public static final Key<Set<Class<? extends Command>>> CommandClasses = Key.get(TypeLiterals.CommandClassSet, Graceland.class);
//
// // Initializers
// public static final Key<Set<Initializer>> Initializers = Key.get(TypeLiterals.InitializerSet, Graceland.class);
// public static final Key<Set<Class<? extends Initializer>>> InitializerClasses = Key.get(TypeLiterals.InitializerClassSet, Graceland.class);
//
// // Configurators
// public static final Key<Set<Configurator>> Configurators = Key.get(TypeLiterals.ConfiguratorSet, Graceland.class);
// public static final Key<Set<Class<? extends Configurator>>> ConfiguratorClasses = Key.get(TypeLiterals.ConfiguratorClassSet, Graceland.class);
//
// // Filter Specs
// public static final Key<Set<FilterSpec>> FilterSpecs = Key.get(TypeLiterals.FilterSpecSet, Graceland.class);
// }
//
// Path: graceland-platform/src/test/java/io/graceland/testing/TestFilter.java
// public class TestFilter implements Filter {
// @Override
// public void init(FilterConfig filterConfig) throws ServletException {
// // do nothing
// }
//
// @Override
// public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
// // do nothing
// }
//
// @Override
// public void destroy() {
// // do nothing
// }
// }
// Path: graceland-platform/src/test/java/io/graceland/filter/FilterBinderTest.java
import org.junit.Test;
import com.google.common.collect.Iterables;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import io.graceland.inject.Keys;
import io.graceland.testing.TestFilter;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
@Test
public void can_add_more_than_one_patterns() {
final FilterPattern pattern1 = mock(FilterPattern.class);
final FilterPattern pattern2 = mock(FilterPattern.class);
AbstractModule abstractModule = new AbstractModule() {
@Override
protected void configure() {
FilterBinder
.forClass(binder(), TestFilter.class)
.withPriority(filterPriority)
.addPattern(pattern1)
.addPattern(pattern2)
.withName(filterName)
.bind();
}
};
verifyInjectedValue(abstractModule, filterPriority, filterName, pattern1, pattern2);
}
private void verifyInjectedValue(
AbstractModule abstractModule,
int priority,
String name,
FilterPattern... patterns) {
Injector injector = Guice.createInjector(abstractModule);
| FilterSpec filterSpec = Iterables.getFirst(injector.getInstance(Keys.FilterSpecs), null); |
graceland/graceland-core | graceland-platform/src/test/java/io/graceland/dropwizard/InitializerTest.java | // Path: graceland-platform/src/main/java/io/graceland/PlatformConfiguration.java
// public class PlatformConfiguration extends Configuration {
// }
| import org.junit.Test;
import io.dropwizard.setup.Bootstrap;
import io.graceland.PlatformConfiguration;
import static org.mockito.Mockito.mock; | package io.graceland.dropwizard;
public class InitializerTest {
private Initializer initializer = mock(Initializer.class);
@Test
public void initialize_requires_a_bootstrap() { | // Path: graceland-platform/src/main/java/io/graceland/PlatformConfiguration.java
// public class PlatformConfiguration extends Configuration {
// }
// Path: graceland-platform/src/test/java/io/graceland/dropwizard/InitializerTest.java
import org.junit.Test;
import io.dropwizard.setup.Bootstrap;
import io.graceland.PlatformConfiguration;
import static org.mockito.Mockito.mock;
package io.graceland.dropwizard;
public class InitializerTest {
private Initializer initializer = mock(Initializer.class);
@Test
public void initialize_requires_a_bootstrap() { | Bootstrap<PlatformConfiguration> bootstrap = mock(Bootstrap.class); |
graceland/graceland-core | graceland-platform/src/main/java/io/graceland/inject/InjectorWrapper.java | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
| import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.codahale.metrics.health.HealthCheck;
import com.google.common.base.Preconditions;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.inject.ConfigurationException;
import com.google.inject.Injector;
import com.google.inject.Key;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec; | builder.add(instance);
} else {
builder.add(classOrInstance);
}
}
return builder.build();
}
public ImmutableSet<HealthCheck> getHealthChecks() {
return getAndBuildInstances(Keys.HealthChecks, Keys.HealthCheckClasses);
}
public ImmutableSet<Task> getTasks() {
return getAndBuildInstances(Keys.Tasks, Keys.TaskClasses);
}
public ImmutableSet<Managed> getManaged() {
return getAndBuildInstances(Keys.ManagedObjects, Keys.ManagedObjectClasses);
}
public ImmutableSet<Bundle> getBundles() {
return getAndBuildInstances(Keys.Bundles, Keys.BundleClasses);
}
public ImmutableSet<Command> getCommands() {
return getAndBuildInstances(Keys.Commands, Keys.CommandClasses);
}
| // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
// Path: graceland-platform/src/main/java/io/graceland/inject/InjectorWrapper.java
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.codahale.metrics.health.HealthCheck;
import com.google.common.base.Preconditions;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.inject.ConfigurationException;
import com.google.inject.Injector;
import com.google.inject.Key;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec;
builder.add(instance);
} else {
builder.add(classOrInstance);
}
}
return builder.build();
}
public ImmutableSet<HealthCheck> getHealthChecks() {
return getAndBuildInstances(Keys.HealthChecks, Keys.HealthCheckClasses);
}
public ImmutableSet<Task> getTasks() {
return getAndBuildInstances(Keys.Tasks, Keys.TaskClasses);
}
public ImmutableSet<Managed> getManaged() {
return getAndBuildInstances(Keys.ManagedObjects, Keys.ManagedObjectClasses);
}
public ImmutableSet<Bundle> getBundles() {
return getAndBuildInstances(Keys.Bundles, Keys.BundleClasses);
}
public ImmutableSet<Command> getCommands() {
return getAndBuildInstances(Keys.Commands, Keys.CommandClasses);
}
| public ImmutableSet<Initializer> getInitializers() { |
graceland/graceland-core | graceland-platform/src/main/java/io/graceland/inject/InjectorWrapper.java | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
| import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.codahale.metrics.health.HealthCheck;
import com.google.common.base.Preconditions;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.inject.ConfigurationException;
import com.google.inject.Injector;
import com.google.inject.Key;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec; | }
}
return builder.build();
}
public ImmutableSet<HealthCheck> getHealthChecks() {
return getAndBuildInstances(Keys.HealthChecks, Keys.HealthCheckClasses);
}
public ImmutableSet<Task> getTasks() {
return getAndBuildInstances(Keys.Tasks, Keys.TaskClasses);
}
public ImmutableSet<Managed> getManaged() {
return getAndBuildInstances(Keys.ManagedObjects, Keys.ManagedObjectClasses);
}
public ImmutableSet<Bundle> getBundles() {
return getAndBuildInstances(Keys.Bundles, Keys.BundleClasses);
}
public ImmutableSet<Command> getCommands() {
return getAndBuildInstances(Keys.Commands, Keys.CommandClasses);
}
public ImmutableSet<Initializer> getInitializers() {
return getAndBuildInstances(Keys.Initializers, Keys.InitializerClasses);
}
| // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
// Path: graceland-platform/src/main/java/io/graceland/inject/InjectorWrapper.java
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.codahale.metrics.health.HealthCheck;
import com.google.common.base.Preconditions;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.inject.ConfigurationException;
import com.google.inject.Injector;
import com.google.inject.Key;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec;
}
}
return builder.build();
}
public ImmutableSet<HealthCheck> getHealthChecks() {
return getAndBuildInstances(Keys.HealthChecks, Keys.HealthCheckClasses);
}
public ImmutableSet<Task> getTasks() {
return getAndBuildInstances(Keys.Tasks, Keys.TaskClasses);
}
public ImmutableSet<Managed> getManaged() {
return getAndBuildInstances(Keys.ManagedObjects, Keys.ManagedObjectClasses);
}
public ImmutableSet<Bundle> getBundles() {
return getAndBuildInstances(Keys.Bundles, Keys.BundleClasses);
}
public ImmutableSet<Command> getCommands() {
return getAndBuildInstances(Keys.Commands, Keys.CommandClasses);
}
public ImmutableSet<Initializer> getInitializers() {
return getAndBuildInstances(Keys.Initializers, Keys.InitializerClasses);
}
| public ImmutableSet<Configurator> getConfigurators() { |
graceland/graceland-core | graceland-platform/src/main/java/io/graceland/inject/InjectorWrapper.java | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
| import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.codahale.metrics.health.HealthCheck;
import com.google.common.base.Preconditions;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.inject.ConfigurationException;
import com.google.inject.Injector;
import com.google.inject.Key;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec; | }
public ImmutableSet<HealthCheck> getHealthChecks() {
return getAndBuildInstances(Keys.HealthChecks, Keys.HealthCheckClasses);
}
public ImmutableSet<Task> getTasks() {
return getAndBuildInstances(Keys.Tasks, Keys.TaskClasses);
}
public ImmutableSet<Managed> getManaged() {
return getAndBuildInstances(Keys.ManagedObjects, Keys.ManagedObjectClasses);
}
public ImmutableSet<Bundle> getBundles() {
return getAndBuildInstances(Keys.Bundles, Keys.BundleClasses);
}
public ImmutableSet<Command> getCommands() {
return getAndBuildInstances(Keys.Commands, Keys.CommandClasses);
}
public ImmutableSet<Initializer> getInitializers() {
return getAndBuildInstances(Keys.Initializers, Keys.InitializerClasses);
}
public ImmutableSet<Configurator> getConfigurators() {
return getAndBuildInstances(Keys.Configurators, Keys.ConfiguratorClasses);
}
| // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
// Path: graceland-platform/src/main/java/io/graceland/inject/InjectorWrapper.java
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.codahale.metrics.health.HealthCheck;
import com.google.common.base.Preconditions;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.inject.ConfigurationException;
import com.google.inject.Injector;
import com.google.inject.Key;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec;
}
public ImmutableSet<HealthCheck> getHealthChecks() {
return getAndBuildInstances(Keys.HealthChecks, Keys.HealthCheckClasses);
}
public ImmutableSet<Task> getTasks() {
return getAndBuildInstances(Keys.Tasks, Keys.TaskClasses);
}
public ImmutableSet<Managed> getManaged() {
return getAndBuildInstances(Keys.ManagedObjects, Keys.ManagedObjectClasses);
}
public ImmutableSet<Bundle> getBundles() {
return getAndBuildInstances(Keys.Bundles, Keys.BundleClasses);
}
public ImmutableSet<Command> getCommands() {
return getAndBuildInstances(Keys.Commands, Keys.CommandClasses);
}
public ImmutableSet<Initializer> getInitializers() {
return getAndBuildInstances(Keys.Initializers, Keys.InitializerClasses);
}
public ImmutableSet<Configurator> getConfigurators() {
return getAndBuildInstances(Keys.Configurators, Keys.ConfiguratorClasses);
}
| public ImmutableList<FilterSpec> getFilterSpecs() { |
graceland/graceland-core | graceland-example/src/main/java/io/graceland/example/startingon/StartingOnCountingMachine.java | // Path: graceland-example/src/main/java/io/graceland/example/counting/Counter.java
// public class Counter {
// private final long count;
// private final DateTime timestamp;
//
// public Counter(long count, DateTime timestamp) {
// this.count = count;
// this.timestamp = timestamp;
// }
//
// public long getCount() {
// return count;
// }
//
// public DateTime getTimestamp() {
// return timestamp;
// }
// }
//
// Path: graceland-example/src/main/java/io/graceland/example/counting/CountingMachine.java
// public interface CountingMachine {
//
// void increment();
//
// void resetCount();
//
// Counter getCurrentCount();
// }
| import java.util.concurrent.atomic.AtomicLong;
import javax.inject.Inject;
import org.joda.time.DateTime;
import io.graceland.example.counting.Counter;
import io.graceland.example.counting.CountingMachine; | package io.graceland.example.startingon;
public class StartingOnCountingMachine implements CountingMachine {
private final AtomicLong count;
@Inject
StartingOnCountingMachine(StartingOnConfiguration configuration) {
// use the configuration to get the starting on count
count = new AtomicLong(configuration.getStartingOn());
}
@Override
public void increment() {
count.incrementAndGet();
}
@Override
public void resetCount() {
count.set(0);
}
@Override | // Path: graceland-example/src/main/java/io/graceland/example/counting/Counter.java
// public class Counter {
// private final long count;
// private final DateTime timestamp;
//
// public Counter(long count, DateTime timestamp) {
// this.count = count;
// this.timestamp = timestamp;
// }
//
// public long getCount() {
// return count;
// }
//
// public DateTime getTimestamp() {
// return timestamp;
// }
// }
//
// Path: graceland-example/src/main/java/io/graceland/example/counting/CountingMachine.java
// public interface CountingMachine {
//
// void increment();
//
// void resetCount();
//
// Counter getCurrentCount();
// }
// Path: graceland-example/src/main/java/io/graceland/example/startingon/StartingOnCountingMachine.java
import java.util.concurrent.atomic.AtomicLong;
import javax.inject.Inject;
import org.joda.time.DateTime;
import io.graceland.example.counting.Counter;
import io.graceland.example.counting.CountingMachine;
package io.graceland.example.startingon;
public class StartingOnCountingMachine implements CountingMachine {
private final AtomicLong count;
@Inject
StartingOnCountingMachine(StartingOnConfiguration configuration) {
// use the configuration to get the starting on count
count = new AtomicLong(configuration.getStartingOn());
}
@Override
public void increment() {
count.incrementAndGet();
}
@Override
public void resetCount() {
count.set(0);
}
@Override | public Counter getCurrentCount() { |
graceland/graceland-core | graceland-platform/src/test/java/io/graceland/application/UnknownModeExceptionTest.java | // Path: graceland-platform/src/test/java/io/graceland/testing/TestModes.java
// public enum TestModes {
// DEV,
// PROD
// }
| import org.junit.Test;
import io.graceland.testing.TestModes;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertThat; | package io.graceland.application;
public class UnknownModeExceptionTest {
private String candidate = "not-in-the-enum"; | // Path: graceland-platform/src/test/java/io/graceland/testing/TestModes.java
// public enum TestModes {
// DEV,
// PROD
// }
// Path: graceland-platform/src/test/java/io/graceland/application/UnknownModeExceptionTest.java
import org.junit.Test;
import io.graceland.testing.TestModes;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertThat;
package io.graceland.application;
public class UnknownModeExceptionTest {
private String candidate = "not-in-the-enum"; | private UnknownModeException exception = new UnknownModeException(TestModes.class, candidate); |
graceland/graceland-core | graceland-platform/src/main/java/io/graceland/inject/TypeLiterals.java | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
| import java.util.Set;
import com.codahale.metrics.health.HealthCheck;
import com.google.inject.TypeLiteral;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec; | public static final TypeLiteral<Class<? extends Task>> TaskClass = new TypeLiteral<Class<? extends Task>>() {
};
public static final TypeLiteral<Set<Task>> TaskSet = new TypeLiteral<Set<Task>>() {
};
public static final TypeLiteral<Set<Class<? extends Task>>> TaskClassSet = new TypeLiteral<Set<Class<? extends Task>>>() {
};
// ====================
// Bundle Type Literals
// ====================
public static final TypeLiteral<Class<? extends Bundle>> BundleClass = new TypeLiteral<Class<? extends Bundle>>() {
};
public static final TypeLiteral<Set<Bundle>> BundleSet = new TypeLiteral<Set<Bundle>>() {
};
public static final TypeLiteral<Set<Class<? extends Bundle>>> BundleClassSet = new TypeLiteral<Set<Class<? extends Bundle>>>() {
};
// =====================
// Command Type Literals
// =====================
public static final TypeLiteral<Class<? extends Command>> CommandClass = new TypeLiteral<Class<? extends Command>>() {
};
public static final TypeLiteral<Set<Command>> CommandSet = new TypeLiteral<Set<Command>>() {
};
public static final TypeLiteral<Set<Class<? extends Command>>> CommandClassSet = new TypeLiteral<Set<Class<? extends Command>>>() {
};
// =========================
// Initializer Type Literals
// ========================= | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
// Path: graceland-platform/src/main/java/io/graceland/inject/TypeLiterals.java
import java.util.Set;
import com.codahale.metrics.health.HealthCheck;
import com.google.inject.TypeLiteral;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec;
public static final TypeLiteral<Class<? extends Task>> TaskClass = new TypeLiteral<Class<? extends Task>>() {
};
public static final TypeLiteral<Set<Task>> TaskSet = new TypeLiteral<Set<Task>>() {
};
public static final TypeLiteral<Set<Class<? extends Task>>> TaskClassSet = new TypeLiteral<Set<Class<? extends Task>>>() {
};
// ====================
// Bundle Type Literals
// ====================
public static final TypeLiteral<Class<? extends Bundle>> BundleClass = new TypeLiteral<Class<? extends Bundle>>() {
};
public static final TypeLiteral<Set<Bundle>> BundleSet = new TypeLiteral<Set<Bundle>>() {
};
public static final TypeLiteral<Set<Class<? extends Bundle>>> BundleClassSet = new TypeLiteral<Set<Class<? extends Bundle>>>() {
};
// =====================
// Command Type Literals
// =====================
public static final TypeLiteral<Class<? extends Command>> CommandClass = new TypeLiteral<Class<? extends Command>>() {
};
public static final TypeLiteral<Set<Command>> CommandSet = new TypeLiteral<Set<Command>>() {
};
public static final TypeLiteral<Set<Class<? extends Command>>> CommandClassSet = new TypeLiteral<Set<Class<? extends Command>>>() {
};
// =========================
// Initializer Type Literals
// ========================= | public static final TypeLiteral<Class<? extends Initializer>> InitializerClass = new TypeLiteral<Class<? extends Initializer>>() { |
graceland/graceland-core | graceland-platform/src/main/java/io/graceland/inject/TypeLiterals.java | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
| import java.util.Set;
import com.codahale.metrics.health.HealthCheck;
import com.google.inject.TypeLiteral;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec; | public static final TypeLiteral<Class<? extends Bundle>> BundleClass = new TypeLiteral<Class<? extends Bundle>>() {
};
public static final TypeLiteral<Set<Bundle>> BundleSet = new TypeLiteral<Set<Bundle>>() {
};
public static final TypeLiteral<Set<Class<? extends Bundle>>> BundleClassSet = new TypeLiteral<Set<Class<? extends Bundle>>>() {
};
// =====================
// Command Type Literals
// =====================
public static final TypeLiteral<Class<? extends Command>> CommandClass = new TypeLiteral<Class<? extends Command>>() {
};
public static final TypeLiteral<Set<Command>> CommandSet = new TypeLiteral<Set<Command>>() {
};
public static final TypeLiteral<Set<Class<? extends Command>>> CommandClassSet = new TypeLiteral<Set<Class<? extends Command>>>() {
};
// =========================
// Initializer Type Literals
// =========================
public static final TypeLiteral<Class<? extends Initializer>> InitializerClass = new TypeLiteral<Class<? extends Initializer>>() {
};
public static final TypeLiteral<Set<Initializer>> InitializerSet = new TypeLiteral<Set<Initializer>>() {
};
public static final TypeLiteral<Set<Class<? extends Initializer>>> InitializerClassSet = new TypeLiteral<Set<Class<? extends Initializer>>>() {
};
// ==========================
// Configurator Type Literals
// ========================== | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
// Path: graceland-platform/src/main/java/io/graceland/inject/TypeLiterals.java
import java.util.Set;
import com.codahale.metrics.health.HealthCheck;
import com.google.inject.TypeLiteral;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec;
public static final TypeLiteral<Class<? extends Bundle>> BundleClass = new TypeLiteral<Class<? extends Bundle>>() {
};
public static final TypeLiteral<Set<Bundle>> BundleSet = new TypeLiteral<Set<Bundle>>() {
};
public static final TypeLiteral<Set<Class<? extends Bundle>>> BundleClassSet = new TypeLiteral<Set<Class<? extends Bundle>>>() {
};
// =====================
// Command Type Literals
// =====================
public static final TypeLiteral<Class<? extends Command>> CommandClass = new TypeLiteral<Class<? extends Command>>() {
};
public static final TypeLiteral<Set<Command>> CommandSet = new TypeLiteral<Set<Command>>() {
};
public static final TypeLiteral<Set<Class<? extends Command>>> CommandClassSet = new TypeLiteral<Set<Class<? extends Command>>>() {
};
// =========================
// Initializer Type Literals
// =========================
public static final TypeLiteral<Class<? extends Initializer>> InitializerClass = new TypeLiteral<Class<? extends Initializer>>() {
};
public static final TypeLiteral<Set<Initializer>> InitializerSet = new TypeLiteral<Set<Initializer>>() {
};
public static final TypeLiteral<Set<Class<? extends Initializer>>> InitializerClassSet = new TypeLiteral<Set<Class<? extends Initializer>>>() {
};
// ==========================
// Configurator Type Literals
// ========================== | public static final TypeLiteral<Class<? extends Configurator>> ConfiguratorClass = new TypeLiteral<Class<? extends Configurator>>() { |
graceland/graceland-core | graceland-platform/src/main/java/io/graceland/inject/TypeLiterals.java | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
| import java.util.Set;
import com.codahale.metrics.health.HealthCheck;
import com.google.inject.TypeLiteral;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec; | public static final TypeLiteral<Class<? extends Command>> CommandClass = new TypeLiteral<Class<? extends Command>>() {
};
public static final TypeLiteral<Set<Command>> CommandSet = new TypeLiteral<Set<Command>>() {
};
public static final TypeLiteral<Set<Class<? extends Command>>> CommandClassSet = new TypeLiteral<Set<Class<? extends Command>>>() {
};
// =========================
// Initializer Type Literals
// =========================
public static final TypeLiteral<Class<? extends Initializer>> InitializerClass = new TypeLiteral<Class<? extends Initializer>>() {
};
public static final TypeLiteral<Set<Initializer>> InitializerSet = new TypeLiteral<Set<Initializer>>() {
};
public static final TypeLiteral<Set<Class<? extends Initializer>>> InitializerClassSet = new TypeLiteral<Set<Class<? extends Initializer>>>() {
};
// ==========================
// Configurator Type Literals
// ==========================
public static final TypeLiteral<Class<? extends Configurator>> ConfiguratorClass = new TypeLiteral<Class<? extends Configurator>>() {
};
public static final TypeLiteral<Set<Configurator>> ConfiguratorSet = new TypeLiteral<Set<Configurator>>() {
};
public static final TypeLiteral<Set<Class<? extends Configurator>>> ConfiguratorClassSet = new TypeLiteral<Set<Class<? extends Configurator>>>() {
};
// ==========================
// Filter Spec Type Literals
// ========================== | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
// Path: graceland-platform/src/main/java/io/graceland/inject/TypeLiterals.java
import java.util.Set;
import com.codahale.metrics.health.HealthCheck;
import com.google.inject.TypeLiteral;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec;
public static final TypeLiteral<Class<? extends Command>> CommandClass = new TypeLiteral<Class<? extends Command>>() {
};
public static final TypeLiteral<Set<Command>> CommandSet = new TypeLiteral<Set<Command>>() {
};
public static final TypeLiteral<Set<Class<? extends Command>>> CommandClassSet = new TypeLiteral<Set<Class<? extends Command>>>() {
};
// =========================
// Initializer Type Literals
// =========================
public static final TypeLiteral<Class<? extends Initializer>> InitializerClass = new TypeLiteral<Class<? extends Initializer>>() {
};
public static final TypeLiteral<Set<Initializer>> InitializerSet = new TypeLiteral<Set<Initializer>>() {
};
public static final TypeLiteral<Set<Class<? extends Initializer>>> InitializerClassSet = new TypeLiteral<Set<Class<? extends Initializer>>>() {
};
// ==========================
// Configurator Type Literals
// ==========================
public static final TypeLiteral<Class<? extends Configurator>> ConfiguratorClass = new TypeLiteral<Class<? extends Configurator>>() {
};
public static final TypeLiteral<Set<Configurator>> ConfiguratorSet = new TypeLiteral<Set<Configurator>>() {
};
public static final TypeLiteral<Set<Class<? extends Configurator>>> ConfiguratorClassSet = new TypeLiteral<Set<Class<? extends Configurator>>>() {
};
// ==========================
// Filter Spec Type Literals
// ========================== | public static final TypeLiteral<Set<FilterSpec>> FilterSpecSet = new TypeLiteral<Set<FilterSpec>>() { |
graceland/graceland-core | graceland-example/src/main/java/io/graceland/example/simple/SimpleCountingMachine.java | // Path: graceland-example/src/main/java/io/graceland/example/counting/Counter.java
// public class Counter {
// private final long count;
// private final DateTime timestamp;
//
// public Counter(long count, DateTime timestamp) {
// this.count = count;
// this.timestamp = timestamp;
// }
//
// public long getCount() {
// return count;
// }
//
// public DateTime getTimestamp() {
// return timestamp;
// }
// }
//
// Path: graceland-example/src/main/java/io/graceland/example/counting/CountingMachine.java
// public interface CountingMachine {
//
// void increment();
//
// void resetCount();
//
// Counter getCurrentCount();
// }
| import java.util.concurrent.atomic.AtomicLong;
import org.joda.time.DateTime;
import io.graceland.example.counting.Counter;
import io.graceland.example.counting.CountingMachine; | package io.graceland.example.simple;
public class SimpleCountingMachine implements CountingMachine {
private final AtomicLong count = new AtomicLong();
@Override
public void increment() {
count.incrementAndGet();
}
@Override
public void resetCount() {
count.set(0);
}
@Override | // Path: graceland-example/src/main/java/io/graceland/example/counting/Counter.java
// public class Counter {
// private final long count;
// private final DateTime timestamp;
//
// public Counter(long count, DateTime timestamp) {
// this.count = count;
// this.timestamp = timestamp;
// }
//
// public long getCount() {
// return count;
// }
//
// public DateTime getTimestamp() {
// return timestamp;
// }
// }
//
// Path: graceland-example/src/main/java/io/graceland/example/counting/CountingMachine.java
// public interface CountingMachine {
//
// void increment();
//
// void resetCount();
//
// Counter getCurrentCount();
// }
// Path: graceland-example/src/main/java/io/graceland/example/simple/SimpleCountingMachine.java
import java.util.concurrent.atomic.AtomicLong;
import org.joda.time.DateTime;
import io.graceland.example.counting.Counter;
import io.graceland.example.counting.CountingMachine;
package io.graceland.example.simple;
public class SimpleCountingMachine implements CountingMachine {
private final AtomicLong count = new AtomicLong();
@Override
public void increment() {
count.incrementAndGet();
}
@Override
public void resetCount() {
count.set(0);
}
@Override | public Counter getCurrentCount() { |
graceland/graceland-core | graceland-platform/src/test/java/io/graceland/testing/TestConfigurator.java | // Path: graceland-platform/src/main/java/io/graceland/PlatformConfiguration.java
// public class PlatformConfiguration extends Configuration {
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
| import io.dropwizard.setup.Environment;
import io.graceland.PlatformConfiguration;
import io.graceland.dropwizard.Configurator; | package io.graceland.testing;
public class TestConfigurator implements Configurator {
@Override | // Path: graceland-platform/src/main/java/io/graceland/PlatformConfiguration.java
// public class PlatformConfiguration extends Configuration {
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
// Path: graceland-platform/src/test/java/io/graceland/testing/TestConfigurator.java
import io.dropwizard.setup.Environment;
import io.graceland.PlatformConfiguration;
import io.graceland.dropwizard.Configurator;
package io.graceland.testing;
public class TestConfigurator implements Configurator {
@Override | public void configure(PlatformConfiguration configuration, Environment environment) { |
graceland/graceland-core | graceland-platform/src/test/java/io/graceland/plugin/loaders/PluginLoaderTest.java | // Path: graceland-platform/src/main/java/io/graceland/application/Application.java
// public interface Application {
//
// /**
// * Adds the plugin to the list of plugins that will be loaded.
// *
// * @param plugin The plugin to load.
// */
// void loadPlugin(Plugin plugin);
//
// /**
// * Provides a list of loaded plugins for this application. Once requested, the list of plugins should not change.
// * <p/>
// * At least one plugin must be loaded.
// *
// * @return A list of plugins.
// */
// ImmutableList<Plugin> getPlugins();
// }
| import org.junit.Test;
import io.graceland.application.Application;
import static org.mockito.Mockito.mock; | package io.graceland.plugin.loaders;
public abstract class PluginLoaderTest<T extends PluginLoader> {
protected T pluginLoader = newPluginLoader(); | // Path: graceland-platform/src/main/java/io/graceland/application/Application.java
// public interface Application {
//
// /**
// * Adds the plugin to the list of plugins that will be loaded.
// *
// * @param plugin The plugin to load.
// */
// void loadPlugin(Plugin plugin);
//
// /**
// * Provides a list of loaded plugins for this application. Once requested, the list of plugins should not change.
// * <p/>
// * At least one plugin must be loaded.
// *
// * @return A list of plugins.
// */
// ImmutableList<Plugin> getPlugins();
// }
// Path: graceland-platform/src/test/java/io/graceland/plugin/loaders/PluginLoaderTest.java
import org.junit.Test;
import io.graceland.application.Application;
import static org.mockito.Mockito.mock;
package io.graceland.plugin.loaders;
public abstract class PluginLoaderTest<T extends PluginLoader> {
protected T pluginLoader = newPluginLoader(); | protected Application application = mock(Application.class); |
graceland/graceland-core | graceland-platform/src/test/java/io/graceland/dropwizard/ConfiguratorTest.java | // Path: graceland-platform/src/main/java/io/graceland/PlatformConfiguration.java
// public class PlatformConfiguration extends Configuration {
// }
| import org.junit.Test;
import io.dropwizard.setup.Environment;
import io.graceland.PlatformConfiguration;
import static org.mockito.Mockito.mock; | package io.graceland.dropwizard;
public class ConfiguratorTest {
private Configurator configurator = mock(Configurator.class); | // Path: graceland-platform/src/main/java/io/graceland/PlatformConfiguration.java
// public class PlatformConfiguration extends Configuration {
// }
// Path: graceland-platform/src/test/java/io/graceland/dropwizard/ConfiguratorTest.java
import org.junit.Test;
import io.dropwizard.setup.Environment;
import io.graceland.PlatformConfiguration;
import static org.mockito.Mockito.mock;
package io.graceland.dropwizard;
public class ConfiguratorTest {
private Configurator configurator = mock(Configurator.class); | private PlatformConfiguration configuration = mock(PlatformConfiguration.class); |
graceland/graceland-core | graceland-example/src/main/java/io/graceland/example/ExampleResource.java | // Path: graceland-example/src/main/java/io/graceland/example/counting/Counter.java
// public class Counter {
// private final long count;
// private final DateTime timestamp;
//
// public Counter(long count, DateTime timestamp) {
// this.count = count;
// this.timestamp = timestamp;
// }
//
// public long getCount() {
// return count;
// }
//
// public DateTime getTimestamp() {
// return timestamp;
// }
// }
//
// Path: graceland-example/src/main/java/io/graceland/example/counting/CountingMachine.java
// public interface CountingMachine {
//
// void increment();
//
// void resetCount();
//
// Counter getCurrentCount();
// }
| import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.codahale.metrics.annotation.Timed;
import io.graceland.example.counting.Counter;
import io.graceland.example.counting.CountingMachine; | package io.graceland.example;
@Path("/api/example")
public class ExampleResource {
| // Path: graceland-example/src/main/java/io/graceland/example/counting/Counter.java
// public class Counter {
// private final long count;
// private final DateTime timestamp;
//
// public Counter(long count, DateTime timestamp) {
// this.count = count;
// this.timestamp = timestamp;
// }
//
// public long getCount() {
// return count;
// }
//
// public DateTime getTimestamp() {
// return timestamp;
// }
// }
//
// Path: graceland-example/src/main/java/io/graceland/example/counting/CountingMachine.java
// public interface CountingMachine {
//
// void increment();
//
// void resetCount();
//
// Counter getCurrentCount();
// }
// Path: graceland-example/src/main/java/io/graceland/example/ExampleResource.java
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.codahale.metrics.annotation.Timed;
import io.graceland.example.counting.Counter;
import io.graceland.example.counting.CountingMachine;
package io.graceland.example;
@Path("/api/example")
public class ExampleResource {
| private final CountingMachine countingMachine; |
graceland/graceland-core | graceland-example/src/main/java/io/graceland/example/ExampleResource.java | // Path: graceland-example/src/main/java/io/graceland/example/counting/Counter.java
// public class Counter {
// private final long count;
// private final DateTime timestamp;
//
// public Counter(long count, DateTime timestamp) {
// this.count = count;
// this.timestamp = timestamp;
// }
//
// public long getCount() {
// return count;
// }
//
// public DateTime getTimestamp() {
// return timestamp;
// }
// }
//
// Path: graceland-example/src/main/java/io/graceland/example/counting/CountingMachine.java
// public interface CountingMachine {
//
// void increment();
//
// void resetCount();
//
// Counter getCurrentCount();
// }
| import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.codahale.metrics.annotation.Timed;
import io.graceland.example.counting.Counter;
import io.graceland.example.counting.CountingMachine; | package io.graceland.example;
@Path("/api/example")
public class ExampleResource {
private final CountingMachine countingMachine;
@Inject
ExampleResource(CountingMachine countingMachine) {
this.countingMachine = countingMachine;
}
@Timed
@GET
@Produces(MediaType.APPLICATION_JSON) | // Path: graceland-example/src/main/java/io/graceland/example/counting/Counter.java
// public class Counter {
// private final long count;
// private final DateTime timestamp;
//
// public Counter(long count, DateTime timestamp) {
// this.count = count;
// this.timestamp = timestamp;
// }
//
// public long getCount() {
// return count;
// }
//
// public DateTime getTimestamp() {
// return timestamp;
// }
// }
//
// Path: graceland-example/src/main/java/io/graceland/example/counting/CountingMachine.java
// public interface CountingMachine {
//
// void increment();
//
// void resetCount();
//
// Counter getCurrentCount();
// }
// Path: graceland-example/src/main/java/io/graceland/example/ExampleResource.java
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.codahale.metrics.annotation.Timed;
import io.graceland.example.counting.Counter;
import io.graceland.example.counting.CountingMachine;
package io.graceland.example;
@Path("/api/example")
public class ExampleResource {
private final CountingMachine countingMachine;
@Inject
ExampleResource(CountingMachine countingMachine) {
this.countingMachine = countingMachine;
}
@Timed
@GET
@Produces(MediaType.APPLICATION_JSON) | public Counter getCurrentCount() { |
graceland/graceland-core | graceland-platform/src/test/java/io/graceland/testing/TestInitializer.java | // Path: graceland-platform/src/main/java/io/graceland/PlatformConfiguration.java
// public class PlatformConfiguration extends Configuration {
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
| import io.dropwizard.setup.Bootstrap;
import io.graceland.PlatformConfiguration;
import io.graceland.dropwizard.Initializer; | package io.graceland.testing;
public class TestInitializer implements Initializer {
@Override | // Path: graceland-platform/src/main/java/io/graceland/PlatformConfiguration.java
// public class PlatformConfiguration extends Configuration {
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
// Path: graceland-platform/src/test/java/io/graceland/testing/TestInitializer.java
import io.dropwizard.setup.Bootstrap;
import io.graceland.PlatformConfiguration;
import io.graceland.dropwizard.Initializer;
package io.graceland.testing;
public class TestInitializer implements Initializer {
@Override | public void initialize(Bootstrap<PlatformConfiguration> bootstrap) { |
graceland/graceland-core | graceland-platform/src/main/java/io/graceland/inject/Keys.java | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
| import java.util.Set;
import com.codahale.metrics.health.HealthCheck;
import com.google.inject.Key;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec; | package io.graceland.inject;
/**
* A utility class that defines helpful classes and static variables. They are used when interacting with Guice's
* {@link com.google.inject.Injector}.
*/
public final class Keys {
protected Keys() {
// utility class
}
// ===================
// Guice Injector Keys
// ===================
// Managed Objects
public static final Key<Set<Managed>> ManagedObjects = Key.get(TypeLiterals.ManagedSet, Graceland.class);
public static final Key<Set<Class<? extends Managed>>> ManagedObjectClasses = Key.get(TypeLiterals.ManagedClassSet, Graceland.class);
// Jersey Components
public static final Key<Set<Object>> JerseyComponents = Key.get(TypeLiterals.ObjectSet, Graceland.class);
// Health Checks
public static final Key<Set<HealthCheck>> HealthChecks = Key.get(TypeLiterals.HealthCheckSet, Graceland.class);
public static final Key<Set<Class<? extends HealthCheck>>> HealthCheckClasses = Key.get(TypeLiterals.HealthCheckClassSet, Graceland.class);
// Tasks
public static final Key<Set<Task>> Tasks = Key.get(TypeLiterals.TaskSet, Graceland.class);
public static final Key<Set<Class<? extends Task>>> TaskClasses = Key.get(TypeLiterals.TaskClassSet, Graceland.class);
// Bundles
public static final Key<Set<Bundle>> Bundles = Key.get(TypeLiterals.BundleSet, Graceland.class);
public static final Key<Set<Class<? extends Bundle>>> BundleClasses = Key.get(TypeLiterals.BundleClassSet, Graceland.class);
// Commands
public static final Key<Set<Command>> Commands = Key.get(TypeLiterals.CommandSet, Graceland.class);
public static final Key<Set<Class<? extends Command>>> CommandClasses = Key.get(TypeLiterals.CommandClassSet, Graceland.class);
// Initializers | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
// Path: graceland-platform/src/main/java/io/graceland/inject/Keys.java
import java.util.Set;
import com.codahale.metrics.health.HealthCheck;
import com.google.inject.Key;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec;
package io.graceland.inject;
/**
* A utility class that defines helpful classes and static variables. They are used when interacting with Guice's
* {@link com.google.inject.Injector}.
*/
public final class Keys {
protected Keys() {
// utility class
}
// ===================
// Guice Injector Keys
// ===================
// Managed Objects
public static final Key<Set<Managed>> ManagedObjects = Key.get(TypeLiterals.ManagedSet, Graceland.class);
public static final Key<Set<Class<? extends Managed>>> ManagedObjectClasses = Key.get(TypeLiterals.ManagedClassSet, Graceland.class);
// Jersey Components
public static final Key<Set<Object>> JerseyComponents = Key.get(TypeLiterals.ObjectSet, Graceland.class);
// Health Checks
public static final Key<Set<HealthCheck>> HealthChecks = Key.get(TypeLiterals.HealthCheckSet, Graceland.class);
public static final Key<Set<Class<? extends HealthCheck>>> HealthCheckClasses = Key.get(TypeLiterals.HealthCheckClassSet, Graceland.class);
// Tasks
public static final Key<Set<Task>> Tasks = Key.get(TypeLiterals.TaskSet, Graceland.class);
public static final Key<Set<Class<? extends Task>>> TaskClasses = Key.get(TypeLiterals.TaskClassSet, Graceland.class);
// Bundles
public static final Key<Set<Bundle>> Bundles = Key.get(TypeLiterals.BundleSet, Graceland.class);
public static final Key<Set<Class<? extends Bundle>>> BundleClasses = Key.get(TypeLiterals.BundleClassSet, Graceland.class);
// Commands
public static final Key<Set<Command>> Commands = Key.get(TypeLiterals.CommandSet, Graceland.class);
public static final Key<Set<Class<? extends Command>>> CommandClasses = Key.get(TypeLiterals.CommandClassSet, Graceland.class);
// Initializers | public static final Key<Set<Initializer>> Initializers = Key.get(TypeLiterals.InitializerSet, Graceland.class); |
graceland/graceland-core | graceland-platform/src/main/java/io/graceland/inject/Keys.java | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
| import java.util.Set;
import com.codahale.metrics.health.HealthCheck;
import com.google.inject.Key;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec; | package io.graceland.inject;
/**
* A utility class that defines helpful classes and static variables. They are used when interacting with Guice's
* {@link com.google.inject.Injector}.
*/
public final class Keys {
protected Keys() {
// utility class
}
// ===================
// Guice Injector Keys
// ===================
// Managed Objects
public static final Key<Set<Managed>> ManagedObjects = Key.get(TypeLiterals.ManagedSet, Graceland.class);
public static final Key<Set<Class<? extends Managed>>> ManagedObjectClasses = Key.get(TypeLiterals.ManagedClassSet, Graceland.class);
// Jersey Components
public static final Key<Set<Object>> JerseyComponents = Key.get(TypeLiterals.ObjectSet, Graceland.class);
// Health Checks
public static final Key<Set<HealthCheck>> HealthChecks = Key.get(TypeLiterals.HealthCheckSet, Graceland.class);
public static final Key<Set<Class<? extends HealthCheck>>> HealthCheckClasses = Key.get(TypeLiterals.HealthCheckClassSet, Graceland.class);
// Tasks
public static final Key<Set<Task>> Tasks = Key.get(TypeLiterals.TaskSet, Graceland.class);
public static final Key<Set<Class<? extends Task>>> TaskClasses = Key.get(TypeLiterals.TaskClassSet, Graceland.class);
// Bundles
public static final Key<Set<Bundle>> Bundles = Key.get(TypeLiterals.BundleSet, Graceland.class);
public static final Key<Set<Class<? extends Bundle>>> BundleClasses = Key.get(TypeLiterals.BundleClassSet, Graceland.class);
// Commands
public static final Key<Set<Command>> Commands = Key.get(TypeLiterals.CommandSet, Graceland.class);
public static final Key<Set<Class<? extends Command>>> CommandClasses = Key.get(TypeLiterals.CommandClassSet, Graceland.class);
// Initializers
public static final Key<Set<Initializer>> Initializers = Key.get(TypeLiterals.InitializerSet, Graceland.class);
public static final Key<Set<Class<? extends Initializer>>> InitializerClasses = Key.get(TypeLiterals.InitializerClassSet, Graceland.class);
// Configurators | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
// Path: graceland-platform/src/main/java/io/graceland/inject/Keys.java
import java.util.Set;
import com.codahale.metrics.health.HealthCheck;
import com.google.inject.Key;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec;
package io.graceland.inject;
/**
* A utility class that defines helpful classes and static variables. They are used when interacting with Guice's
* {@link com.google.inject.Injector}.
*/
public final class Keys {
protected Keys() {
// utility class
}
// ===================
// Guice Injector Keys
// ===================
// Managed Objects
public static final Key<Set<Managed>> ManagedObjects = Key.get(TypeLiterals.ManagedSet, Graceland.class);
public static final Key<Set<Class<? extends Managed>>> ManagedObjectClasses = Key.get(TypeLiterals.ManagedClassSet, Graceland.class);
// Jersey Components
public static final Key<Set<Object>> JerseyComponents = Key.get(TypeLiterals.ObjectSet, Graceland.class);
// Health Checks
public static final Key<Set<HealthCheck>> HealthChecks = Key.get(TypeLiterals.HealthCheckSet, Graceland.class);
public static final Key<Set<Class<? extends HealthCheck>>> HealthCheckClasses = Key.get(TypeLiterals.HealthCheckClassSet, Graceland.class);
// Tasks
public static final Key<Set<Task>> Tasks = Key.get(TypeLiterals.TaskSet, Graceland.class);
public static final Key<Set<Class<? extends Task>>> TaskClasses = Key.get(TypeLiterals.TaskClassSet, Graceland.class);
// Bundles
public static final Key<Set<Bundle>> Bundles = Key.get(TypeLiterals.BundleSet, Graceland.class);
public static final Key<Set<Class<? extends Bundle>>> BundleClasses = Key.get(TypeLiterals.BundleClassSet, Graceland.class);
// Commands
public static final Key<Set<Command>> Commands = Key.get(TypeLiterals.CommandSet, Graceland.class);
public static final Key<Set<Class<? extends Command>>> CommandClasses = Key.get(TypeLiterals.CommandClassSet, Graceland.class);
// Initializers
public static final Key<Set<Initializer>> Initializers = Key.get(TypeLiterals.InitializerSet, Graceland.class);
public static final Key<Set<Class<? extends Initializer>>> InitializerClasses = Key.get(TypeLiterals.InitializerClassSet, Graceland.class);
// Configurators | public static final Key<Set<Configurator>> Configurators = Key.get(TypeLiterals.ConfiguratorSet, Graceland.class); |
graceland/graceland-core | graceland-platform/src/main/java/io/graceland/inject/Keys.java | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
| import java.util.Set;
import com.codahale.metrics.health.HealthCheck;
import com.google.inject.Key;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec; | package io.graceland.inject;
/**
* A utility class that defines helpful classes and static variables. They are used when interacting with Guice's
* {@link com.google.inject.Injector}.
*/
public final class Keys {
protected Keys() {
// utility class
}
// ===================
// Guice Injector Keys
// ===================
// Managed Objects
public static final Key<Set<Managed>> ManagedObjects = Key.get(TypeLiterals.ManagedSet, Graceland.class);
public static final Key<Set<Class<? extends Managed>>> ManagedObjectClasses = Key.get(TypeLiterals.ManagedClassSet, Graceland.class);
// Jersey Components
public static final Key<Set<Object>> JerseyComponents = Key.get(TypeLiterals.ObjectSet, Graceland.class);
// Health Checks
public static final Key<Set<HealthCheck>> HealthChecks = Key.get(TypeLiterals.HealthCheckSet, Graceland.class);
public static final Key<Set<Class<? extends HealthCheck>>> HealthCheckClasses = Key.get(TypeLiterals.HealthCheckClassSet, Graceland.class);
// Tasks
public static final Key<Set<Task>> Tasks = Key.get(TypeLiterals.TaskSet, Graceland.class);
public static final Key<Set<Class<? extends Task>>> TaskClasses = Key.get(TypeLiterals.TaskClassSet, Graceland.class);
// Bundles
public static final Key<Set<Bundle>> Bundles = Key.get(TypeLiterals.BundleSet, Graceland.class);
public static final Key<Set<Class<? extends Bundle>>> BundleClasses = Key.get(TypeLiterals.BundleClassSet, Graceland.class);
// Commands
public static final Key<Set<Command>> Commands = Key.get(TypeLiterals.CommandSet, Graceland.class);
public static final Key<Set<Class<? extends Command>>> CommandClasses = Key.get(TypeLiterals.CommandClassSet, Graceland.class);
// Initializers
public static final Key<Set<Initializer>> Initializers = Key.get(TypeLiterals.InitializerSet, Graceland.class);
public static final Key<Set<Class<? extends Initializer>>> InitializerClasses = Key.get(TypeLiterals.InitializerClassSet, Graceland.class);
// Configurators
public static final Key<Set<Configurator>> Configurators = Key.get(TypeLiterals.ConfiguratorSet, Graceland.class);
public static final Key<Set<Class<? extends Configurator>>> ConfiguratorClasses = Key.get(TypeLiterals.ConfiguratorClassSet, Graceland.class);
// Filter Specs | // Path: graceland-platform/src/main/java/io/graceland/dropwizard/Configurator.java
// public interface Configurator {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#run(io.dropwizard.Configuration, io.dropwizard.setup.Environment)}
// * method.
// *
// * @param configuration Provided by Dropwizard.
// * @param environment Provided by Dropwizard.
// */
// void configure(PlatformConfiguration configuration, Environment environment);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/dropwizard/Initializer.java
// public interface Initializer {
//
// /**
// * The method that will be called during the Dropwizard's {@link io.dropwizard.Application#initialize(io.dropwizard.setup.Bootstrap)}
// * method.
// *
// * @param bootstrap Provided by Dropwizard.
// */
// void initialize(Bootstrap<PlatformConfiguration> bootstrap);
// }
//
// Path: graceland-platform/src/main/java/io/graceland/filter/FilterSpec.java
// public class FilterSpec {
// public static final Comparator<FilterSpec> PRIORITY_COMPARATOR = new Comparator<FilterSpec>() {
// @Override
// public int compare(FilterSpec o1, FilterSpec o2) {
// return o1.getPriority() - o2.getPriority();
// }
// };
//
// private final Provider<? extends Filter> filterProvider;
// private final int priority;
// private final String name;
// private final ImmutableList<FilterPattern> patterns;
//
// FilterSpec(
// Provider<? extends Filter> filterProvider,
// int priority,
// String name,
// ImmutableList<FilterPattern> patterns) {
//
// this.filterProvider = Preconditions.checkNotNull(filterProvider, "Filter Provider cannot be null.");
// this.priority = Preconditions.checkNotNull(priority, "Priority cannot be null.");
// this.name = Preconditions.checkNotNull(name, "Name cannot be null.");
// this.patterns = Preconditions.checkNotNull(patterns, "Filter Patterns cannot be null.");
// }
//
// public Filter getFilter() {
// return filterProvider.get();
// }
//
// /**
// * The priority is used to determine the order of the filters added to the {@link io.dropwizard.setup.Environment}.
// *
// * @return The filter's priority.
// */
// public int getPriority() {
// return priority;
// }
//
// public String getName() {
// return name;
// }
//
// public ImmutableList<FilterPattern> getPatterns() {
// return patterns;
// }
// }
// Path: graceland-platform/src/main/java/io/graceland/inject/Keys.java
import java.util.Set;
import com.codahale.metrics.health.HealthCheck;
import com.google.inject.Key;
import io.dropwizard.Bundle;
import io.dropwizard.cli.Command;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.servlets.tasks.Task;
import io.graceland.dropwizard.Configurator;
import io.graceland.dropwizard.Initializer;
import io.graceland.filter.FilterSpec;
package io.graceland.inject;
/**
* A utility class that defines helpful classes and static variables. They are used when interacting with Guice's
* {@link com.google.inject.Injector}.
*/
public final class Keys {
protected Keys() {
// utility class
}
// ===================
// Guice Injector Keys
// ===================
// Managed Objects
public static final Key<Set<Managed>> ManagedObjects = Key.get(TypeLiterals.ManagedSet, Graceland.class);
public static final Key<Set<Class<? extends Managed>>> ManagedObjectClasses = Key.get(TypeLiterals.ManagedClassSet, Graceland.class);
// Jersey Components
public static final Key<Set<Object>> JerseyComponents = Key.get(TypeLiterals.ObjectSet, Graceland.class);
// Health Checks
public static final Key<Set<HealthCheck>> HealthChecks = Key.get(TypeLiterals.HealthCheckSet, Graceland.class);
public static final Key<Set<Class<? extends HealthCheck>>> HealthCheckClasses = Key.get(TypeLiterals.HealthCheckClassSet, Graceland.class);
// Tasks
public static final Key<Set<Task>> Tasks = Key.get(TypeLiterals.TaskSet, Graceland.class);
public static final Key<Set<Class<? extends Task>>> TaskClasses = Key.get(TypeLiterals.TaskClassSet, Graceland.class);
// Bundles
public static final Key<Set<Bundle>> Bundles = Key.get(TypeLiterals.BundleSet, Graceland.class);
public static final Key<Set<Class<? extends Bundle>>> BundleClasses = Key.get(TypeLiterals.BundleClassSet, Graceland.class);
// Commands
public static final Key<Set<Command>> Commands = Key.get(TypeLiterals.CommandSet, Graceland.class);
public static final Key<Set<Class<? extends Command>>> CommandClasses = Key.get(TypeLiterals.CommandClassSet, Graceland.class);
// Initializers
public static final Key<Set<Initializer>> Initializers = Key.get(TypeLiterals.InitializerSet, Graceland.class);
public static final Key<Set<Class<? extends Initializer>>> InitializerClasses = Key.get(TypeLiterals.InitializerClassSet, Graceland.class);
// Configurators
public static final Key<Set<Configurator>> Configurators = Key.get(TypeLiterals.ConfiguratorSet, Graceland.class);
public static final Key<Set<Class<? extends Configurator>>> ConfiguratorClasses = Key.get(TypeLiterals.ConfiguratorClassSet, Graceland.class);
// Filter Specs | public static final Key<Set<FilterSpec>> FilterSpecs = Key.get(TypeLiterals.FilterSpecSet, Graceland.class); |
graceland/graceland-core | graceland-platform/src/test/java/io/graceland/application/ApplicationTest.java | // Path: graceland-platform/src/main/java/io/graceland/plugin/Plugin.java
// public interface Plugin extends Module {
// }
| import java.util.List;
import org.junit.Test;
import com.google.common.collect.ImmutableList;
import io.graceland.plugin.Plugin;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock; | package io.graceland.application;
public abstract class ApplicationTest {
protected Application application = newApplication();
protected abstract Application newApplication();
@Test
public void getPlugins_stay_the_same() { | // Path: graceland-platform/src/main/java/io/graceland/plugin/Plugin.java
// public interface Plugin extends Module {
// }
// Path: graceland-platform/src/test/java/io/graceland/application/ApplicationTest.java
import java.util.List;
import org.junit.Test;
import com.google.common.collect.ImmutableList;
import io.graceland.plugin.Plugin;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
package io.graceland.application;
public abstract class ApplicationTest {
protected Application application = newApplication();
protected abstract Application newApplication();
@Test
public void getPlugins_stay_the_same() { | application.loadPlugin(mock(Plugin.class)); |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/demo/XRollMinusAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
| import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base; | package in.tombo.kashiki.keybind.demo;
public class XRollMinusAction implements Action {
@Override
public String name() {
return "x-roll-minus";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/demo/XRollMinusAction.java
import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base;
package in.tombo.kashiki.keybind.demo;
public class XRollMinusAction implements Action {
@Override
public String name() {
return "x-roll-minus";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/demo/XRollMinusAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
| import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base; | package in.tombo.kashiki.keybind.demo;
public class XRollMinusAction implements Action {
@Override
public String name() {
return "x-roll-minus";
}
@Override
public void execute(Editor editor, String... args) { | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/demo/XRollMinusAction.java
import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base;
package in.tombo.kashiki.keybind.demo;
public class XRollMinusAction implements Action {
@Override
public String name() {
return "x-roll-minus";
}
@Override
public void execute(Editor editor, String... args) { | List<Base> drawables = editor.getDrawables(); |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/MarkAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class MarkAction implements Action {
@Override
public String name() {
return "mark";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/MarkAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class MarkAction implements Action {
@Override
public String name() {
return "mark";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/FullScreenAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class FullScreenAction implements Action {
@Override
public String name() {
return "full-screen";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/FullScreenAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class FullScreenAction implements Action {
@Override
public String name() {
return "full-screen";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/demo/ZRollPlusAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
| import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base; | package in.tombo.kashiki.keybind.demo;
public class ZRollPlusAction implements Action {
@Override
public String name() {
return "z-roll-plus";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/demo/ZRollPlusAction.java
import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base;
package in.tombo.kashiki.keybind.demo;
public class ZRollPlusAction implements Action {
@Override
public String name() {
return "z-roll-plus";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/demo/ZRollPlusAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
| import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base; | package in.tombo.kashiki.keybind.demo;
public class ZRollPlusAction implements Action {
@Override
public String name() {
return "z-roll-plus";
}
@Override
public void execute(Editor editor, String... args) { | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/demo/ZRollPlusAction.java
import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base;
package in.tombo.kashiki.keybind.demo;
public class ZRollPlusAction implements Action {
@Override
public String name() {
return "z-roll-plus";
}
@Override
public void execute(Editor editor, String... args) { | List<Base> drawables = editor.getDrawables(); |
mitoma/kashiki | src/main/java/in/tombo/kashiki/view/CharView.java | // Path: src/main/java/in/tombo/kashiki/buffer/BufferChar.java
// public class BufferChar implements Comparable<BufferChar> {
//
// private String c;
// private int row;
// private int col;
// private BufferCharObserver observer = new BufferCharObserver();
//
// public BufferChar(String c, int row, int col) {
// this.c = c;
// this.row = row;
// this.col = col;
// }
//
// public void addListener(BufferCharListener listener) {
// observer.addListener(listener);
// }
//
// public void updatePosition(int row, int col) {
// this.row = row;
// this.col = col;
// observer.update(this);
// }
//
// public String getChar() {
// return c;
// }
//
// public int getRow() {
// return row;
// }
//
// public int getCol() {
// return col;
// }
//
// @Override
// public int compareTo(BufferChar o) {
// int rowCompare = Integer.compare(row, o.row);
// if (rowCompare != 0) {
// return rowCompare;
// }
// return Integer.compare(col, o.col);
// }
// }
//
// Path: src/main/java/in/tombo/kashiki/buffer/BufferCharListener.java
// public interface BufferCharListener {
//
// public void update(BufferChar bc);
// }
| import in.tombo.kashiki.buffer.BufferChar;
import in.tombo.kashiki.buffer.BufferCharListener;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.util.texture.Texture; | package in.tombo.kashiki.view;
public class CharView extends Base implements BufferCharListener, Comparable<CharView> {
private TextureProvider textureProvider; | // Path: src/main/java/in/tombo/kashiki/buffer/BufferChar.java
// public class BufferChar implements Comparable<BufferChar> {
//
// private String c;
// private int row;
// private int col;
// private BufferCharObserver observer = new BufferCharObserver();
//
// public BufferChar(String c, int row, int col) {
// this.c = c;
// this.row = row;
// this.col = col;
// }
//
// public void addListener(BufferCharListener listener) {
// observer.addListener(listener);
// }
//
// public void updatePosition(int row, int col) {
// this.row = row;
// this.col = col;
// observer.update(this);
// }
//
// public String getChar() {
// return c;
// }
//
// public int getRow() {
// return row;
// }
//
// public int getCol() {
// return col;
// }
//
// @Override
// public int compareTo(BufferChar o) {
// int rowCompare = Integer.compare(row, o.row);
// if (rowCompare != 0) {
// return rowCompare;
// }
// return Integer.compare(col, o.col);
// }
// }
//
// Path: src/main/java/in/tombo/kashiki/buffer/BufferCharListener.java
// public interface BufferCharListener {
//
// public void update(BufferChar bc);
// }
// Path: src/main/java/in/tombo/kashiki/view/CharView.java
import in.tombo.kashiki.buffer.BufferChar;
import in.tombo.kashiki.buffer.BufferCharListener;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.util.texture.Texture;
package in.tombo.kashiki.view;
public class CharView extends Base implements BufferCharListener, Comparable<CharView> {
private TextureProvider textureProvider; | private BufferChar bufferChar; |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/LastAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class LastAction implements Action {
@Override
public String name() {
return "last";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/LastAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class LastAction implements Action {
@Override
public String name() {
return "last";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/PreviousAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class PreviousAction implements Action {
@Override
public String name() {
return "previous";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/PreviousAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class PreviousAction implements Action {
@Override
public String name() {
return "previous";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/CopyAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class CopyAction implements Action {
@Override
public String name() {
return "copy";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/CopyAction.java
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class CopyAction implements Action {
@Override
public String name() {
return "copy";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/view/CaretView.java | // Path: src/main/java/in/tombo/kashiki/buffer/Caret.java
// public class Caret implements Comparable<Caret> {
// private int col = 0;
// private int row = 0;
//
// public Caret(int row, int col) {
// this.row = row;
// this.col = col;
// }
//
// @Override
// public int compareTo(Caret o) {
// int rowCompare = Integer.compare(this.row, o.row);
// if (rowCompare == 0) {
// return Integer.compare(this.col, o.col);
// } else {
// return rowCompare;
// }
// }
//
// @Override
// public boolean equals(Object o) {
// return compareTo((Caret) o) == 0;
// }
//
// @Override
// public String toString() {
// return "[row:" + row + ", col:" + col + "]";
// }
//
// public void incCol(int gain) {
// col += gain;
// }
//
// public void incRow(int gain) {
// row += gain;
// }
//
// public void decCol(int gain) {
// incCol(-gain);
// }
//
// public void decRow(int gain) {
// incRow(-gain);
// }
//
// public int getCol() {
// return col;
// }
//
// public void setCol(int col) {
// this.col = col;
// }
//
// public int getRow() {
// return row;
// }
//
// public void setRow(int row) {
// this.row = row;
// }
// }
| import in.tombo.kashiki.buffer.Caret;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.util.texture.Texture; | package in.tombo.kashiki.view;
public class CaretView extends Base {
private TextureProvider textureProvider;
private SmoothValue col = getPosition().getX();
private SmoothValue row = getPosition().getY(); | // Path: src/main/java/in/tombo/kashiki/buffer/Caret.java
// public class Caret implements Comparable<Caret> {
// private int col = 0;
// private int row = 0;
//
// public Caret(int row, int col) {
// this.row = row;
// this.col = col;
// }
//
// @Override
// public int compareTo(Caret o) {
// int rowCompare = Integer.compare(this.row, o.row);
// if (rowCompare == 0) {
// return Integer.compare(this.col, o.col);
// } else {
// return rowCompare;
// }
// }
//
// @Override
// public boolean equals(Object o) {
// return compareTo((Caret) o) == 0;
// }
//
// @Override
// public String toString() {
// return "[row:" + row + ", col:" + col + "]";
// }
//
// public void incCol(int gain) {
// col += gain;
// }
//
// public void incRow(int gain) {
// row += gain;
// }
//
// public void decCol(int gain) {
// incCol(-gain);
// }
//
// public void decRow(int gain) {
// incRow(-gain);
// }
//
// public int getCol() {
// return col;
// }
//
// public void setCol(int col) {
// this.col = col;
// }
//
// public int getRow() {
// return row;
// }
//
// public void setRow(int row) {
// this.row = row;
// }
// }
// Path: src/main/java/in/tombo/kashiki/view/CaretView.java
import in.tombo.kashiki.buffer.Caret;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.util.texture.Texture;
package in.tombo.kashiki.view;
public class CaretView extends Base {
private TextureProvider textureProvider;
private SmoothValue col = getPosition().getX();
private SmoothValue row = getPosition().getY(); | private Caret caret; |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/NextAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class NextAction implements Action {
@Override
public String name() {
return "next";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/NextAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class NextAction implements Action {
@Override
public String name() {
return "next";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/EmacsKeyListener.java | // Path: src/main/java/in/tombo/kashiki/keybind/SupportKey.java
// public enum SupportKey {
//
// CTRL_ALT_SHIFT, CTRL_ALT, CTRL_SHIFT, ALT_SHIFT, CTRL, ALT, SHIFT, NONE
//
// }
//
// Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
| import static in.tombo.kashiki.keybind.SupportKey.*;
import static java.awt.event.KeyEvent.*;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import in.tombo.kashiki.Editor; | CODE_MAPPING.put("insert", VK_INSERT);
CODE_MAPPING.put("delete", VK_DELETE);
CODE_MAPPING.put("home", VK_HOME);
CODE_MAPPING.put("end", VK_END);
CODE_MAPPING.put("pageup", VK_PAGE_UP);
CODE_MAPPING.put("pagedown", VK_DELETE);
CODE_MAPPING.put("space", VK_SPACE);
CODE_MAPPING.put("tab", VK_TAB);
CODE_MAPPING.put("enter", VK_ENTER);
CODE_MAPPING.put("up", VK_UP);
CODE_MAPPING.put("down", VK_DOWN);
CODE_MAPPING.put("left", VK_LEFT);
CODE_MAPPING.put("right", VK_RIGHT);
// function keys
CODE_MAPPING.put("f1", VK_F1);
CODE_MAPPING.put("f2", VK_F2);
CODE_MAPPING.put("f3", VK_F3);
CODE_MAPPING.put("f4", VK_F4);
CODE_MAPPING.put("f5", VK_F5);
CODE_MAPPING.put("f6", VK_F6);
CODE_MAPPING.put("f7", VK_F7);
CODE_MAPPING.put("f8", VK_F8);
CODE_MAPPING.put("f9", VK_F9);
CODE_MAPPING.put("f10", VK_F10);
CODE_MAPPING.put("f11", VK_F11);
CODE_MAPPING.put("f12", VK_F12);
}
| // Path: src/main/java/in/tombo/kashiki/keybind/SupportKey.java
// public enum SupportKey {
//
// CTRL_ALT_SHIFT, CTRL_ALT, CTRL_SHIFT, ALT_SHIFT, CTRL, ALT, SHIFT, NONE
//
// }
//
// Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/EmacsKeyListener.java
import static in.tombo.kashiki.keybind.SupportKey.*;
import static java.awt.event.KeyEvent.*;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import in.tombo.kashiki.Editor;
CODE_MAPPING.put("insert", VK_INSERT);
CODE_MAPPING.put("delete", VK_DELETE);
CODE_MAPPING.put("home", VK_HOME);
CODE_MAPPING.put("end", VK_END);
CODE_MAPPING.put("pageup", VK_PAGE_UP);
CODE_MAPPING.put("pagedown", VK_DELETE);
CODE_MAPPING.put("space", VK_SPACE);
CODE_MAPPING.put("tab", VK_TAB);
CODE_MAPPING.put("enter", VK_ENTER);
CODE_MAPPING.put("up", VK_UP);
CODE_MAPPING.put("down", VK_DOWN);
CODE_MAPPING.put("left", VK_LEFT);
CODE_MAPPING.put("right", VK_RIGHT);
// function keys
CODE_MAPPING.put("f1", VK_F1);
CODE_MAPPING.put("f2", VK_F2);
CODE_MAPPING.put("f3", VK_F3);
CODE_MAPPING.put("f4", VK_F4);
CODE_MAPPING.put("f5", VK_F5);
CODE_MAPPING.put("f6", VK_F6);
CODE_MAPPING.put("f7", VK_F7);
CODE_MAPPING.put("f8", VK_F8);
CODE_MAPPING.put("f9", VK_F9);
CODE_MAPPING.put("f10", VK_F10);
CODE_MAPPING.put("f11", VK_F11);
CODE_MAPPING.put("f12", VK_F12);
}
| private final Editor editor; |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/EmacsKeyListener.java | // Path: src/main/java/in/tombo/kashiki/keybind/SupportKey.java
// public enum SupportKey {
//
// CTRL_ALT_SHIFT, CTRL_ALT, CTRL_SHIFT, ALT_SHIFT, CTRL, ALT, SHIFT, NONE
//
// }
//
// Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
| import static in.tombo.kashiki.keybind.SupportKey.*;
import static java.awt.event.KeyEvent.*;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import in.tombo.kashiki.Editor; | keybinds.put(strokes, action);
}
private Stroke getStroke(String key) {
Matcher m = ACTION_PATTERN.matcher(key);
if (!m.find()) {
throw new RuntimeException("invalid config.");
}
String actionString = m.group(1);
int code = CODE_MAPPING.get(actionString);
if (key.startsWith("C-A-S-")) {
return new Stroke(CTRL_ALT_SHIFT, code);
} else if (key.startsWith("C-A-")) {
return new Stroke(CTRL_ALT, code);
} else if (key.startsWith("C-S-")) {
return new Stroke(CTRL_SHIFT, code);
} else if (key.startsWith("A-S-")) {
return new Stroke(ALT_SHIFT, code);
} else if (key.startsWith("C-")) {
return new Stroke(CTRL, code);
} else if (key.startsWith("A-")) {
return new Stroke(ALT, code);
} else if (key.startsWith("S-")) {
return new Stroke(SHIFT, code);
} else {
return new Stroke(NONE, code);
}
}
@Override | // Path: src/main/java/in/tombo/kashiki/keybind/SupportKey.java
// public enum SupportKey {
//
// CTRL_ALT_SHIFT, CTRL_ALT, CTRL_SHIFT, ALT_SHIFT, CTRL, ALT, SHIFT, NONE
//
// }
//
// Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/EmacsKeyListener.java
import static in.tombo.kashiki.keybind.SupportKey.*;
import static java.awt.event.KeyEvent.*;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import in.tombo.kashiki.Editor;
keybinds.put(strokes, action);
}
private Stroke getStroke(String key) {
Matcher m = ACTION_PATTERN.matcher(key);
if (!m.find()) {
throw new RuntimeException("invalid config.");
}
String actionString = m.group(1);
int code = CODE_MAPPING.get(actionString);
if (key.startsWith("C-A-S-")) {
return new Stroke(CTRL_ALT_SHIFT, code);
} else if (key.startsWith("C-A-")) {
return new Stroke(CTRL_ALT, code);
} else if (key.startsWith("C-S-")) {
return new Stroke(CTRL_SHIFT, code);
} else if (key.startsWith("A-S-")) {
return new Stroke(ALT_SHIFT, code);
} else if (key.startsWith("C-")) {
return new Stroke(CTRL, code);
} else if (key.startsWith("A-")) {
return new Stroke(ALT, code);
} else if (key.startsWith("S-")) {
return new Stroke(SHIFT, code);
} else {
return new Stroke(NONE, code);
}
}
@Override | public void keyPressed(SupportKey supportKey, int keyCode, long when) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/ReturnAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class ReturnAction implements Action {
@Override
public String name() {
return "return";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/ReturnAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class ReturnAction implements Action {
@Override
public String name() {
return "return";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/SaveFileAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import com.google.common.base.Charsets;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class SaveFileAction implements Action {
@Override
public String name() {
return "save-file";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/SaveFileAction.java
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import com.google.common.base.Charsets;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class SaveFileAction implements Action {
@Override
public String name() {
return "save-file";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/ViewRefleshAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class ViewRefleshAction implements Action {
@Override
public String name() {
return "view-reflesh";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/ViewRefleshAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class ViewRefleshAction implements Action {
@Override
public String name() {
return "view-reflesh";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/ViewScaleUpAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/SmoothValue.java
// public class SmoothValue {
//
// private static final int NUM_OF_DIV = 15;
// private Queue<Double> queue = new LinkedList<>();
// private int numOfDiv;
// private double value;
// private double currentValue;
// private MovingType movingType;
//
// public SmoothValue() {
// this(0, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, MovingType movingType) {
// this(initialValue, NUM_OF_DIV, movingType);
// }
//
// public SmoothValue(double initialValue, int delayTime) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, int numOfDiv, MovingType movingType) {
// this.value = initialValue;
// this.currentValue = initialValue;
// this.numOfDiv = numOfDiv;
// this.movingType = movingType;
// }
//
// public void setValue(double value) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime) {
// setValue(value, delayTime, movingType);
// }
//
// public void setValue(double value, MovingType movingType) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime, MovingType movingType) {
// setValue(value, 0, movingType, numOfDiv);
// }
//
// public void setValueWithoutSmooth(double value) {
// this.currentValue += value - this.value;
// this.value = value;
// }
//
// public void setValue(double value, int delayTime, MovingType movingType, int numOfDiv) {
// this.movingType = movingType;
//
// double delta = value - this.value;
// if (this.value == value) {
// return;
// }
//
// this.value = value;
// double[] gains = movingType.gains(numOfDiv);
// Queue<Double> newQueue = new LinkedList<>();
// for (int i = 0; i < delayTime; i++) {
// newQueue.offer(0.0);
// }
// for (int i = 0; i < numOfDiv; i++) {
// if (queue.isEmpty()) {
// newQueue.offer(gains[i] * delta);
// } else {
// newQueue.offer(gains[i] * delta + queue.poll());
// }
// }
// queue = newQueue;
// }
//
// public void addValue(double value) {
// setValue(this.value + value);
// }
//
// public double getValue() {
// return getValue(true);
// }
//
// public double getValue(boolean withUpdate) {
// if (withUpdate) {
// update();
// }
// return currentValue;
// }
//
// public void update() {
// if (queue.isEmpty()) {
// currentValue = value;
// } else {
// currentValue += queue.poll();
// }
// }
//
// public boolean isAnimated() {
// return currentValue == value;
// }
//
// public double getLastValue() {
// return value;
// }
//
// public MovingType getMovingType() {
// return movingType;
// }
//
// public void setMovingType(MovingType movingType) {
// this.movingType = movingType;
// }
//
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.SmoothValue; | package in.tombo.kashiki.keybind.basic;
public class ViewScaleUpAction implements Action {
@Override
public String name() {
return "view-scale-up";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/SmoothValue.java
// public class SmoothValue {
//
// private static final int NUM_OF_DIV = 15;
// private Queue<Double> queue = new LinkedList<>();
// private int numOfDiv;
// private double value;
// private double currentValue;
// private MovingType movingType;
//
// public SmoothValue() {
// this(0, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, MovingType movingType) {
// this(initialValue, NUM_OF_DIV, movingType);
// }
//
// public SmoothValue(double initialValue, int delayTime) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, int numOfDiv, MovingType movingType) {
// this.value = initialValue;
// this.currentValue = initialValue;
// this.numOfDiv = numOfDiv;
// this.movingType = movingType;
// }
//
// public void setValue(double value) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime) {
// setValue(value, delayTime, movingType);
// }
//
// public void setValue(double value, MovingType movingType) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime, MovingType movingType) {
// setValue(value, 0, movingType, numOfDiv);
// }
//
// public void setValueWithoutSmooth(double value) {
// this.currentValue += value - this.value;
// this.value = value;
// }
//
// public void setValue(double value, int delayTime, MovingType movingType, int numOfDiv) {
// this.movingType = movingType;
//
// double delta = value - this.value;
// if (this.value == value) {
// return;
// }
//
// this.value = value;
// double[] gains = movingType.gains(numOfDiv);
// Queue<Double> newQueue = new LinkedList<>();
// for (int i = 0; i < delayTime; i++) {
// newQueue.offer(0.0);
// }
// for (int i = 0; i < numOfDiv; i++) {
// if (queue.isEmpty()) {
// newQueue.offer(gains[i] * delta);
// } else {
// newQueue.offer(gains[i] * delta + queue.poll());
// }
// }
// queue = newQueue;
// }
//
// public void addValue(double value) {
// setValue(this.value + value);
// }
//
// public double getValue() {
// return getValue(true);
// }
//
// public double getValue(boolean withUpdate) {
// if (withUpdate) {
// update();
// }
// return currentValue;
// }
//
// public void update() {
// if (queue.isEmpty()) {
// currentValue = value;
// } else {
// currentValue += queue.poll();
// }
// }
//
// public boolean isAnimated() {
// return currentValue == value;
// }
//
// public double getLastValue() {
// return value;
// }
//
// public MovingType getMovingType() {
// return movingType;
// }
//
// public void setMovingType(MovingType movingType) {
// this.movingType = movingType;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/ViewScaleUpAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.SmoothValue;
package in.tombo.kashiki.keybind.basic;
public class ViewScaleUpAction implements Action {
@Override
public String name() {
return "view-scale-up";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/ViewScaleUpAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/SmoothValue.java
// public class SmoothValue {
//
// private static final int NUM_OF_DIV = 15;
// private Queue<Double> queue = new LinkedList<>();
// private int numOfDiv;
// private double value;
// private double currentValue;
// private MovingType movingType;
//
// public SmoothValue() {
// this(0, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, MovingType movingType) {
// this(initialValue, NUM_OF_DIV, movingType);
// }
//
// public SmoothValue(double initialValue, int delayTime) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, int numOfDiv, MovingType movingType) {
// this.value = initialValue;
// this.currentValue = initialValue;
// this.numOfDiv = numOfDiv;
// this.movingType = movingType;
// }
//
// public void setValue(double value) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime) {
// setValue(value, delayTime, movingType);
// }
//
// public void setValue(double value, MovingType movingType) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime, MovingType movingType) {
// setValue(value, 0, movingType, numOfDiv);
// }
//
// public void setValueWithoutSmooth(double value) {
// this.currentValue += value - this.value;
// this.value = value;
// }
//
// public void setValue(double value, int delayTime, MovingType movingType, int numOfDiv) {
// this.movingType = movingType;
//
// double delta = value - this.value;
// if (this.value == value) {
// return;
// }
//
// this.value = value;
// double[] gains = movingType.gains(numOfDiv);
// Queue<Double> newQueue = new LinkedList<>();
// for (int i = 0; i < delayTime; i++) {
// newQueue.offer(0.0);
// }
// for (int i = 0; i < numOfDiv; i++) {
// if (queue.isEmpty()) {
// newQueue.offer(gains[i] * delta);
// } else {
// newQueue.offer(gains[i] * delta + queue.poll());
// }
// }
// queue = newQueue;
// }
//
// public void addValue(double value) {
// setValue(this.value + value);
// }
//
// public double getValue() {
// return getValue(true);
// }
//
// public double getValue(boolean withUpdate) {
// if (withUpdate) {
// update();
// }
// return currentValue;
// }
//
// public void update() {
// if (queue.isEmpty()) {
// currentValue = value;
// } else {
// currentValue += queue.poll();
// }
// }
//
// public boolean isAnimated() {
// return currentValue == value;
// }
//
// public double getLastValue() {
// return value;
// }
//
// public MovingType getMovingType() {
// return movingType;
// }
//
// public void setMovingType(MovingType movingType) {
// this.movingType = movingType;
// }
//
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.SmoothValue; | package in.tombo.kashiki.keybind.basic;
public class ViewScaleUpAction implements Action {
@Override
public String name() {
return "view-scale-up";
}
@Override
public void execute(Editor editor, String... args) { | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/SmoothValue.java
// public class SmoothValue {
//
// private static final int NUM_OF_DIV = 15;
// private Queue<Double> queue = new LinkedList<>();
// private int numOfDiv;
// private double value;
// private double currentValue;
// private MovingType movingType;
//
// public SmoothValue() {
// this(0, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, MovingType movingType) {
// this(initialValue, NUM_OF_DIV, movingType);
// }
//
// public SmoothValue(double initialValue, int delayTime) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, int numOfDiv, MovingType movingType) {
// this.value = initialValue;
// this.currentValue = initialValue;
// this.numOfDiv = numOfDiv;
// this.movingType = movingType;
// }
//
// public void setValue(double value) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime) {
// setValue(value, delayTime, movingType);
// }
//
// public void setValue(double value, MovingType movingType) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime, MovingType movingType) {
// setValue(value, 0, movingType, numOfDiv);
// }
//
// public void setValueWithoutSmooth(double value) {
// this.currentValue += value - this.value;
// this.value = value;
// }
//
// public void setValue(double value, int delayTime, MovingType movingType, int numOfDiv) {
// this.movingType = movingType;
//
// double delta = value - this.value;
// if (this.value == value) {
// return;
// }
//
// this.value = value;
// double[] gains = movingType.gains(numOfDiv);
// Queue<Double> newQueue = new LinkedList<>();
// for (int i = 0; i < delayTime; i++) {
// newQueue.offer(0.0);
// }
// for (int i = 0; i < numOfDiv; i++) {
// if (queue.isEmpty()) {
// newQueue.offer(gains[i] * delta);
// } else {
// newQueue.offer(gains[i] * delta + queue.poll());
// }
// }
// queue = newQueue;
// }
//
// public void addValue(double value) {
// setValue(this.value + value);
// }
//
// public double getValue() {
// return getValue(true);
// }
//
// public double getValue(boolean withUpdate) {
// if (withUpdate) {
// update();
// }
// return currentValue;
// }
//
// public void update() {
// if (queue.isEmpty()) {
// currentValue = value;
// } else {
// currentValue += queue.poll();
// }
// }
//
// public boolean isAnimated() {
// return currentValue == value;
// }
//
// public double getLastValue() {
// return value;
// }
//
// public MovingType getMovingType() {
// return movingType;
// }
//
// public void setMovingType(MovingType movingType) {
// this.movingType = movingType;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/ViewScaleUpAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.SmoothValue;
package in.tombo.kashiki.keybind.basic;
public class ViewScaleUpAction implements Action {
@Override
public String name() {
return "view-scale-up";
}
@Override
public void execute(Editor editor, String... args) { | SmoothValue scale = editor.getScale(); |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/BufferHeadAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class BufferHeadAction implements Action {
@Override
public String name() {
return "buffer-head";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/BufferHeadAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class BufferHeadAction implements Action {
@Override
public String name() {
return "buffer-head";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/HeadAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class HeadAction implements Action {
@Override
public String name() {
return "head";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/HeadAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class HeadAction implements Action {
@Override
public String name() {
return "head";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/demo/YRollPlusAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
| import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base; | package in.tombo.kashiki.keybind.demo;
public class YRollPlusAction implements Action {
@Override
public String name() {
return "y-roll-plus";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/demo/YRollPlusAction.java
import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base;
package in.tombo.kashiki.keybind.demo;
public class YRollPlusAction implements Action {
@Override
public String name() {
return "y-roll-plus";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/demo/YRollPlusAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
| import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base; | package in.tombo.kashiki.keybind.demo;
public class YRollPlusAction implements Action {
@Override
public String name() {
return "y-roll-plus";
}
@Override
public void execute(Editor editor, String... args) { | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/demo/YRollPlusAction.java
import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base;
package in.tombo.kashiki.keybind.demo;
public class YRollPlusAction implements Action {
@Override
public String name() {
return "y-roll-plus";
}
@Override
public void execute(Editor editor, String... args) { | List<Base> drawables = editor.getDrawables(); |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/ExitNavyAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class ExitNavyAction implements Action {
@Override
public String name() {
return "exit-navy";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/ExitNavyAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class ExitNavyAction implements Action {
@Override
public String name() {
return "exit-navy";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/BackAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class BackAction implements Action {
@Override
public String name() {
return "back";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/BackAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class BackAction implements Action {
@Override
public String name() {
return "back";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/BackspaceAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class BackspaceAction implements Action {
@Override
public String name() {
return "backspace";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/BackspaceAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class BackspaceAction implements Action {
@Override
public String name() {
return "backspace";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/demo/ZRollMinusAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
| import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base; | package in.tombo.kashiki.keybind.demo;
public class ZRollMinusAction implements Action {
@Override
public String name() {
return "z-roll-minus";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/demo/ZRollMinusAction.java
import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base;
package in.tombo.kashiki.keybind.demo;
public class ZRollMinusAction implements Action {
@Override
public String name() {
return "z-roll-minus";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/demo/ZRollMinusAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
| import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base; | package in.tombo.kashiki.keybind.demo;
public class ZRollMinusAction implements Action {
@Override
public String name() {
return "z-roll-minus";
}
@Override
public void execute(Editor editor, String... args) { | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/demo/ZRollMinusAction.java
import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base;
package in.tombo.kashiki.keybind.demo;
public class ZRollMinusAction implements Action {
@Override
public String name() {
return "z-roll-minus";
}
@Override
public void execute(Editor editor, String... args) { | List<Base> drawables = editor.getDrawables(); |
mitoma/kashiki | src/main/java/in/tombo/kashiki/view/LineView.java | // Path: src/main/java/in/tombo/kashiki/buffer/BufferChar.java
// public class BufferChar implements Comparable<BufferChar> {
//
// private String c;
// private int row;
// private int col;
// private BufferCharObserver observer = new BufferCharObserver();
//
// public BufferChar(String c, int row, int col) {
// this.c = c;
// this.row = row;
// this.col = col;
// }
//
// public void addListener(BufferCharListener listener) {
// observer.addListener(listener);
// }
//
// public void updatePosition(int row, int col) {
// this.row = row;
// this.col = col;
// observer.update(this);
// }
//
// public String getChar() {
// return c;
// }
//
// public int getRow() {
// return row;
// }
//
// public int getCol() {
// return col;
// }
//
// @Override
// public int compareTo(BufferChar o) {
// int rowCompare = Integer.compare(row, o.row);
// if (rowCompare != 0) {
// return rowCompare;
// }
// return Integer.compare(col, o.col);
// }
// }
//
// Path: src/main/java/in/tombo/kashiki/buffer/BufferLine.java
// public class BufferLine implements Comparable<BufferLine> {
//
// private int rowNum;
// private List<BufferChar> chars = new ArrayList<>();
// private BufferLineObserver observer = new BufferLineObserver();
//
// public void addListener(BufferLineListener listener) {
// observer.addListener(listener);
// }
//
// public void updatePosition(int rowNum) {
// this.rowNum = rowNum;
// for (int i = 0; i < chars.size(); i++) {
// chars.get(i).updatePosition(rowNum, i);
// }
// observer.update(this);
// }
//
// public int getLength() {
// return chars.size();
// }
//
// public String toLineString() {
// StringBuilder buf = new StringBuilder();
// for (BufferChar bc : chars) {
// buf.append(bc.getChar());
// }
// return buf.toString();
// }
//
// public String posString(int position) {
// return chars.get(position).getChar();
// }
//
// public void insertLast(BufferChar bufferChar) {
// chars.add(bufferChar);
// }
//
// public void insertChar(int col, String c) {
// BufferChar bc = new BufferChar(c, rowNum, col);
// chars.add(col, bc);
// updatePosition(rowNum);
// observer.addChar(bc);
// }
//
// public List<BufferChar> insertEnter(int col) {
// List<BufferChar> results = new ArrayList<>();
// if (col == chars.size()) {
// return results;
// }
// while (chars.size() > col) {
// results.add(chars.remove(col));
// }
// observer.update(this);
// return results;
// }
//
// public BufferChar removeChar(int col) {
// BufferChar removedChar = chars.remove(col);
// observer.removeChar(removedChar);
// return removedChar;
// }
//
// public void join(BufferLine line) {
// for (BufferChar bc : line.chars) {
// chars.add(bc);
// }
// updatePosition(rowNum);
// }
//
// public List<BufferChar> getChars() {
// return ImmutableList.copyOf(chars);
// }
//
// public int getRowNum() {
// return rowNum;
// }
//
// @Override
// public int compareTo(BufferLine o) {
// return Integer.compare(rowNum, o.rowNum);
// }
// }
//
// Path: src/main/java/in/tombo/kashiki/buffer/BufferLineListener.java
// public interface BufferLineListener {
// public void update(BufferLine bl);
//
// public void addChar(BufferChar bufferChar);
//
// public void removeChar(BufferChar bufferChar);
//
// }
| import in.tombo.kashiki.buffer.BufferChar;
import in.tombo.kashiki.buffer.BufferLine;
import in.tombo.kashiki.buffer.BufferLineListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import com.jogamp.opengl.GL2; | package in.tombo.kashiki.view;
public class LineView extends Base implements BufferLineListener, Comparable<LineView> {
private BufferLine bufferLine;
private List<CharView> chars = new ArrayList<>();
private List<CharView> removedChars = new ArrayList<>();
public LineView(BufferLine bufferLine) {
this.bufferLine = bufferLine;
bufferLine.addListener(this); | // Path: src/main/java/in/tombo/kashiki/buffer/BufferChar.java
// public class BufferChar implements Comparable<BufferChar> {
//
// private String c;
// private int row;
// private int col;
// private BufferCharObserver observer = new BufferCharObserver();
//
// public BufferChar(String c, int row, int col) {
// this.c = c;
// this.row = row;
// this.col = col;
// }
//
// public void addListener(BufferCharListener listener) {
// observer.addListener(listener);
// }
//
// public void updatePosition(int row, int col) {
// this.row = row;
// this.col = col;
// observer.update(this);
// }
//
// public String getChar() {
// return c;
// }
//
// public int getRow() {
// return row;
// }
//
// public int getCol() {
// return col;
// }
//
// @Override
// public int compareTo(BufferChar o) {
// int rowCompare = Integer.compare(row, o.row);
// if (rowCompare != 0) {
// return rowCompare;
// }
// return Integer.compare(col, o.col);
// }
// }
//
// Path: src/main/java/in/tombo/kashiki/buffer/BufferLine.java
// public class BufferLine implements Comparable<BufferLine> {
//
// private int rowNum;
// private List<BufferChar> chars = new ArrayList<>();
// private BufferLineObserver observer = new BufferLineObserver();
//
// public void addListener(BufferLineListener listener) {
// observer.addListener(listener);
// }
//
// public void updatePosition(int rowNum) {
// this.rowNum = rowNum;
// for (int i = 0; i < chars.size(); i++) {
// chars.get(i).updatePosition(rowNum, i);
// }
// observer.update(this);
// }
//
// public int getLength() {
// return chars.size();
// }
//
// public String toLineString() {
// StringBuilder buf = new StringBuilder();
// for (BufferChar bc : chars) {
// buf.append(bc.getChar());
// }
// return buf.toString();
// }
//
// public String posString(int position) {
// return chars.get(position).getChar();
// }
//
// public void insertLast(BufferChar bufferChar) {
// chars.add(bufferChar);
// }
//
// public void insertChar(int col, String c) {
// BufferChar bc = new BufferChar(c, rowNum, col);
// chars.add(col, bc);
// updatePosition(rowNum);
// observer.addChar(bc);
// }
//
// public List<BufferChar> insertEnter(int col) {
// List<BufferChar> results = new ArrayList<>();
// if (col == chars.size()) {
// return results;
// }
// while (chars.size() > col) {
// results.add(chars.remove(col));
// }
// observer.update(this);
// return results;
// }
//
// public BufferChar removeChar(int col) {
// BufferChar removedChar = chars.remove(col);
// observer.removeChar(removedChar);
// return removedChar;
// }
//
// public void join(BufferLine line) {
// for (BufferChar bc : line.chars) {
// chars.add(bc);
// }
// updatePosition(rowNum);
// }
//
// public List<BufferChar> getChars() {
// return ImmutableList.copyOf(chars);
// }
//
// public int getRowNum() {
// return rowNum;
// }
//
// @Override
// public int compareTo(BufferLine o) {
// return Integer.compare(rowNum, o.rowNum);
// }
// }
//
// Path: src/main/java/in/tombo/kashiki/buffer/BufferLineListener.java
// public interface BufferLineListener {
// public void update(BufferLine bl);
//
// public void addChar(BufferChar bufferChar);
//
// public void removeChar(BufferChar bufferChar);
//
// }
// Path: src/main/java/in/tombo/kashiki/view/LineView.java
import in.tombo.kashiki.buffer.BufferChar;
import in.tombo.kashiki.buffer.BufferLine;
import in.tombo.kashiki.buffer.BufferLineListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import com.jogamp.opengl.GL2;
package in.tombo.kashiki.view;
public class LineView extends Base implements BufferLineListener, Comparable<LineView> {
private BufferLine bufferLine;
private List<CharView> chars = new ArrayList<>();
private List<CharView> removedChars = new ArrayList<>();
public LineView(BufferLine bufferLine) {
this.bufferLine = bufferLine;
bufferLine.addListener(this); | List<BufferChar> bufferChars = bufferLine.getChars(); |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/ForwardAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class ForwardAction implements Action {
@Override
public String name() {
return "forward";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/ForwardAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class ForwardAction implements Action {
@Override
public String name() {
return "forward";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/demo/XRollPlusAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
| import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base; | package in.tombo.kashiki.keybind.demo;
public class XRollPlusAction implements Action {
@Override
public String name() {
return "x-roll-plus";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/demo/XRollPlusAction.java
import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base;
package in.tombo.kashiki.keybind.demo;
public class XRollPlusAction implements Action {
@Override
public String name() {
return "x-roll-plus";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/demo/XRollPlusAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
| import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base; | package in.tombo.kashiki.keybind.demo;
public class XRollPlusAction implements Action {
@Override
public String name() {
return "x-roll-plus";
}
@Override
public void execute(Editor editor, String... args) { | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/demo/XRollPlusAction.java
import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base;
package in.tombo.kashiki.keybind.demo;
public class XRollPlusAction implements Action {
@Override
public String name() {
return "x-roll-plus";
}
@Override
public void execute(Editor editor, String... args) { | List<Base> drawables = editor.getDrawables(); |
mitoma/kashiki | src/main/java/in/tombo/kashiki/KeyListenerAdapter.java | // Path: src/main/java/in/tombo/kashiki/keybind/SupportKey.java
// public enum SupportKey {
//
// CTRL_ALT_SHIFT, CTRL_ALT, CTRL_SHIFT, ALT_SHIFT, CTRL, ALT, SHIFT, NONE
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/KashikiKeyListener.java
// public interface KashikiKeyListener {
//
// public void keyPressed(SupportKey supportKey, int keyCode, long when);
//
// public void keyTyped(char typedString, long when);
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/SupportKey.java
// public enum SupportKey {
//
// CTRL_ALT_SHIFT, CTRL_ALT, CTRL_SHIFT, ALT_SHIFT, CTRL, ALT, SHIFT, NONE
//
// }
| import static in.tombo.kashiki.keybind.SupportKey.*;
import in.tombo.kashiki.keybind.KashikiKeyListener;
import in.tombo.kashiki.keybind.SupportKey;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.SwingUtilities; | package in.tombo.kashiki;
public class KeyListenerAdapter implements KeyListener {
private final KashikiKeyListener keyListener;
public KeyListenerAdapter(KashikiKeyListener keyListener) {
this.keyListener = keyListener;
}
@Override
public void keyPressed(KeyEvent e) { | // Path: src/main/java/in/tombo/kashiki/keybind/SupportKey.java
// public enum SupportKey {
//
// CTRL_ALT_SHIFT, CTRL_ALT, CTRL_SHIFT, ALT_SHIFT, CTRL, ALT, SHIFT, NONE
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/KashikiKeyListener.java
// public interface KashikiKeyListener {
//
// public void keyPressed(SupportKey supportKey, int keyCode, long when);
//
// public void keyTyped(char typedString, long when);
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/SupportKey.java
// public enum SupportKey {
//
// CTRL_ALT_SHIFT, CTRL_ALT, CTRL_SHIFT, ALT_SHIFT, CTRL, ALT, SHIFT, NONE
//
// }
// Path: src/main/java/in/tombo/kashiki/KeyListenerAdapter.java
import static in.tombo.kashiki.keybind.SupportKey.*;
import in.tombo.kashiki.keybind.KashikiKeyListener;
import in.tombo.kashiki.keybind.SupportKey;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.SwingUtilities;
package in.tombo.kashiki;
public class KeyListenerAdapter implements KeyListener {
private final KashikiKeyListener keyListener;
public KeyListenerAdapter(KashikiKeyListener keyListener) {
this.keyListener = keyListener;
}
@Override
public void keyPressed(KeyEvent e) { | SupportKey key; |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/demo/YRollMinusAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
| import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base; | package in.tombo.kashiki.keybind.demo;
public class YRollMinusAction implements Action {
@Override
public String name() {
return "y-roll-minus";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/demo/YRollMinusAction.java
import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base;
package in.tombo.kashiki.keybind.demo;
public class YRollMinusAction implements Action {
@Override
public String name() {
return "y-roll-minus";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/demo/YRollMinusAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
| import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base; | package in.tombo.kashiki.keybind.demo;
public class YRollMinusAction implements Action {
@Override
public String name() {
return "y-roll-minus";
}
@Override
public void execute(Editor editor, String... args) { | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/Base.java
// public abstract class Base {
//
// private Position position = new Position();
// private Angle angle = new Angle();
// private Scale scale = new Scale();
// private Color color = new Color();
//
// public void draw(GL2 gl) {
// preDraw(gl);
// innerDraw(gl);
// postDraw(gl);
// }
//
// public abstract void innerDraw(GL2 gl);
//
// public void preDraw(GL2 gl) {
// gl.glPushMatrix();
// position.updateTranslate(gl);
// angle.updateRotate(gl);
// scale.updateScale(gl);
// color.updateColor(gl);
// }
//
// public void postDraw(GL2 gl) {
// gl.glPopMatrix();
// }
//
// public boolean isAnimated() {
// return position.isAnimated() && angle.isAnimated() && scale.isAnimated() && color.isAnimated();
// }
//
// public Position getPosition() {
// return position;
// }
//
// public void setPosition(Position position) {
// this.position = position;
// }
//
// public Angle getAngle() {
// return angle;
// }
//
// public void setAngle(Angle angle) {
// this.angle = angle;
// }
//
// public Scale getScale() {
// return scale;
// }
//
// public void setScale(Scale scale) {
// this.scale = scale;
// }
//
// public Color getColor() {
// return color;
// }
//
// public void setColor(Color color) {
// this.color = color;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/demo/YRollMinusAction.java
import java.util.List;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.Base;
package in.tombo.kashiki.keybind.demo;
public class YRollMinusAction implements Action {
@Override
public String name() {
return "y-roll-minus";
}
@Override
public void execute(Editor editor, String... args) { | List<Base> drawables = editor.getDrawables(); |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/DeleteAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class DeleteAction implements Action {
@Override
public String name() {
return "delete";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/DeleteAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class DeleteAction implements Action {
@Override
public String name() {
return "delete";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/NoopAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
| import in.tombo.kashiki.Editor; | package in.tombo.kashiki.keybind;
public class NoopAction implements Action {
@Override
public String name() {
return "noop";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/NoopAction.java
import in.tombo.kashiki.Editor;
package in.tombo.kashiki.keybind;
public class NoopAction implements Action {
@Override
public String name() {
return "noop";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/ViewScaleDownAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/SmoothValue.java
// public class SmoothValue {
//
// private static final int NUM_OF_DIV = 15;
// private Queue<Double> queue = new LinkedList<>();
// private int numOfDiv;
// private double value;
// private double currentValue;
// private MovingType movingType;
//
// public SmoothValue() {
// this(0, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, MovingType movingType) {
// this(initialValue, NUM_OF_DIV, movingType);
// }
//
// public SmoothValue(double initialValue, int delayTime) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, int numOfDiv, MovingType movingType) {
// this.value = initialValue;
// this.currentValue = initialValue;
// this.numOfDiv = numOfDiv;
// this.movingType = movingType;
// }
//
// public void setValue(double value) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime) {
// setValue(value, delayTime, movingType);
// }
//
// public void setValue(double value, MovingType movingType) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime, MovingType movingType) {
// setValue(value, 0, movingType, numOfDiv);
// }
//
// public void setValueWithoutSmooth(double value) {
// this.currentValue += value - this.value;
// this.value = value;
// }
//
// public void setValue(double value, int delayTime, MovingType movingType, int numOfDiv) {
// this.movingType = movingType;
//
// double delta = value - this.value;
// if (this.value == value) {
// return;
// }
//
// this.value = value;
// double[] gains = movingType.gains(numOfDiv);
// Queue<Double> newQueue = new LinkedList<>();
// for (int i = 0; i < delayTime; i++) {
// newQueue.offer(0.0);
// }
// for (int i = 0; i < numOfDiv; i++) {
// if (queue.isEmpty()) {
// newQueue.offer(gains[i] * delta);
// } else {
// newQueue.offer(gains[i] * delta + queue.poll());
// }
// }
// queue = newQueue;
// }
//
// public void addValue(double value) {
// setValue(this.value + value);
// }
//
// public double getValue() {
// return getValue(true);
// }
//
// public double getValue(boolean withUpdate) {
// if (withUpdate) {
// update();
// }
// return currentValue;
// }
//
// public void update() {
// if (queue.isEmpty()) {
// currentValue = value;
// } else {
// currentValue += queue.poll();
// }
// }
//
// public boolean isAnimated() {
// return currentValue == value;
// }
//
// public double getLastValue() {
// return value;
// }
//
// public MovingType getMovingType() {
// return movingType;
// }
//
// public void setMovingType(MovingType movingType) {
// this.movingType = movingType;
// }
//
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.SmoothValue; | package in.tombo.kashiki.keybind.basic;
public class ViewScaleDownAction implements Action {
@Override
public String name() {
return "view-scale-down";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/SmoothValue.java
// public class SmoothValue {
//
// private static final int NUM_OF_DIV = 15;
// private Queue<Double> queue = new LinkedList<>();
// private int numOfDiv;
// private double value;
// private double currentValue;
// private MovingType movingType;
//
// public SmoothValue() {
// this(0, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, MovingType movingType) {
// this(initialValue, NUM_OF_DIV, movingType);
// }
//
// public SmoothValue(double initialValue, int delayTime) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, int numOfDiv, MovingType movingType) {
// this.value = initialValue;
// this.currentValue = initialValue;
// this.numOfDiv = numOfDiv;
// this.movingType = movingType;
// }
//
// public void setValue(double value) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime) {
// setValue(value, delayTime, movingType);
// }
//
// public void setValue(double value, MovingType movingType) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime, MovingType movingType) {
// setValue(value, 0, movingType, numOfDiv);
// }
//
// public void setValueWithoutSmooth(double value) {
// this.currentValue += value - this.value;
// this.value = value;
// }
//
// public void setValue(double value, int delayTime, MovingType movingType, int numOfDiv) {
// this.movingType = movingType;
//
// double delta = value - this.value;
// if (this.value == value) {
// return;
// }
//
// this.value = value;
// double[] gains = movingType.gains(numOfDiv);
// Queue<Double> newQueue = new LinkedList<>();
// for (int i = 0; i < delayTime; i++) {
// newQueue.offer(0.0);
// }
// for (int i = 0; i < numOfDiv; i++) {
// if (queue.isEmpty()) {
// newQueue.offer(gains[i] * delta);
// } else {
// newQueue.offer(gains[i] * delta + queue.poll());
// }
// }
// queue = newQueue;
// }
//
// public void addValue(double value) {
// setValue(this.value + value);
// }
//
// public double getValue() {
// return getValue(true);
// }
//
// public double getValue(boolean withUpdate) {
// if (withUpdate) {
// update();
// }
// return currentValue;
// }
//
// public void update() {
// if (queue.isEmpty()) {
// currentValue = value;
// } else {
// currentValue += queue.poll();
// }
// }
//
// public boolean isAnimated() {
// return currentValue == value;
// }
//
// public double getLastValue() {
// return value;
// }
//
// public MovingType getMovingType() {
// return movingType;
// }
//
// public void setMovingType(MovingType movingType) {
// this.movingType = movingType;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/ViewScaleDownAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.SmoothValue;
package in.tombo.kashiki.keybind.basic;
public class ViewScaleDownAction implements Action {
@Override
public String name() {
return "view-scale-down";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/ViewScaleDownAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/SmoothValue.java
// public class SmoothValue {
//
// private static final int NUM_OF_DIV = 15;
// private Queue<Double> queue = new LinkedList<>();
// private int numOfDiv;
// private double value;
// private double currentValue;
// private MovingType movingType;
//
// public SmoothValue() {
// this(0, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, MovingType movingType) {
// this(initialValue, NUM_OF_DIV, movingType);
// }
//
// public SmoothValue(double initialValue, int delayTime) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, int numOfDiv, MovingType movingType) {
// this.value = initialValue;
// this.currentValue = initialValue;
// this.numOfDiv = numOfDiv;
// this.movingType = movingType;
// }
//
// public void setValue(double value) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime) {
// setValue(value, delayTime, movingType);
// }
//
// public void setValue(double value, MovingType movingType) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime, MovingType movingType) {
// setValue(value, 0, movingType, numOfDiv);
// }
//
// public void setValueWithoutSmooth(double value) {
// this.currentValue += value - this.value;
// this.value = value;
// }
//
// public void setValue(double value, int delayTime, MovingType movingType, int numOfDiv) {
// this.movingType = movingType;
//
// double delta = value - this.value;
// if (this.value == value) {
// return;
// }
//
// this.value = value;
// double[] gains = movingType.gains(numOfDiv);
// Queue<Double> newQueue = new LinkedList<>();
// for (int i = 0; i < delayTime; i++) {
// newQueue.offer(0.0);
// }
// for (int i = 0; i < numOfDiv; i++) {
// if (queue.isEmpty()) {
// newQueue.offer(gains[i] * delta);
// } else {
// newQueue.offer(gains[i] * delta + queue.poll());
// }
// }
// queue = newQueue;
// }
//
// public void addValue(double value) {
// setValue(this.value + value);
// }
//
// public double getValue() {
// return getValue(true);
// }
//
// public double getValue(boolean withUpdate) {
// if (withUpdate) {
// update();
// }
// return currentValue;
// }
//
// public void update() {
// if (queue.isEmpty()) {
// currentValue = value;
// } else {
// currentValue += queue.poll();
// }
// }
//
// public boolean isAnimated() {
// return currentValue == value;
// }
//
// public double getLastValue() {
// return value;
// }
//
// public MovingType getMovingType() {
// return movingType;
// }
//
// public void setMovingType(MovingType movingType) {
// this.movingType = movingType;
// }
//
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.SmoothValue; | package in.tombo.kashiki.keybind.basic;
public class ViewScaleDownAction implements Action {
@Override
public String name() {
return "view-scale-down";
}
@Override
public void execute(Editor editor, String... args) { | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
//
// Path: src/main/java/in/tombo/kashiki/view/SmoothValue.java
// public class SmoothValue {
//
// private static final int NUM_OF_DIV = 15;
// private Queue<Double> queue = new LinkedList<>();
// private int numOfDiv;
// private double value;
// private double currentValue;
// private MovingType movingType;
//
// public SmoothValue() {
// this(0, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, MovingType movingType) {
// this(initialValue, NUM_OF_DIV, movingType);
// }
//
// public SmoothValue(double initialValue, int delayTime) {
// this(initialValue, NUM_OF_DIV, MovingType.SMOOTH);
// }
//
// public SmoothValue(double initialValue, int numOfDiv, MovingType movingType) {
// this.value = initialValue;
// this.currentValue = initialValue;
// this.numOfDiv = numOfDiv;
// this.movingType = movingType;
// }
//
// public void setValue(double value) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime) {
// setValue(value, delayTime, movingType);
// }
//
// public void setValue(double value, MovingType movingType) {
// setValue(value, 0, movingType);
// }
//
// public void setValue(double value, int delayTime, MovingType movingType) {
// setValue(value, 0, movingType, numOfDiv);
// }
//
// public void setValueWithoutSmooth(double value) {
// this.currentValue += value - this.value;
// this.value = value;
// }
//
// public void setValue(double value, int delayTime, MovingType movingType, int numOfDiv) {
// this.movingType = movingType;
//
// double delta = value - this.value;
// if (this.value == value) {
// return;
// }
//
// this.value = value;
// double[] gains = movingType.gains(numOfDiv);
// Queue<Double> newQueue = new LinkedList<>();
// for (int i = 0; i < delayTime; i++) {
// newQueue.offer(0.0);
// }
// for (int i = 0; i < numOfDiv; i++) {
// if (queue.isEmpty()) {
// newQueue.offer(gains[i] * delta);
// } else {
// newQueue.offer(gains[i] * delta + queue.poll());
// }
// }
// queue = newQueue;
// }
//
// public void addValue(double value) {
// setValue(this.value + value);
// }
//
// public double getValue() {
// return getValue(true);
// }
//
// public double getValue(boolean withUpdate) {
// if (withUpdate) {
// update();
// }
// return currentValue;
// }
//
// public void update() {
// if (queue.isEmpty()) {
// currentValue = value;
// } else {
// currentValue += queue.poll();
// }
// }
//
// public boolean isAnimated() {
// return currentValue == value;
// }
//
// public double getLastValue() {
// return value;
// }
//
// public MovingType getMovingType() {
// return movingType;
// }
//
// public void setMovingType(MovingType movingType) {
// this.movingType = movingType;
// }
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/ViewScaleDownAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
import in.tombo.kashiki.view.SmoothValue;
package in.tombo.kashiki.keybind.basic;
public class ViewScaleDownAction implements Action {
@Override
public String name() {
return "view-scale-down";
}
@Override
public void execute(Editor editor, String... args) { | SmoothValue scale = editor.getScale(); |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/PasteAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class PasteAction implements Action {
@Override
public String name() {
return "paste";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/PasteAction.java
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class PasteAction implements Action {
@Override
public String name() {
return "paste";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/Action.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
| import in.tombo.kashiki.Editor; | package in.tombo.kashiki.keybind;
public interface Action {
public String name();
| // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
import in.tombo.kashiki.Editor;
package in.tombo.kashiki.keybind;
public interface Action {
public String name();
| public void execute(Editor editor, String... args); |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/TypeAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class TypeAction implements Action {
@Override
public String name() {
return "type";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/TypeAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class TypeAction implements Action {
@Override
public String name() {
return "type";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/OpenFileAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import java.io.IOException;
import javax.swing.JFileChooser;
import com.google.common.base.Charsets;
import com.google.common.io.Files;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
/*
* 暫定実装。将来捨てるべき。
*/
public class OpenFileAction implements Action {
@Override
public String name() {
return "open-file";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/OpenFileAction.java
import java.io.IOException;
import javax.swing.JFileChooser;
import com.google.common.base.Charsets;
import com.google.common.io.Files;
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
/*
* 暫定実装。将来捨てるべき。
*/
public class OpenFileAction implements Action {
@Override
public String name() {
return "open-file";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/BufferLastAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class BufferLastAction implements Action {
@Override
public String name() {
return "buffer-last";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/BufferLastAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class BufferLastAction implements Action {
@Override
public String name() {
return "buffer-last";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/NewBufferAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class NewBufferAction implements Action {
@Override
public String name() {
return "new-buffer";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/NewBufferAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class NewBufferAction implements Action {
@Override
public String name() {
return "new-buffer";
}
@Override | public void execute(Editor editor, String... args) { |
mitoma/kashiki | src/main/java/in/tombo/kashiki/keybind/basic/SaveAction.java | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
| import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action; | package in.tombo.kashiki.keybind.basic;
public class SaveAction implements Action {
@Override
public String name() {
return "save-buffer";
}
@Override | // Path: src/main/java/in/tombo/kashiki/Editor.java
// public interface Editor {
//
// Buffer getCurrentBuffer();
//
// List<Base> getDrawables();
//
// void tearDown();
//
// void toggleFullScreen();
//
// void reflesh();
//
// SmoothValue getScale();
//
// void createNewBuffer();
//
// }
//
// Path: src/main/java/in/tombo/kashiki/keybind/Action.java
// public interface Action {
// public String name();
//
// public void execute(Editor editor, String... args);
// }
// Path: src/main/java/in/tombo/kashiki/keybind/basic/SaveAction.java
import in.tombo.kashiki.Editor;
import in.tombo.kashiki.keybind.Action;
package in.tombo.kashiki.keybind.basic;
public class SaveAction implements Action {
@Override
public String name() {
return "save-buffer";
}
@Override | public void execute(Editor editor, String... args) { |
oSoc14/Artoria | app/src/main/java/be/artoria/belfortapp/app/PrefUtils.java | // Path: app/src/main/java/be/artoria/belfortapp/activities/LanguageChoiceActivity.java
// public class LanguageChoiceActivity extends BaseActivity {
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_language_choice);
// final TextView tv = (TextView) findViewById(R.id.to);
// tv.setTypeface(athelas);
// final TextView tv1 = (TextView) findViewById(R.id.string_welcome);
// tv1.setTypeface(athelas);
// final TextView tv2 = (TextView) findViewById(R.id.string_belfry);
// tv2.setTypeface(athelas);
// final TextView tv3 = (TextView) findViewById(R.id.string_choose_language);
// tv3.setTypeface(athelas);
// }
//
//
// @Override
// public boolean onCreateOptionsMenu(Menu menu) {
// // Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.language_choice, menu);
// return true;
// }
//
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
// // Handle action bar item clicks here. The action bar will
// // automatically handle clicks on the Home/Up button, so long
// // as you specify a parent activity in AndroidManifest.xml.
//
// return super.onOptionsItemSelected(item);
// }
//
// public void langSelected(View view) {
// /* Setting the locale in response to a button click */
// final Locale locale;
// switch (view.getId()) {
// case(R.id.english):
// locale = new Locale("en");
// DataManager.lang = DataManager.Language.ENGLISH;
// break;
// case(R.id.french):
// locale = new Locale("fr");
// DataManager.lang = DataManager.Language.FRENCH;
// break;
// case(R.id.dutch):
// default:
// /* Default case is dutch */
// DataManager.lang = DataManager.Language.DUTCH;
// locale = new Locale("nl");
// }
//
// setLang(locale,this);
// /* Saving preferences*/
// PrefUtils.setNotFirstTime();
//
// /* Opening the Main screen */
// final Intent intent = new Intent(this,MainActivity.class);
// startActivity(intent);
// }
//
// public static void setLang(Locale locale, Context ctx){
// Locale.setDefault(locale);
// final Configuration config = new Configuration();
// config.locale = locale;
// ctx.getApplicationContext().getResources().updateConfiguration(config, null);
// PrefUtils.saveLanguage(DataManager.getInstance().getCurrentLanguage());
// }
// }
| import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.provider.ContactsContract;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import be.artoria.belfortapp.R;
import be.artoria.belfortapp.activities.LanguageChoiceActivity; | // get preferences
@SuppressWarnings("NewApi")
private static SharedPreferences getPrefs()
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
return CONTEXT.getSharedPreferences(ARG_USER_KEY, Context.MODE_MULTI_PROCESS);
} else {
return CONTEXT.getSharedPreferences(ARG_USER_KEY, Context.MODE_PRIVATE);
}
}
public static DataManager.Language getLanguage() {
final Locale locale = getContext().getResources().getConfiguration().locale;
final String lang = locale.getLanguage();
if("en".equals(lang)){ return DataManager.Language.ENGLISH;}
if("fr".equals(lang)){ return DataManager.Language.FRENCH;}
/* default choice is dutch */
return DataManager.Language.DUTCH;
}
public static void saveLanguage(DataManager.Language lang){
String lng = "nl";//default dutch
if(lang == DataManager.Language.ENGLISH){lng="en";}
if(lang == DataManager.Language.FRENCH){lng ="fr";}
getPrefs().edit().putString(ARG_LANG,lng).apply();
}
public static void loadLanguage(Context context){
final String lang = getPrefs().getString(ARG_LANG,"nl");/*Default dutch*/
final Locale locale = new Locale(lang); | // Path: app/src/main/java/be/artoria/belfortapp/activities/LanguageChoiceActivity.java
// public class LanguageChoiceActivity extends BaseActivity {
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_language_choice);
// final TextView tv = (TextView) findViewById(R.id.to);
// tv.setTypeface(athelas);
// final TextView tv1 = (TextView) findViewById(R.id.string_welcome);
// tv1.setTypeface(athelas);
// final TextView tv2 = (TextView) findViewById(R.id.string_belfry);
// tv2.setTypeface(athelas);
// final TextView tv3 = (TextView) findViewById(R.id.string_choose_language);
// tv3.setTypeface(athelas);
// }
//
//
// @Override
// public boolean onCreateOptionsMenu(Menu menu) {
// // Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.language_choice, menu);
// return true;
// }
//
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
// // Handle action bar item clicks here. The action bar will
// // automatically handle clicks on the Home/Up button, so long
// // as you specify a parent activity in AndroidManifest.xml.
//
// return super.onOptionsItemSelected(item);
// }
//
// public void langSelected(View view) {
// /* Setting the locale in response to a button click */
// final Locale locale;
// switch (view.getId()) {
// case(R.id.english):
// locale = new Locale("en");
// DataManager.lang = DataManager.Language.ENGLISH;
// break;
// case(R.id.french):
// locale = new Locale("fr");
// DataManager.lang = DataManager.Language.FRENCH;
// break;
// case(R.id.dutch):
// default:
// /* Default case is dutch */
// DataManager.lang = DataManager.Language.DUTCH;
// locale = new Locale("nl");
// }
//
// setLang(locale,this);
// /* Saving preferences*/
// PrefUtils.setNotFirstTime();
//
// /* Opening the Main screen */
// final Intent intent = new Intent(this,MainActivity.class);
// startActivity(intent);
// }
//
// public static void setLang(Locale locale, Context ctx){
// Locale.setDefault(locale);
// final Configuration config = new Configuration();
// config.locale = locale;
// ctx.getApplicationContext().getResources().updateConfiguration(config, null);
// PrefUtils.saveLanguage(DataManager.getInstance().getCurrentLanguage());
// }
// }
// Path: app/src/main/java/be/artoria/belfortapp/app/PrefUtils.java
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.provider.ContactsContract;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import be.artoria.belfortapp.R;
import be.artoria.belfortapp.activities.LanguageChoiceActivity;
// get preferences
@SuppressWarnings("NewApi")
private static SharedPreferences getPrefs()
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
return CONTEXT.getSharedPreferences(ARG_USER_KEY, Context.MODE_MULTI_PROCESS);
} else {
return CONTEXT.getSharedPreferences(ARG_USER_KEY, Context.MODE_PRIVATE);
}
}
public static DataManager.Language getLanguage() {
final Locale locale = getContext().getResources().getConfiguration().locale;
final String lang = locale.getLanguage();
if("en".equals(lang)){ return DataManager.Language.ENGLISH;}
if("fr".equals(lang)){ return DataManager.Language.FRENCH;}
/* default choice is dutch */
return DataManager.Language.DUTCH;
}
public static void saveLanguage(DataManager.Language lang){
String lng = "nl";//default dutch
if(lang == DataManager.Language.ENGLISH){lng="en";}
if(lang == DataManager.Language.FRENCH){lng ="fr";}
getPrefs().edit().putString(ARG_LANG,lng).apply();
}
public static void loadLanguage(Context context){
final String lang = getPrefs().getString(ARG_LANG,"nl");/*Default dutch*/
final Locale locale = new Locale(lang); | LanguageChoiceActivity.setLang(locale,context); |
oSoc14/Artoria | app/src/main/java/be/artoria/belfortapp/mixare/mgr/downloader/DownloadResult.java | // Path: app/src/main/java/be/artoria/belfortapp/mixare/data/DataSource.java
// public class DataSource {
//
// private static final String name = "Artoria";
//
// public enum TYPE {
// WIKIPEDIA, BUZZ, TWITTER, OSM, MIXARE, ARTORIA
// };
//
// private static final TYPE type = TYPE.ARTORIA;
//
//
// public DataSource() {
// }
//
// public int getColor() {
// return Color.RED;
// }
//
//
// public TYPE getType() {
// return this.type;
// }
//
// public String getName() {
// return this.name;
// }
//
// @Override
// public String toString() {
// return "ARTORIA DataSource ";
// }
// }
//
// Path: app/src/main/java/be/artoria/belfortapp/mixare/lib/marker/Marker.java
// public interface Marker extends Comparable<Marker>{
//
// String getTitle();
//
// String getURL();
//
// double getLatitude();
//
// double getLongitude();
//
// double getAltitude();
//
// MixVector getLocationVector();
//
// void update(Location curGPSFix);
//
// void calcPaint(Camera viewCam, float addX, float addY);
//
// void draw(PaintScreen dw);
//
// double getDistance();
//
// void setDistance(double distance);
//
// String getID();
//
// void setID(String iD);
//
// boolean isActive();
//
// void setActive(boolean active);
//
// int getColour();
//
// public void setTxtLab(Label txtLab);
//
// Label getTxtLab();
//
// public boolean fClick(float x, float y, MixContextInterface ctx, MixStateInterface state);
//
// int getMaxObjects();
//
// void setExtras(String name, ParcelableProperty parcelableProperty);
//
// void setExtras(String name, PrimitiveProperty primitiveProperty);
//
// }
| import be.artoria.belfortapp.mixare.lib.marker.Marker;
import java.util.ArrayList;
import java.util.List;
import be.artoria.belfortapp.mixare.data.DataSource; | /*
* Copyright (C) 2012- Peer internet solutions & Finalist IT Group
*
* This file is part of be.artoria.belfortapp.mixare.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>
*/
package be.artoria.belfortapp.mixare.mgr.downloader;
public class DownloadResult {
private DataSource dataSource;
private String params; | // Path: app/src/main/java/be/artoria/belfortapp/mixare/data/DataSource.java
// public class DataSource {
//
// private static final String name = "Artoria";
//
// public enum TYPE {
// WIKIPEDIA, BUZZ, TWITTER, OSM, MIXARE, ARTORIA
// };
//
// private static final TYPE type = TYPE.ARTORIA;
//
//
// public DataSource() {
// }
//
// public int getColor() {
// return Color.RED;
// }
//
//
// public TYPE getType() {
// return this.type;
// }
//
// public String getName() {
// return this.name;
// }
//
// @Override
// public String toString() {
// return "ARTORIA DataSource ";
// }
// }
//
// Path: app/src/main/java/be/artoria/belfortapp/mixare/lib/marker/Marker.java
// public interface Marker extends Comparable<Marker>{
//
// String getTitle();
//
// String getURL();
//
// double getLatitude();
//
// double getLongitude();
//
// double getAltitude();
//
// MixVector getLocationVector();
//
// void update(Location curGPSFix);
//
// void calcPaint(Camera viewCam, float addX, float addY);
//
// void draw(PaintScreen dw);
//
// double getDistance();
//
// void setDistance(double distance);
//
// String getID();
//
// void setID(String iD);
//
// boolean isActive();
//
// void setActive(boolean active);
//
// int getColour();
//
// public void setTxtLab(Label txtLab);
//
// Label getTxtLab();
//
// public boolean fClick(float x, float y, MixContextInterface ctx, MixStateInterface state);
//
// int getMaxObjects();
//
// void setExtras(String name, ParcelableProperty parcelableProperty);
//
// void setExtras(String name, PrimitiveProperty primitiveProperty);
//
// }
// Path: app/src/main/java/be/artoria/belfortapp/mixare/mgr/downloader/DownloadResult.java
import be.artoria.belfortapp.mixare.lib.marker.Marker;
import java.util.ArrayList;
import java.util.List;
import be.artoria.belfortapp.mixare.data.DataSource;
/*
* Copyright (C) 2012- Peer internet solutions & Finalist IT Group
*
* This file is part of be.artoria.belfortapp.mixare.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>
*/
package be.artoria.belfortapp.mixare.mgr.downloader;
public class DownloadResult {
private DataSource dataSource;
private String params; | private List<Marker> markers; |
oSoc14/Artoria | app/src/main/java/be/artoria/belfortapp/mixare/mgr/location/LocationFinder.java | // Path: app/src/main/java/be/artoria/belfortapp/mixare/mgr/downloader/DownloadManager.java
// public interface DownloadManager {
//
// /**
// * Possible state of this Manager
// */
// enum DownloadManagerState {
// OnLine, //manage downlad request
// OffLine, // No OnLine
// Downloading, //Process some Download Request
// Confused // Internal state not congruent
// }
//
// /**
// * Reset all Request and Responce
// */
// void resetActivity();
//
// /**
// * Submit new DownloadRequest
// *
// * @param job
// * @return reference Of Job or null if job is rejected
// */
// String submitJob(DownloadRequest job);
//
// /**
// * Get result of job if exist, null otherwise
// *
// * @return result
// */
// DownloadResult getReqResult();
//
// /**
// * Pseudo Iterator on results
// * @return actual Download Result
// */
// DownloadResult getNextResult();
//
// /**
// * Gets the number of downloaded results
// * @return the number of results
// */
// int getResultSize();
//
// /**
// * check if all Download request is done
// *
// * @return BOOLEAN
// */
// Boolean isDone();
//
// /**
// * Request to active the service
// */
// void switchOn();
//
// /**
// * Request to deactive the service
// */
// void switchOff();
//
// /**
// * Request state of service
// * @return
// */
// DownloadManagerState getState();
//
// }
| import be.artoria.belfortapp.mixare.mgr.downloader.DownloadManager;
import android.hardware.GeomagneticField;
import android.location.Location; | /*
* Copyright (C) 2012- Peer internet solutions & Finalist IT Group
*
* This file is part of be.artoria.belfortapp.mixare.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>
*/
package be.artoria.belfortapp.mixare.mgr.location;
/**
* This class is repsonsible for finding the location, and sending it back to
* the mixcontext.
*/
public interface LocationFinder {
/**
* Possible status of LocationFinder
*/
public enum LocationFinderState {
Active, // Providing Location Information
Inactive, // No-Active
Confused // Same problem in internal state
}
/**
* Finds the location through the providers
* @param ctx
* @return
*/
void findLocation();
/**
* A working location provider has been found: check if
* the found location has the best accuracy.
*/
void locationCallback(String provider);
/**
* Returns the current location.
*/
Location getCurrentLocation();
/**
* Gets the location that was used in the last download for
* datasources.
* @return
*/
Location getLocationAtLastDownload();
/**
* Sets the property to the location with the last successfull download.
*/
void setLocationAtLastDownload(Location locationAtLastDownload);
/**
* Set the DownloadManager manager at this service
*
* @param downloadManager
*/ | // Path: app/src/main/java/be/artoria/belfortapp/mixare/mgr/downloader/DownloadManager.java
// public interface DownloadManager {
//
// /**
// * Possible state of this Manager
// */
// enum DownloadManagerState {
// OnLine, //manage downlad request
// OffLine, // No OnLine
// Downloading, //Process some Download Request
// Confused // Internal state not congruent
// }
//
// /**
// * Reset all Request and Responce
// */
// void resetActivity();
//
// /**
// * Submit new DownloadRequest
// *
// * @param job
// * @return reference Of Job or null if job is rejected
// */
// String submitJob(DownloadRequest job);
//
// /**
// * Get result of job if exist, null otherwise
// *
// * @return result
// */
// DownloadResult getReqResult();
//
// /**
// * Pseudo Iterator on results
// * @return actual Download Result
// */
// DownloadResult getNextResult();
//
// /**
// * Gets the number of downloaded results
// * @return the number of results
// */
// int getResultSize();
//
// /**
// * check if all Download request is done
// *
// * @return BOOLEAN
// */
// Boolean isDone();
//
// /**
// * Request to active the service
// */
// void switchOn();
//
// /**
// * Request to deactive the service
// */
// void switchOff();
//
// /**
// * Request state of service
// * @return
// */
// DownloadManagerState getState();
//
// }
// Path: app/src/main/java/be/artoria/belfortapp/mixare/mgr/location/LocationFinder.java
import be.artoria.belfortapp.mixare.mgr.downloader.DownloadManager;
import android.hardware.GeomagneticField;
import android.location.Location;
/*
* Copyright (C) 2012- Peer internet solutions & Finalist IT Group
*
* This file is part of be.artoria.belfortapp.mixare.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>
*/
package be.artoria.belfortapp.mixare.mgr.location;
/**
* This class is repsonsible for finding the location, and sending it back to
* the mixcontext.
*/
public interface LocationFinder {
/**
* Possible status of LocationFinder
*/
public enum LocationFinderState {
Active, // Providing Location Information
Inactive, // No-Active
Confused // Same problem in internal state
}
/**
* Finds the location through the providers
* @param ctx
* @return
*/
void findLocation();
/**
* A working location provider has been found: check if
* the found location has the best accuracy.
*/
void locationCallback(String provider);
/**
* Returns the current location.
*/
Location getCurrentLocation();
/**
* Gets the location that was used in the last download for
* datasources.
* @return
*/
Location getLocationAtLastDownload();
/**
* Sets the property to the location with the last successfull download.
*/
void setLocationAtLastDownload(Location locationAtLastDownload);
/**
* Set the DownloadManager manager at this service
*
* @param downloadManager
*/ | void setDownloadManager(DownloadManager downloadManager); |
oSoc14/Artoria | app/src/main/java/be/artoria/belfortapp/mixare/plugin/connection/MarkerServiceConnection.java | // Path: app/src/main/java/be/artoria/belfortapp/mixare/plugin/PluginConnection.java
// public abstract class PluginConnection {
//
// private PluginType pluginType;
//
// public void setPluginType(PluginType pluginType) {
// this.pluginType = pluginType;
// }
//
// public PluginType getPluginType() {
// return pluginType;
// }
//
// public String getPluginName() {
// return pluginType.getActionName();
// }
//
// protected void storeFoundPlugin(){
// PluginLoader.getInstance().addFoundPluginToMap(pluginType.toString(), this);
// }
//
// protected void storeFoundPlugin(String pluginName){
// PluginLoader.getInstance().addFoundPluginToMap(pluginName, this);
// }
// }
//
// Path: app/src/main/java/be/artoria/belfortapp/mixare/plugin/PluginNotFoundException.java
// public class PluginNotFoundException extends RuntimeException{
//
// private static final long serialVersionUID = 1L;
//
// public PluginNotFoundException() {
// super();
// }
//
// public PluginNotFoundException(Throwable throwable){
// super(throwable);
// }
//
// public PluginNotFoundException(String message) {
// super(message);
// }
//
// }
| import java.util.HashMap;
import java.util.Map;
import be.artoria.belfortapp.mixare.lib.service.IMarkerService;
import be.artoria.belfortapp.mixare.plugin.PluginConnection;
import be.artoria.belfortapp.mixare.plugin.PluginNotFoundException;
import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.RemoteException; | /*
* Copyright (C) 2012- Peer internet solutions & Finalist IT Group
*
* This file is part of be.artoria.belfortapp.mixare.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>
*/
package be.artoria.belfortapp.mixare.plugin.connection;
/**
* A service connector for the marker plugins, this class creates a IMarkerService instance
* for every loaded plugin. And stores them in a hashmap.
* @author A. Egal
*
*/
public class MarkerServiceConnection extends PluginConnection implements ServiceConnection{
private Map<String, IMarkerService> markerServices = new HashMap<String, IMarkerService>();
@Override
public void onServiceDisconnected(ComponentName name) {
markerServices.clear();
}
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
// get instance of the aidl binder
IMarkerService iMarkerService = IMarkerService.Stub
.asInterface(service);
try {
String markername = iMarkerService.getPluginName();
markerServices.put(markername, iMarkerService);
storeFoundPlugin();
} catch (RemoteException e) { | // Path: app/src/main/java/be/artoria/belfortapp/mixare/plugin/PluginConnection.java
// public abstract class PluginConnection {
//
// private PluginType pluginType;
//
// public void setPluginType(PluginType pluginType) {
// this.pluginType = pluginType;
// }
//
// public PluginType getPluginType() {
// return pluginType;
// }
//
// public String getPluginName() {
// return pluginType.getActionName();
// }
//
// protected void storeFoundPlugin(){
// PluginLoader.getInstance().addFoundPluginToMap(pluginType.toString(), this);
// }
//
// protected void storeFoundPlugin(String pluginName){
// PluginLoader.getInstance().addFoundPluginToMap(pluginName, this);
// }
// }
//
// Path: app/src/main/java/be/artoria/belfortapp/mixare/plugin/PluginNotFoundException.java
// public class PluginNotFoundException extends RuntimeException{
//
// private static final long serialVersionUID = 1L;
//
// public PluginNotFoundException() {
// super();
// }
//
// public PluginNotFoundException(Throwable throwable){
// super(throwable);
// }
//
// public PluginNotFoundException(String message) {
// super(message);
// }
//
// }
// Path: app/src/main/java/be/artoria/belfortapp/mixare/plugin/connection/MarkerServiceConnection.java
import java.util.HashMap;
import java.util.Map;
import be.artoria.belfortapp.mixare.lib.service.IMarkerService;
import be.artoria.belfortapp.mixare.plugin.PluginConnection;
import be.artoria.belfortapp.mixare.plugin.PluginNotFoundException;
import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.RemoteException;
/*
* Copyright (C) 2012- Peer internet solutions & Finalist IT Group
*
* This file is part of be.artoria.belfortapp.mixare.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>
*/
package be.artoria.belfortapp.mixare.plugin.connection;
/**
* A service connector for the marker plugins, this class creates a IMarkerService instance
* for every loaded plugin. And stores them in a hashmap.
* @author A. Egal
*
*/
public class MarkerServiceConnection extends PluginConnection implements ServiceConnection{
private Map<String, IMarkerService> markerServices = new HashMap<String, IMarkerService>();
@Override
public void onServiceDisconnected(ComponentName name) {
markerServices.clear();
}
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
// get instance of the aidl binder
IMarkerService iMarkerService = IMarkerService.Stub
.asInterface(service);
try {
String markername = iMarkerService.getPluginName();
markerServices.put(markername, iMarkerService);
storeFoundPlugin();
} catch (RemoteException e) { | throw new PluginNotFoundException(e); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.