blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
66357c54dcc2f84835e7974c9763a18814a7103d | 97287c448893bb1b068e7dff5da61a4500684e09 | /java/apuestas_backend/core/src/main/java/com/devonfw/application/apuestas_backend/usuariomejoramanagement/dataaccess/api/repo/UsuarioMejoraRepository.java | 2e7f74c66f97eea9fd6fa9df4fd2d81802b07037 | [] | no_license | msuarezcabello/apuestas_backend | a715d21e8e2f24b494b80559f69d05251d1a966f | 2c228c01824dcff1d902bb3d8b3e6d667046f6ee | refs/heads/master | 2020-04-19T04:24:17.047395 | 2019-02-11T11:51:21 | 2019-02-11T11:51:21 | 167,961,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,881 | java | package com.devonfw.application.apuestas_backend.usuariomejoramanagement.dataaccess.api.repo;
import static com.querydsl.core.alias.Alias.$;
import java.util.Iterator;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Order;
import com.devonfw.application.apuestas_backend.usuariomejoramanagement.dataaccess.api.UsuarioMejoraEntity;
import com.devonfw.application.apuestas_backend.usuariomejoramanagement.logic.api.to.UsuarioMejoraSearchCriteriaTo;
import com.devonfw.module.jpa.dataaccess.api.QueryUtil;
import com.devonfw.module.jpa.dataaccess.api.data.DefaultRepository;
import com.querydsl.jpa.impl.JPAQuery;
/**
* {@link DefaultRepository} for {@link UsuarioMejoraEntity}
*/
public interface UsuarioMejoraRepository extends DefaultRepository<UsuarioMejoraEntity> {
/**
* @param criteria the {@link UsuarioMejoraSearchCriteriaTo} with the
* criteria to search.
* @param pageRequest {@link Pageable} implementation used to set page
* properties like page size
* @return the {@link Page} of the {@link UsuarioMejoraEntity} objects that
* matched the search.
*/
default Page<UsuarioMejoraEntity> findByCriteria(UsuarioMejoraSearchCriteriaTo criteria) {
UsuarioMejoraEntity alias = newDslAlias();
JPAQuery<UsuarioMejoraEntity> query = newDslQuery(alias);
Long usuario = criteria.getUsuarioId();
if (usuario != null) {
query.where($(alias.getUsuario().getId()).eq(usuario));
}
Long mejora = criteria.getMejoraId();
if (mejora != null) {
query.where($(alias.getMejora().getId()).eq(mejora));
}
addOrderBy(query, alias, criteria.getPageable().getSort());
return QueryUtil.get().findPaginated(criteria.getPageable(), query, true);
}
/**
* Add sorting to the given query on the given alias
*
* @param query to add sorting to
* @param alias to retrieve columns from for sorting
* @param sort specification of sorting
*/
public default void addOrderBy(JPAQuery<UsuarioMejoraEntity> query, UsuarioMejoraEntity alias, Sort sort) {
if (sort != null && sort.isSorted()) {
Iterator<Order> it = sort.iterator();
while (it.hasNext()) {
Order next = it.next();
switch (next.getProperty()) {
case "usuario":
if (next.isAscending()) {
query.orderBy($(alias.getUsuario().getId()).asc());
} else {
query.orderBy($(alias.getUsuario().getId()).desc());
}
break;
case "mejora":
if (next.isAscending()) {
query.orderBy($(alias.getMejora().getId()).asc());
} else {
query.orderBy($(alias.getMejora().getId()).desc());
}
break;
default:
throw new IllegalArgumentException("Sorted by the unknown property '" + next.getProperty() + "'");
}
}
}
}
} | [
"mauricio-jhonatan.suarez-cabello-external@capgemini.com"
] | mauricio-jhonatan.suarez-cabello-external@capgemini.com |
0ecfd82ea238149e6d649b2c590fe175f67cbe30 | 07897bca97ad53917a65c6b53d8de2fda99cf300 | /src/test/java/com/sonyericsson/hudson/plugins/multislaveconfigplugin/NodeManageLinkTest.java | 05628a9851a1a77f163fc3ffd93cfa2ab86035ac | [
"MIT"
] | permissive | phiamo/multi-slave-config-plugin | 2f44a62eb7a25abffeff80c939dad066d2b077b6 | a674f8ca68464d5b11de7cc0af36cab40bee4374 | refs/heads/master | 2021-01-15T20:52:27.107692 | 2011-09-22T08:01:19 | 2011-09-22T08:01:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,636 | java | /*
* The MIT License
*
* Copyright 2011 Sony Ericsson Mobile Communications. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.sonyericsson.hudson.plugins.multislaveconfigplugin;
import antlr.ANTLRException;
import hudson.model.Failure;
import hudson.model.Hudson;
import hudson.model.Node;
import hudson.os.windows.ManagedWindowsServiceLauncher;
import hudson.slaves.CommandLauncher;
import hudson.slaves.DumbSlave;
import hudson.slaves.JNLPLauncher;
import hudson.slaves.RetentionStrategy;
import hudson.slaves.SimpleScheduledRetentionStrategy;
import net.sf.json.JSONObject;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import javax.servlet.ServletException;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import static com.sonyericsson.hudson.plugins.multislaveconfigplugin.NodeManageLink.ICON;
import static com.sonyericsson.hudson.plugins.multislaveconfigplugin.NodeManageLink.URL;
import static com.sonyericsson.hudson.plugins.multislaveconfigplugin.NodeManageLink.UserMode.*;
import static org.junit.Assert.*;
import static org.powermock.api.mockito.PowerMockito.*;
/**
* Tests the {@link NodeManageLink} using JUnit Tests.
* @author Nicklas Nilsson <nicklas3.nilsson@sonyericsson.com>
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({ DumbSlave.class, Hudson.class, StaplerRequest.class, HttpSession.class, JSONObject.class,
Stapler.class })
public class NodeManageLinkTest {
private DumbSlave dumbSlaveMock;
private Hudson hudsonMock;
private NodeManageLink nodeManageLink;
private StaplerRequest staplerRequestMock;
private HttpSession httpSessionMock;
private StaplerResponse staplerResponse;
private JSONObject jsonObjectMock;
private Stapler staplerMock;
private HashSet<String> names;
/**
* Adds a configured DumbSlave for Jenkins before starting the tests.
* Also creates a dummy JSON object that has potential search strings.
* @throws ServletException if so.
*/
@Before
public void setup() throws ServletException {
names = new HashSet<String>();
nodeManageLink = new NodeManageLink();
//DumbSlave mock
dumbSlaveMock = PowerMockito.mock(DumbSlave.class);
when(dumbSlaveMock.getNodeName()).thenReturn("TestSlave");
when(dumbSlaveMock.getNodeDescription()).thenReturn("This is the description");
when(dumbSlaveMock.getRemoteFS()).thenReturn("/jenkins/root");
when(dumbSlaveMock.getNumExecutors()).thenReturn(1);
when(dumbSlaveMock.getLabelString()).thenReturn("BUILDNODE");
//JSON mock
jsonObjectMock = mock(JSONObject.class);
//Hudson instance mock
hudsonMock = mock(Hudson.class);
mockStatic(Hudson.class);
when(Hudson.getInstance()).thenReturn(hudsonMock);
when(hudsonMock.getNodes()).thenReturn(Collections.<Node>singletonList(dumbSlaveMock));
//HTTP Session mock
httpSessionMock = mock(HttpSession.class);
when(httpSessionMock.getId()).thenReturn("currentUserId");
//StaplerRequest mock
staplerRequestMock = mock(StaplerRequest.class);
when(staplerRequestMock.getSession()).thenReturn(httpSessionMock);
when(staplerRequestMock.getSubmittedForm()).thenReturn(jsonObjectMock);
//Stapler mock
staplerMock = mock(Stapler.class);
mockStatic(Stapler.class);
when(Stapler.getCurrentRequest()).thenReturn(staplerRequestMock);
//StaplerResponse mock
staplerResponse = mock(StaplerResponse.class);
}
/**
* Tests {@link com.sonyericsson.hudson.plugins.multislaveconfigplugin.NodeManageLink#getIconFileName()}.
* Checks that the returned icon is correct.
*/
@Test
public void testGetIconFileName() {
assertEquals(ICON, nodeManageLink.getIconFileName());
}
/**
* Tests {@link com.sonyericsson.hudson.plugins.multislaveconfigplugin.NodeManageLink#getUrlName()}.
* Checks that the returned URL is correct.
*/
@Test
public void testGetUrlName() {
assertEquals(URL, nodeManageLink.getUrlName());
}
/**
* Tests {@link com.sonyericsson.hudson.plugins.multislaveconfigplugin.NodeManageLink#getDisplayName()}.
* Checks that the returned display name is correct.
*/
@Test
public void testGetDisplayName() {
assertEquals(Messages.Name(), nodeManageLink.getDisplayName());
}
/**
* Tests {@link com.sonyericsson.hudson.plugins.multislaveconfigplugin.NodeManageLink#getDescription()}.
* Checks that the returned description is correct.
*/
@Test
public void testGetDescription() {
assertEquals(Messages.Description(), nodeManageLink.getDescription());
}
/**
* Tests {@link com.sonyericsson.hudson.plugins.multislaveconfigplugin.NodeManageLink#isConfigureMode()}.
* Checks that IsConfigureMode returns true when userMode is set to configure.
*/
@Test
public void testIsConfigureMode() {
nodeManageLink.userMode.put("currentUserId", CONFIGURE);
assertTrue(nodeManageLink.isConfigureMode());
}
/**
* Tests {@link com.sonyericsson.hudson.plugins.multislaveconfigplugin.NodeManageLink#isConfigureMode()}.
* Checks that IsConfigureMode returns false when userMode is set to anything but configure.
*/
@Test
public void testIsConfigureModeFalse() {
nodeManageLink.userMode.put("currentUserId", DELETE);
assertFalse(nodeManageLink.isConfigureMode());
}
/**
* Tests {@link com.sonyericsson.hudson.plugins.multislaveconfigplugin.NodeManageLink#isDeleteMode()}.
* Checks that isDeleteMode returns true when userMode is set to delete.
*/
@Test
public void testIsDeleteMode() {
nodeManageLink.userMode.put("currentUserId", DELETE);
assertTrue(nodeManageLink.isDeleteMode());
}
/**
* Tests {@link com.sonyericsson.hudson.plugins.multislaveconfigplugin.NodeManageLink#isDeleteMode()}.
* Checks that IsDeleteMode returns false when userMode is set to anything but delete.
*/
@Test
public void testIsDeleteModeFalse() {
nodeManageLink.userMode.put("currentUserId", CONFIGURE);
assertFalse(nodeManageLink.isDeleteMode());
}
/**
* Tests {@link NodeManageLink#generateStars(int)}.
* Checks that the right amount of stars is generated, and that it only is stars.
*/
@Test
public void testGenerateStars() {
final int testNumber = 3;
String stars = nodeManageLink.generateStars(testNumber);
assertEquals(stars, "***");
}
/**
* Tests {@link NodeManageLink.UserMode}.
* Check that you can set the usermode configure to a user.
*/
@Test
public void testPutUserModeConfigure() {
nodeManageLink.userMode.put("currentUserId", CONFIGURE);
assertEquals(nodeManageLink.userMode.get("currentUserId"), CONFIGURE);
}
/**
* Tests {@link NodeManageLink.UserMode}.
* Check that you can set the usermode delete to a user.
*/
@Test
public void testPutUserModeDelete() {
nodeManageLink.userMode.put("currentUserId", DELETE);
assertEquals(nodeManageLink.userMode.get("currentUserId"), DELETE);
}
/**
* Tests {@link NodeManageLink.UserMode}.
* Check that you can set the usermode add to a user.
*/
@Test
public void testPutUserModeAdd() {
nodeManageLink.userMode.put("currentUserId", ADD);
assertEquals(nodeManageLink.userMode.get("currentUserId"), ADD);
}
/**
* Tests {@link NodeManageLink#doSearch(String, net.sf.json.JSONObject)}.
* Checks that a hudson Failure is being thrown when redirecting without having any slaves in the system and
* usermode is configure.
* @throws IOException if so.
*/
@Test (expected = Failure.class)
public void testDoSearchRedirectTestEmptyList() throws IOException {
nodeManageLink.userMode.put("currentUserId", CONFIGURE);
when(hudsonMock.getNodes()).thenReturn(Collections.<Node>emptyList());
nodeManageLink.doConfigureRedirect(staplerRequestMock, staplerResponse);
}
/**
* Tests {@link NodeManageLink#doDeleteRedirect
* (org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse)}.
* Checks that a hudson Failure is being thrown when redirecting without having any slaves in the system and
* usermode is delete.
* @throws IOException if so.
*/
@Test (expected = Failure.class)
public void testDoDeleteRedirectEmptyList() throws IOException {
nodeManageLink.userMode.put("currentUserId", DELETE);
when(hudsonMock.getNodes()).thenReturn(Collections.<Node>emptyList());
nodeManageLink.doDeleteRedirect(staplerRequestMock, staplerResponse);
}
/**
* Tests {@link NodeManageLink#getNodeList(String)}.
* Checks that nothing is returned when trying to get a NodeList that not exist.
*/
@Test
public void testGetNodeList() {
assertNull(nodeManageLink.getNodeList("differentUserId"));
}
/**
* Tests {@link NodeManageLink#getSlaveNames(String, String, String, String)}.
* Test with null nodeNames string parameter.
*/
@Test
public void testGetSlaveNamesNullSlaveNames() {
names = nodeManageLink.getSlaveNames(null, "name", "0", "1");
assertEquals(2, names.size());
assertTrue(names.contains("name0"));
assertTrue(names.contains("name1"));
}
/**
* Tests {@link NodeManageLink#getSlaveNames(String, String, String, String)}.
* Test with null nodeName, first and last string parameters.
*/
@Test
public void testGetSlaveNamesNullNodeName() {
names = nodeManageLink.getSlaveNames("Slave Slave2", null, null, null);
assertEquals(2, names.size());
assertTrue(names.contains("Slave"));
assertTrue(names.contains("Slave2"));
}
/**
* Tests {@link NodeManageLink#getSlaveNames(String, String, String, String)}.
* Test with non digit string parameter. Shall throw failure.
*/
@Test (expected = Failure.class)
public void testGetSlaveNamesNotANumber() {
names = nodeManageLink.getSlaveNames("Slave Slave2", "Slave", "Non digit", "Non digit");
}
/**
* Tests {@link NodeManageLink#getSlaveNames(String, String, String, String)}.
* Shall throw failure when first int is bigger than last int.
*/
@Test (expected = Failure.class)
public void testGetSlaveNamesWrongIntervalSpan() {
names = nodeManageLink.getSlaveNames("", "Slave", "5", "1");
}
/**
* Tests {@link NodeManageLink#getSlaveNames(String, String, String, String)}.
* Shall throw failure when you try to add a slave with the same name as one that already exist.
*/
@Test (expected = Failure.class)
public void testGetSlaveNamesExistingNodeName() {
when(hudsonMock.getNode("TestSlave")).thenReturn(dumbSlaveMock);
names = nodeManageLink.getSlaveNames("TestSlave", "Slave", "1", "5");
}
/**
* Tests{@link NodeManageLink#isManagedWindowsServiceLauncher(hudson.slaves.ComputerLauncher)}.
* Testing that a ManagedWindowsServiceLauncher makes this method return true.
*/
@Test
public void testIsManagedWindowsServiceLauncher() {
assertTrue(nodeManageLink.isManagedWindowsServiceLauncher(new ManagedWindowsServiceLauncher("", "")));
}
/**
* Tests{@link NodeManageLink#isCommandLauncher(hudson.slaves.ComputerLauncher)}.
* Testing that a CommandLauncher makes this method return true.
*/
@Test
public void testIsCommandLauncher() {
assertTrue(nodeManageLink.isCommandLauncher(new CommandLauncher("")));
}
/**
* Tests{@link NodeManageLink#isJNLPLauncher(hudson.slaves.ComputerLauncher)}.
* Testing that a JNLPLauncher makes this method return true.
*/
@Test
public void testIsJNLPLauncher() {
assertTrue(nodeManageLink.isJNLPLauncher(new JNLPLauncher("", "")));
}
/**
* Tests{@link NodeManageLink#isRetentionStrategyAlways(hudson.slaves.RetentionStrategy)}.
* Testing that a RetentionStrategy with mode always makes this method return true.
*/
@Test
public void testIsRetentionStrategyAlways() {
assertTrue(nodeManageLink.isRetentionStrategyAlways(new RetentionStrategy.Always()));
}
/**
* Tests{@link NodeManageLink#isRetentionStrategyDemand(hudson.slaves.RetentionStrategy)}.
* Testing that a RetentionStrategy with mode demand makes this method return true.
*/
@Test
public void testIsRetentionStrategyDemand() {
assertTrue(nodeManageLink.isRetentionStrategyDemand(new RetentionStrategy.Demand(1, 2)));
}
/**
* Tests{@link NodeManageLink#isRetentionStrategyDemand(hudson.slaves.RetentionStrategy)}.
* Testing that a SimpleScheduledRetentionStrategy makes this method return true.
* @throws ANTLRException if so.
*/
@Test
public void testIsSimpleScheduledRetentionStrategy() throws ANTLRException {
assertTrue(nodeManageLink.isSimpleScheduledRetentionStrategy(
new SimpleScheduledRetentionStrategy("", 1, true)));
}
/**
* Tests{@link com.sonyericsson.hudson.plugins.multislaveconfigplugin.NodeManageLink#getAllNodes()} )}.
* Shall return all slaves in the system, currently one.
*/
@Test
public void testGetAllNodes() {
assertEquals(1, nodeManageLink.getAllNodes().size());
}
/**
* Tests{@link NodeManageLink#doSelectSlaves
* (org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse)} .
* Tests that this method throws a failure when get("selectedSlaves") return null.
* @throws IOException if so.
*/
@Test (expected = Failure.class)
public void testDoSelectNodesJsonNull() throws IOException {
when(jsonObjectMock.get("selectedSlaves")).thenReturn(null);
nodeManageLink.doSelectSlaves(staplerRequestMock, staplerResponse);
}
}
| [
"robert.sandell@sonyericsson.com"
] | robert.sandell@sonyericsson.com |
f67fee82bb5c560bad341ad4f5eb5153782132f6 | b0b0cfd53372631734c2bbf06efc5f09e31872b9 | /PenticHealthMonitor/com/csci360/healthmonitor/GUI/sceneCaloriesTodayController.java | 164f753934ea0a30296975cbf100fdd31a6b0d11 | [] | no_license | divine0enigma/CSCI-360 | a2c6d073f49b418e45d7f6df393264c388e257a3 | 99090da5a7684a69ec0933ea4fb74024b8f18bdb | refs/heads/master | 2021-01-20T21:19:30.521965 | 2018-06-14T16:14:34 | 2018-06-14T16:14:34 | 101,763,806 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | package GUI;
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.util.Duration;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
/**
* W. Scott Palmer II
* 11/22/2017
*/
public class sceneCaloriesTodayController extends guiNavigation {
@FXML
Label CaloriesDisplay;
@FXML
public void initialize(){
int stepsToday = SYS.StepData.stepsToday();
int fileNumber = SYS.StepFile.getCurrentFile();
Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(0),
e -> CaloriesDisplay.setText("Calories = " + SYS.CalorieCalculator.calculateCalories(fileNumber))),
new KeyFrame((Duration.seconds(1))));
timeline.setCycleCount((Animation.INDEFINITE));
timeline.play();
}
}
| [
"divine0enigma@gmail.com"
] | divine0enigma@gmail.com |
b6de899bebbee1d777700b70422e99888c5defbb | 3fe51916bfd4bc9958202ad12aecc73ddb44e7f4 | /main/tags/mxlib-app-support-1.1.1/src/main/java/net/matrix/app/DefaultSystemContext.java | 26961e7c291e90b00ce10f2920872f4b69162b2c | [] | no_license | tweea/matrixjavalib-history | c06d4a69cba4fca45a6514b886b9d9e5d3b301a2 | f41412e99f661531740b49dc12a1e175e072abde | refs/heads/master | 2016-09-05T15:09:25.169446 | 2014-06-03T11:43:22 | 2014-06-03T11:43:22 | 25,458,119 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,379 | java | /*
* $Id$
* Copyright(C) 2008 Matrix
* All right reserved.
*/
package net.matrix.app;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
/**
* 默认的系统环境。
*/
public class DefaultSystemContext
implements SystemContext {
private static final Logger LOG = LoggerFactory.getLogger(DefaultSystemContext.class);
private ResourceLoader resourceLoader;
private ResourcePatternResolver resourceResolver;
private Configuration config;
private Map<String, Object> objects;
private SystemController controller;
public DefaultSystemContext() {
objects = new HashMap<String, Object>();
}
@Override
public void setResourceLoader(ResourceLoader loader) {
resourceLoader = loader;
}
@Override
public ResourceLoader getResourceLoader() {
if (resourceLoader == null) {
resourceLoader = new DefaultResourceLoader();
}
return resourceLoader;
}
@Override
public ResourcePatternResolver getResourcePatternResolver() {
if (resourceResolver == null) {
if (getResourceLoader() instanceof ResourcePatternResolver) {
resourceResolver = (ResourcePatternResolver) getResourceLoader();
} else {
resourceResolver = new PathMatchingResourcePatternResolver(getResourceLoader());
}
}
return resourceResolver;
}
@Override
public void setConfig(Configuration config) {
this.config = config;
}
@Override
public Configuration getConfig() {
// 尝试加载默认位置
if (config == null) {
LOG.info("加载默认配置");
Resource resource = getResourceLoader().getResource("classpath:sysconfig.cfg");
try {
config = new PropertiesConfiguration(resource.getURL());
} catch (IOException e) {
throw new RuntimeException("sysconfig.cfg 加载失败", e);
} catch (ConfigurationException e) {
throw new RuntimeException("sysconfig.cfg 加载失败", e);
}
}
return config;
}
@Override
public void registerObject(String name, Object object) {
objects.put(name, object);
}
@Override
public <T> void registerObject(Class<T> type, T object) {
registerObject(type.getName(), object);
}
@Override
public Object lookupObject(String name) {
return objects.get(name);
}
@Override
public <T> T lookupObject(String name, Class<T> type) {
return type.cast(lookupObject(name));
}
@Override
public <T> T lookupObject(Class<T> type) {
return lookupObject(type.getName(), type);
}
@Override
public void setController(SystemController controller) {
this.controller = controller;
}
@Override
public SystemController getController() {
if (controller == null) {
controller = new DefaultSystemController();
controller.setContext(this);
}
return controller;
}
}
| [
"tweea@263.net"
] | tweea@263.net |
e23bb3870a6805ba3c9f9adb295244537e4607c9 | 0fa737878c2ade9d1b0bcdd11ba5e9943a577a83 | /2020_0407_2일차/자료형_정수형.java | 80415beac519a15ac9d6c82a5855da9f6a79c6dd | [] | no_license | k10j29/jinhan_javachip | 4c7f01954030b7df8ee2061994085630100692a4 | f5eb5c4096427ef2bc0afe9a11403a90efe3878b | refs/heads/master | 2022-08-30T09:16:14.899720 | 2020-05-25T09:24:26 | 2020-05-25T09:24:26 | 260,416,747 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,595 | java | class 자료형_정수형
{
public static void main(String[] args)
{
//정수 : 소숫점이 없는 수(byte,short,int,long)
//기본형: 0(int) 0L(long)
//상수 : 1 100 0 <= 10진수
// 0144 <= 8진수
// 0x64 <= 16진수
// cf)16진의 값 표현:0~15까지 표현
// 0~9 10 11 12 13 14 15
// a b c d e f
// 0xf => 15
//출력서식: %d (decimal:10진수)
// %o (octal:8진수)
// %x (hexa:16진수)
int n = 100;
// 1 2 1 2
System.out.printf("10진수 %d는 16진수 %x입니다\n",n,n);
int m = 0x64;
System.out.printf("16진수 %x는 10진수 %d입니다\n",m,m);
int o = 0144;
System.out.printf("8진수 %o는 10진수 %d입니다\n",o,o);
n = 0xff;//16진수 1자리가 2진수 4자리
// f f
// 1111 1111
System.out.println(n);
byte b1 = 100;
System.out.printf("b1's value=%d\n",b1);
//b1 = 128;(X)
System.out.println("---각 자료형별 사용 범위---");
System.out.printf("byte : %d~%d\n",
Byte.MIN_VALUE,
Byte.MAX_VALUE);
System.out.printf("short : %d~%d\n",
Short.MIN_VALUE,
Short.MAX_VALUE);
System.out.printf("int : %d~%d\n",
Integer.MIN_VALUE,
Integer.MAX_VALUE);
System.out.printf("long : %d~%d\n",
Long.MIN_VALUE,
Long.MAX_VALUE);
}
}
| [
"63346479+k10j29@users.noreply.github.com"
] | 63346479+k10j29@users.noreply.github.com |
d4fa8ee83e429876cd7634cb5f71bf3c04c8a260 | 7777313a1e28d9d0d04610ee3cee6f04e501ab17 | /app/src/main/java/social/application/mainpage/Secondary.java | e266392fcb469e3ea3c7dcd475c95a67286a2c01 | [] | no_license | walidnoori/SocialApp2.0 | 742dfdab9b56170e952cf86102ea5a653f49440b | 5751c517d3e6def8f6a45fc4f330522cb284cbf0 | refs/heads/master | 2020-03-17T15:30:44.854230 | 2018-06-02T11:10:44 | 2018-06-02T11:10:44 | 133,713,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,127 | java | package social.application.mainpage;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import pl.droidsonroids.gif.GifImageView;
import social.application.R;
public class Secondary extends AppCompatActivity {
GifImageView gifImageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_secondary);
/* ImageView imageView = (ImageView)findViewById(R.id.gif_imageview);
// load with glide
Glide.with(this)
.load(R.drawable.giphy)
.asGif() // load image
.placeholder(R.drawable.giphy)
.crossFade()
.into(imageView);
*/
}
}
| [
"naziribrar@gmailcom"
] | naziribrar@gmailcom |
36c3d471202fdd2591b6407bd04fda36a0863459 | 5fa271a04027b1f7ce10dce7debbfb338a9bd7c5 | /workspace/PSTViewr/src/PSTViewer/ComPort.java | 26fae82658b41e38a4cd9b831adc7718a1e2638c | [] | no_license | Mj82GitHub/My_Java_SRC | b36133a3435f9c776276de287ff757102648560b | fa470f7166403af1ca32b25a3389872aaddbe5c8 | refs/heads/master | 2020-04-12T22:18:27.291903 | 2019-06-05T10:58:05 | 2019-06-05T10:58:05 | 162,275,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,887 | java | package PSTViewer;
import jssc.SerialPort;
import jssc.SerialPortException;
import jssc.SerialPortList;
public class ComPort {
private SerialPort mPort;
private EventListener mEventListener; // Слушатель порта
private Controller mController;
private WorkThread mWorkThread; // Поток запросов
private String mComName; // Имя порта при обнаружении
private boolean isFirstCheck = false; // При запуске была проведена проверка портов
public ComPort(Controller controller) {
mController = controller;
mEventListener = new EventListener();
}
/**
* До запуска опртса проверяет наличие активных портов.
*
* @return TRUE, если есть порты, иначе - FALSE
*/
public boolean checkPortNames() {
String [] portNames = SerialPortList.getPortNames();
if (portNames.length == 0) {
mController.setSplitMenu(portNames);
System.out.println("COM порты не обнаружены.");
} else {
mController.setSplitMenu(portNames);
System.out.println("Обнаружены COM порты: " + portNames[0]);
return true;
}
return false;
}
public void initPort() {
mWorkThread = new WorkThread(this, mEventListener, mController);
mPort = new SerialPort(mComName);
try {
mPort.openPort();
mPort.setParams(
SerialPort.BAUDRATE_9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
mPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
mPort.setEventsMask(SerialPort.MASK_RXCHAR);
mPort.addEventListener(mEventListener);
mWorkThread.startThread();
mEventListener.setPort(mPort);
mEventListener.setmWorkThread(mWorkThread);
// mController.setWorkThread(mWorkThread);
} catch (SerialPortException e) {
System.out.println("Не удалось открыть порт.");
e.printStackTrace();
}
}
/**
* Устанавливает имя рабочего порта.
* @param name
*/
public void setComName(String name) {
mComName = name;
}
public String getComName() {
return mComName;
}
/**
* Отправляет символ в виде байта в ПСТ (запрос).
*
* @param word символ запроса в виде байта
* @return TRUE, если запрос прошел успешно, иначе - FALSE
*/
public boolean sendWord(byte word) {
if (mPort.isOpened()) {
try {
return mPort.writeByte(word);
} catch (SerialPortException e) {
e.printStackTrace();
}
}
return false;
}
/**
* Отанавливает поток запросов и закрывает СОМ порт.
*/
public void closeComPort() {
try {
if (mWorkThread != null) {
mWorkThread.stopThread();
mWorkThread = null;
}
if (mPort!= null) {
if (mPort.isOpened()) {
mPort.closePort();
mPort = null;
}
}
} catch (SerialPortException e) {
e.printStackTrace();
}
}
public SerialPort getPort() {
return mPort;
}
public boolean isFirstCheck() {
return isFirstCheck;
}
public void setFirstCheck(boolean firstCheck) {
isFirstCheck = firstCheck;
}
}
| [
"mj82@yandex.ru"
] | mj82@yandex.ru |
8689eaa0aab98968918b3b7e39a7ab82111d89f8 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/30/30_6f6f1c8048496aee0ee422c32496b0eae83d168c/EnergyPanel/30_6f6f1c8048496aee0ee422c32496b0eae83d168c_EnergyPanel_s.java | d2fa8f9ee8c9d6d4a9af6cb2324e57ec1773608d | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 85,913 | java | package org.concord.energy3d.gui;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.HierarchyBoundsAdapter;
import java.awt.event.HierarchyEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.embed.swing.JFXPanel;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.StackedBarChart;
import javafx.scene.chart.XYChart;
import javafx.scene.layout.GridPane;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JSlider;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerDateModel;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.concord.energy3d.model.Door;
import org.concord.energy3d.model.Floor;
import org.concord.energy3d.model.Foundation;
import org.concord.energy3d.model.HousePart;
import org.concord.energy3d.model.Roof;
import org.concord.energy3d.model.SolarPanel;
import org.concord.energy3d.model.Wall;
import org.concord.energy3d.model.Window;
import org.concord.energy3d.scene.Scene;
import org.concord.energy3d.scene.SceneManager;
import org.concord.energy3d.shapes.Heliodon;
import org.concord.energy3d.util.Config;
import org.concord.energy3d.util.Util;
import org.poly2tri.geometry.primitives.Point;
import org.poly2tri.transform.coordinate.AnyToXYTransform;
import org.poly2tri.transform.coordinate.XYToAnyTransform;
import org.poly2tri.triangulation.point.TPoint;
import com.ardor3d.image.Image;
import com.ardor3d.image.ImageDataFormat;
import com.ardor3d.image.PixelDataType;
import com.ardor3d.image.Texture.MinificationFilter;
import com.ardor3d.image.Texture2D;
import com.ardor3d.intersection.PickResults;
import com.ardor3d.intersection.PickingUtil;
import com.ardor3d.intersection.PrimitivePickResults;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Ray3;
import com.ardor3d.math.Vector2;
import com.ardor3d.math.Vector3;
import com.ardor3d.math.type.ReadOnlyColorRGBA;
import com.ardor3d.math.type.ReadOnlyVector2;
import com.ardor3d.math.type.ReadOnlyVector3;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.Spatial;
import com.ardor3d.util.TextureKey;
import com.ardor3d.util.geom.BufferUtils;
public class EnergyPanel extends JPanel {
public static final ReadOnlyColorRGBA[] solarColors = { ColorRGBA.BLUE, ColorRGBA.GREEN, ColorRGBA.YELLOW, ColorRGBA.RED };
private double solarStep = 2.0;
private static final int SOLAR_MINUTE_STEP = 15;
private static final double COST_PER_KWH = 0.13;
private static final long serialVersionUID = 1L;
private static final Map<String, Integer> cityLatitute = new HashMap<String, Integer>();
private static final Map<String, int[]> avgMonthlyLowTemperatures = new HashMap<String, int[]>();
private static final Map<String, int[]> avgMonthlyHighTemperatures = new HashMap<String, int[]>();
private static final EnergyPanel instance = new EnergyPanel();
private static final DecimalFormat twoDecimals = new DecimalFormat();
private static final DecimalFormat noDecimals = new DecimalFormat();
private static final DecimalFormat moneyDecimals = new DecimalFormat();
private static final RuntimeException cancelException = new RuntimeException("CANCEL");
private static boolean keepHeatmapOn = false;
public enum UpdateRadiation {
ALWAYS, NEVER, ONLY_IF_SLECTED_IN_GUI
};
static {
twoDecimals.setMaximumFractionDigits(2);
noDecimals.setMaximumFractionDigits(0);
moneyDecimals.setMaximumFractionDigits(0);
cityLatitute.put("Moscow", 55);
cityLatitute.put("Ottawa", 45);
cityLatitute.put("Boston", 42);
cityLatitute.put("Beijing", 39);
cityLatitute.put("Washington DC", 38);
cityLatitute.put("Tehran", 35);
cityLatitute.put("Los Angeles", 34);
cityLatitute.put("Miami", 25);
cityLatitute.put("Mexico City", 19);
cityLatitute.put("Singapore", 1);
cityLatitute.put("Sydney", -33);
cityLatitute.put("Buenos Aires", -34);
avgMonthlyLowTemperatures.put("Boston", new int[] { -6, -4, -1, 5, 10, 16, 18, 18, 14, 8, 3, -2 });
avgMonthlyHighTemperatures.put("Boston", new int[] { 2, 4, 7, 13, 19, 24, 28, 27, 22, 16, 11, 5 });
avgMonthlyLowTemperatures.put("Moscow", new int[] { -14, -14, -9, 0, 6, 10, 13, 11, 6, 1, -5, -10 });
avgMonthlyHighTemperatures.put("Moscow", new int[] { -7, -6, 0, 9, 17, 22, 24, 22, 16, 8, 0, -5 });
avgMonthlyLowTemperatures.put("Ottawa", new int[] { -16, -14, -7, 1, 7, 12, 15, 14, 9, 3, -2, -11 });
avgMonthlyHighTemperatures.put("Ottawa", new int[] { -7, -5, 2, 11, 18, 23, 26, 24, 19, 13, 4, -4 });
avgMonthlyLowTemperatures.put("Beijing", new int[] { -9, -7, -1, 7, 13, 18, 21, 20, 14, 7, -1, -7 });
avgMonthlyHighTemperatures.put("Beijing", new int[] { 1, 4, 11, 19, 26, 30, 31, 29, 26, 19, 10, 3 });
avgMonthlyLowTemperatures.put("Washington DC", new int[] { -2, -1, 3, 8, 13, 19, 22, 21, 17, 11, 5, 1 });
avgMonthlyHighTemperatures.put("Washington DC", new int[] { 6, 8, 13, 19, 24, 29, 32, 31, 27, 30, 14, 8 });
avgMonthlyLowTemperatures.put("Tehran", new int[] { 1, 3, 7, 13, 17, 22, 25, 25, 21, 15, 8, 3 });
avgMonthlyHighTemperatures.put("Tehran", new int[] { 8, 11, 16, 23, 28, 34, 37, 36, 32, 25, 16, 10 });
avgMonthlyLowTemperatures.put("Los Angeles", new int[] { 9, 9, 11, 12, 14, 16, 18, 18, 17, 15, 11, 8 });
avgMonthlyHighTemperatures.put("Los Angeles", new int[] { 20, 21, 21, 23, 23, 26, 28, 29, 28, 26, 23, 20 });
avgMonthlyLowTemperatures.put("Miami", new int[] { 16, 17, 18, 21, 23, 25, 26, 26, 26, 24, 21, 18 });
avgMonthlyHighTemperatures.put("Miami", new int[] { 23, 24, 24, 26, 28, 31, 31, 32, 31, 29, 26, 24 });
avgMonthlyLowTemperatures.put("Mexico City", new int[] { 6, 7, 9, 11, 12, 12, 12, 12, 12, 10, 8, 7 });
avgMonthlyHighTemperatures.put("Mexico City", new int[] { 21, 23, 25, 26, 26, 24, 23, 23, 23, 22, 22, 21 });
avgMonthlyLowTemperatures.put("Singapore", new int[] { 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 23, 23 });
avgMonthlyHighTemperatures.put("Singapore", new int[] { 29, 31, 31, 32, 31, 31, 31, 31, 31, 31, 30, 29 });
avgMonthlyLowTemperatures.put("Sydney", new int[] { 19, 19, 18, 15, 12, 9, 8, 8, 11, 14, 16, 18 });
avgMonthlyHighTemperatures.put("Sydney", new int[] { 26, 26, 25, 23, 20, 17, 17, 18, 20, 22, 23, 25 });
avgMonthlyLowTemperatures.put("Buenos Aires", new int[] { 20, 19, 18, 14, 11, 8, 8, 9, 11, 13, 16, 18 });
avgMonthlyHighTemperatures.put("Buenos Aires", new int[] { 28, 27, 25, 22, 18, 15, 14, 16, 18, 21, 24, 27 });
}
private JFXPanel fxPanel;
private final XYChart.Data<String, Number> wallsAreaChartData = new XYChart.Data<String, Number>("Area", 0);
private final XYChart.Data<String, Number> windowsAreaChartData = new XYChart.Data<String, Number>("Area", 0);
private final XYChart.Data<String, Number> doorsAreaChartData = new XYChart.Data<String, Number>("Area", 0);
private final XYChart.Data<String, Number> roofsAreaChartData = new XYChart.Data<String, Number>("Area", 0);
private final XYChart.Data<String, Number> wallsEnergyChartData = new XYChart.Data<String, Number>("Energy Loss", 0);
private final XYChart.Data<String, Number> windowsEnergyChartData = new XYChart.Data<String, Number>("Energy Loss", 0);
private final XYChart.Data<String, Number> doorsEnergyChartData = new XYChart.Data<String, Number>("Energy Loss", 0);
private final XYChart.Data<String, Number> roofsEnergyChartData = new XYChart.Data<String, Number>("Energy Loss", 0);
private final JTextField heatingRateTextField;
private final JComboBox wallsComboBox;
private final JComboBox doorsComboBox;
private final JComboBox windowsComboBox;
private final JComboBox roofsComboBox;
private final JCheckBox autoCheckBox;
private final JTextField heatingYearlyTextField;
private final JTextField sunRateTextField;
private final JTextField sunTodayTextField;
private final JTextField sunYearlyTextField;
private final JTextField heatingTodayTextField;
private final JTextField coolingRateTextField;
private final JTextField coolingTodayTextField;
private final JTextField coolingYearlyTextField;
private final JTextField totalRateTextField;
private final JTextField totalTodayTextField;
private final JTextField totalYearlyTextField;
private final JTextField heatingCostTextField;
private final JTextField coolingCostTextField;
private final JTextField totalCostTextField;
private final JSpinner insideTemperatureSpinner;
private final JSpinner outsideTemperatureSpinner;
private final JLabel dateLabel;
private final JLabel timeLabel;
private final JSpinner dateSpinner;
private final JSpinner timeSpinner;
private final JComboBox cityComboBox;
private final JLabel latitudeLabel;
private final JSpinner latitudeSpinner;
private final JPanel panel_4;
private final JSlider colorMapSlider;
private final JPanel colormapPanel;
private final JLabel legendLabel;
private final JLabel contrastLabel;
private final JProgressBar progressBar;
private JTextField solarRateTextField;
private JTextField solarTodayTextField;
private JTextField solarYearlyTextField;
private final Map<Mesh, double[][]> solarOnMesh = new HashMap<Mesh, double[][]>();
private final Map<Mesh, Boolean> textureCoordsAlreadyComputed = new HashMap<Mesh, Boolean>();
private final List<Spatial> solarCollidables = new ArrayList<Spatial>();
private double[][] solarOnLand;
private Thread thread;
private double wallsArea;
private double doorsArea;
private double windowsArea;
private double roofsArea;
private double wallUFactor;
private double doorUFactor;
private double windowUFactor;
private double roofUFactor;
private long maxSolarValue;
private boolean computeRequest;
private boolean initJavaFxAlreadyCalled = false;
private boolean alreadyRenderedHeatmap = false;
private UpdateRadiation updateRadiation;
private boolean computeEnabled = true;
private final ArrayList<PropertyChangeListener> propertyChangeListeners = new ArrayList<PropertyChangeListener>();
private JPanel partPanel;
private JLabel partEnergyLabel;
private JTextField partEnergyTextField;
private JPanel buildingPanel;
private JLabel solarPotentialKWhLabel;
private JLabel lblSolarPotentialEnergy;
private JTextField houseSolarPotentialTextField;
private JLabel lblNewLabel;
private JPanel panel;
private JPanel panel_2;
private JLabel lblPosition;
private JTextField positionTextField;
private JLabel lblArea;
private JTextField areaTextField;
private JLabel lblHeight;
private JTextField heightTextField;
private JPanel panel_5;
private JLabel lblVolume;
private JTextField volumnTextField;
private JPanel allPanel;
private JLabel lblSolarPotential;
private JTextField solarPotentialAlltextField;
private JLabel lblPassiveSolar;
private JTextField passiveSolarTextField;
private JLabel lblPhotovoltaic;
private JTextField photovoltaicTextField;
private JPanel panel_7;
private JLabel lblKwh;
private JPanel panel_6;
private JPanel panel_8;
private JLabel lblWidth;
private JTextField partWidthTextField;
private JLabel lblHeight_1;
private JTextField partHeightTextField;
private static class EnergyAmount {
double solar;
double solarPanel;
double heating;
double cooling;
}
public static EnergyPanel getInstance() {
return instance;
}
private EnergyPanel() {
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.repaint();
this.paint(null);
progressBar = new JProgressBar();
add(progressBar);
final JPanel panel_3 = new JPanel();
panel_3.setBorder(new TitledBorder(null, "Time & Location", TitledBorder.LEADING, TitledBorder.TOP, null, null));
add(panel_3);
final GridBagLayout gbl_panel_3 = new GridBagLayout();
panel_3.setLayout(gbl_panel_3);
dateLabel = new JLabel("Date: ");
final GridBagConstraints gbc_dateLabel = new GridBagConstraints();
gbc_dateLabel.gridx = 0;
gbc_dateLabel.gridy = 0;
panel_3.add(dateLabel, gbc_dateLabel);
dateSpinner = new JSpinner();
dateSpinner.setModel(new SpinnerDateModel(new Date(1380427200000L), null, null, Calendar.MONTH));
dateSpinner.setEditor(new JSpinner.DateEditor(dateSpinner, "MMMM dd"));
dateSpinner.addHierarchyBoundsListener(new HierarchyBoundsAdapter() {
@Override
public void ancestorResized(final HierarchyEvent e) {
dateSpinner.setMinimumSize(dateSpinner.getPreferredSize());
dateSpinner.setPreferredSize(dateSpinner.getPreferredSize());
dateSpinner.removeHierarchyBoundsListener(this);
}
});
dateSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
boolean firstCall = true;
@Override
public void stateChanged(final javax.swing.event.ChangeEvent e) {
if (firstCall) {
firstCall = false;
return;
}
final Heliodon heliodon = Heliodon.getInstance();
if (heliodon != null)
heliodon.setDate((Date) dateSpinner.getValue());
compute(UpdateRadiation.ONLY_IF_SLECTED_IN_GUI);
Scene.getInstance().setEdited(true);
}
});
final GridBagConstraints gbc_dateSpinner = new GridBagConstraints();
gbc_dateSpinner.insets = new Insets(0, 0, 1, 1);
gbc_dateSpinner.gridx = 1;
gbc_dateSpinner.gridy = 0;
panel_3.add(dateSpinner, gbc_dateSpinner);
cityComboBox = new JComboBox();
cityComboBox.setModel(new DefaultComboBoxModel(new String[] { "", "Moscow", "Ottawa", "Boston", "Beijing", "Washington DC", "Tehran", "Los Angeles", "Miami", "Mexico City", "Singapore", "Sydney", "Buenos Aires" }));
cityComboBox.setSelectedItem("Boston");
cityComboBox.setMaximumRowCount(15);
cityComboBox.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(final java.awt.event.ActionEvent e) {
if (cityComboBox.getSelectedItem().equals(""))
compute(UpdateRadiation.ONLY_IF_SLECTED_IN_GUI);
else {
final Integer newLatitude = cityLatitute.get(cityComboBox.getSelectedItem());
if (newLatitude.equals(latitudeSpinner.getValue()))
compute(UpdateRadiation.ONLY_IF_SLECTED_IN_GUI);
else
latitudeSpinner.setValue(newLatitude);
}
Scene.getInstance().setEdited(true);
}
});
final GridBagConstraints gbc_cityComboBox = new GridBagConstraints();
gbc_cityComboBox.gridwidth = 2;
gbc_cityComboBox.fill = GridBagConstraints.HORIZONTAL;
gbc_cityComboBox.gridx = 2;
gbc_cityComboBox.gridy = 0;
panel_3.add(cityComboBox, gbc_cityComboBox);
timeLabel = new JLabel("Time: ");
final GridBagConstraints gbc_timeLabel = new GridBagConstraints();
gbc_timeLabel.gridx = 0;
gbc_timeLabel.gridy = 1;
panel_3.add(timeLabel, gbc_timeLabel);
timeSpinner = new JSpinner(new SpinnerDateModel());
timeSpinner.setEditor(new JSpinner.DateEditor(timeSpinner, "H:mm"));
timeSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
private boolean firstCall = true;
@Override
public void stateChanged(final javax.swing.event.ChangeEvent e) {
// ignore the first event
if (firstCall) {
firstCall = false;
return;
}
final Heliodon heliodon = Heliodon.getInstance();
if (heliodon != null)
heliodon.setTime((Date) timeSpinner.getValue());
compute(UpdateRadiation.NEVER);
Scene.getInstance().setEdited(true);
}
});
final GridBagConstraints gbc_timeSpinner = new GridBagConstraints();
gbc_timeSpinner.insets = new Insets(0, 0, 0, 1);
gbc_timeSpinner.fill = GridBagConstraints.HORIZONTAL;
gbc_timeSpinner.gridx = 1;
gbc_timeSpinner.gridy = 1;
panel_3.add(timeSpinner, gbc_timeSpinner);
latitudeLabel = new JLabel("Latitude: ");
final GridBagConstraints gbc_altitudeLabel = new GridBagConstraints();
gbc_altitudeLabel.insets = new Insets(0, 1, 0, 0);
gbc_altitudeLabel.gridx = 2;
gbc_altitudeLabel.gridy = 1;
panel_3.add(latitudeLabel, gbc_altitudeLabel);
latitudeSpinner = new JSpinner();
latitudeSpinner.setModel(new SpinnerNumberModel(Heliodon.DEFAULT_LATITUDE, -90, 90, 1));
latitudeSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
@Override
public void stateChanged(final javax.swing.event.ChangeEvent e) {
if (!cityComboBox.getSelectedItem().equals("") && !cityLatitute.values().contains(latitudeSpinner.getValue()))
cityComboBox.setSelectedItem("");
Heliodon.getInstance().setLatitude(((Integer) latitudeSpinner.getValue()) / 180.0 * Math.PI);
compute(UpdateRadiation.ONLY_IF_SLECTED_IN_GUI);
Scene.getInstance().setEdited(true);
}
});
final GridBagConstraints gbc_latitudeSpinner = new GridBagConstraints();
gbc_latitudeSpinner.fill = GridBagConstraints.HORIZONTAL;
gbc_latitudeSpinner.gridx = 3;
gbc_latitudeSpinner.gridy = 1;
panel_3.add(latitudeSpinner, gbc_latitudeSpinner);
panel_3.setMaximumSize(new Dimension(Integer.MAX_VALUE, panel_3.getPreferredSize().height));
panel_4 = new JPanel();
panel_4.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Solar Irradiation Heat Map", TitledBorder.LEADING, TitledBorder.TOP, null, null));
add(panel_4);
final GridBagLayout gbl_panel_4 = new GridBagLayout();
panel_4.setLayout(gbl_panel_4);
legendLabel = new JLabel("Color Scale: ");
final GridBagConstraints gbc_legendLabel = new GridBagConstraints();
gbc_legendLabel.insets = new Insets(5, 0, 0, 0);
gbc_legendLabel.anchor = GridBagConstraints.WEST;
gbc_legendLabel.gridx = 0;
gbc_legendLabel.gridy = 0;
panel_4.add(legendLabel, gbc_legendLabel);
colorMapSlider = new JSlider();
colorMapSlider.setMinimum(10);
colorMapSlider.setMaximum(90);
colorMapSlider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
if (!colorMapSlider.getValueIsAdjusting()) {
compute(SceneManager.getInstance().isSolarColorMap() ? UpdateRadiation.ALWAYS : UpdateRadiation.ONLY_IF_SLECTED_IN_GUI);
Scene.getInstance().setEdited(true, false);
}
}
});
colormapPanel = new JPanel() {
private static final long serialVersionUID = 1L;
@Override
public void paint(final Graphics g) {
final int STEP = 5;
final Dimension size = getSize();
for (int x = 0; x < size.width - STEP; x += STEP) {
final ColorRGBA color = computeSolarColor(x, size.width);
g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue()));
g.fillRect(x, 0, x + STEP, size.height);
}
}
};
final GridBagConstraints gbc_colormapPanel = new GridBagConstraints();
gbc_colormapPanel.fill = GridBagConstraints.HORIZONTAL;
gbc_colormapPanel.gridy = 0;
gbc_colormapPanel.gridx = 1;
panel_4.add(colormapPanel, gbc_colormapPanel);
contrastLabel = new JLabel("Contrast: ");
final GridBagConstraints gbc_contrastLabel = new GridBagConstraints();
gbc_contrastLabel.anchor = GridBagConstraints.WEST;
gbc_contrastLabel.gridx = 0;
gbc_contrastLabel.gridy = 1;
panel_4.add(contrastLabel, gbc_contrastLabel);
colorMapSlider.setSnapToTicks(true);
colorMapSlider.setMinorTickSpacing(10);
colorMapSlider.setMajorTickSpacing(10);
colorMapSlider.setPaintTicks(true);
final GridBagConstraints gbc_colorMapSlider = new GridBagConstraints();
gbc_colorMapSlider.gridy = 1;
gbc_colorMapSlider.gridx = 1;
panel_4.add(colorMapSlider, gbc_colorMapSlider);
panel_4.setMaximumSize(new Dimension(Integer.MAX_VALUE, panel_4.getPreferredSize().height));
final JPanel temperaturePanel = new JPanel();
temperaturePanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Temperature \u00B0C", TitledBorder.LEADING, TitledBorder.TOP, null, null));
add(temperaturePanel);
final GridBagLayout gbl_temperaturePanel = new GridBagLayout();
temperaturePanel.setLayout(gbl_temperaturePanel);
final JLabel insideTemperatureLabel = new JLabel("Inside: ");
insideTemperatureLabel.setToolTipText("");
final GridBagConstraints gbc_insideTemperatureLabel = new GridBagConstraints();
gbc_insideTemperatureLabel.gridx = 1;
gbc_insideTemperatureLabel.gridy = 0;
temperaturePanel.add(insideTemperatureLabel, gbc_insideTemperatureLabel);
insideTemperatureSpinner = new JSpinner();
insideTemperatureSpinner.setToolTipText("Thermostat temperature setting for the inside of the house");
insideTemperatureSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
compute(UpdateRadiation.NEVER);
}
});
insideTemperatureSpinner.setModel(new SpinnerNumberModel(20, -70, 60, 1));
final GridBagConstraints gbc_insideTemperatureSpinner = new GridBagConstraints();
gbc_insideTemperatureSpinner.gridx = 2;
gbc_insideTemperatureSpinner.gridy = 0;
temperaturePanel.add(insideTemperatureSpinner, gbc_insideTemperatureSpinner);
final JLabel outsideTemperatureLabel = new JLabel(" Outside: ");
outsideTemperatureLabel.setToolTipText("");
final GridBagConstraints gbc_outsideTemperatureLabel = new GridBagConstraints();
gbc_outsideTemperatureLabel.gridx = 3;
gbc_outsideTemperatureLabel.gridy = 0;
temperaturePanel.add(outsideTemperatureLabel, gbc_outsideTemperatureLabel);
temperaturePanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, temperaturePanel.getPreferredSize().height));
outsideTemperatureSpinner = new JSpinner();
outsideTemperatureSpinner.setToolTipText("Outside temperature at this time and day");
outsideTemperatureSpinner.setEnabled(false);
outsideTemperatureSpinner.setModel(new SpinnerNumberModel(10, -70, 60, 1));
outsideTemperatureSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
if (thread == null)
compute(UpdateRadiation.NEVER);
}
});
final GridBagConstraints gbc_outsideTemperatureSpinner = new GridBagConstraints();
gbc_outsideTemperatureSpinner.gridx = 4;
gbc_outsideTemperatureSpinner.gridy = 0;
temperaturePanel.add(outsideTemperatureSpinner, gbc_outsideTemperatureSpinner);
autoCheckBox = new JCheckBox("Auto");
autoCheckBox.setToolTipText("Automatically set the outside temperature based on historic average of the selected city");
autoCheckBox.setSelected(true);
autoCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
final boolean selected = autoCheckBox.isSelected();
outsideTemperatureSpinner.setEnabled(!selected);
if (selected)
updateOutsideTemperature();
compute(UpdateRadiation.NEVER);
}
});
final GridBagConstraints gbc_autoCheckBox = new GridBagConstraints();
gbc_autoCheckBox.gridx = 5;
gbc_autoCheckBox.gridy = 0;
temperaturePanel.add(autoCheckBox, gbc_autoCheckBox);
partPanel = new JPanel();
partPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Part", TitledBorder.LEADING, TitledBorder.TOP, null, null));
add(partPanel);
buildingPanel = new JPanel();
buildingPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Building", TitledBorder.LEADING, TitledBorder.TOP, null, null));
add(buildingPanel);
buildingPanel.setLayout(new BoxLayout(buildingPanel, BoxLayout.Y_AXIS));
panel = new JPanel();
buildingPanel.add(panel);
lblSolarPotentialEnergy = new JLabel("Solar Potential:");
panel.add(lblSolarPotentialEnergy);
houseSolarPotentialTextField = new JTextField();
houseSolarPotentialTextField.setEditable(false);
panel.add(houseSolarPotentialTextField);
houseSolarPotentialTextField.setColumns(10);
lblNewLabel = new JLabel("kWh");
panel.add(lblNewLabel);
panel_2 = new JPanel();
buildingPanel.add(panel_2);
GridBagLayout gbl_panel_2 = new GridBagLayout();
gbl_panel_2.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0 };
gbl_panel_2.rowWeights = new double[] { 0.0, 0.0 };
panel_2.setLayout(gbl_panel_2);
lblPosition = new JLabel("Position:");
GridBagConstraints gbc_lblPosition = new GridBagConstraints();
gbc_lblPosition.anchor = GridBagConstraints.EAST;
gbc_lblPosition.insets = new Insets(0, 0, 5, 5);
gbc_lblPosition.gridx = 0;
gbc_lblPosition.gridy = 0;
panel_2.add(lblPosition, gbc_lblPosition);
positionTextField = new JTextField();
positionTextField.setEditable(false);
GridBagConstraints gbc_positionTextField = new GridBagConstraints();
gbc_positionTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_positionTextField.anchor = GridBagConstraints.NORTH;
gbc_positionTextField.insets = new Insets(0, 0, 5, 5);
gbc_positionTextField.gridx = 1;
gbc_positionTextField.gridy = 0;
panel_2.add(positionTextField, gbc_positionTextField);
positionTextField.setColumns(10);
lblHeight = new JLabel("Height:");
GridBagConstraints gbc_lblHeight = new GridBagConstraints();
gbc_lblHeight.anchor = GridBagConstraints.EAST;
gbc_lblHeight.insets = new Insets(0, 0, 5, 5);
gbc_lblHeight.gridx = 2;
gbc_lblHeight.gridy = 0;
panel_2.add(lblHeight, gbc_lblHeight);
heightTextField = new JTextField();
heightTextField.setEditable(false);
GridBagConstraints gbc_heightTextField = new GridBagConstraints();
gbc_heightTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_heightTextField.insets = new Insets(0, 0, 5, 0);
gbc_heightTextField.anchor = GridBagConstraints.NORTH;
gbc_heightTextField.gridx = 3;
gbc_heightTextField.gridy = 0;
panel_2.add(heightTextField, gbc_heightTextField);
heightTextField.setColumns(10);
lblArea = new JLabel("Area:");
GridBagConstraints gbc_lblArea = new GridBagConstraints();
gbc_lblArea.anchor = GridBagConstraints.EAST;
gbc_lblArea.insets = new Insets(0, 0, 0, 5);
gbc_lblArea.gridx = 0;
gbc_lblArea.gridy = 1;
panel_2.add(lblArea, gbc_lblArea);
areaTextField = new JTextField();
areaTextField.setEditable(false);
GridBagConstraints gbc_areaTextField = new GridBagConstraints();
gbc_areaTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_areaTextField.insets = new Insets(0, 0, 0, 5);
gbc_areaTextField.gridx = 1;
gbc_areaTextField.gridy = 1;
panel_2.add(areaTextField, gbc_areaTextField);
areaTextField.setColumns(10);
lblVolume = new JLabel("Volume:");
GridBagConstraints gbc_lblVolume = new GridBagConstraints();
gbc_lblVolume.anchor = GridBagConstraints.EAST;
gbc_lblVolume.insets = new Insets(0, 0, 0, 5);
gbc_lblVolume.gridx = 2;
gbc_lblVolume.gridy = 1;
panel_2.add(lblVolume, gbc_lblVolume);
volumnTextField = new JTextField();
volumnTextField.setEditable(false);
GridBagConstraints gbc_volumnTextField = new GridBagConstraints();
gbc_volumnTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_volumnTextField.gridx = 3;
gbc_volumnTextField.gridy = 1;
panel_2.add(volumnTextField, gbc_volumnTextField);
volumnTextField.setColumns(10);
allPanel = new JPanel();
allPanel.setBorder(new TitledBorder(null, "All", TitledBorder.LEADING, TitledBorder.TOP, null, null));
add(allPanel);
allPanel.setLayout(new BoxLayout(allPanel, BoxLayout.Y_AXIS));
panel_5 = new JPanel();
allPanel.add(panel_5);
lblSolarPotential = new JLabel("Solar Potential:");
panel_5.add(lblSolarPotential);
solarPotentialAlltextField = new JTextField();
solarPotentialAlltextField.setEditable(false);
panel_5.add(solarPotentialAlltextField);
solarPotentialAlltextField.setColumns(10);
lblKwh = new JLabel("kWh");
panel_5.add(lblKwh);
panel_7 = new JPanel();
allPanel.add(panel_7);
lblPassiveSolar = new JLabel("Passive Solar:");
panel_7.add(lblPassiveSolar);
passiveSolarTextField = new JTextField();
passiveSolarTextField.setEditable(false);
panel_7.add(passiveSolarTextField);
passiveSolarTextField.setColumns(10);
lblPhotovoltaic = new JLabel("Photovoltaic:");
panel_7.add(lblPhotovoltaic);
photovoltaicTextField = new JTextField();
photovoltaicTextField.setEditable(false);
panel_7.add(photovoltaicTextField);
photovoltaicTextField.setColumns(10);
final JPanel panel_1 = new JPanel();
panel_1.setVisible(false);
panel_1.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Energy", TitledBorder.LEADING, TitledBorder.TOP, null, null));
add(panel_1);
final GridBagLayout gbl_panel_1 = new GridBagLayout();
gbl_panel_1.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 };
panel_1.setLayout(gbl_panel_1);
final JLabel sunLabel = new JLabel("Passive Solar");
final GridBagConstraints gbc_sunLabel = new GridBagConstraints();
gbc_sunLabel.insets = new Insets(0, 0, 5, 5);
gbc_sunLabel.gridx = 1;
gbc_sunLabel.gridy = 0;
panel_1.add(sunLabel, gbc_sunLabel);
final JLabel solarLabel = new JLabel("Photovoltaic");
solarLabel.setHorizontalAlignment(SwingConstants.CENTER);
final GridBagConstraints gbc_solarLabel = new GridBagConstraints();
gbc_solarLabel.insets = new Insets(0, 0, 5, 5);
gbc_solarLabel.gridx = 2;
gbc_solarLabel.gridy = 0;
panel_1.add(solarLabel, gbc_solarLabel);
final JLabel heatingLabel = new JLabel("Heating");
heatingLabel.setHorizontalAlignment(SwingConstants.CENTER);
final GridBagConstraints gbc_heatingLabel = new GridBagConstraints();
gbc_heatingLabel.insets = new Insets(0, 0, 5, 5);
gbc_heatingLabel.gridx = 3;
gbc_heatingLabel.gridy = 0;
panel_1.add(heatingLabel, gbc_heatingLabel);
final JLabel coolingLabel = new JLabel("Cooling");
coolingLabel.setHorizontalAlignment(SwingConstants.CENTER);
final GridBagConstraints gbc_coolingLabel = new GridBagConstraints();
gbc_coolingLabel.insets = new Insets(0, 0, 5, 5);
gbc_coolingLabel.gridx = 4;
gbc_coolingLabel.gridy = 0;
panel_1.add(coolingLabel, gbc_coolingLabel);
final JLabel totalLabel = new JLabel("Total");
totalLabel.setHorizontalAlignment(SwingConstants.CENTER);
final GridBagConstraints gbc_totalLabel = new GridBagConstraints();
gbc_totalLabel.insets = new Insets(0, 0, 5, 0);
gbc_totalLabel.gridx = 5;
gbc_totalLabel.gridy = 0;
panel_1.add(totalLabel, gbc_totalLabel);
final JLabel nowLabel = new JLabel("Now (watts):");
final GridBagConstraints gbc_nowLabel = new GridBagConstraints();
gbc_nowLabel.insets = new Insets(0, 0, 5, 5);
gbc_nowLabel.anchor = GridBagConstraints.WEST;
gbc_nowLabel.gridx = 0;
gbc_nowLabel.gridy = 1;
panel_1.add(nowLabel, gbc_nowLabel);
sunRateTextField = new JTextField();
sunRateTextField.setEditable(false);
final GridBagConstraints gbc_sunRateTextField = new GridBagConstraints();
gbc_sunRateTextField.insets = new Insets(0, 0, 5, 5);
gbc_sunRateTextField.weightx = 1.0;
gbc_sunRateTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_sunRateTextField.gridx = 1;
gbc_sunRateTextField.gridy = 1;
sunRateTextField.setColumns(5);
panel_1.add(sunRateTextField, gbc_sunRateTextField);
solarRateTextField = new JTextField();
solarRateTextField.setEditable(false);
final GridBagConstraints gbc_solarRateTextField = new GridBagConstraints();
gbc_solarRateTextField.weightx = 1.0;
gbc_solarRateTextField.insets = new Insets(0, 0, 5, 5);
gbc_solarRateTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_solarRateTextField.gridx = 2;
gbc_solarRateTextField.gridy = 1;
panel_1.add(solarRateTextField, gbc_solarRateTextField);
solarRateTextField.setColumns(5);
heatingRateTextField = new JTextField();
final GridBagConstraints gbc_heatingRateTextField = new GridBagConstraints();
gbc_heatingRateTextField.insets = new Insets(0, 0, 5, 5);
gbc_heatingRateTextField.weightx = 1.0;
gbc_heatingRateTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_heatingRateTextField.gridx = 3;
gbc_heatingRateTextField.gridy = 1;
panel_1.add(heatingRateTextField, gbc_heatingRateTextField);
heatingRateTextField.setEditable(false);
heatingRateTextField.setColumns(5);
coolingRateTextField = new JTextField();
coolingRateTextField.setEditable(false);
final GridBagConstraints gbc_coolingRateTextField = new GridBagConstraints();
gbc_coolingRateTextField.insets = new Insets(0, 0, 5, 5);
gbc_coolingRateTextField.weightx = 1.0;
gbc_coolingRateTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_coolingRateTextField.gridx = 4;
gbc_coolingRateTextField.gridy = 1;
panel_1.add(coolingRateTextField, gbc_coolingRateTextField);
coolingRateTextField.setColumns(5);
totalRateTextField = new JTextField();
totalRateTextField.setEditable(false);
final GridBagConstraints gbc_totalRateTextField = new GridBagConstraints();
gbc_totalRateTextField.insets = new Insets(0, 0, 5, 0);
gbc_totalRateTextField.weightx = 1.0;
gbc_totalRateTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_totalRateTextField.gridx = 5;
gbc_totalRateTextField.gridy = 1;
panel_1.add(totalRateTextField, gbc_totalRateTextField);
totalRateTextField.setColumns(5);
final JLabel todayLabel = new JLabel("Today (kWh): ");
final GridBagConstraints gbc_todayLabel = new GridBagConstraints();
gbc_todayLabel.insets = new Insets(0, 0, 5, 5);
gbc_todayLabel.anchor = GridBagConstraints.WEST;
gbc_todayLabel.gridx = 0;
gbc_todayLabel.gridy = 2;
panel_1.add(todayLabel, gbc_todayLabel);
sunTodayTextField = new JTextField();
sunTodayTextField.setEditable(false);
final GridBagConstraints gbc_sunTodayTextField = new GridBagConstraints();
gbc_sunTodayTextField.insets = new Insets(0, 0, 5, 5);
gbc_sunTodayTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_sunTodayTextField.gridx = 1;
gbc_sunTodayTextField.gridy = 2;
panel_1.add(sunTodayTextField, gbc_sunTodayTextField);
sunTodayTextField.setColumns(5);
solarTodayTextField = new JTextField();
solarTodayTextField.setEditable(false);
final GridBagConstraints gbc_solarTodayTextField = new GridBagConstraints();
gbc_solarTodayTextField.insets = new Insets(0, 0, 5, 5);
gbc_solarTodayTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_solarTodayTextField.gridx = 2;
gbc_solarTodayTextField.gridy = 2;
panel_1.add(solarTodayTextField, gbc_solarTodayTextField);
solarTodayTextField.setColumns(5);
heatingTodayTextField = new JTextField();
heatingTodayTextField.setEditable(false);
final GridBagConstraints gbc_heatingTodayTextField = new GridBagConstraints();
gbc_heatingTodayTextField.insets = new Insets(0, 0, 5, 5);
gbc_heatingTodayTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_heatingTodayTextField.gridx = 3;
gbc_heatingTodayTextField.gridy = 2;
panel_1.add(heatingTodayTextField, gbc_heatingTodayTextField);
heatingTodayTextField.setColumns(5);
coolingTodayTextField = new JTextField();
coolingTodayTextField.setEditable(false);
final GridBagConstraints gbc_coolingTodayTextField = new GridBagConstraints();
gbc_coolingTodayTextField.insets = new Insets(0, 0, 5, 5);
gbc_coolingTodayTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_coolingTodayTextField.gridx = 4;
gbc_coolingTodayTextField.gridy = 2;
panel_1.add(coolingTodayTextField, gbc_coolingTodayTextField);
coolingTodayTextField.setColumns(5);
totalTodayTextField = new JTextField();
totalTodayTextField.setEditable(false);
final GridBagConstraints gbc_totalTodayTextField = new GridBagConstraints();
gbc_totalTodayTextField.insets = new Insets(0, 0, 5, 0);
gbc_totalTodayTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_totalTodayTextField.gridx = 5;
gbc_totalTodayTextField.gridy = 2;
panel_1.add(totalTodayTextField, gbc_totalTodayTextField);
totalTodayTextField.setColumns(5);
final JLabel yearlyLabel = new JLabel("Yearly (kWh): ");
final GridBagConstraints gbc_yearlyLabel = new GridBagConstraints();
gbc_yearlyLabel.insets = new Insets(0, 0, 5, 5);
gbc_yearlyLabel.anchor = GridBagConstraints.WEST;
gbc_yearlyLabel.gridx = 0;
gbc_yearlyLabel.gridy = 3;
panel_1.add(yearlyLabel, gbc_yearlyLabel);
panel_1.setMaximumSize(new Dimension(Integer.MAX_VALUE, panel_1.getPreferredSize().height));
sunYearlyTextField = new JTextField();
sunYearlyTextField.setEditable(false);
final GridBagConstraints gbc_sunYearlyTextField = new GridBagConstraints();
gbc_sunYearlyTextField.insets = new Insets(0, 0, 5, 5);
gbc_sunYearlyTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_sunYearlyTextField.gridx = 1;
gbc_sunYearlyTextField.gridy = 3;
panel_1.add(sunYearlyTextField, gbc_sunYearlyTextField);
sunYearlyTextField.setColumns(5);
solarYearlyTextField = new JTextField();
solarYearlyTextField.setEditable(false);
final GridBagConstraints gbc_solarYearlyTextField = new GridBagConstraints();
gbc_solarYearlyTextField.insets = new Insets(0, 0, 5, 5);
gbc_solarYearlyTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_solarYearlyTextField.gridx = 2;
gbc_solarYearlyTextField.gridy = 3;
panel_1.add(solarYearlyTextField, gbc_solarYearlyTextField);
solarYearlyTextField.setColumns(5);
heatingYearlyTextField = new JTextField();
heatingYearlyTextField.setEditable(false);
final GridBagConstraints gbc_heatingYearlyTextField = new GridBagConstraints();
gbc_heatingYearlyTextField.insets = new Insets(0, 0, 5, 5);
gbc_heatingYearlyTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_heatingYearlyTextField.gridx = 3;
gbc_heatingYearlyTextField.gridy = 3;
panel_1.add(heatingYearlyTextField, gbc_heatingYearlyTextField);
heatingYearlyTextField.setColumns(5);
coolingYearlyTextField = new JTextField();
coolingYearlyTextField.setEditable(false);
final GridBagConstraints gbc_coolingYearlyTextField = new GridBagConstraints();
gbc_coolingYearlyTextField.insets = new Insets(0, 0, 5, 5);
gbc_coolingYearlyTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_coolingYearlyTextField.gridx = 4;
gbc_coolingYearlyTextField.gridy = 3;
panel_1.add(coolingYearlyTextField, gbc_coolingYearlyTextField);
coolingYearlyTextField.setColumns(5);
totalYearlyTextField = new JTextField();
totalYearlyTextField.setEditable(false);
final GridBagConstraints gbc_totalYearlyTextField = new GridBagConstraints();
gbc_totalYearlyTextField.insets = new Insets(0, 0, 5, 0);
// gbc_totalYearlyTextField.insets = new Insets(0, 0, 5, 0);
gbc_totalYearlyTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_totalYearlyTextField.gridx = 5;
gbc_totalYearlyTextField.gridy = 3;
panel_1.add(totalYearlyTextField, gbc_totalYearlyTextField);
totalYearlyTextField.setColumns(5);
final JLabel yearlyCostLabel = new JLabel("Yearly Cost:");
final GridBagConstraints gbc_yearlyCostLabel = new GridBagConstraints();
gbc_yearlyCostLabel.insets = new Insets(0, 0, 0, 5);
gbc_yearlyCostLabel.anchor = GridBagConstraints.WEST;
gbc_yearlyCostLabel.gridx = 0;
gbc_yearlyCostLabel.gridy = 4;
panel_1.add(yearlyCostLabel, gbc_yearlyCostLabel);
heatingCostTextField = new JTextField();
heatingCostTextField.setEditable(false);
final GridBagConstraints gbc_heatingCostTextField = new GridBagConstraints();
gbc_heatingCostTextField.insets = new Insets(0, 0, 0, 5);
gbc_heatingCostTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_heatingCostTextField.gridx = 3;
gbc_heatingCostTextField.gridy = 4;
panel_1.add(heatingCostTextField, gbc_heatingCostTextField);
heatingCostTextField.setColumns(5);
coolingCostTextField = new JTextField();
coolingCostTextField.setEditable(false);
final GridBagConstraints gbc_coolingCostTextField = new GridBagConstraints();
gbc_coolingCostTextField.insets = new Insets(0, 0, 0, 5);
gbc_coolingCostTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_coolingCostTextField.gridx = 4;
gbc_coolingCostTextField.gridy = 4;
panel_1.add(coolingCostTextField, gbc_coolingCostTextField);
coolingCostTextField.setColumns(5);
totalCostTextField = new JTextField();
totalCostTextField.setEditable(false);
final GridBagConstraints gbc_totalCostTextField = new GridBagConstraints();
gbc_totalCostTextField.fill = GridBagConstraints.HORIZONTAL;
gbc_totalCostTextField.gridx = 5;
gbc_totalCostTextField.gridy = 4;
panel_1.add(totalCostTextField, gbc_totalCostTextField);
totalCostTextField.setColumns(5);
final Dimension size = heatingLabel.getMinimumSize();
sunLabel.setMinimumSize(size);
solarLabel.setMinimumSize(size);
coolingLabel.setMinimumSize(size);
totalLabel.setMinimumSize(size);
final JPanel uFactorPanel = new JPanel();
uFactorPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "U-Factor W/(m\u00B2.\u00B0C)", TitledBorder.LEADING, TitledBorder.TOP, null, null));
add(uFactorPanel);
final GridBagLayout gbl_uFactorPanel = new GridBagLayout();
uFactorPanel.setLayout(gbl_uFactorPanel);
final JLabel wallsLabel = new JLabel("Walls:");
final GridBagConstraints gbc_wallsLabel = new GridBagConstraints();
gbc_wallsLabel.anchor = GridBagConstraints.EAST;
gbc_wallsLabel.insets = new Insets(0, 0, 5, 5);
gbc_wallsLabel.gridx = 0;
gbc_wallsLabel.gridy = 0;
uFactorPanel.add(wallsLabel, gbc_wallsLabel);
wallsComboBox = new WideComboBox();
wallsComboBox.setEditable(true);
wallsComboBox.setModel(new DefaultComboBoxModel(new String[] { "0.28 ", "0.67 (Concrete 8\")", "0.41 (Masonary Brick 8\")", "0.04 (Flat Metal 8\" Fiberglass Insulation)" }));
wallsComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
compute(UpdateRadiation.NEVER);
}
});
final GridBagConstraints gbc_wallsComboBox = new GridBagConstraints();
gbc_wallsComboBox.insets = new Insets(0, 0, 5, 5);
gbc_wallsComboBox.gridx = 1;
gbc_wallsComboBox.gridy = 0;
uFactorPanel.add(wallsComboBox, gbc_wallsComboBox);
final JLabel doorsLabel = new JLabel("Doors:");
final GridBagConstraints gbc_doorsLabel = new GridBagConstraints();
gbc_doorsLabel.anchor = GridBagConstraints.EAST;
gbc_doorsLabel.insets = new Insets(0, 0, 5, 5);
gbc_doorsLabel.gridx = 2;
gbc_doorsLabel.gridy = 0;
uFactorPanel.add(doorsLabel, gbc_doorsLabel);
doorsComboBox = new WideComboBox();
doorsComboBox.setEditable(true);
doorsComboBox.setModel(new DefaultComboBoxModel(new String[] { "0.00 " }));
doorsComboBox.setModel(new DefaultComboBoxModel(new String[] { "1.14 ", "1.20 (Steel)", "0.64 (Wood)" }));
doorsComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
compute(UpdateRadiation.NEVER);
}
});
final GridBagConstraints gbc_doorsComboBox = new GridBagConstraints();
gbc_doorsComboBox.insets = new Insets(0, 0, 5, 0);
gbc_doorsComboBox.gridx = 3;
gbc_doorsComboBox.gridy = 0;
uFactorPanel.add(doorsComboBox, gbc_doorsComboBox);
final JLabel windowsLabel = new JLabel("Windows:");
final GridBagConstraints gbc_windowsLabel = new GridBagConstraints();
gbc_windowsLabel.anchor = GridBagConstraints.EAST;
gbc_windowsLabel.insets = new Insets(0, 0, 0, 5);
gbc_windowsLabel.gridx = 0;
gbc_windowsLabel.gridy = 1;
uFactorPanel.add(windowsLabel, gbc_windowsLabel);
windowsComboBox = new WideComboBox();
windowsComboBox.setEditable(true);
windowsComboBox.setModel(new DefaultComboBoxModel(new String[] { "1.89 ", "1.22 (Single Pane)", "0.70 (Double Pane)" }));
windowsComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
compute(UpdateRadiation.NEVER);
}
});
final GridBagConstraints gbc_windowsComboBox = new GridBagConstraints();
gbc_windowsComboBox.insets = new Insets(0, 0, 0, 5);
gbc_windowsComboBox.gridx = 1;
gbc_windowsComboBox.gridy = 1;
uFactorPanel.add(windowsComboBox, gbc_windowsComboBox);
final JLabel roofsLabel = new JLabel("Roofs:");
final GridBagConstraints gbc_roofsLabel = new GridBagConstraints();
gbc_roofsLabel.anchor = GridBagConstraints.EAST;
gbc_roofsLabel.insets = new Insets(0, 0, 0, 5);
gbc_roofsLabel.gridx = 2;
gbc_roofsLabel.gridy = 1;
uFactorPanel.add(roofsLabel, gbc_roofsLabel);
roofsComboBox = new WideComboBox();
roofsComboBox.setEditable(true);
roofsComboBox.setModel(new DefaultComboBoxModel(new String[] { "0.14 ", "0.23 (Concrete 3\")", "0.11 (Flat Metal 3\" Fiberglass Insulation)", "0.10 (Wood 3\" Fiberglass Insulation)" }));
roofsComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
compute(UpdateRadiation.NEVER);
}
});
final GridBagConstraints gbc_roofsComboBox = new GridBagConstraints();
gbc_roofsComboBox.gridx = 3;
gbc_roofsComboBox.gridy = 1;
uFactorPanel.add(roofsComboBox, gbc_roofsComboBox);
uFactorPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, uFactorPanel.getPreferredSize().height));
final Component verticalGlue = Box.createVerticalGlue();
add(verticalGlue);
JPanel target = buildingPanel;
target.setMaximumSize(new Dimension(target.getMaximumSize().width, target.getPreferredSize().height));
target = partPanel;
target.setMaximumSize(new Dimension(target.getMaximumSize().width, target.getPreferredSize().height));
partPanel.setLayout(new BoxLayout(partPanel, BoxLayout.Y_AXIS));
panel_6 = new JPanel();
partPanel.add(panel_6);
partEnergyLabel = new JLabel("Solar Potential:");
panel_6.add(partEnergyLabel);
partEnergyTextField = new JTextField();
panel_6.add(partEnergyTextField);
partEnergyTextField.setEditable(false);
partEnergyTextField.setColumns(10);
solarPotentialKWhLabel = new JLabel("kWh");
panel_6.add(solarPotentialKWhLabel);
panel_8 = new JPanel();
partPanel.add(panel_8);
lblWidth = new JLabel("Width:");
panel_8.add(lblWidth);
partWidthTextField = new JTextField();
partWidthTextField.setEditable(false);
panel_8.add(partWidthTextField);
partWidthTextField.setColumns(10);
lblHeight_1 = new JLabel("Height:");
panel_8.add(lblHeight_1);
partHeightTextField = new JTextField();
partHeightTextField.setEditable(false);
panel_8.add(partHeightTextField);
partHeightTextField.setColumns(10);
target = allPanel;
target.setMaximumSize(new Dimension(target.getMaximumSize().width, target.getPreferredSize().height));
if (Config.isRestrictMode()) {
coolingLabel.setVisible(false);
coolingCostTextField.setVisible(false);
coolingRateTextField.setVisible(false);
coolingTodayTextField.setVisible(false);
coolingYearlyTextField.setVisible(false);
heatingLabel.setVisible(false);
heatingCostTextField.setVisible(false);
heatingRateTextField.setVisible(false);
heatingTodayTextField.setVisible(false);
heatingYearlyTextField.setVisible(false);
totalLabel.setVisible(false);
totalCostTextField.setVisible(false);
totalRateTextField.setVisible(false);
totalTodayTextField.setVisible(false);
totalYearlyTextField.setVisible(false);
yearlyCostLabel.setVisible(false);
temperaturePanel.setVisible(false);
uFactorPanel.setVisible(false);
}
}
public void initJavaFXGUI() {
if (fxPanel == null && !initJavaFxAlreadyCalled) {
initJavaFxAlreadyCalled = true;
try {
System.out.println("initJavaFXGUI()");
fxPanel = new JFXPanel();
final GridBagConstraints gbc_fxPanel = new GridBagConstraints();
fxPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 400));
gbc_fxPanel.gridwidth = 3;
gbc_fxPanel.fill = GridBagConstraints.BOTH;
gbc_fxPanel.insets = new Insets(0, 0, 5, 0);
gbc_fxPanel.gridx = 0;
gbc_fxPanel.gridy = 1;
add(fxPanel, gbc_fxPanel);
initFxComponents();
} catch (final Throwable e) {
System.out.println("Error occured when initializing JavaFX: JavaFX is probably not supported!");
e.printStackTrace();
}
}
}
private void initFxComponents() {
Platform.runLater(new Runnable() {
@Override
public void run() {
final GridPane grid = new GridPane();
final javafx.scene.Scene scene = new javafx.scene.Scene(grid, 800, 400);
scene.getStylesheets().add("org/concord/energy3d/gui/css/fx.css");
final NumberAxis yAxis = new NumberAxis(0, 100, 10);
final CategoryAxis xAxis = new CategoryAxis();
xAxis.setCategories(FXCollections.<String> observableArrayList(Arrays.asList("Area", "Energy Loss")));
final StackedBarChart<String, Number> chart = new StackedBarChart<String, Number>(xAxis, yAxis);
chart.setStyle("-fx-background-color: #" + Integer.toHexString(UIManager.getColor("Panel.background").getRGB() & 0x00FFFFFF) + ";");
XYChart.Series<String, Number> series = new XYChart.Series<String, Number>();
series.setName("Walls");
series.getData().add(wallsAreaChartData);
series.getData().add(wallsEnergyChartData);
chart.getData().add(series);
series = new XYChart.Series<String, Number>();
series.setName("Doors");
series.getData().add(doorsAreaChartData);
series.getData().add(doorsEnergyChartData);
chart.getData().add(series);
series = new XYChart.Series<String, Number>();
series.setName("Windows");
series.getData().add(windowsAreaChartData);
series.getData().add(windowsEnergyChartData);
chart.getData().add(series);
series = new XYChart.Series<String, Number>();
series.setName("Roof");
series.getData().add(roofsAreaChartData);
series.getData().add(roofsEnergyChartData);
chart.getData().add(series);
grid.add(chart, 0, 0);
fxPanel.setScene(scene);
}
});
}
public void updateAreaChart() {
final double total = wallsArea + doorsArea + windowsArea + roofsArea;
final boolean isZero = (total == 0.0);
wallsAreaChartData.setYValue(isZero ? 0 : wallsArea / total * 100.0);
doorsAreaChartData.setYValue(isZero ? 0 : doorsArea / total * 100.0);
windowsAreaChartData.setYValue(isZero ? 0 : windowsArea / total * 100.0);
roofsAreaChartData.setYValue(isZero ? 0 : roofsArea / total * 100.0);
}
public void updateEnergyLossChart() {
final double walls = wallsArea * wallUFactor;
final double doors = doorsArea * doorUFactor;
final double windows = windowsArea * windowUFactor;
final double roofs = roofsArea * roofUFactor;
final double total = walls + windows + doors + roofs;
final boolean isZero = (total == 0.0);
wallsEnergyChartData.setYValue(isZero ? 0 : walls / total * 100.0);
doorsEnergyChartData.setYValue(isZero ? 0 : doors / total * 100.0);
windowsEnergyChartData.setYValue(isZero ? 0 : windows / total * 100.0);
roofsEnergyChartData.setYValue(isZero ? 0 : roofs / total * 100.0);
}
public void compute(final UpdateRadiation updateRadiation) {
if (!computeEnabled)
return;
this.updateRadiation = updateRadiation;
if (thread != null && thread.isAlive())
computeRequest = true;
else {
thread = new Thread("Energy Computer") {
@Override
public void run() {
do {
computeRequest = false;
/* since this thread can accept multiple computeRequest, cannot use updateRadiationColorMap parameter directly */
try {
computeNow(EnergyPanel.this.updateRadiation);
} catch (final Throwable e) {
e.printStackTrace();
Util.reportError(e);
}
try {
Thread.sleep(500);
} catch (final InterruptedException e) {
e.printStackTrace();
}
progressBar.setValue(0);
} while (computeRequest);
thread = null;
}
};
thread.start();
}
}
public void computeNow(final UpdateRadiation updateRadiation) {
try {
System.out.println("EnergyPanel.computeNow()");
progressBar.setValue(0);
if (updateRadiation != UpdateRadiation.NEVER) {
if (updateRadiation == UpdateRadiation.ALWAYS || (SceneManager.getInstance().isSolarColorMap() && (!alreadyRenderedHeatmap || keepHeatmapOn))) {
alreadyRenderedHeatmap = true;
computeRadiation();
notifyPropertyChangeListeners(new PropertyChangeEvent(EnergyPanel.this, "Solar energy calculation completed", 0, 1));
} else {
if (SceneManager.getInstance().isSolarColorMap())
MainPanel.getInstance().getSolarButton().setSelected(false);
int numberOfHouses = 0;
for (final HousePart part : Scene.getInstance().getParts()) {
if (part instanceof Foundation && !part.getChildren().isEmpty() && !part.isFrozen())
numberOfHouses++;
if (numberOfHouses >= 2)
break;
}
for (final HousePart part : Scene.getInstance().getParts())
if (part instanceof Foundation)
((Foundation) part).setSolarValue(numberOfHouses >= 2 && !part.getChildren().isEmpty() && !part.isFrozen() ? -1 : -2);
SceneManager.getInstance().refresh();
}
}
computeEnergy();
} catch (final RuntimeException e) {
if (e != cancelException)
e.printStackTrace();
}
}
private void computeEnergy() {
if (autoCheckBox.isSelected())
updateOutsideTemperature();
try {
wallUFactor = parseUFactor(wallsComboBox);
doorUFactor = parseUFactor(doorsComboBox);
windowUFactor = parseUFactor(windowsComboBox);
roofUFactor = parseUFactor(roofsComboBox);
} catch (final Exception e) {
e.printStackTrace();
JOptionPane.showMessageDialog(MainPanel.getInstance(), "Invalid U-Factor value: " + e.getMessage(), "Invalid U-Factor", JOptionPane.WARNING_MESSAGE);
return;
}
wallsArea = 0;
doorsArea = 0;
windowsArea = 0;
roofsArea = 0;
/* compute area */
for (final HousePart part : Scene.getInstance().getParts()) {
if (part instanceof Wall)
wallsArea += part.computeArea();
else if (part instanceof Window)
windowsArea += part.computeArea();
else if (part instanceof Door)
doorsArea += part.computeArea();
else if (part instanceof Roof)
roofsArea += part.computeArea();
}
updateAreaChart();
updateEnergyLossChart();
final int insideTemperature = (Integer) insideTemperatureSpinner.getValue();
final int outsideTemperature = (Integer) outsideTemperatureSpinner.getValue();
computeEnergyLossRate(insideTemperature - outsideTemperature);
final EnergyAmount energyRate = computeEnergyRate(Heliodon.getInstance().getSunLocation(), insideTemperature, outsideTemperature);
sunRateTextField.setText(noDecimals.format(energyRate.solar));
solarRateTextField.setText(noDecimals.format(energyRate.solarPanel));
heatingRateTextField.setText(noDecimals.format(energyRate.heating));
coolingRateTextField.setText(noDecimals.format(energyRate.cooling));
totalRateTextField.setText(noDecimals.format(energyRate.heating + energyRate.cooling));
final EnergyAmount energyToday = computeEnergyToday((Calendar) Heliodon.getInstance().getCalander().clone(), (Integer) insideTemperatureSpinner.getValue());
sunTodayTextField.setText(twoDecimals.format(energyToday.solar));
solarTodayTextField.setText(twoDecimals.format(energyToday.solarPanel));
heatingTodayTextField.setText(twoDecimals.format(energyToday.heating));
coolingTodayTextField.setText(twoDecimals.format(energyToday.cooling));
totalTodayTextField.setText(twoDecimals.format(energyToday.heating + energyToday.cooling));
final EnergyAmount energyYearly = computeEnergyYearly((Integer) insideTemperatureSpinner.getValue());
sunYearlyTextField.setText(noDecimals.format(energyYearly.solar));
solarYearlyTextField.setText(noDecimals.format(energyYearly.solarPanel));
heatingYearlyTextField.setText(noDecimals.format(energyYearly.heating));
coolingYearlyTextField.setText(noDecimals.format(energyYearly.cooling));
totalYearlyTextField.setText(noDecimals.format(energyYearly.heating + energyYearly.cooling));
heatingCostTextField.setText("$" + moneyDecimals.format(COST_PER_KWH * energyYearly.heating));
coolingCostTextField.setText("$" + moneyDecimals.format(COST_PER_KWH * energyYearly.cooling));
totalCostTextField.setText("$" + moneyDecimals.format(COST_PER_KWH * (energyYearly.heating + energyYearly.cooling)));
progressBar.setValue(100);
}
private double parseUFactor(final JComboBox comboBox) {
final String valueStr = comboBox.getSelectedItem().toString();
final int indexOfSpace = valueStr.indexOf(' ');
return Double.parseDouble(valueStr.substring(0, indexOfSpace != -1 ? indexOfSpace : valueStr.length()));
}
private EnergyAmount computeEnergyYearly(final double insideTemperature) {
final EnergyAmount energyYearly = new EnergyAmount();
final Calendar date = Calendar.getInstance();
date.set(Calendar.DAY_OF_MONTH, 15);
date.set(Calendar.MONTH, 0);
for (int month = 0; month < 11; month++) {
final EnergyAmount energyToday = computeEnergyToday(date, insideTemperature);
final int daysInMonth = date.getActualMaximum(Calendar.DAY_OF_MONTH);
energyYearly.solar += energyToday.solar * daysInMonth;
energyYearly.solarPanel += energyToday.solarPanel * daysInMonth;
energyYearly.heating += energyToday.heating * daysInMonth;
energyYearly.cooling += energyToday.cooling * daysInMonth;
date.add(Calendar.MONTH, 1);
}
return energyYearly;
}
private EnergyAmount computeEnergyToday(final Calendar today, final double insideTemperature) {
final EnergyAmount energyToday = new EnergyAmount();
final Heliodon heliodon = Heliodon.getInstance();
today.set(Calendar.SECOND, 0);
today.set(Calendar.MINUTE, 0);
today.set(Calendar.HOUR_OF_DAY, 0);
final double[] outsideTemperature;
if (getCity().isEmpty()) {
/*
* if there are no temperatures available for the selected city compute zero for cooling and heating
*/
outsideTemperature = new double[] { insideTemperature, insideTemperature };
energyToday.heating = Double.NaN;
energyToday.cooling = Double.NaN;
} else
outsideTemperature = computeOutsideTemperature(today);
for (int hour = 0; hour < 24; hour++) {
final EnergyAmount energyThisHour = computeEnergyRate(heliodon.computeSunLocation(today), insideTemperature, outsideTemperature[0] + (outsideTemperature[1] - outsideTemperature[0]) / 24 * hour);
energyToday.solar += energyThisHour.solar / 1000.0;
energyToday.solarPanel += energyThisHour.solarPanel / 1000.0;
energyToday.heating += energyThisHour.heating / 1000.0;
energyToday.cooling += energyThisHour.cooling / 1000.0;
today.add(Calendar.HOUR_OF_DAY, 1);
}
final double coolingWithSolarPanel = Math.max(0.0, energyToday.cooling - energyToday.solarPanel);
final double heatingWithSolarPanel = energyToday.heating - energyToday.solarPanel - (energyToday.cooling - coolingWithSolarPanel);
energyToday.cooling = coolingWithSolarPanel;
energyToday.heating = heatingWithSolarPanel;
return energyToday;
}
private double[] computeOutsideTemperature(final Calendar today) {
final int day = today.get(Calendar.DAY_OF_MONTH);
final int daysInMonth = today.getActualMaximum(Calendar.DAY_OF_MONTH);
final double[] outsideTemperature = new double[2];
final Calendar monthFrom, monthTo;
final int halfMonth = daysInMonth / 2;
final double portion;
final int totalDaysOfMonth;
if (day < halfMonth) {
monthFrom = (Calendar) today.clone();
monthFrom.add(Calendar.MONTH, -1);
monthTo = today;
final int prevHalfMonth = monthFrom.getActualMaximum(Calendar.DAY_OF_MONTH) - monthFrom.getActualMaximum(Calendar.DAY_OF_MONTH) / 2;
totalDaysOfMonth = prevHalfMonth + daysInMonth / 2;
portion = (double) (day + prevHalfMonth) / totalDaysOfMonth;
} else {
monthFrom = today;
monthTo = (Calendar) today.clone();
monthTo.add(Calendar.MONTH, 1);
final int nextHalfMonth = monthTo.getActualMaximum(Calendar.DAY_OF_MONTH) / 2;
totalDaysOfMonth = halfMonth + nextHalfMonth;
portion = (double) (day - halfMonth) / totalDaysOfMonth;
}
final int[] monthlyLowTemperatures = avgMonthlyLowTemperatures.get(getCity());
final int[] monthlyHighTemperatures = avgMonthlyHighTemperatures.get(getCity());
final int monthFromIndex = monthFrom.get(Calendar.MONTH);
final int monthToIndex = monthTo.get(Calendar.MONTH);
outsideTemperature[0] = monthlyLowTemperatures[monthFromIndex] + (monthlyLowTemperatures[monthToIndex] - monthlyLowTemperatures[monthFromIndex]) * portion;
outsideTemperature[1] = monthlyHighTemperatures[monthFromIndex] + (monthlyHighTemperatures[monthToIndex] - monthlyHighTemperatures[monthFromIndex]) * portion;
return outsideTemperature;
}
public String getCity() {
return (String) cityComboBox.getSelectedItem();
}
public void setCity(final String city) {
cityComboBox.setSelectedItem(city);
}
private EnergyAmount computeEnergyRate(final ReadOnlyVector3 sunLocation, final double insideTemperature, final double outsideTemperature) {
if (computeRequest)
throw cancelException;
final EnergyAmount energyRate = new EnergyAmount();
// if (Heliodon.getInstance().isVisible() && sunLocation.getZ() > 0.0) {
if (sunLocation.getZ() > 0.0) {
energyRate.solar = computeEnergySolarRate(sunLocation.normalize(null));
energyRate.solarPanel = computeEnergySolarPanelRate(sunLocation.normalize(null));
}
final double energyLossRate = computeEnergyLossRate(insideTemperature - outsideTemperature);
if (energyLossRate >= 0.0) {
energyRate.heating = energyLossRate;
energyRate.cooling = 0.0;
} else {
energyRate.cooling = -energyLossRate;
energyRate.heating = 0.0;
}
if (Heliodon.getInstance().isVisible()) {
final double heatingWithSolar = Math.max(0.0, energyRate.heating - energyRate.solar);
final double coolingWithSolar = energyRate.cooling + energyRate.solar - (energyRate.heating - heatingWithSolar);
energyRate.heating = heatingWithSolar;
energyRate.cooling = coolingWithSolar;
if (outsideTemperature < insideTemperature)
energyRate.cooling = 0;
}
return energyRate;
}
private double computeEnergyLossRate(final double deltaT) {
final double wallsEnergyLoss = wallsArea * wallUFactor * deltaT;
final double doorsEnergyLoss = doorsArea * doorUFactor * deltaT;
final double windowsEnergyLoss = windowsArea * windowUFactor * deltaT;
final double roofsEnergyLoss = roofsArea * roofUFactor * deltaT;
return wallsEnergyLoss + doorsEnergyLoss + windowsEnergyLoss + roofsEnergyLoss;
}
private double computeEnergySolarRate(final ReadOnlyVector3 sunVector) {
double totalRate = 0.0;
final boolean computeSunEnergyOfWalls = Scene.getInstance().isComputeSunEnergyOfWalls();
for (final HousePart part : Scene.getInstance().getParts())
if ((part instanceof Window && !computeSunEnergyOfWalls) || (part instanceof Wall && computeSunEnergyOfWalls)) {
final double dot = part.getContainer().getFaceDirection().dot(sunVector);
if (dot > 0.0)
totalRate += 100.0 * part.computeArea() * dot;
}
return totalRate;
}
private double computeEnergySolarPanelRate(final ReadOnlyVector3 sunVector) {
double totalRate = 0.0;
for (final HousePart part : Scene.getInstance().getParts()) {
if (part instanceof SolarPanel) {
final double dot = part.getContainer().getFaceDirection().dot(sunVector);
if (dot > 0.0)
totalRate += 70.0 * part.computeArea() * dot;
}
}
return totalRate;
}
private void updateOutsideTemperature() {
if (getCity().isEmpty())
outsideTemperatureSpinner.setValue(15);
else {
final double[] temperature = computeOutsideTemperature(Heliodon.getInstance().getCalander());
final double avgTemperature = (temperature[0] + temperature[1]) / 2.0;
outsideTemperatureSpinner.setValue((int) Math.round(avgTemperature));
}
}
public JSpinner getDateSpinner() {
return dateSpinner;
}
public JSpinner getTimeSpinner() {
return timeSpinner;
}
private void computeRadiation() {
System.out.println("computeRadiation()");
initSolarCollidables();
solarOnMesh.clear();
textureCoordsAlreadyComputed.clear();
for (final HousePart part : Scene.getInstance().getParts())
part.setSolarPotentialEnergy(0.0);
solarOnLand = null;
maxSolarValue = 1;
computeRadiationToday((Calendar) Heliodon.getInstance().getCalander().clone());
updateSolarValueOnAllHouses();
}
private void initSolarCollidables() {
solarCollidables.clear();
for (final HousePart part : Scene.getInstance().getParts()) {
if (part instanceof Foundation)
solarCollidables.add(part.getMesh());
else if (part instanceof Wall)
solarCollidables.add(((Wall) part).getInvisibleMesh());
else if (part instanceof SolarPanel)
solarCollidables.add(((SolarPanel) part).getSurroundMesh());
else if (part instanceof Roof)
for (final Spatial roofPart : ((Roof) part).getRoofPartsRoot().getChildren())
solarCollidables.add(((Node) roofPart).getChild(0));
}
}
private void computeRadiationOnMesh(final ReadOnlyVector3 directionTowardSun, final HousePart housePart, final Mesh drawMesh, final Mesh collisionMesh, final ReadOnlyVector3 normal, final boolean addToTotal) {
/* needed in order to prevent picking collision with neighboring wall at wall edge */
final double OFFSET = 0.1;
final ReadOnlyVector3 offset = directionTowardSun.multiply(OFFSET, null);
final AnyToXYTransform toXY = new AnyToXYTransform(normal.getX(), normal.getY(), normal.getZ());
final XYToAnyTransform fromXY = new XYToAnyTransform(normal.getX(), normal.getY(), normal.getZ());
final FloatBuffer vertexBuffer = collisionMesh.getMeshData().getVertexBuffer();
vertexBuffer.rewind();
double minX, minY, maxX, maxY;
minX = minY = Double.POSITIVE_INFINITY;
maxX = maxY = Double.NEGATIVE_INFINITY;
double z = Double.NaN;
final List<ReadOnlyVector2> points = new ArrayList<ReadOnlyVector2>(vertexBuffer.limit() / 3);
while (vertexBuffer.hasRemaining()) {
final Vector3 pWorld = drawMesh.localToWorld(new Vector3(vertexBuffer.get(), vertexBuffer.get(), vertexBuffer.get()), null);
final Point p = new TPoint(pWorld.getX(), pWorld.getY(), pWorld.getZ());
toXY.transform(p);
if (p.getX() < minX)
minX = p.getX();
if (p.getX() > maxX)
maxX = p.getX();
if (p.getY() < minY)
minY = p.getY();
if (p.getY() > maxY)
maxY = p.getY();
if (Double.isNaN(z))
z = p.getZ();
points.add(new Vector2(p.getX(), p.getY()));
}
final Point tmp = new TPoint(minX, minY, z);
fromXY.transform(tmp);
final ReadOnlyVector3 origin = new Vector3(tmp.getX(), tmp.getY(), tmp.getZ());
tmp.set(minX, maxY, z);
fromXY.transform(tmp);
final ReadOnlyVector3 p1 = new Vector3(tmp.getX(), tmp.getY(), tmp.getZ());
tmp.set(maxX, minY, z);
fromXY.transform(tmp);
final ReadOnlyVector3 p2 = new Vector3(tmp.getX(), tmp.getY(), tmp.getZ());
final double height = p1.subtract(origin, null).length();
final int rows = (int) Math.ceil(height / solarStep);
final int cols = (int) Math.ceil(p2.subtract(origin, null).length() / solarStep);
double[][] solar = solarOnMesh.get(drawMesh);
if (solar == null) {
solar = new double[roundToPowerOfTwo(rows)][roundToPowerOfTwo(cols)];
solarOnMesh.put(drawMesh, solar);
}
if (textureCoordsAlreadyComputed.get(drawMesh) == null) {
final ReadOnlyVector2 originXY = new Vector2(minX, minY);
final ReadOnlyVector2 uXY = new Vector2(maxX - minX, 0).normalizeLocal();
final ReadOnlyVector2 vXY = new Vector2(0, maxY - minY).normalizeLocal();
for (int row = 0; row < solar.length; row++)
for (int col = 0; col < solar[0].length; col++) {
if (row >= rows || col >= cols)
solar[row][col] = -1;
else {
final ReadOnlyVector2 p = originXY.add(uXY.multiply(col * solarStep, null), null).add(vXY.multiply(row * solarStep, null), null);
boolean isInside = false;
for (int i = 0; i < points.size(); i += 3) {
if (Util.isPointInsideTriangle(p, points.get(i), points.get(i + 1), points.get(i + 2))) {
isInside = true;
break;
}
}
if (!isInside)
solar[row][col] = -1;
}
}
}
final ReadOnlyVector3 u = p2.subtract(origin, null).normalizeLocal();
final ReadOnlyVector3 v = p1.subtract(origin, null).normalizeLocal();
final double dot = normal.dot(directionTowardSun);
for (int col = 0; col < cols; col++) {
final ReadOnlyVector3 pU = u.multiply(solarStep / 2.0 + col * solarStep, null).addLocal(origin);
final double w = (col == cols - 1) ? p2.distance(pU) : solarStep;
for (int row = 0; row < rows; row++) {
if (computeRequest)
throw cancelException;
if (solar[row][col] == -1)
continue;
final ReadOnlyVector3 p = v.multiply(solarStep / 2.0 + row * solarStep, null).addLocal(pU);
final double h;
if (row == rows - 1)
h = height - (row * solarStep);
else
h = solarStep;
final Ray3 pickRay = new Ray3(p.add(offset, null), directionTowardSun);
final PickResults pickResults = new PrimitivePickResults();
for (final Spatial spatial : solarCollidables)
if (spatial != collisionMesh) {
PickingUtil.findPick(spatial, pickRay, pickResults, false);
if (pickResults.getNumber() != 0)
break;
}
if (pickResults.getNumber() == 0) {
solar[row][col] += dot;
final double annotationScale = Scene.getInstance().getAnnotationScale();
housePart.setSolarPotentialEnergy(housePart.getSolarPotentialEnergy() + dot * w * h * annotationScale * annotationScale);
}
}
}
if (textureCoordsAlreadyComputed.get(drawMesh) == null && !(housePart instanceof Window)) {
updateRadiationMeshTextureCoords(drawMesh, origin, u, v, rows, cols);
textureCoordsAlreadyComputed.put(drawMesh, Boolean.TRUE);
}
}
private void updateRadiationMeshTextureCoords(final Mesh drawMesh, final ReadOnlyVector3 origin, final ReadOnlyVector3 uDir, final ReadOnlyVector3 vDir, final int rows, final int cols) {
final ReadOnlyVector3 o = origin;
final ReadOnlyVector3 u = uDir.multiply(roundToPowerOfTwo(cols) * EnergyPanel.getInstance().getSolarStep(), null);
final ReadOnlyVector3 v = vDir.multiply(roundToPowerOfTwo(rows) * EnergyPanel.getInstance().getSolarStep(), null);
final FloatBuffer vertexBuffer = drawMesh.getMeshData().getVertexBuffer();
final FloatBuffer textureBuffer = drawMesh.getMeshData().getTextureBuffer(0);
vertexBuffer.rewind();
textureBuffer.rewind();
while (vertexBuffer.hasRemaining()) {
final ReadOnlyVector3 p = drawMesh.localToWorld(new Vector3(vertexBuffer.get(), vertexBuffer.get(), vertexBuffer.get()), null);
final Vector3 uP = Util.closestPoint(o, u, p, v.negate(null));
final float uScale = (float) (uP.distance(o) / u.length());
final Vector3 vP = Util.closestPoint(o, v, p, u.negate(null));
final float vScale = (float) (vP.distance(o) / v.length());
textureBuffer.put(uScale).put(vScale);
}
}
private void computeRadiationOnLand(final ReadOnlyVector3 directionTowardSun) {
final double step = solarStep * 4;
final int rows = (int) (256 / step);
final int cols = rows;
if (solarOnLand == null)
solarOnLand = new double[rows][cols];
final Vector3 p = new Vector3();
for (int col = 0; col < cols; col++) {
p.setX((col - cols / 2) * step + step / 2.0);
for (int row = 0; row < rows; row++) {
if (computeRequest)
throw cancelException;
p.setY((row - rows / 2) * step + step / 2.0);
final Ray3 pickRay = new Ray3(p, directionTowardSun);
final PickResults pickResults = new PrimitivePickResults();
for (final Spatial spatial : solarCollidables)
PickingUtil.findPick(spatial, pickRay, pickResults, false);
if (pickResults.getNumber() == 0)
solarOnLand[row][col] += directionTowardSun.dot(Vector3.UNIT_Z);
}
}
}
private void computeRadiationToday(final Calendar today) {
final Heliodon heliodon = Heliodon.getInstance();
today.set(Calendar.SECOND, 0);
today.set(Calendar.MINUTE, 0);
today.set(Calendar.HOUR_OF_DAY, 0);
for (int minute = 0; minute < 1440; minute += SOLAR_MINUTE_STEP) {
final ReadOnlyVector3 sunLocation = heliodon.computeSunLocation(today).normalize(null);
// final ReadOnlyVector3 sunLocation = heliodon.getSunLocation();
if (sunLocation.getZ() > 0) {
final ReadOnlyVector3 directionTowardSun = sunLocation.normalize(null);
for (final HousePart part : Scene.getInstance().getParts()) {
if (part.isDrawCompleted())
if (part instanceof Wall || part instanceof Window || part instanceof SolarPanel) {
final ReadOnlyVector3 faceDirection = part.getFaceDirection();
if (faceDirection.dot(directionTowardSun) > 0)
computeRadiationOnMesh(directionTowardSun, part, part.getMesh(), part instanceof Wall ? ((Wall) part).getInvisibleMesh() : part.getMesh(), faceDirection, true);
} else if (part instanceof Roof) {
for (final Spatial roofPart : ((Roof) part).getRoofPartsRoot().getChildren()) {
final ReadOnlyVector3 faceDirection = (ReadOnlyVector3) roofPart.getUserData();
if (faceDirection.dot(directionTowardSun) > 0) {
final Mesh mesh = (Mesh) ((Node) roofPart).getChild(0);
computeRadiationOnMesh(directionTowardSun, part, mesh, mesh, faceDirection, false);
}
}
}
}
computeRadiationOnLand(directionTowardSun);
}
maxSolarValue++;
today.add(Calendar.MINUTE, SOLAR_MINUTE_STEP);
progress();
}
maxSolarValue *= (100 - colorMapSlider.getValue()) / 100.0;
}
private void updateSolarValueOnAllHouses() {
applySolarTexture(SceneManager.getInstance().getSolarLand(), solarOnLand, maxSolarValue);
for (final HousePart part : Scene.getInstance().getParts())
if (part instanceof Wall || part instanceof Window || part instanceof SolarPanel)
applySolarTexture(part.getMesh(), solarOnMesh.get(part.getMesh()), maxSolarValue);
else if (part instanceof Roof)
for (final Spatial roofPart : ((Roof) part).getRoofPartsRoot().getChildren()) {
final Mesh mesh = (Mesh) ((Node) roofPart).getChild(0);
applySolarTexture(mesh, solarOnMesh.get(mesh), maxSolarValue);
}
for (final HousePart part : Scene.getInstance().getParts()) {
if (part instanceof Foundation) {
final Foundation foundation = (Foundation) part;
double totalSolar = 0.0;
for (final HousePart houseChild : Scene.getInstance().getParts())
if (houseChild.getTopContainer() == foundation)
totalSolar += houseChild.getSolarPotentialEnergy();
foundation.setSolarValue(convertSolarValue(totalSolar));
}
}
SceneManager.getInstance().refresh();
}
public long convertSolarValue(final Double val) {
return val == null ? 0 : val.longValue() / (60 / SOLAR_MINUTE_STEP);
}
private void progress() {
progressBar.setValue(progressBar.getValue() + 1);
}
public void setLatitude(final int latitude) {
latitudeSpinner.setValue(latitude);
}
public int getLatitude() {
return (Integer) latitudeSpinner.getValue();
}
public int roundToPowerOfTwo(final int n) {
return (int) Math.pow(2.0, Math.ceil(Math.log(n) / Math.log(2)));
}
public JSlider getColorMapSlider() {
return colorMapSlider;
}
private void applySolarTexture(final Mesh mesh, final double[][] solarData, final long maxValue) {
if (solarData != null)
fillBlanksWithNeighboringValues(solarData);
final int rows;
final int cols;
if (solarData == null) {
rows = cols = 1;
} else {
rows = solarData.length;
cols = solarData[0].length;
}
final ByteBuffer data = BufferUtils.createByteBuffer(cols * rows * 3);
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
final double value = solarData == null ? 0 : solarData[row][col];
final ColorRGBA color = computeSolarColor(value, maxValue);
data.put((byte) (color.getRed() * 255)).put((byte) (color.getGreen() * 255)).put((byte) (color.getBlue() * 255));
}
}
final Image image = new Image(ImageDataFormat.RGB, PixelDataType.UnsignedByte, cols, rows, data, null);
final Texture2D texture = new Texture2D();
texture.setTextureKey(TextureKey.getRTTKey(MinificationFilter.NearestNeighborNoMipMaps));
texture.setImage(image);
final TextureState textureState = new TextureState();
textureState.setTexture(texture);
mesh.setRenderState(textureState);
}
private void fillBlanksWithNeighboringValues(final double[][] solarData) {
final int rows = solarData.length;
final int cols = solarData[0].length;
for (int repeat = 0; repeat < 2; repeat++)
for (int row = 0; row < rows; row++)
for (int col = 0; col < cols; col++)
if (solarData[row][col] == -1)
if (solarData[row][(col + 1) % cols] != -1)
solarData[row][col] = solarData[row][(col + 1) % cols];
else if (col != 0 && solarData[row][col - 1] != -1)
solarData[row][col] = solarData[row][col - 1];
else if (col == 0 && solarData[row][cols - 1] != -1)
solarData[row][col] = solarData[row][cols - 1];
else if (solarData[(row + 1) % rows][col] != -1)
solarData[row][col] = solarData[(row + 1) % rows][col];
else if (row != 0 && solarData[row - 1][col] != -1)
solarData[row][col] = solarData[row - 1][col];
else if (row == 0 && solarData[rows - 1][col] != -1)
solarData[row][col] = solarData[rows - 1][col];
}
private ColorRGBA computeSolarColor(final double value, final long maxValue) {
final ReadOnlyColorRGBA[] colors = EnergyPanel.solarColors;
long valuePerColorRange = maxValue / (colors.length - 1);
final int colorIndex;
if (valuePerColorRange == 0) {
valuePerColorRange = 1;
colorIndex = 0;
} else
colorIndex = (int) Math.min(value / valuePerColorRange, colors.length - 2);
final float scalar = Math.min(1.0f, (float) (value - valuePerColorRange * colorIndex) / valuePerColorRange);
final ColorRGBA color = new ColorRGBA().lerpLocal(colors[colorIndex], colors[colorIndex + 1], scalar);
return color;
}
public void clearAlreadyRendered() {
alreadyRenderedHeatmap = false;
}
public static void setKeepHeatmapOn(final boolean on) {
keepHeatmapOn = on;
}
public void setComputeEnabled(final boolean computeEnabled) {
this.computeEnabled = computeEnabled;
}
@Override
public void addPropertyChangeListener(final PropertyChangeListener pcl) {
propertyChangeListeners.add(pcl);
}
@Override
public void removePropertyChangeListener(final PropertyChangeListener pcl) {
propertyChangeListeners.remove(pcl);
}
private void notifyPropertyChangeListeners(final PropertyChangeEvent evt) {
if (!propertyChangeListeners.isEmpty()) {
for (final PropertyChangeListener x : propertyChangeListeners) {
x.propertyChange(evt);
}
}
}
public void updatePartEnergy() {
final boolean iradiationEnabled = MainPanel.getInstance().getSolarButton().isSelected();
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
final TitledBorder titledBorder = (TitledBorder) partPanel.getBorder();
if (selectedPart == null)
titledBorder.setTitle("Part");
else
titledBorder.setTitle("Part - " + selectedPart.toString().substring(0, selectedPart.toString().indexOf(')') + 1));
partPanel.repaint();
if (!iradiationEnabled || selectedPart == null || selectedPart instanceof Foundation || selectedPart instanceof Door)
partEnergyTextField.setText("");
else
partEnergyTextField.setText(noDecimals.format(convertSolarValue(selectedPart.getSolarPotentialEnergy())));
if (selectedPart != null && !(selectedPart instanceof Roof || selectedPart instanceof Floor)) {
if (selectedPart instanceof SolarPanel) {
partWidthTextField.setText(twoDecimals.format(SolarPanel.WIDTH));
partHeightTextField.setText(twoDecimals.format(SolarPanel.HEIGHT));
} else {
partWidthTextField.setText(twoDecimals.format((selectedPart.getAbsPoint(0).distance(selectedPart.getAbsPoint(2))) * Scene.getInstance().getAnnotationScale()));
partHeightTextField.setText(twoDecimals.format((selectedPart.getAbsPoint(0).distance(selectedPart.getAbsPoint(1))) * Scene.getInstance().getAnnotationScale()));
}
} else {
partWidthTextField.setText("");
partHeightTextField.setText("");
}
final Foundation foundation = selectedPart == null ? null : (Foundation) selectedPart.getTopContainer();
if (foundation != null) {
if (iradiationEnabled)
houseSolarPotentialTextField.setText("" + foundation.getSolarValue());
else
houseSolarPotentialTextField.setText("");
final double[] buildingGeometry = foundation.getBuildingGeometry();
positionTextField.setText("(" + twoDecimals.format(buildingGeometry[3]) + ", " + twoDecimals.format(buildingGeometry[4]) + ")");
heightTextField.setText(twoDecimals.format(buildingGeometry[0]));
areaTextField.setText(twoDecimals.format(buildingGeometry[1]));
volumnTextField.setText(twoDecimals.format(buildingGeometry[2]));
} else {
houseSolarPotentialTextField.setText("");
heightTextField.setText("");
areaTextField.setText("");
volumnTextField.setText("");
}
if (iradiationEnabled) {
double solarPotentialAll = 0.0;
double passiveSolar = 0.0;
double photovoltaic = 0.0;
for (final HousePart part : Scene.getInstance().getParts()) {
if (part instanceof Foundation)
solarPotentialAll += ((Foundation) part).getSolarValue();
else if (part instanceof Window)
passiveSolar += part.getSolarPotentialEnergy();
else if (part instanceof SolarPanel)
photovoltaic += part.getSolarPotentialEnergy();
}
solarPotentialAlltextField.setText(noDecimals.format(solarPotentialAll));
passiveSolarTextField.setText(noDecimals.format(passiveSolar));
photovoltaicTextField.setText(noDecimals.format(photovoltaic));
} else {
solarPotentialAlltextField.setText("");
passiveSolarTextField.setText("");
photovoltaicTextField.setText("");
}
}
public void setSolarStep(double solarStep) {
this.solarStep = solarStep;
}
public double getSolarStep() {
return solarStep;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
f266e36d75ed0ade6f5e8de6e2d681aeff1bfc51 | e6516f3e89b815c9a62d8f131acc638f76f61f24 | /hermes/src/main/java/xiaofei/library/hermes/sender/InstanceCreatingSender.java | bc52b941994e5b8bb25fe54e5df21befbb6fc04c | [] | no_license | leafyesy/nettylib | a438630fe9eac6a3b0369dd41ee636ceb0bf711e | 31c2ea190cdf96542ad694448cea7785220e16e6 | refs/heads/master | 2020-07-29T01:00:53.655884 | 2019-12-08T16:08:53 | 2019-12-08T16:08:53 | 209,607,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,851 | java | /**
*
* Copyright 2016 Xiaofei
*
* 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 xiaofei.library.hermes.sender;
import java.lang.reflect.Method;
import xiaofei.library.hermes.HermesService;
import xiaofei.library.hermes.wrapper.MethodWrapper;
import xiaofei.library.hermes.wrapper.ObjectWrapper;
import xiaofei.library.hermes.wrapper.ParameterWrapper;
/**
* Created by Xiaofei on 16/4/8.
*/
public class InstanceCreatingSender extends Sender {
private Class<?>[] mConstructorParameterTypes;
public InstanceCreatingSender(Class<? extends HermesService> service, ObjectWrapper object) {
super(service, object);
}
@Override
protected MethodWrapper getMethodWrapper(Method method, ParameterWrapper[] parameterWrappers) {
int length = parameterWrappers == null ? 0 : parameterWrappers.length;
mConstructorParameterTypes = new Class<?>[length];
for (int i = 0; i < length; ++i) {
try {
ParameterWrapper parameterWrapper = parameterWrappers[i];
mConstructorParameterTypes[i] = parameterWrapper == null ? null : parameterWrapper.getClassType();
} catch (Exception e) {
}
}
return new MethodWrapper(mConstructorParameterTypes);
}
}
| [
"yeshouyou@51yund.com"
] | yeshouyou@51yund.com |
afed5b0f98316f21f5a321d169fe401ee8c6071e | 662e669b6ceab8d1d79fc334174fbdfc82a6fb1b | /Marlabs/Jun-10/com/yi/hw1/q3/Y.java | d49ae612847310cad7483f6a6a51171f49b01511 | [] | no_license | tianxyi/marlabsJava | 061a4646c28eb301a67dcff74af0d6d001c71915 | 905932ece459479f2d8f0bd1ef1dc42f7699ab7c | refs/heads/master | 2022-10-15T23:53:34.909164 | 2020-06-13T20:35:13 | 2020-06-13T20:35:13 | 271,922,711 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | package com.yi.hw1.q3;
public class Y {
int num2;
public int getNum2() {
return num2;
}
public void setNum2(int num2) {
this.num2 = num2;
}
@Override
public String toString() {
return "Y [num2=" + num2 + "]";
}
}
| [
"tyi100@syr.edu"
] | tyi100@syr.edu |
0255d7662def736243191db61606d1501a00fb44 | 9376f4fbd2415e6cd5dea537a3c0075791fb9440 | /src/DAO/EmpresaMySQL.java | 4ad193fb8e7c63fbb6667ce64d2bce9f4ac41ca4 | [] | no_license | halisonrodrigues/SisClinica | 1cf164718f070617869d7636da610a9ddbde8e6a | 515f54d999a15f3a9ef828922170ae4ef26eb79a | refs/heads/master | 2021-07-08T16:15:43.451578 | 2017-10-06T18:35:54 | 2017-10-06T18:35:54 | 104,888,798 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 3,018 | java | package DAO;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import model.Empresa;
public class EmpresaMySQL extends DAO_MySQL{
int id=0;
public EmpresaMySQL(){
open();
try {
Statement stm = con.createStatement();
stm.executeUpdate(
"Create table if not exists EMPRESA ("
+ "id Integer AUTO_INCREMENT, "
+ "nome varchar(255), "
+ "endereco varchar(255), "
+ "bairro varchar(60), "
+ "cidade varchar(60), "
+ "estado char(2), "
+ "cep varchar(10), "
+ "telefone varchar(20), "
+ "email varchar(255), "
+ "cnpj varchar(20), "
+ "insc_estadual varchar(42), "
// + "logo_grande blob, "
// + "logo_pequeno blob,"
+ "PRIMARY KEY(id));");
} catch (SQLException e) {
e.printStackTrace();
} finally {
close();
}
}
public void create(Empresa emp){
open();
try {
Statement stm = con.createStatement();
String qr = "INSERT INTO Empresa VALUES ("
+ id+", '"
+ emp.getNomeEmpresa()+"', '"
+ emp.getEndereco()+"', '"
+ emp.getBairro()+"', '"
+ emp.getCidade()+"', '"
+ emp.getEstado()+"', '"
+ emp.getCep()+"', '"
+ emp.getTelefone()+"', '"
+ emp.getEmail()+"', '"
+ emp.getCnpj()+"', '"
+ emp.getInscricao_estadual()+"');";
stm.executeUpdate(qr);
} catch (Exception e) {
e.printStackTrace();
} finally {
close();
}
}
public void update(Empresa emp){
open();
try {
Statement stm = con.createStatement();
String qr = "UPDATE Empresa SET "
+ "nome = '"+emp.getNomeEmpresa()+"', "
+ "endereco = '"+emp.getEndereco()+"', "
+ "bairro = '"+emp.getBairro()+"', "
+ "cidade = '"+emp.getCidade()+"', "
+ "estado = '"+emp.getEstado()+"', "
+ "cep = '"+emp.getCep()+"', "
+ "telefone = '"+emp.getTelefone()+"', "
+ "email = '"+emp.getEmail()+"', "
+ "cnpj = '"+emp.getCnpj()+"', "
+ "insc_estadual = '"+emp.getInscricao_estadual()+"' "
+ "WHERE id = "+emp.get_id()+";";
stm.executeUpdate(qr);
} catch (Exception e) {
e.printStackTrace();
} finally {
close();
}
}
public Empresa find(){
Empresa result = null;
open();
try {
Statement stm = con.createStatement();
ResultSet rs = stm.executeQuery(
"SELECT * FROM Empresa;");
if (rs.next()){
Empresa e = new Empresa(
rs.getInt(1), //id
rs.getString(2), //nome
rs.getString(3), //endereço
rs.getString(4), //bairro
rs.getString(5), //cidade
rs.getString(6), //estado
rs.getString(7), //cep
rs.getString(8), //telefone
rs.getString(9), //email
rs.getString(10), //cnpj
rs.getString(11)); //inscrição estadual
result = e;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
close();
}
return result;
}
}
| [
"halisonrodrigues@hotmail.com"
] | halisonrodrigues@hotmail.com |
fec0c3b1893a6562324a83797b5ea1e02dd45ea0 | f8c8c84e2a8035a253a8a2903ce3da97d817759d | /base/src/main/java/com/yxy/lib/base/http/call/OKHttpManager.java | e141dd6a494e7619f10c9de9913d0cb9ba1c690f | [] | no_license | yang7206/BaseLib | df07abf24c9ba80a026357f1b6f1b38eb9682449 | cd7be0ab286700d385aa1390065ef0504c4c6385 | refs/heads/master | 2021-01-19T05:06:05.549031 | 2017-04-06T09:45:19 | 2017-04-06T09:45:19 | 87,413,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,990 | java | package com.yxy.lib.base.http.call;
import android.util.Log;
import org.json.JSONObject;
import java.io.File;
import java.util.Iterator;
import java.util.concurrent.TimeUnit;
import okhttp3.Call;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
/**
* Created by Administrator on 2016/9/5.
*/
public class OKHttpManager {
private static OKHttpManager mInstance;
private OkHttpClient client;
private final MediaType JSON
= MediaType.parse("application/json; charset=utf-8");
private final MediaType MEDIA_STREM = MediaType.parse("application/octet-stream");
private OKHttpManager() {
client = new OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.build();
}
public synchronized static OKHttpManager getInstance() {
if (mInstance == null) {
mInstance = new OKHttpManager();
}
return mInstance;
}
public Call buildPostCall(String url, String json) {
Log.d("OKHttpManager", "url :" + url + ",json :" + json);
RequestBody body = RequestBody.create(JSON, json);
Request request = new Request.Builder()
.url(url)
.post(body)
.build();
Call call = client.newCall(request);
return call;
}
public Call buildPostCall(String url, byte[] content) {
Log.d("OKHttpManager", "url :" + url + " \ncontent len :" + content.length);
RequestBody body = RequestBody.create(MEDIA_STREM, content);
Request request = new Request.Builder()
.url(url)
.post(body)
.build();
Call call = client.newCall(request);
return call;
}
public Call buildPostFileCall(String url, JSONObject object) {
MultipartBody.Builder builder = new MultipartBody.Builder();
builder.setType(MultipartBody.FORM);
Iterator<String> keys = object.keys();
while (keys.hasNext()) {
String key = keys.next();
File file = new File(object.optString(key));
RequestBody fileBody = RequestBody.create(MEDIA_STREM, file);
builder.addFormDataPart(file.getName(), file.getName(), fileBody);
}
RequestBody requestBody = builder.build();
Request request = new Request.Builder()
.url(url)
.post(requestBody)
.build();
Call call = client.newCall(request);
return call;
}
public Call buildGetFileCall(String url){
Log.d("OKHttpManager", "buildGetFileCall url :" + url);
Request request = new Request.Builder()
.url(url)
.build();
Call call = client.newCall(request);
return call;
}
}
| [
"403530547@qq.com"
] | 403530547@qq.com |
9c29feb2543a072e14dcc89370fbc8a04c6d82e7 | 9670fc6e06eb6b3db89d0384f3920ae4410730c7 | /PolyBounce/src/main/java/com/github/caniblossom/polybounce/game/GameWindow.java | 81b7c0e98d864741e0989baa459a1de459c911bb | [
"BSD-3-Clause"
] | permissive | caniblossom/PolyBounce | 7954a4e59d5b9a32b3181f719da3963935ef45e1 | 79e329ceb5b3b549b09cd38afab65dfbc9b70197 | refs/heads/master | 2021-01-19T06:03:45.749894 | 2015-05-02T21:29:40 | 2015-05-02T21:29:40 | 31,966,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,938 | java | /*
* Copyright (c) 2015, Jani Salo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.github.caniblossom.polybounce.game;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.ContextAttribs;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.PixelFormat;
// TODO Fix window size.
/**
* A class representing the game window (and the game itself).
* @author Jani Salo
*/
public class GameWindow {
private static final int DEFAULT_WINDOW_WIDTH = 1280;
private static final int DEFAULT_WINDOW_HEIGHT = 720;
private GameEngine gameEngine;
/**
* @return Pixel format used by the game
*/
private static PixelFormat getDefaultPixelFormat() {
return new PixelFormat(8, 16, 0);
}
/**
* @return OpenGL context version used by the game
*/
private static ContextAttribs getDefaultContextAttributes() {
return new ContextAttribs(3, 2).withForwardCompatible(true).withProfileCore(true);
}
/**
* Constructs a new game window.
* @param width width of the game canvas in pixels
* @param height height of the game canvas in pixels
* @throws RuntimeException
*/
public GameWindow(final int width, final int height) throws RuntimeException {
try {
Display.setTitle("Poly Bounce");
Display.setDisplayMode(new DisplayMode(width, height));
Display.create(getDefaultPixelFormat(), getDefaultContextAttributes());
} catch (LWJGLException e) {
throw new RuntimeException("Unable to create OpenGL context: " + e.getMessage());
}
// It's important to create the engine only after the OpenGL context has been created.
gameEngine = new GameEngine(width, height);
}
/**
* Constructs a new game window with preset dimensions in pixels.
*/
public GameWindow() throws RuntimeException {
this(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT);
}
/**
* Executes the loop running the game window (and the game itself).
*/
public void run() {
while (!Display.isCloseRequested() && !gameEngine.isQuitRequested()) {
gameEngine.update(1.0f / 60.0f);
Display.update();
Display.sync(60);
}
gameEngine.deleteGLResources();
Display.destroy();
}
}
| [
"jani.q.salo@helsinki.fi"
] | jani.q.salo@helsinki.fi |
b4119ee338d11848f05217673fe6ed185f5ea6dd | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /unimkt-20181212/src/main/java/com/aliyun/unimkt20181212/models/UpdateFlowResponse.java | a49573fe344ea05d83d40dd08ec912a82c96a691 | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 1,320 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.unimkt20181212.models;
import com.aliyun.tea.*;
public class UpdateFlowResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public UpdateFlowResponseBody body;
public static UpdateFlowResponse build(java.util.Map<String, ?> map) throws Exception {
UpdateFlowResponse self = new UpdateFlowResponse();
return TeaModel.build(map, self);
}
public UpdateFlowResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public UpdateFlowResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public UpdateFlowResponse setBody(UpdateFlowResponseBody body) {
this.body = body;
return this;
}
public UpdateFlowResponseBody getBody() {
return this.body;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
1acc9b6bb0a6510730aa2a1bc3e4393fdbfdffe9 | ce7251d788742678471237207188027d0675240d | /crazyBird/src/main/java/com/crazyBird/dao/user/UserWxPayOrderDao.java | 6a9aa7d9de1255b500746c7a2a4e2eb769a7988b | [] | no_license | FnGZS/ZYPcrazy | 36b0c41e979e52510fcf1dc034548da56cc785a4 | b56df19d85fcba22c73a4987a2ed4259b0f3c298 | refs/heads/master | 2022-12-22T13:41:57.571145 | 2019-11-28T13:47:56 | 2019-11-28T13:47:56 | 154,813,509 | 0 | 0 | null | 2022-12-16T03:30:34 | 2018-10-26T09:52:20 | Java | UTF-8 | Java | false | false | 637 | java | package com.crazyBird.dao.user;
import java.util.List;
import com.crazyBird.dao.user.dataobject.BillDO;
import com.crazyBird.dao.user.dataobject.BillDTO;
import com.crazyBird.dao.user.dataobject.BillPO;
import com.crazyBird.dao.user.dataobject.UserRefundDO;
import com.crazyBird.dao.user.dataobject.UserWxPayOrderDO;
public interface UserWxPayOrderDao {
int insertOrder(UserWxPayOrderDO orderDO);
int checkWxPayOrder(String transaction_id);
int insertRefundOrder(UserRefundDO refundDO);
//插入账单
boolean insertBill(BillDO billDO);
//得到账单
List<BillDTO> getBillList(BillPO po);
int getBillCount(Long userId );
}
| [
"1162032404@qq.com"
] | 1162032404@qq.com |
da2bd3d7cbfa683683cba242296108af4f302dba | 3b5da03271b8c56caf845bdbc7e95a2c57b13d6a | /src/main/java/com/example/demo/model/BusquedaPelicula.java | 80f6485dca2fa59a4677a856ecc2ce89e5867d6d | [] | no_license | DanielReig/PruebaSeleccionOkode | dd65c500f85f392f5d575c0b943e809a011b8f22 | 0796971a0aa172b6c69ad3abf8688578878005e9 | refs/heads/main | 2023-04-05T11:55:01.760058 | 2021-04-13T07:48:41 | 2021-04-13T07:48:41 | 356,614,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,096 | java | package com.example.demo.model;
public class BusquedaPelicula
{
private String page;
private String total_pages;
private Pelicula[] results;
private String total_results;
public String getPage ()
{
return page;
}
public void setPage (String page)
{
this.page = page;
}
public String getTotal_pages ()
{
return total_pages;
}
public void setTotal_pages (String total_pages)
{
this.total_pages = total_pages;
}
public Pelicula[] getResults ()
{
return results;
}
public void setResults (Pelicula[] results)
{
this.results = results;
}
public String getTotal_results ()
{
return total_results;
}
public void setTotal_results (String total_results)
{
this.total_results = total_results;
}
@Override
public String toString()
{
return "com.example.demo.model.BusquedaPelicula [page = "+page+", total_pages = "+total_pages+", results = "+results+", total_results = "+total_results+"]";
}
}
| [
"rmartinezdaniel@gmail.com"
] | rmartinezdaniel@gmail.com |
274a8ed133357ad5b7f03326fcbf51820c772f8a | d1057dd7f1c0a72821e511f7587e511368f41f94 | /AndroidProject/Park/app/src/main/java/com/fcn/park/me/module/MeCarEditorModule.java | d41fab33eb398e36ea5aee7d2b0a0a97ecefc465 | [] | no_license | hyb1234hi/Atom-Github | 1c7b1800c2dcf8a12af90bf54de2a5964c6d625e | 46bcb8cc204ef71f0d310d4bb9a3ae7cdf7b04a1 | refs/heads/master | 2020-08-27T16:23:50.568306 | 2018-07-06T01:26:17 | 2018-07-06T01:26:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,187 | java | package com.fcn.park.me.module;
import android.content.Context;
import com.fcn.park.base.http.ApiClient;
import com.fcn.park.base.http.HttpResult;
import com.fcn.park.base.http.ProgressSubscriber;
import com.fcn.park.base.http.RequestImpl;
import com.fcn.park.base.http.RetrofitManager;
import com.fcn.park.base.interfacee.OnDataCallback;
/**
* Created by 860117073 on 2018/4/26.
*/
public class MeCarEditorModule {
/**请求编辑车辆信息
* @param context
* @param CarOwner
* @param PlateNumber
* @param Phone
* @param callback
*/
public void requestSendCarEditor(final Context context,String carId,String CarOwner,String PlateNumber,
String Phone,final OnDataCallback<String>callback){
RetrofitManager.toSubscribe(ApiClient.getApiService().carEditor(carId,CarOwner,PlateNumber,Phone),
new ProgressSubscriber<>(context, new RequestImpl<HttpResult<String>>(){
@Override
public void onNext(HttpResult<String> result) {
callback.onSuccessResult(result.getMsg());
}
}));
}
}
| [
"wufengfeilong@163.com"
] | wufengfeilong@163.com |
9e17e47ebedcc165c7fb1e91652cfba2d69ec234 | 27e6e8042e34bfa95abfb3e8fb08e65820d98110 | /app/src/main/java/com/zxwl/chinahappy/Adapter/VpAdapter.java | fb567356c1e825d481e2be0c2e97330200e34e93 | [] | no_license | wyz12/ChinaHappy | 3289c0a3a702ebbde52f861ce4e93954bcb69926 | a3e96ab4d0366bfe69c6ff31c897e8938ca06002 | refs/heads/master | 2020-03-09T09:23:59.952704 | 2018-04-20T10:17:08 | 2018-04-20T10:17:08 | 128,712,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,301 | java | package com.zxwl.chinahappy.Adapter;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import java.util.ArrayList;
import java.util.List;
/**
* Created by sks on 2018/4/11.
*/
public class VpAdapter extends FragmentPagerAdapter {
private ArrayList<Fragment> list;
private ArrayList<String> wz;
private int mChildCount = 0;
@Override
public void notifyDataSetChanged() {
mChildCount = getCount();
super.notifyDataSetChanged();
}
@Override
public int getItemPosition(Object object) {
if (mChildCount > 0) {
mChildCount--;
return POSITION_NONE;
}
return super.getItemPosition(object);
}
public VpAdapter(FragmentManager fm, ArrayList<Fragment> list, ArrayList<String> wz) {
super(fm);
this.list = list;
this.wz = wz;
}
public VpAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return list.get(position);
}
@Override
public int getCount() {
return list.size();
}
@Override
public CharSequence getPageTitle(int position) {
return wz.get(position);
}
} | [
"690298131@qq.com"
] | 690298131@qq.com |
624355fdd40a17c4a05a41a66c8782ee37608e74 | d9566590ed39c35df20f366024ae8c7bd5098469 | /Workspace/Loan/src/loan.java | a13d651fe3a44b7f77fad032c3af39a32297a76e | [] | no_license | Migle-visi/SDJ1 | 1f3e9f7f63bb596f5bfbed46af7ca82e707c8abe | 9eb246f5d3092a856a3f44b7cb6c1b78a21023aa | refs/heads/master | 2023-07-25T23:53:32.508519 | 2021-09-13T14:24:12 | 2021-09-13T14:24:12 | 405,615,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 603 | java | import java.util.Scanner;
public class loan
{
public static void main(String[] args)
{
int books, coupons;
Scanner keyboard = new Scanner(System.in);
System.out.println("How many books are being purchased? ");
books = keyboard.nextInt();
keyboard.nextLine();
if (books < 1)
coupons = 0;
else if (books < 3)
coupons = 1;
else if (books < 5)
coupons = 2;
else
coupons = 3;
System.out.println("You will receive " + coupons + " coupons for the purchase.");
}
} | [
"migle283@gmail.com"
] | migle283@gmail.com |
a67dd93fd69459d2578336dc8a57a7150d544648 | 0c9126f1ceafb714b8850014ec6d0f16cc7e92a3 | /mores/WEB-INF/src/app/RoughCounterServlet.java | 47f2e36f4358fc9389815ac2d37450174dbca4a2 | [] | no_license | LungTel/servlet | 6ea7fb007d6f9749eaf93035c4af98c00135bbff | 441468de59f3f3aab3ffd596df0325f9e80edb5f | refs/heads/master | 2021-07-03T15:41:21.894820 | 2019-04-27T03:02:52 | 2019-04-27T03:02:52 | 147,077,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 971 | java | package app;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class RoughCounterServlet extends HttpServlet {
private Integer counter = new Integer(0);
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
int count = counter.intValue();
count = count + 1;
System.out.println(count);
try {
Thread.sleep(5000);
} catch (InterruptedException ignore) {}
counter = new Integer(count);
response.setContentType("text/plain; charset=Windows-31J");
PrintWriter out = response.getWriter();
out.println("count=" + count);
out.println("thread=" + Thread.currentThread());
out.println("instance=" + this);
}
}
| [
"taiki50891@yahoo.co.jp"
] | taiki50891@yahoo.co.jp |
1719a8a202ea90f45f61f06e685cb151983d2720 | 50f986af2eccc6cbe001ec4990b75d289ff50c10 | /YYshow/yyshow2/src/main/java/com/yy/mshow/peripherals/networking/services/GetProgramCodeFromNumber.java | f00fd16217e8a4678aa20d44dec8c67a686a8723 | [] | no_license | ElliotLinLin/hello-world | 4817a1c349c27ad9267e4adbacf0c7fbfb06a5d4 | 60814e3fc6d2fd1f44ce4e60e30a51406b222bce | refs/heads/master | 2021-01-20T04:42:27.738946 | 2019-12-20T10:22:08 | 2019-12-20T10:22:08 | 85,552,628 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,352 | java | package com.yy.mshow.peripherals.networking.services;
import com.google.gson.JsonElement;
import kits.reactor.Job;
import kits.reactor.Reactor;
import kits.reactor.methods.GET;
public class GetProgramCodeFromNumber extends Job {
private Completion completion;
private String number;
public GetProgramCodeFromNumber(String paramString, Completion paramCompletion) {
this.number = paramString;
this.completion = paramCompletion;
}
public Reactor.Method method() { return new GET(); }
protected void process(Object paramObject) {
paramObject = (JsonElement)paramObject;
if (paramObject.isJsonObject()) {
paramObject = paramObject.getAsJsonObject();
if (paramObject.has("program_id")) {
this.completion.onSuccess(Integer.valueOf(Integer.parseInt(paramObject.get("program_id").getAsString())));
return;
}
}
this.completion.onFailure();
}
public String url() { return "/v1/qrcode/" + this.number; }
public static interface Completion {
void onFailure();
void onSuccess(Integer param1Integer);
}
}
/* Location: E:\BaiduNetdiskDownload\androidcompile\dex2jar-2.0\classes30-dex2jar.jar!\com\yy\mshow\peripherals\networking\services\GetProgramCodeFromNumber.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.0.7
*/ | [
"1509930816@qq.com"
] | 1509930816@qq.com |
cd043fcbd46b4d937310755fd614ce8cf1e5502c | 4359aaa28cacceb42f76437509e2325cd118d8ed | /Presidentti-peli/src/main/java/presidenttipeli/logiikka/luojat/PelaajienLuoja.java | a42c7f565ae6d36e1b055bc3d80c1eb14a8ccb17 | [] | no_license | eerojala/Presidentti-peli | b8a13028e4dd2c95b860f4d9618e0e2c015c8c3d | 516d6ef55cbf07783e7608bc35808531cab6d200 | refs/heads/master | 2021-01-01T19:28:10.517602 | 2015-05-03T20:56:26 | 2015-05-03T20:56:26 | 31,963,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 625 | java | package presidenttipeli.logiikka.luojat;
import java.util.ArrayList;
import presidenttipeli.domain.Pelaaja;
/**
* Luojaluokka joka luo pelille pelaajat.
*/
public class PelaajienLuoja extends Luoja {
private ArrayList<String> nimet;
private ArrayList<Pelaaja> pelaajat;
public PelaajienLuoja(ArrayList<String> nimet) {
this.nimet = nimet;
pelaajat = new ArrayList();
}
@Override
public void luo() {
for (String nimi : nimet) {
pelaajat.add(new Pelaaja(nimi));
}
}
public ArrayList<Pelaaja> getPelaajat() {
return pelaajat;
}
}
| [
"eero.ojala@helsinki.fi"
] | eero.ojala@helsinki.fi |
0a7bd17c4680b5ba6385561251da76d51f42b862 | 8740a4c6985dd141a05cc6ea45bb1688877542f5 | /chapter_001/src/main/java/ru/job4j/collection/MapEntry.java | c1155d1d2b9be3a767ff411dfe7ffdbf33ec2d3c | [] | no_license | DmitriyYugai/job4j_design | 4d8e7935c7370a6ec3ec8a236cf3495eca3a98e4 | ceb1d0871521ab59631720155f2e55afb2d99b3b | refs/heads/master | 2023-02-14T04:17:42.439603 | 2021-01-04T08:34:51 | 2021-01-04T08:34:51 | 307,927,278 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 927 | java | package ru.job4j.collection;
import java.util.Map;
import java.util.Objects;
public class MapEntry<K, V> implements Map.Entry<K, V> {
private K key;
private V value;
public MapEntry(K key, V value) {
this.key = key;
this.value = value;
}
@Override
public K getKey() {
return key;
}
@Override
public V getValue() {
return value;
}
@Override
public V setValue(Object v) {
V rsl = value;
value = (V) v;
return rsl;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MapEntry<?, ?> mapEntry = (MapEntry<?, ?>) o;
return Objects.equals(key, mapEntry.key);
}
@Override
public int hashCode() {
return Objects.hash(key);
}
}
| [
"studentnstu97@mail.ru"
] | studentnstu97@mail.ru |
20ea993c4012ca44f6df827f39c3d795ba8222b3 | 01c30b0d7fe894c6447e5b3256077443e24780f4 | /Java/DynamicProgramming/ElevatorTest.java | e4f12922d51d7740b0d47fd22bfa232ec63f5857 | [] | no_license | haibol2016/sampleCode | 02e6062479b74e9fb3b324b4337a862cd2e79d86 | 21760270d4352d5b99b733039d19e4ff67a79fb5 | refs/heads/master | 2023-02-21T11:47:25.562086 | 2023-02-17T16:51:42 | 2023-02-17T16:51:42 | 184,301,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 166 | java | package cs567.hw5;
public class ElevatorTest
{
public static void main(String[] args)
{
Elevator e = new Elevator(50, 11, 6);
e.take(32,33);
}
}
| [
"haibol2017@gmail.com"
] | haibol2017@gmail.com |
76a894c494a94b5fb01d597c6736d06d8cee2cd8 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/16/16_2d3b43d6c33d9cf6faed486eb4c51391055940d7/CollectionDataModel/16_2d3b43d6c33d9cf6faed486eb4c51391055940d7_CollectionDataModel_t.java | 7ff3937ab9e9e682204bdd2e31e3a256f1f122a8 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 6,794 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.faces.model;
import java.util.Collection;
/**
* <p class="changed_added_2_2"><strong>CollectionDataModel</strong> is a convenience
* implementation of {@link DataModel} that wraps an <code>Collection</code> of
* Java objects.</p>
*/
public class CollectionDataModel<E> extends DataModel<E> {
// ------------------------------------------------------------ Constructors
/**
* <p>Construct a new {@link CollectionDataModel} with no specified
* wrapped data.</p>
*/
public CollectionDataModel() {
this(null);
}
/**
* <p>Construct a new {@link CollectionDataModel} wrapping the specified
* list.</p>
*
* @param collection Collection to be wrapped.
*/
public CollectionDataModel(Collection<E> collection) {
super();
setWrappedData(collection);
}
// ------------------------------------------------------ Instance Variables
// The current row index (zero relative)
private int index = -1;
private Collection<E> inner;
private E[] arrayFromInner;
// -------------------------------------------------------------- Properties
/**
* <p>Return <code>true</code> if there is <code>wrappedData</code>
* available, and the current value of <code>rowIndex</code> is greater
* than or equal to zero, and less than the size of the list. Otherwise,
* return <code>false</code>.</p>
*
* @throws javax.faces.FacesException if an error occurs getting the row availability
*/
public boolean isRowAvailable() {
if (arrayFromInner == null) {
return (false);
} else if ((index >= 0) && (index < arrayFromInner.length)) {
return (true);
} else {
return (false);
}
}
/**
* <p>If there is <code>wrappedData</code> available, return the
* length of the list. If no <code>wrappedData</code> is available,
* return -1.</p>
*
* @throws javax.faces.FacesException if an error occurs getting the row count
*/
public int getRowCount() {
if (arrayFromInner == null) {
return (-1);
}
return (arrayFromInner.length);
}
/**
* <p>If row data is available, return the array element at the index
* specified by <code>rowIndex</code>. If no wrapped data is available,
* return <code>null</code>.</p>
*
* @throws javax.faces.FacesException if an error occurs getting the row data
* @throws IllegalArgumentException if now row data is available
* at the currently specified row index
*/
public E getRowData() {
if (arrayFromInner == null) {
return (null);
} else if (!isRowAvailable()) {
throw new NoRowAvailableException();
} else {
return (arrayFromInner[index]);
}
}
/**
* @throws javax.faces.FacesException {@inheritDoc}
*/
public int getRowIndex() {
return (index);
}
/**
* @throws javax.faces.FacesException {@inheritDoc}
* @throws IllegalArgumentException {@inheritDoc}
*/
public void setRowIndex(int rowIndex) {
if (rowIndex < -1) {
throw new IllegalArgumentException();
}
int old = index;
index = rowIndex;
if (arrayFromInner == null) {
return;
}
DataModelListener [] listeners = getDataModelListeners();
if ((old != index) && (listeners != null)) {
Object rowData = null;
if (isRowAvailable()) {
rowData = getRowData();
}
DataModelEvent event =
new DataModelEvent(this, index, rowData);
int n = listeners.length;
for (int i = 0; i < n; i++) {
if (null != listeners[i]) {
listeners[i].rowSelected(event);
}
}
}
}
public Object getWrappedData() {
return (this.inner);
}
/**
* @throws ClassCastException if <code>data</code> is
* non-<code>null</code> and is not a <code>Collection</code>
*/
public void setWrappedData(Object data) {
if (data == null) {
inner = null;
arrayFromInner = null;
setRowIndex(-1);
} else {
final Collection<E> collection = (Collection<E>) data;
arrayFromInner = (E[]) new Object[collection.size()];
collection.toArray(arrayFromInner);
setRowIndex(0);
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
91725a19dc057b82585d07b26f81775003f6120b | 4a4c1c9eab0b0776eba7f14a1090206264b9eb70 | /src/main/java/com/jluzh/concurrency/example/sync/SynchronizedExample2.java | cb36bc35d54d448acef16f255bc58fc88ea51c9e | [] | no_license | desertTown/concurrency | 722965c4ae72957ea9dd78c2a037198c5134879f | 858a902c0c330ee9b0603f5409c080bca1bd7a94 | refs/heads/master | 2020-05-03T13:10:45.093050 | 2018-10-08T00:48:59 | 2018-10-08T00:48:59 | 178,646,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 953 | java | package com.jluzh.concurrency.example.sync;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Slf4j
public class SynchronizedExample2 {
//修饰一个类
public static void test01(int j) {
synchronized (SynchronizedExample2.class) {
for (int i = 0; i < 10; i++) {
log.info("test01 {} - {}", j, i);
}
}
}
// 修饰一个静态方法
public static synchronized void test02(int j) {
for (int i = 0; i < 10; i++) {
log.info("test02 {} - {}", j, i);
}
}
public static void main(String[] args) {
ExecutorService executorService = Executors.newCachedThreadPool();
executorService.execute(() -> {
SynchronizedExample2.test01(1);
});
executorService.execute(() -> {
SynchronizedExample2.test01(2);
});
}
}
| [
"evan.huang@oocl.com"
] | evan.huang@oocl.com |
ff03e931b0276da31e931ae327a6a0721b87c016 | 3945a7746813a2b2d87daec23e09e4a49fcd7c4d | /app/src/main/java/com/keven/dnplayerdemo/PlayActivity.java | 3a734f61ed9a9d736bf34c12f3a10700a1b99408 | [] | no_license | keven1119/DNPlayerDemo | 12bd6ec503ec3f6e698acc4eeb5f3567217087fe | dbc8e44e6493cc23eb35efca409627967e79b1a3 | refs/heads/master | 2021-05-26T08:45:16.041651 | 2020-04-09T11:12:17 | 2020-04-09T11:12:17 | 254,063,667 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,415 | java | package com.keven.dnplayerdemo;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.SurfaceView;
import android.view.WindowManager;
import android.widget.Toast;
import androidx.annotation.Nullable;
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;
/**
* @author Lance
* @date 2018/9/7
*/
public class PlayActivity extends RxAppCompatActivity {
private DNPlayer dnPlayer;
public String url;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager
.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_play);
SurfaceView surfaceView = findViewById(R.id.surfaceView);
dnPlayer = new DNPlayer();
dnPlayer.setSurfaceView(surfaceView);
dnPlayer.setOnPrepareListener(new DNPlayer.OnPrepareListener() {
@Override
public void onPrepare() {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(PlayActivity.this, "开始播放", Toast.LENGTH_SHORT).show();
}
});
dnPlayer.start();
}
});
url = getIntent().getStringExtra("url");
dnPlayer.setDataSource(url);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager
.LayoutParams.FLAG_FULLSCREEN);
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
setContentView(R.layout.activity_play);
SurfaceView surfaceView = findViewById(R.id.surfaceView);
dnPlayer.setSurfaceView(surfaceView);
}
@Override
protected void onResume() {
super.onResume();
dnPlayer.prepare();
}
@Override
protected void onStop() {
super.onStop();
dnPlayer.stop();
}
@Override
protected void onDestroy() {
super.onDestroy();
dnPlayer.release();
}
}
| [
"liangzhenxing@carben.me"
] | liangzhenxing@carben.me |
26c4536817a29f24557c167b752489b936397a6a | 1883c4b65baac8b6da19944379149eda66ab11a0 | /SCM/xcf-scm-runtime/src/main/java/com/forte/runtime/pagination/Dialect.java | 2e38cbcd7f03852a0d7510f517898031a8584d37 | [] | no_license | cqxcftest-ca3a2-9e97e/testgit-AAAAB3NzaC1yc2EAAAADAQABAAABAQC7 | f47e85ee440b3574c100291b08bcdbe5df9cf33b | bbbae4e48f71086974cefde5ce8a03dd62b26a9e | refs/heads/master | 2021-07-17T22:08:29.049397 | 2017-10-26T00:39:05 | 2017-10-26T00:39:05 | 106,354,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 260 | java | package com.forte.runtime.pagination;
public abstract interface Dialect
{
public abstract boolean supportsLimit();
public abstract boolean supportOffsetLimit();
public abstract String getLimitString(String paramString, int paramInt1, int paramInt2);
} | [
"12345678"
] | 12345678 |
0d1c14f1002c1bfb94564449fe0fd48b783d0aed | 26d30f7ee070d71c66a3971189c679bf8c25110a | /src/main/java/br/fpu/taw/configuration/SecurityConfiguration.java | 936bb13c22005c4c503dd52eef43eb8d1f285951 | [] | no_license | deisesantos/taw-site-acessibilidade | aaae0a12314d24157d39e60597353e603ccb0a3d | 49557c5f8120fa141ec64c0842529cc26241831b | refs/heads/master | 2021-01-18T16:42:48.215863 | 2017-05-25T23:17:27 | 2017-05-25T23:17:27 | 86,756,842 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,966 | java | package br.fpu.taw.configuration;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.csrf.CsrfFilter;
import org.springframework.security.web.csrf.CsrfToken;
import org.springframework.security.web.csrf.CsrfTokenRepository;
import org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.util.WebUtils;
@Configuration
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic()
.and().authorizeRequests()
.antMatchers("/api/**").access("hasRole('USER')")
.antMatchers("/index.html", "/", "/api", "/console")
.permitAll().anyRequest().authenticated()
.and().authorizeRequests()
.antMatchers("/login","/user")
.permitAll().anyRequest().permitAll()
.and().formLogin().loginPage("/login")
.and().csrf().csrfTokenRepository(csrfTokenRepository())
.and().addFilterAfter(csrfHeaderFilter(), CsrfFilter.class);
http.csrf().disable();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");
}
private Filter csrfHeaderFilter() {
return new OncePerRequestFilter() {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
FilterChain filterChain) throws ServletException, IOException {
CsrfToken csrf = (CsrfToken) request.getAttribute(CsrfToken.class.getName());
if (csrf != null) {
Cookie cookie = WebUtils.getCookie(request, "XSRF-TOKEN");
String token = csrf.getToken();
if (cookie == null || token != null && !token.equals(cookie.getValue())) {
cookie = new Cookie("XSRF-TOKEN", token);
cookie.setPath("/");
response.addCookie(cookie);
}
}
filterChain.doFilter(request, response);
}
};
}
private CsrfTokenRepository csrfTokenRepository() {
HttpSessionCsrfTokenRepository repository = new HttpSessionCsrfTokenRepository();
repository.setHeaderName("X-XSRF-TOKEN");
return repository;
}
}
| [
"deise.raiane@hotmail.com"
] | deise.raiane@hotmail.com |
3d8543426e6bc1aa783a4e77a5ef9ce6a41cd6ea | 83e81c25b1f74f88ed0f723afc5d3f83e7d05da8 | /media/mca/filterpacks/java/android/filterpacks/performance/Throughput.java | 93738dd88d5396c3fcd00b90e6fe33061387b59f | [
"Apache-2.0",
"LicenseRef-scancode-unicode"
] | permissive | Ankits-lab/frameworks_base | 8a63f39a79965c87a84e80550926327dcafb40b7 | 150a9240e5a11cd5ebc9bb0832ce30e9c23f376a | refs/heads/main | 2023-02-06T03:57:44.893590 | 2020-11-14T09:13:40 | 2020-11-14T09:13:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,720 | java | /*
* Copyright (C) 2011 The Android Open Source Project
*
* 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 android.filterpacks.performance;
/**
* @hide
*/
public class Throughput {
private final int mTotalFrames;
private final int mPeriodFrames;
private final int mPeriodTime;
private final int mPixels;
public Throughput(int totalFrames, int periodFrames, int periodTime, int pixels) {
mTotalFrames = totalFrames;
mPeriodFrames = periodFrames;
mPeriodTime = periodTime;
mPixels = pixels;
}
public int getTotalFrameCount() {
return mTotalFrames;
}
public int getPeriodFrameCount() {
return mPeriodFrames;
}
public int getPeriodTime() {
return mPeriodTime;
}
public float getFramesPerSecond() {
return mPeriodFrames / (float)mPeriodTime;
}
public float getNanosPerPixel() {
double frameTimeInNanos = (mPeriodTime / (double)mPeriodFrames) * 1000000.0;
return (float)(frameTimeInNanos / mPixels);
}
public String toString() {
return getFramesPerSecond() + " FPS";
}
}
| [
"keneankit01@gmail.com"
] | keneankit01@gmail.com |
51dbdca50fa4829cce94983ad5d33dee320fef17 | 7383fe48d8ac4c199f09d5c86e7f099c31b8971a | /MyApplication9/app/src/main/java/com/example/myapplication9/User.java | ff3ef6e6ab5cf02c7238111ff4712afafba3c06f | [] | no_license | Zeongwan/2017-Android | 191365578b83b6db52dc3367952942946401f770 | 4ba4cf00b25b923eb4df785e877c42ea0aac0cfb | refs/heads/master | 2021-09-01T04:05:17.920147 | 2017-12-24T16:40:34 | 2017-12-24T16:40:34 | 104,580,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 577 | java | package com.example.myapplication9;
/**
* Created by 丁丁 on 2017/12/12 0012.
*/
public class User {
private String name;
private String blog;
private int id;
private String url;
public String getName() {
return name;
}
public String getBlog() {
return blog;
}
public String getUrl() {return url; }
public int getId() {
return id;
}
public User(String name, String blog, int id, String url) {
this.name = name;
this.blog = blog;
this.id = id;
this.url = url;
}
}
| [
"503286654@qq.com"
] | 503286654@qq.com |
21f08a377d9b33c16ba4ea2a950b181e94ad08d0 | a1e49f5edd122b211bace752b5fb1bd5c970696b | /projects/org.springframework.beans/src/test/java/org/springframework/beans/factory/config/CustomScopeConfigurerTests.java | 0e31d83c101e4acef1ddf3c78a9440c720d1063f | [
"Apache-2.0"
] | permissive | savster97/springframework-3.0.5 | 4f86467e2456e5e0652de9f846f0eaefc3214cfa | 34cffc70e25233ed97e2ddd24265ea20f5f88957 | refs/heads/master | 2020-04-26T08:48:34.978350 | 2019-01-22T14:45:38 | 2019-01-22T14:45:38 | 173,434,995 | 0 | 0 | Apache-2.0 | 2019-03-02T10:37:13 | 2019-03-02T10:37:12 | null | UTF-8 | Java | false | false | 3,925 | java | /*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.beans.factory.config;
import static org.easymock.EasyMock.*;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
/**
* Unit tests for {@link CustomScopeConfigurer}.
*
* @author Rick Evans
* @author Juergen Hoeller
* @author Chris Beams
*/
public final class CustomScopeConfigurerTests {
private static final String FOO_SCOPE = "fooScope";
private ConfigurableListableBeanFactory factory;
@Before
public void setUp() {
factory = new DefaultListableBeanFactory();
}
@Test
public void testWithNoScopes() throws Exception {
Scope scope = createMock(Scope.class);
replay(scope);
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.postProcessBeanFactory(factory);
verify(scope);
}
@Test
public void testSunnyDayWithBonaFideScopeInstance() throws Exception {
Scope scope = createMock(Scope.class);
replay(scope);
factory.registerScope(FOO_SCOPE, scope);
Map<String, Object> scopes = new HashMap<String, Object>();
scopes.put(FOO_SCOPE, scope);
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.setScopes(scopes);
figurer.postProcessBeanFactory(factory);
verify(scope);
}
@Test
public void testSunnyDayWithBonaFideScopeClass() throws Exception {
Map<String, Object> scopes = new HashMap<String, Object>();
scopes.put(FOO_SCOPE, NoOpScope.class);
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.setScopes(scopes);
figurer.postProcessBeanFactory(factory);
assertTrue(factory.getRegisteredScope(FOO_SCOPE) instanceof NoOpScope);
}
@Test
public void testSunnyDayWithBonaFideScopeClassname() throws Exception {
Map<String, Object> scopes = new HashMap<String, Object>();
scopes.put(FOO_SCOPE, NoOpScope.class.getName());
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.setScopes(scopes);
figurer.postProcessBeanFactory(factory);
assertTrue(factory.getRegisteredScope(FOO_SCOPE) instanceof NoOpScope);
}
@Test(expected=IllegalArgumentException.class)
public void testWhereScopeMapHasNullScopeValueInEntrySet() throws Exception {
Map<String, Object> scopes = new HashMap<String, Object>();
scopes.put(FOO_SCOPE, null);
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.setScopes(scopes);
figurer.postProcessBeanFactory(factory);
}
@Test(expected=IllegalArgumentException.class)
public void testWhereScopeMapHasNonScopeInstanceInEntrySet() throws Exception {
Map<String, Object> scopes = new HashMap<String, Object>();
scopes.put(FOO_SCOPE, this); // <-- not a valid value...
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.setScopes(scopes);
figurer.postProcessBeanFactory(factory);
}
@SuppressWarnings("unchecked")
@Test(expected=ClassCastException.class)
public void testWhereScopeMapHasNonStringTypedScopeNameInKeySet() throws Exception {
Map scopes = new HashMap();
scopes.put(this, new NoOpScope()); // <-- not a valid value (the key)...
CustomScopeConfigurer figurer = new CustomScopeConfigurer();
figurer.setScopes(scopes);
figurer.postProcessBeanFactory(factory);
}
}
| [
"taibi@sonar-scheduler.rd.tut.fi"
] | taibi@sonar-scheduler.rd.tut.fi |
df0adaae32a1ffca9f26421a03f56466d3c7fc8c | c4f37485fe74548dd90fc93b99fe64ee60679263 | /shop/src/test/hibernate/CategoryServiceImpl.java | 45be9206a924aa79fb704f662769583d8740492a | [] | no_license | zhujiancong/shop | 5324100bef0984a9017b6e5e1f0356ef2fc6d793 | 37b6b04bb0f74520ca619ccc6a2c22930c7da2c0 | refs/heads/master | 2021-06-16T02:57:02.615761 | 2017-05-17T15:28:11 | 2017-05-17T15:28:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 715 | java | package test.hibernate;
import org.hibernate.Session;
import com.jcom.shop.model.Category;
import com.jcon.shop.utils.HibernateSessionFactory;
public class CategoryServiceImpl implements CategoryService{
@Override
public void save(Category category) {
//生成的sessionFactory获取session
Session session = HibernateSessionFactory.getSession();
try {
//手动事务
session.getTransaction().begin();
//执行业务逻辑
session.save(category);
//手动提交
session.getTransaction().commit();
} catch (Exception e) {
session.getTransaction().rollback();
e.printStackTrace();
}finally{
HibernateSessionFactory.closeSession();
}
}
}
| [
"525176261@qq.com"
] | 525176261@qq.com |
3f3498dbbb6039bdb66b5a9faa92b9ffa426bfd0 | 974f79a2fa2d41896b617af848f0fd4d859d8d9e | /DoubleLinkedListClass.java | 81f7ddd3cc933fd751034d987b250d46fd03e34c | [] | no_license | AnilKumar1992/NodeCreation | 148a464998375428781a92a5f3ce95fac46c4175 | c91de6c5920fbec118b94ed61daff9e68901b631 | refs/heads/master | 2023-02-19T19:21:23.888799 | 2021-01-04T11:04:33 | 2021-01-04T11:04:33 | 326,629,403 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,780 | java | package com.enhancesys.analytics.master.extractor.util;
public class DoubleLinkedListClass
{
Node head, tail = null;
int size;
class Node{
int data;
Node previous;
Node next;
public Node(int data) {
this.data = data;
}
}
// used to delete node from start of Doubly linked list
public Node deleteFirst() {
if (size == 0)
throw new RuntimeException("Doubly linked list is already empty");
Node temp = head;
head = head.next;
head.previous = null;
size--;
return temp;
}
// used to delete node from last of Doubly linked list
public Node deleteLast() {
Node temp = tail;
tail = tail.previous;
tail.next=null;
size--;
return temp;
}
public void insertFirst(int data) {
Node newNode = new Node(data);
newNode.next = head;
newNode.previous=null;
if(head!=null)
head.previous=newNode;
head = newNode;
if(tail==null)
tail=newNode;
size++;
}
public void insertLast(int data) {
Node newNode = new Node(data);
newNode.data = data;
newNode.next = null;
newNode.previous=tail;
if(tail!=null)
tail.next=newNode;
tail = newNode;
if(head==null)
head=newNode;
size++;
}
public void insertAtIndex(int i, int index){
if(index < 0 || index > i){
throw new IndexOutOfBoundsException("Index " + index +" not valid for linked list of size " + size);
}
Node newNode = new Node(i);
Node current = head;
//insert at the start
if(index == 0){
insertFirst(i);
}
// insert at last
else if(index == size){
insertLast(i);
}else{
for(int j = 0; j < index && current.next != null; j++){
current = current.next;
}
newNode.next = current;
current.previous.next = newNode;
newNode.previous = current.previous;
current.previous = newNode;
size++;
}
}
public void display() {
//Node current will point to head
Node current = head;
if(head == null) {
System.out.println("List is empty");
return;
}
System.out.println("Nodes of doubly linked list: ");
while(current != null) {
//Prints each node by incrementing the pointer.
System.out.print(current.data + " ");
current = current.next;
}
}
public void searchNode(int value)
{
int i = 1;
boolean flag = false;
//Node current will point to head
Node current = head;
//Checks whether the list is empty
if(head == null)
{
System.out.println("List is empty");
return;
}
while(current != null)
{
//Compare value to be searched with each node in the list
if(current.data == value) {
flag = true;
break;
}
current = current.next;
i++;
}
if(flag)
System.out.println("Node is present in the list at the position : " + i);
else
System.out.println("Node is not present in the list");
}
public static void main(String[] args)
{
DoubleLinkedListClass myLinkedlist = new DoubleLinkedListClass();
myLinkedlist.insertFirst(5);
myLinkedlist.insertFirst(6);
myLinkedlist.insertLast(20);
myLinkedlist.insertFirst(7);
myLinkedlist.insertFirst(1);
myLinkedlist.insertLast(2);
myLinkedlist.insertAtIndex(18, 2);
myLinkedlist.deleteFirst();
myLinkedlist.deleteLast();
myLinkedlist.display();
System.out.println();
myLinkedlist.searchNode(5);
}
}
| [
"vinay.nagaraj@enhancesys.com"
] | vinay.nagaraj@enhancesys.com |
53e71025db466380f64b89ca3f8ecd138d1cd1d0 | 2713293d42932abca9a81b61287741cf04a2e7fc | /1.9.18/MyAaptha/app/src/main/java/com/cpetsol/cpetsolutions/myaaptha/fragment/AddPrescriptionFragment.java | e77d16bbd5430e60fea8655286d5a68973185543 | [] | no_license | Kodanda9/MyAaptha | 420e71cb1dcbe6190a5cc85163f82b83b083e5ee | 2fd60e6a8ec3c190c5ccf2cc304bf1a8df5a4ce3 | refs/heads/master | 2020-12-06T20:37:11.204248 | 2020-01-08T11:28:40 | 2020-01-08T11:28:40 | 232,547,344 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,982 | java | package com.cpetsol.cpetsolutions.myaaptha.fragment;
import android.app.Fragment;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.cpetsol.cpetsolutions.myaaptha.R;
import com.cpetsol.cpetsolutions.myaaptha.helper.ApisHelper;
import com.cpetsol.cpetsolutions.myaaptha.helper.AppHelper;
import com.cpetsol.cpetsolutions.myaaptha.helper.AsyncTaskHelper;
import com.cpetsol.cpetsolutions.myaaptha.helper.validations.ValidationDTO;
import com.cpetsol.cpetsolutions.myaaptha.helper.validations.ValidationHelper;
import com.cpetsol.cpetsolutions.myaaptha.helper.validations.ValidationUtils;
import com.cpetsol.cpetsolutions.myaaptha.util.SessinSave;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
/**
* A simple {@link Fragment} subclass.
*/
public class AddPrescriptionFragment extends Fragment {
private View rootView;
private Spinner SFamilyNames,ETDrSpec;
private EditText ETDetails,ETDate,ETDrName;
private Button btnSubmit;
private TextView TvUpoloadName;
final int GALLERY_REQUEST=2200;
// private GalleryPhoto galleryPhoto;
private RadioGroup privacyGroup;
private String ppId="1";
private String photoPath;
private Bitmap imageBitmap;
private String uploadName;
private long totalSize = 0;
public AddPrescriptionFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if(rootView != null) {
ViewGroup parent=(ViewGroup)rootView.getParent();
if(parent != null)
{ parent.removeView(rootView); }
}//if
try{
rootView=inflater.inflate(R.layout.add_prescription_fragment,container,false);
// rootView.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.enter_from_right));
// Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(getActivity()));
// AppHelper.setupHideleyboard(rootView,getActivity());
// fontAwesomeFont = Typeface.createFromAsset(getActivity().getAssets(), "fontawesome-webfont.ttf");
init();
FamilyNamesAsyncTask runner= new FamilyNamesAsyncTask(); runner.execute();
}catch (Exception e){ e.printStackTrace(); }
return rootView;
}//onCreate
private void init() {
SFamilyNames=(Spinner)rootView.findViewById(R.id.sFamilynames);
ETDrName=(EditText)rootView.findViewById(R.id.et_DrName);
ETDrSpec=(Spinner) rootView.findViewById(R.id.et_DrSpec);
ETDate=(EditText)rootView.findViewById(R.id.et_Date);
ETDetails=(EditText)rootView.findViewById(R.id.et_details);
btnSubmit=(Button) rootView.findViewById(R.id.btn_submit);
TvUpoloadName = (TextView) rootView.findViewById(R.id.tvUploadTitle);
TextView TvUpload = (TextView) rootView.findViewById(R.id.tvUpload);
TvUpload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// galleryPhoto = new GalleryPhoto(getActivity());
// Intent in = galleryPhoto.openGalleryIntent();
// startActivityForResult(in, GALLERY_REQUEST);
}
});
btnSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
validations();
}
});
privacyGroup=(RadioGroup)rootView.findViewById(R.id.pp_radioGroup);
privacyGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, @IdRes int checkedId) {
int pos=privacyGroup.indexOfChild(rootView.findViewById(privacyGroup.getCheckedRadioButtonId()));
ppId=String.valueOf(pos+1);
Toast.makeText(getActivity(),ppId, Toast.LENGTH_LONG).show();
}
});
ETDate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AppHelper.DatePickerDialodPopUp(getActivity(),ETDate);
}
});
}//inIt
private void validations() {
try{
ValidationHelper helper=new ValidationHelper();
String[] strIds = getResources().getStringArray(R.array.AddPresc_ids_array);
String[] strErrMsgs = getResources().getStringArray(R.array.AddPresc_errors_array);
String[] strCompTypeArr = getResources().getStringArray(R.array.AddPresc_comptypes_array);
ArrayList<ValidationDTO> aList = new ArrayList<ValidationDTO>();
int iPos = 0;
for(String strCompType:strCompTypeArr){
ValidationDTO valDTO=new ValidationDTO();
valDTO.setComponentType(strCompType);
valDTO.setComponentID(ValidationUtils.getIdResourceByName(getActivity(),strIds[iPos]));
valDTO.setErrorMessage(strErrMsgs[iPos]);
aList.add(valDTO);
iPos++;
}
boolean isValidData = helper.validateData(getActivity(), aList, rootView);
if (!isValidData) {
return;
}else{
AsyncTaskRunner runner = new AsyncTaskRunner();
runner.execute();
}
}catch (Exception e){
e.printStackTrace();
}
}//val
public class AsyncTaskRunner extends AsyncTask<String, String, String> {
ProgressDialog progressDialog;
String famName,EBirthday,EDetails,EComapany,drName,drSpec ;
@Override
protected void onPreExecute() {
progressDialog = ProgressDialog.show(getActivity(), "Please wait", "loading...");
famName=SFamilyNames.getSelectedItem().toString();
drName=ETDrName.getText().toString();
drSpec=ETDrSpec.getSelectedItem().toString();
EBirthday=ETDate.getText().toString();
EDetails=ETDetails.getText().toString();
}
@Override
protected String doInBackground(String... strings) {
JSONObject obj= null;
try{
obj= new JSONObject();
obj.accumulate("documentCategory","Add Prescription");
obj.accumulate("familyNames",famName);
obj.accumulate("doctorName",drName);
obj.accumulate("specailization",drSpec);
obj.accumulate("date",EBirthday);
obj.accumulate("details",EDetails);
obj.accumulate("fileName",uploadName);
obj.accumulate("view",ppId);
}catch (Exception e){
e.printStackTrace();
}
Log.i("obj:-->",obj.toString());
String content= AsyncTaskHelper.makeServiceCall(ApisHelper.storeUserDataMyAaptha+ SessinSave.getsessin("profile_id",getActivity()),"POST",obj);
return content;
}
@Override
protected void onPostExecute(String s) {
try {
JSONObject obj=new JSONObject(s);
if(obj.getString("status").equalsIgnoreCase("SUCCESS")){
Toast.makeText(getActivity(),"Successfully saved", Toast.LENGTH_LONG).show();
// Intent in=new Intent(getActivity(),NavigationActivity.class);
// startActivity(in);
// getActivity().finish();
}else{
Toast.makeText(getActivity(),"Some Issue is going on, we will Solve this ASAP",Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
Log.i("AddEduAsyncTask onPost:",s);
super.onPostExecute(s);
progressDialog.dismiss();
// getFragmentManager().beginTransaction().replace(R.id.nav_content, new AddAdvanceFragment()).commit();
// android.app.FragmentManager fragmentManager = getActivity().getFragmentManager();//Refresh Fragmet
// fragmentManager.beginTransaction().replace(R.id.nav_main_replace, new PD_Guardian()).commit();
}
}//NavSubmitAsyncTask
public class FamilyNamesAsyncTask extends AsyncTask<String, String, String> {
private JSONArray array;
private ArrayList<String> familyList;
private ProgressDialog pDialog;
@Override
protected void onPreExecute() {
pDialog= ProgressDialog.show(getActivity(),"Please wait","Loading...");
}
@Override
protected String doInBackground(String... strings) {
String content= AsyncTaskHelper.makeServiceCall(ApisHelper.allFamilyNames+SessinSave.getsessin("profile_id",getActivity())+"","GET",null);
return content;
}
@Override
protected void onPostExecute(String s) {
if(pDialog.isShowing()){ pDialog.dismiss(); }
try {
familyList = new ArrayList<String>();
array=new JSONArray(s);
for(int i = 0; i < array.length(); i++){
JSONObject jsonObj=array.getJSONObject(i);
familyList.add(jsonObj.getString("fullName"));
}
familyList.add(0,"Select");
}catch (Exception e){
e.printStackTrace();
}
SFamilyNames.setAdapter(new ArrayAdapter<String>(getActivity(),android.R.layout.simple_spinner_dropdown_item,familyList));
}
}//AddEduAsyncTask
// @Override
// public void onActivityResult(int requestCode, int resultCode, Intent data) {
// if(resultCode == getActivity().RESULT_OK) {
// if(requestCode == GALLERY_REQUEST){
// galleryPhoto.setPhotoUri(data.getData());
// photoPath = galleryPhoto.getPath();
// Log.i("Photo path",photoPath);
// try {
// imageBitmap = BitmapFactory.decodeFile(photoPath);
//// profileImg.setImageBitmap(imageBitmap);
//// Bitmap bitmap = ImageLoader.init().from(photoPath).requestSize(512, 512).getBitmap();
//// profileImg.setImageBitmap(bitmap);
//// selectedImage = photoPath;
// new UploadFileToServer().execute();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// }
// }//onActivityResult
//
// private class UploadFileToServer extends AsyncTask<Void, Integer, String> {
// ProgressDialog progressDialog;
// @Override
// protected void onPreExecute() {
// // setting progress bar to zero
// progressDialog = ProgressDialog.show(getActivity(), "Please wait", "loading...");
// super.onPreExecute();
// }
//
//// @Override
//// protected void onProgressUpdate(Integer... progress) {
//// // Making progress bar visible
////// progressBar.setVisibility(View.VISIBLE);
////
//// // updating progress bar value
////// progressBar.setProgress(progress[0]);
////
//// // updating percentage value
////// txtPercentage.setText(String.valueOf(progress[0]) + "%");
//// }
//
// @Override
// protected String doInBackground(Void... params) {
// return uploadFile();
// }
// @SuppressWarnings("deprecation")
// private String uploadFile() {
// String responseString = null;
//
// HttpClient httpclient = new DefaultHttpClient();
// HttpPost httppost = new HttpPost(ApisHelper.fileuploadMyAaptha+ SessinSave.getsessin("profile_id",getActivity()));
//
// try {
// AndroidMultiPartEntity entity = new AndroidMultiPartEntity(
// new AndroidMultiPartEntity.ProgressListener() {
//
// @Override
// public void transferred(long num) {
// publishProgress((int) ((num / (float) totalSize) * 100));
// }
// });
//
// File sourceFile = new File(photoPath);
//
// // Adding file data to http body
// entity.addPart("file", new FileBody(sourceFile));
//
//// Extra parameters if you want to pass to server
//// entity.addPart("website", new StringBody("www.androidhive.info"));
//// entity.addPart("email", new StringBody("abc@gmail.com"));
//
// totalSize = entity.getContentLength();
// httppost.setEntity(entity);
//
// // Making server call
// HttpResponse response = httpclient.execute(httppost);
// HttpEntity r_entity = response.getEntity();
//
// int statusCode = response.getStatusLine().getStatusCode();
// if (statusCode == 200) {
// // Server response
// responseString = EntityUtils.toString(r_entity);
// } else {
// responseString = "Error occurred! Http Status Code: "
// + statusCode;
// Log.i("Line 1200","Error occurred!");
// }
//
// } catch (ClientProtocolException e) {
// responseString = e.toString();
// } catch (IOException e) {
// responseString = e.toString();
// }finally {
// }
//
// return responseString;
//
// }
// @Override
// protected void onPostExecute(String result) {
// Log.e("OnPOst", "Response from server: " + result);
// // showing the server response in an alert dialog
//// showAlert(result);
// Pattern p = Pattern.compile("\"([^\"]*)\"");
// Matcher m = p.matcher(result);
// while (m.find()) {
// uploadName=m.group(1);
// }
// TvUpoloadName.setText(uploadName);
//// super.onPostExecute(result);
// if(progressDialog.isShowing()){ progressDialog.dismiss(); }
// }
//
// }
}
| [
"kodanda55555@gmail.com"
] | kodanda55555@gmail.com |
0f1ff85df1a05e6715e63b3880abcb63223400a6 | 2acb47e9fad229d5e50a9a0eb8fb83b0d8f2dd19 | /ehcache/src/main/java/com/scotch/io/ehcache/EhcacheApplication.java | 6c2ef18dbf319e3db41c2d06ff17917624b171af | [
"MIT"
] | permissive | NehaChopra/Spring_Boot_Quick_Start | e74daf88508c363f43de05a05a8cd0c5b4f7db0b | a1975103bd26612839eabb86de17e110e394899f | refs/heads/master | 2020-03-14T06:28:41.727274 | 2018-08-30T12:28:37 | 2018-08-30T12:28:37 | 131,485,017 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,068 | java | package com.scotch.io.ehcache;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
/*
* Configuration for ehcache
*/
@SpringBootApplication
@EnableCaching
public class EhcacheApplication {
/*
* Ehcache, a widely used, open-source Java-based cache.
* It features memory and disk stores, listeners, cache loaders, RESTful and SOAP APIs and other very useful features.
* To show how caching can optimize our application,we will create a simple method which will calculate square values of provided numbers.
* On each call, the method will call calculateSquareOfNumber(int number) method and print information message to the console.
* With this simple example, we want to show that calculation of squared values is done only once, and every other call with same input value is
* returning result from cache.
*
*/
public static void main(String[] args) {
SpringApplication.run(EhcacheApplication.class, args);
}
}
| [
"neha.chopra@paytm.com"
] | neha.chopra@paytm.com |
fd2db56e36c4ab4c3d96fc8a7cd6b8cba8ca4ce1 | 599f5bf3b464bdfa01a45ebab7c06559f24f2031 | /src/main/java/com/capitalone/dashboard/collector/BlackDuckSettings.java | 9a55adb419f2b42b4b42f9607a842b81c14aa078 | [] | no_license | matjukov-nikolaj/blackduck | 925e3ba8568dd59f0cf96fcbb5931481b7c76f10 | 03820ee91971040476960181f0ca54a823a2af8b | refs/heads/master | 2020-03-23T07:41:40.065338 | 2018-09-06T10:06:50 | 2018-09-06T10:06:50 | 141,286,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package com.capitalone.dashboard.collector;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import codesecurity.collectors.collector.CodeSecuritySettings;
@Component
@ConfigurationProperties(prefix = "blackduck")
public class BlackDuckSettings extends CodeSecuritySettings{
}
| [
"blatnoi.kolyan@yandex.ru"
] | blatnoi.kolyan@yandex.ru |
695d3213ce458c491f4748413b38bd56421c81d6 | 9e9b33b8ac94636028075b26509d9d017dde29de | /JspPrj/src/com/newlecture/jspprj/dao/jdbc/JdbcAnswerisDao.java | 9eb5775f441eec3f3b1276af3a815fe1dcc8807d | [] | no_license | yurimelliekim/JspProject | f948bf384728f3e8b719c5c8790d83d50d276d99 | daf40d8d4b693b75ec1d5c0133c92a287ba6c8fb | refs/heads/master | 2020-03-07T09:19:00.716729 | 2018-03-30T08:40:56 | 2018-03-30T08:40:56 | 124,978,795 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,188 | java | package com.newlecture.jspprj.dao.jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.newlecture.jspprj.dao.AnswerisDao;
import com.newlecture.jspprj.entity.Answeris;
import com.newlecture.jspprj.entity.AnswerisView;
import com.newlecture.jspweb.entity.Notice;
import com.newlecture.jspweb.entity.NoticeView;
public class JdbcAnswerisDao implements AnswerisDao {
@Override
public int insert(Answeris answeris) {
String sql = "INSERT INTO ANSWERIS(ID,TITLE, LANGUAGE, PLATFORM, RUNTIME, ERROR_CODE, ERROR_MESSAGE,SITUATION, TRIED_TO_FIX, REASON, HOW_TO_FIX, WRITER_ID,ATTACHED_FILE) VALUES((SELECT NVL(MAX(TO_NUMBER(ID)),0)+1 ID FROM ANSWERIS),?,?,?,?,?,?,?,?,?,?,?,?)";
int result = 0;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@211.238.142.251:1521:orcl";
Connection con = DriverManager.getConnection(url, "c##sist", "dclass");
PreparedStatement st = con.prepareStatement(sql);
//Statement st = con.createStatement();
//st.setString(1, answeris.getId());
st.setString(1, answeris.getTitle());
st.setString(2, answeris.getLanguage());
st.setString(3, answeris.getPlatform());
st.setString(4, answeris.getRuntime());
st.setString(5, answeris.getErrorCode());
st.setString(6, answeris.getErrorMessage());
st.setString(7, answeris.getSituation());
st.setString(8, answeris.getTriedToFix());
st.setString(9, answeris.getReason());
st.setString(10, answeris.getHowToFix());
st.setString(11, answeris.getWriterId());
st.setString(12, answeris.getAttachedFile());
result = st.executeUpdate(); //결과 반환
st.close();
con.close();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
@Override
public int update(Answeris answeris) {
String sql = "UPDATE ANSWERIS SET TITLE = ?,LANGUAGE = ?, PLATFORM = ?, RUNTIME = ?, ERROR_CODE = ?, ERROR_MESSAGE = ?,"
+ "SITUATION = ?, TRIED_TO_FIX = ?, REASON = ?, HOW_TO_FIX = ?, HIT = ?"
+ "WHERE ID = ?";
int result = 0;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@211.238.142.251:1521:orcl";
Connection con = DriverManager.getConnection(url, "c##sist", "dclass");
PreparedStatement st = con.prepareStatement(sql);
st.setString(1, answeris.getTitle());
st.setString(2, answeris.getLanguage());
st.setString(3, answeris.getPlatform());
st.setString(4, answeris.getRuntime());
st.setString(5, answeris.getErrorCode());
st.setString(6, answeris.getErrorMessage());
st.setString(7, answeris.getSituation());
st.setString(8, answeris.getTriedToFix());
st.setString(9, answeris.getReason());
st.setString(10, answeris.getHowToFix());
st.setInt(11, answeris.getHit());
st.setString(12, answeris.getId());
result = st.executeUpdate();
//ResultSet rs = st.executeQuery();
//rs.close();
st.close();
con.close();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
@Override
public int delete(String id) {
String sql = "DELETE ANSWERIS WHERE ID = ?";
int result = 0;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@211.238.142.251:1521:orcl";
Connection con = DriverManager.getConnection(url, "c##sist", "dclass");
PreparedStatement st = con.prepareStatement(sql);
st.setString(1, id);
result = st.executeUpdate();
//rs.close();
st.close();
con.close();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
@Override
public List<AnswerisView> getList(int page) {
int start = 1+(page-1)*15;
int end = page*15;
String sql = "SELECT * FROM ANSWERIS_VIEW WHERE NUM BETWEEN ? AND ?";
List<AnswerisView> list = new ArrayList<>();
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@211.238.142.251:1521:orcl";
Connection con = DriverManager.getConnection(url, "c##sist", "dclass");
PreparedStatement st = con.prepareStatement(sql);
st.setInt(1, start);
st.setInt(2, end);
ResultSet rs = st.executeQuery();
AnswerisView answeris = null;
while (rs.next()) {
AnswerisView answerisview = new AnswerisView(
rs.getString("id"),
rs.getString("language"),
rs.getString("platform"),
rs.getString("runtime"),
rs.getString("title"),
rs.getString("error_Code"),
rs.getString("error_Message"),
rs.getString("situation"),
rs.getString("tried_To_Fix"),
rs.getString("reason"),
rs.getString("writer_Id"),
rs.getString("how_To_Fix"),
rs.getDate("reg_Date"),
rs.getInt("hit"),
rs.getString("attached_file"),
rs.getInt("comment_Count")
);
list.add(answerisview);
}
rs.close();
st.close();
con.close();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
@Override
public AnswerisView get(String id) {
String sql = "SELECT * FROM ANSWERIS_VIEW WHERE ID = ?";
AnswerisView answeris = null; // 초기값
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@211.238.142.251:1521:orcl";
Connection con = DriverManager.getConnection(url, "c##sist", "dclass");
PreparedStatement st = con.prepareStatement(sql);
st.setString(1, id);
ResultSet rs = st.executeQuery();
if(rs.next()) {
answeris = new AnswerisView(
rs.getString("id"),
rs.getString("language"),
rs.getString("platform"),
rs.getString("runtime"),
rs.getString("title"),
rs.getString("error_Code"),
rs.getString("error_Message"),
rs.getString("situation"),
rs.getString("tried_To_Fix"),
rs.getString("reason"),
rs.getString("writer_Id"),
rs.getString("how_To_Fix"),
rs.getDate("reg_Date"),
rs.getInt("hit"),
rs.getString("attached_file"),
rs.getInt("comment_Count")
);
//System.out.printf("id: %s, name: %s\n",id,name);
}
rs.close();
st.close();
con.close();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return answeris;
}
@Override
public int getCount() {
String sql = "SELECT COUNT(ID) COUNT FROM ANSWERIS";
int count = 0; // 초기값
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@211.238.142.251:1521:orcl";
Connection con = DriverManager.getConnection(url, "c##sist", "dclass");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(sql);
if(rs.next()) {
count = rs.getInt("count");
//System.out.printf("id: %s, name: %s\n",id,name);
}
rs.close();
st.close();
con.close();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return count;
}
}
| [
"unloveparty@naver.com"
] | unloveparty@naver.com |
e6fa2e1b6f8c72a99ba2b29c2b0b57e7c5bdbcc2 | 1f266aded13d164724c1464993ff394e1a0edbc2 | /src/main/java/com/example/bddspring1557238462/DemoApplication.java | dca2b48243d4ecd424fb05af38f389bb464d3f99 | [] | no_license | cloudcat-meow/bdd-spring-1557238462 | 57fe1f9763b89bf1d053cb8df22f03893e90fc39 | 0d70031db0ea91a52c99a1fc328c3b69c219faa9 | refs/heads/master | 2020-05-20T05:50:39.555555 | 2019-05-07T14:14:33 | 2019-05-07T14:14:33 | 185,416,010 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package com.example.bddspring1557238462;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
| [
"andrew.bayer@gmail.com"
] | andrew.bayer@gmail.com |
77c328b1a2f44ce7adbd33e1aad4d90a12e3bc4b | f017652f293f04dee607cfa0898e660fa2d672db | /src/main/java/teamUnknown/immersion/features/electricalAge/energy/IEnergyReciever.java | 06091f6da688c9c4e5e41c7cde494951b7189fbb | [] | no_license | MCDTeam/Immersion | 0fc98b6f4b716859f7ab1c5831da87cd54ac9876 | a37f5e4b9fff5b93cdaec942062dda50636986fd | refs/heads/master | 2021-01-23T07:27:04.157214 | 2015-01-04T01:05:08 | 2015-01-04T01:05:08 | 25,310,245 | 0 | 0 | null | 2014-12-22T12:26:55 | 2014-10-16T16:07:49 | Java | UTF-8 | Java | false | false | 1,377 | java | package teamUnknown.immersion.features.electricalAge.energy;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
* <p>
* A reference implementation is provided {@link TileEnergyHandler}.
*/
public interface IEnergyReciever extends IEnergyConnection{
/**
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
*
* @param from
* Orientation the energy is received from.
* @param maxReceive
* Maximum amount of energy to receive.
* @param simulate
* If TRUE, the charge will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) received.
*/
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
/**
* Returns the amount of energy currently stored.
*/
int getEnergyStored(ForgeDirection from);
/**
* Returns the maximum amount of energy that can be stored.
*/
int getMaxEnergyStored(ForgeDirection from);
/**
* Can the machine accept evergy on a certain side
* @param direction
* @return true/false
*/
boolean canAddEnergyOnSide(ForgeDirection direction);
}
| [
"shaunoneill7@me.com"
] | shaunoneill7@me.com |
75e361dd907034868efdaf767b344a53a20ff6f8 | 0c2ab55aa7cb62929726e0f48c190efdb6c7a610 | /app/src/main/java/com/demo/template/providers/overview/ui/OverviewFragment.java | 2adea76dd8b668f6c9b6f07cfb79ffef997cbb9f | [] | no_license | achourasiya43/HomeMadeRemedies | 9cdc61da4aa206e3bfcd51f3452bab8676f966bc | 36d850b811c16d1a0678310306f6d7da1336d97f | refs/heads/master | 2020-03-26T12:32:07.980304 | 2018-08-15T19:54:11 | 2018-08-15T19:54:11 | 144,897,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,369 | java | package com.demo.template.providers.overview.ui;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.demo.template.HolderActivity;
import com.demo.template.MainActivity;
import com.demo.template.R;
import com.demo.template.drawer.NavItem;
import com.demo.template.providers.overview.CategoryAdapter;
import com.demo.template.providers.overview.OverviewParser;
import com.demo.template.util.Helper;
import com.demo.template.util.InfiniteRecyclerViewAdapter;
import java.util.ArrayList;
/**
* This file is part of the Universal template
* For license information, please check the LICENSE
* file in the root of this project
*
* @author Sherdle
* Copyright 2017
*/
public class OverviewFragment extends Fragment implements CategoryAdapter.OnOverViewClick {
//Views
private RelativeLayout rl;
private RecyclerView mRecyclerView;
private ArrayList<NavItem> items;
private String overviewString;
private DividerItemDecoration horizontalDec;
//List
private CategoryAdapter multipleItemAdapter;
private ViewTreeObserver.OnGlobalLayoutListener recyclerListener;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rl = (RelativeLayout) inflater.inflate(R.layout.fragment_list,null);
setHasOptionsMenu(true);
mRecyclerView = rl.findViewById(R.id.list);
final StaggeredGridLayoutManager mLayoutManager = new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(mLayoutManager);
items = new ArrayList<>();
multipleItemAdapter = new CategoryAdapter(items, getContext(), OverviewFragment.this);
mRecyclerView.setAdapter(multipleItemAdapter);
multipleItemAdapter.setModeAndNotify(InfiniteRecyclerViewAdapter.MODE_PROGRESS);
overviewString = this.getArguments().getStringArray(MainActivity.FRAGMENT_DATA)[0];
recyclerListener = new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
//Get the view width, and check if it could be valid
int viewWidth = mRecyclerView.getMeasuredWidth();
if (viewWidth <= 0 ) return;
//Remove the VTO
mRecyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
//Calculate and update the span
float cardViewWidth = getResources().getDimension(R.dimen.card_width_overview);
int newSpanCount = Math.max(1, (int) Math.floor(viewWidth / cardViewWidth));
mLayoutManager.setSpanCount(newSpanCount);
mLayoutManager.requestLayout();
if (newSpanCount > 1){
mRecyclerView.addItemDecoration(horizontalDec);
} else {
mRecyclerView.removeItemDecoration(horizontalDec);
}
}
};
mRecyclerView.getViewTreeObserver().addOnGlobalLayoutListener(recyclerListener);
horizontalDec = new DividerItemDecoration(mRecyclerView.getContext(),
DividerItemDecoration.HORIZONTAL);
DividerItemDecoration verticalDec = new DividerItemDecoration(mRecyclerView.getContext(),
DividerItemDecoration.VERTICAL);
mRecyclerView.addItemDecoration(verticalDec);
//Load items
loadItems();
return rl;
}
public void loadItems() {
new OverviewParser(overviewString, getActivity(), new OverviewParser.CallBack() {
@Override
public void categoriesLoaded(ArrayList<NavItem> result, boolean failed) {
if (failed) {
//If it failed; show an error if we're using a local file, or if we are online & using a remote overview.
if (!overviewString.contains("http") || Helper.isOnlineShowDialog(getActivity())) {
Toast.makeText(getActivity(), R.string.invalid_configuration, Toast.LENGTH_LONG).show();
multipleItemAdapter.setModeAndNotify(InfiniteRecyclerViewAdapter.MODE_EMPTY);
}
} else {
//Add all the new posts to the list and notify the adapter
items.addAll(result);
multipleItemAdapter.setModeAndNotify(InfiniteRecyclerViewAdapter.MODE_LIST);
}
}
}).execute();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mRecyclerView.getViewTreeObserver().addOnGlobalLayoutListener(recyclerListener);
}
@Override
public void onOverViewSelected(NavItem item) {
HolderActivity.startActivity(getActivity(), item.getFragment(), item.getData());
}
}
| [
"achourasiya43@gmail.com"
] | achourasiya43@gmail.com |
269afe5d2ee9def86c665627c14468aee8768b89 | 7bda688fab28fa5448b2707e253b1d6d89dacd8a | /app/src/main/java/com/cretin/www/externalmaputils/MainActivity.java | a947e7b6c4ac26e1c1fd9657f3ef51050fa7db18 | [] | no_license | XiaoKeXin09/ExternalMapUtils | 7490e7d8ee73ba6892613c202ca2b3dfb03aee08 | 5c01441df38a1b94c057c790964c583f11cb45b4 | refs/heads/master | 2021-04-07T05:05:35.027996 | 2020-03-20T02:35:11 | 2020-03-20T02:35:11 | 248,648,882 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,972 | java | package com.cretin.www.externalmaputils;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.cretin.www.externalmaputilslibrary.OpenExternalMapAppUtils;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private TextView mTv_showMarker;
private EditText mEd_ll_marker;
private EditText mEd_name_marker;
private EditText mEd_des_marker;
private TextView mTv_showMarker_force;
private EditText mEd_ll_marker_force;
private EditText mEd_name_marker_force;
private EditText mEd_des_marker_force;
private TextView mTv_showMarker_inner;
private EditText mEd_ll_marker_inner;
private EditText mEd_name_marker_inner;
private EditText mEd_des_marker_inner;
private TextView mTv_showDirection;
private EditText mEd_s_ll_direction;
private EditText mEd_s_name_direction;
private EditText mEd_d_ll_direction;
private EditText mEd_d_name_direction;
private TextView mTv_showNaviApp;
private EditText mEd_ll_navi_app;
private EditText mEd_name_navi_app;
private EditText mEd_des_navi_app;
private TextView mTv_showNavi;
private EditText mEd_s_ll_navi;
private EditText mEd_s_name_navi;
private EditText mEd_d_ll_navi;
private EditText mEd_d_name_navi;
private TextView mTv_showNavi_inner;
private EditText mEd_s_ll_navi_inner;
private EditText mEd_s_name_navi_inner;
private EditText mEd_d_ll_navi_inner;
private EditText mEd_d_name_navi_inner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bindViews();
initListener();
}
//初始化事件
private void initListener() {
mTv_showMarker.setOnClickListener(this);
mTv_showMarker_force.setOnClickListener(this);
mTv_showMarker_inner.setOnClickListener(this);
mTv_showDirection.setOnClickListener(this);
mTv_showNaviApp.setOnClickListener(this);
mTv_showNavi.setOnClickListener(this);
mTv_showNavi_inner.setOnClickListener(this);
}
private void bindViews() {
mTv_showMarker = ( TextView ) findViewById(R.id.tv_showMarker);
mEd_ll_marker = ( EditText ) findViewById(R.id.ed_ll_marker);
mEd_name_marker = ( EditText ) findViewById(R.id.ed_name_marker);
mEd_des_marker = ( EditText ) findViewById(R.id.ed_des_marker);
mTv_showMarker_force = ( TextView ) findViewById(R.id.tv_showMarker_force);
mEd_ll_marker_force = ( EditText ) findViewById(R.id.ed_ll_marker_force);
mEd_name_marker_force = ( EditText ) findViewById(R.id.ed_name_marker_force);
mEd_des_marker_force = ( EditText ) findViewById(R.id.ed_des_marker_force);
mTv_showMarker_inner = ( TextView ) findViewById(R.id.tv_showMarker_inner);
mEd_ll_marker_inner = ( EditText ) findViewById(R.id.ed_ll_marker_inner);
mEd_name_marker_inner = ( EditText ) findViewById(R.id.ed_name_marker_inner);
mEd_des_marker_inner = ( EditText ) findViewById(R.id.ed_des_marker_inner);
mTv_showDirection = ( TextView ) findViewById(R.id.tv_showDirection);
mEd_s_ll_direction = ( EditText ) findViewById(R.id.ed_s_ll_direction);
mEd_s_name_direction = ( EditText ) findViewById(R.id.ed_s_name_direction);
mEd_d_ll_direction = ( EditText ) findViewById(R.id.ed_d_ll_direction);
mEd_d_name_direction = ( EditText ) findViewById(R.id.ed_d_name_direction);
mTv_showNaviApp = ( TextView ) findViewById(R.id.tv_showNaviApp);
mEd_ll_navi_app = ( EditText ) findViewById(R.id.ed_ll_navi_app);
mEd_name_navi_app = ( EditText ) findViewById(R.id.ed_name_navi_app);
mEd_des_navi_app = ( EditText ) findViewById(R.id.ed_des_navi_app);
mTv_showNavi = ( TextView ) findViewById(R.id.tv_showNavi);
mEd_s_ll_navi = ( EditText ) findViewById(R.id.ed_s_ll_navi);
mEd_s_name_navi = ( EditText ) findViewById(R.id.ed_s_name_navi);
mEd_d_ll_navi = ( EditText ) findViewById(R.id.ed_d_ll_navi);
mEd_d_name_navi = ( EditText ) findViewById(R.id.ed_d_name_navi);
mTv_showNavi_inner = ( TextView ) findViewById(R.id.tv_showNavi_inner);
mEd_s_ll_navi_inner = ( EditText ) findViewById(R.id.ed_s_ll_navi_inner);
mEd_s_name_navi_inner = ( EditText ) findViewById(R.id.ed_s_name_navi_inner);
mEd_d_ll_navi_inner = ( EditText ) findViewById(R.id.ed_d_ll_navi_inner);
mEd_d_name_navi_inner = ( EditText ) findViewById(R.id.ed_d_name_navi_inner);
}
@Override
public void onClick(View v) {
switch ( v.getId() ) {
case R.id.tv_showMarker:
showMarker();
break;
case R.id.tv_showMarker_force:
showMarkerForce();
break;
case R.id.tv_showMarker_inner:
showMarkerInner();
break;
case R.id.tv_showDirection:
showDirection();
break;
case R.id.tv_showNavi:
showBrosserNavi();
break;
case R.id.tv_showNaviApp:
showNaviApp();
break;
case R.id.tv_showNavi_inner:
showBrosserNaviInner();
break;
}
}
private void showNaviApp() {
//113.942501,22.539013 深圳大学 南山区南海大道3688号(近桂庙新村)
String ll = mEd_ll_navi_app.getText().toString();
if ( TextUtils.isEmpty(ll) ) {
Toast.makeText(this, "请填写经纬度", Toast.LENGTH_SHORT).show();
return;
}
String[] split = ll.split(",");
if ( split.length < 2 ) {
Toast.makeText(this, "经纬度格式有误", Toast.LENGTH_SHORT).show();
return;
}
String longitude = split[0];
String latitude = split[1];
String name = mEd_name_navi_app.getText().toString();
if ( TextUtils.isEmpty(name) ) {
Toast.makeText(this, "请填写地名", Toast.LENGTH_SHORT).show();
return;
}
String des = mEd_des_navi_app.getText().toString();
if ( TextUtils.isEmpty(des) ) {
Toast.makeText(this, "请填写地名描述", Toast.LENGTH_SHORT).show();
return;
}
OpenExternalMapAppUtils.openMapNavi(this, longitude, latitude, name, des, "测试DEMO");
}
private void showBrosserNavi() {
//113.942501,22.539013 深圳大学 南山区南海大道3688号(近桂庙新村)
//113.933012,22.538673 田厦·国际中心 桃园路8号
String sLL = mEd_s_ll_navi.getText().toString();
String dLL = mEd_d_ll_navi.getText().toString();
if ( TextUtils.isEmpty(sLL) ) {
Toast.makeText(this, "请填写起点经纬度", Toast.LENGTH_SHORT).show();
return;
}
String[] split = sLL.split(",");
if ( split.length < 2 ) {
Toast.makeText(this, "起点经纬度格式有误", Toast.LENGTH_SHORT).show();
return;
}
if ( TextUtils.isEmpty(dLL) ) {
Toast.makeText(this, "请填写终点经纬度", Toast.LENGTH_SHORT).show();
return;
}
String[] split1 = dLL.split(",");
if ( split1.length < 2 ) {
Toast.makeText(this, "终点经纬度格式有误", Toast.LENGTH_SHORT).show();
return;
}
String sName = mEd_s_name_navi.getText().toString();
String dName = mEd_d_name_navi.getText().toString();
if ( TextUtils.isEmpty(sName) ) {
Toast.makeText(this, "请填写起点地名", Toast.LENGTH_SHORT).show();
return;
}
if ( TextUtils.isEmpty(dName) ) {
Toast.makeText(this, "请填写终点地名", Toast.LENGTH_SHORT).show();
return;
}
OpenExternalMapAppUtils.openBrosserNaviMap(this, split[0], split[1], sName,
split1[0], split1[1], dName, "深圳", "测试DEMO", true);
}
private void showBrosserNaviInner() {
//113.942501,22.539013 深圳大学 南山区南海大道3688号(近桂庙新村)
//113.933012,22.538673 田厦·国际中心 桃园路8号
String sLL = mEd_s_ll_navi_inner.getText().toString();
String dLL = mEd_d_ll_navi_inner.getText().toString();
if ( TextUtils.isEmpty(sLL) ) {
Toast.makeText(this, "请填写起点经纬度", Toast.LENGTH_SHORT).show();
return;
}
String[] split = sLL.split(",");
if ( split.length < 2 ) {
Toast.makeText(this, "起点经纬度格式有误", Toast.LENGTH_SHORT).show();
return;
}
if ( TextUtils.isEmpty(dLL) ) {
Toast.makeText(this, "请填写终点经纬度", Toast.LENGTH_SHORT).show();
return;
}
String[] split1 = dLL.split(",");
if ( split1.length < 2 ) {
Toast.makeText(this, "终点经纬度格式有误", Toast.LENGTH_SHORT).show();
return;
}
String sName = mEd_s_name_navi_inner.getText().toString();
String dName = mEd_d_name_navi_inner.getText().toString();
if ( TextUtils.isEmpty(sName) ) {
Toast.makeText(this, "请填写起点地名", Toast.LENGTH_SHORT).show();
return;
}
if ( TextUtils.isEmpty(dName) ) {
Toast.makeText(this, "请填写终点地名", Toast.LENGTH_SHORT).show();
return;
}
OpenExternalMapAppUtils.openBrosserNaviMap(this, split[0], split[1], sName,
split1[0], split1[1], dName, "深圳", "测试DEMO");
}
private void showDirection() {
//113.942501,22.539013 深圳大学 南山区南海大道3688号(近桂庙新村)
//113.933012,22.538673 田厦·国际中心 桃园路8号
String sLL = mEd_s_ll_direction.getText().toString();
String dLL = mEd_d_ll_direction.getText().toString();
if ( TextUtils.isEmpty(sLL) ) {
Toast.makeText(this, "请填写起点经纬度", Toast.LENGTH_SHORT).show();
return;
}
String[] split = sLL.split(",");
if ( split.length < 2 ) {
Toast.makeText(this, "起点经纬度格式有误", Toast.LENGTH_SHORT).show();
return;
}
if ( TextUtils.isEmpty(dLL) ) {
Toast.makeText(this, "请填写终点经纬度", Toast.LENGTH_SHORT).show();
return;
}
String[] split1 = dLL.split(",");
if ( split1.length < 2 ) {
Toast.makeText(this, "终点经纬度格式有误", Toast.LENGTH_SHORT).show();
return;
}
String sName = mEd_s_name_direction.getText().toString();
String dName = mEd_d_name_direction.getText().toString();
if ( TextUtils.isEmpty(sName) ) {
Toast.makeText(this, "请填写起点地名", Toast.LENGTH_SHORT).show();
return;
}
if ( TextUtils.isEmpty(dName) ) {
Toast.makeText(this, "请填写终点地名", Toast.LENGTH_SHORT).show();
return;
}
OpenExternalMapAppUtils.openMapDirection(this, split[0], split[1], sName,
split1[0], split1[1], dName, "测试DEMO");
}
private void showMarkerInner() {
//113.933012,22.538673 田厦·国际中心 桃园路8号
String ll = mEd_ll_marker_inner.getText().toString();
if ( TextUtils.isEmpty(ll) ) {
Toast.makeText(this, "请填写经纬度", Toast.LENGTH_SHORT).show();
return;
}
String[] split = ll.split(",");
if ( split.length < 2 ) {
Toast.makeText(this, "经纬度格式有误", Toast.LENGTH_SHORT).show();
return;
}
String longitude = split[0];
String latitude = split[1];
String name = mEd_name_marker_inner.getText().toString();
if ( TextUtils.isEmpty(name) ) {
Toast.makeText(this, "请填写地名", Toast.LENGTH_SHORT).show();
return;
}
String des = mEd_des_marker_inner.getText().toString();
if ( TextUtils.isEmpty(des) ) {
Toast.makeText(this, "请填写地名描述", Toast.LENGTH_SHORT).show();
return;
}
OpenExternalMapAppUtils.openMapMarker(this, longitude, latitude, name, des, "测试DEMO");
}
private void showMarker() {
//113.933012,22.538673 田厦·国际中心 桃园路8号
String ll = mEd_ll_marker.getText().toString();
if ( TextUtils.isEmpty(ll) ) {
Toast.makeText(this, "请填写经纬度", Toast.LENGTH_SHORT).show();
return;
}
String[] split = ll.split(",");
if ( split.length < 2 ) {
Toast.makeText(this, "经纬度格式有误", Toast.LENGTH_SHORT).show();
return;
}
String longitude = split[0];
String latitude = split[1];
String name = mEd_name_marker.getText().toString();
if ( TextUtils.isEmpty(name) ) {
Toast.makeText(this, "请填写地名", Toast.LENGTH_SHORT).show();
return;
}
String des = mEd_des_marker.getText().toString();
if ( TextUtils.isEmpty(des) ) {
Toast.makeText(this, "请填写地名描述", Toast.LENGTH_SHORT).show();
return;
}
OpenExternalMapAppUtils.openMapMarker(this, longitude, latitude, name, des, "测试DEMO", true);
}
private void showMarkerForce() {
//113.933012,22.538673 田厦·国际中心 桃园路8号
String ll = mEd_ll_marker_force.getText().toString();
if ( TextUtils.isEmpty(ll) ) {
Toast.makeText(this, "请填写经纬度", Toast.LENGTH_SHORT).show();
return;
}
String[] split = ll.split(",");
if ( split.length < 2 ) {
Toast.makeText(this, "经纬度格式有误", Toast.LENGTH_SHORT).show();
return;
}
String longitude = split[0];
String latitude = split[1];
String name = mEd_name_marker_force.getText().toString();
if ( TextUtils.isEmpty(name) ) {
Toast.makeText(this, "请填写地名", Toast.LENGTH_SHORT).show();
return;
}
String des = mEd_des_marker_force.getText().toString();
if ( TextUtils.isEmpty(des) ) {
Toast.makeText(this, "请填写地名描述", Toast.LENGTH_SHORT).show();
return;
}
OpenExternalMapAppUtils.openMapMarker(this, longitude, latitude, name, des, "测试DEMO", false, true);
}
}
| [
"http://180.76.167.130/android/app-hitup.git"
] | http://180.76.167.130/android/app-hitup.git |
e5d326f0894966871ba59213e7567f20a5c9a4ef | 8dc84558f0058d90dfc4955e905dab1b22d12c08 | /third_party/android_tools/sdk/sources/android-25/com/android/systemui/statusbar/ViewTransformationHelper.java | cd6c31f370d32f68a610d7f578a4729f73e6bf66 | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | meniossin/src | 42a95cc6c4a9c71d43d62bc4311224ca1fd61e03 | 44f73f7e76119e5ab415d4593ac66485e65d700a | refs/heads/master | 2022-12-16T20:17:03.747113 | 2020-09-03T10:43:12 | 2020-09-03T10:43:12 | 263,710,168 | 1 | 0 | BSD-3-Clause | 2020-05-13T18:20:09 | 2020-05-13T18:20:08 | null | UTF-8 | Java | false | false | 11,594 | java | /*
* Copyright (C) 2016 The Android Open Source Project
*
* 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.android.systemui.statusbar;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.view.View;
import android.view.ViewGroup;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.statusbar.notification.TransformState;
import com.android.systemui.statusbar.stack.StackStateAnimator;
import java.util.Stack;
/**
* A view that can be transformed to and from.
*/
public class ViewTransformationHelper implements TransformableView {
private static final int TAG_CONTAINS_TRANSFORMED_VIEW = R.id.contains_transformed_view;
private ArrayMap<Integer, View> mTransformedViews = new ArrayMap<>();
private ArrayMap<Integer, CustomTransformation> mCustomTransformations = new ArrayMap<>();
private ValueAnimator mViewTransformationAnimation;
public void addTransformedView(int key, View transformedView) {
mTransformedViews.put(key, transformedView);
}
public void reset() {
mTransformedViews.clear();
}
public void setCustomTransformation(CustomTransformation transformation, int viewType) {
mCustomTransformations.put(viewType, transformation);
}
@Override
public TransformState getCurrentState(int fadingView) {
View view = mTransformedViews.get(fadingView);
if (view != null && view.getVisibility() != View.GONE) {
return TransformState.createFrom(view);
}
return null;
}
@Override
public void transformTo(final TransformableView notification, final Runnable endRunnable) {
if (mViewTransformationAnimation != null) {
mViewTransformationAnimation.cancel();
}
mViewTransformationAnimation = ValueAnimator.ofFloat(0.0f, 1.0f);
mViewTransformationAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
transformTo(notification, animation.getAnimatedFraction());
}
});
mViewTransformationAnimation.setInterpolator(Interpolators.LINEAR);
mViewTransformationAnimation.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
mViewTransformationAnimation.addListener(new AnimatorListenerAdapter() {
public boolean mCancelled;
@Override
public void onAnimationEnd(Animator animation) {
if (!mCancelled) {
if (endRunnable != null) {
endRunnable.run();
}
setVisible(false);
} else {
abortTransformations();
}
}
@Override
public void onAnimationCancel(Animator animation) {
mCancelled = true;
}
});
mViewTransformationAnimation.start();
}
@Override
public void transformTo(TransformableView notification, float transformationAmount) {
for (Integer viewType : mTransformedViews.keySet()) {
TransformState ownState = getCurrentState(viewType);
if (ownState != null) {
CustomTransformation customTransformation = mCustomTransformations.get(viewType);
if (customTransformation != null && customTransformation.transformTo(
ownState, notification, transformationAmount)) {
ownState.recycle();
continue;
}
TransformState otherState = notification.getCurrentState(viewType);
if (otherState != null) {
ownState.transformViewTo(otherState, transformationAmount);
otherState.recycle();
} else {
ownState.disappear(transformationAmount, notification);
}
ownState.recycle();
}
}
}
@Override
public void transformFrom(final TransformableView notification) {
if (mViewTransformationAnimation != null) {
mViewTransformationAnimation.cancel();
}
mViewTransformationAnimation = ValueAnimator.ofFloat(0.0f, 1.0f);
mViewTransformationAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
transformFrom(notification, animation.getAnimatedFraction());
}
});
mViewTransformationAnimation.addListener(new AnimatorListenerAdapter() {
public boolean mCancelled;
@Override
public void onAnimationEnd(Animator animation) {
if (!mCancelled) {
setVisible(true);
} else {
abortTransformations();
}
}
@Override
public void onAnimationCancel(Animator animation) {
mCancelled = true;
}
});
mViewTransformationAnimation.setInterpolator(Interpolators.LINEAR);
mViewTransformationAnimation.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
mViewTransformationAnimation.start();
}
@Override
public void transformFrom(TransformableView notification, float transformationAmount) {
for (Integer viewType : mTransformedViews.keySet()) {
TransformState ownState = getCurrentState(viewType);
if (ownState != null) {
CustomTransformation customTransformation = mCustomTransformations.get(viewType);
if (customTransformation != null && customTransformation.transformFrom(
ownState, notification, transformationAmount)) {
ownState.recycle();
continue;
}
TransformState otherState = notification.getCurrentState(viewType);
if (otherState != null) {
ownState.transformViewFrom(otherState, transformationAmount);
otherState.recycle();
} else {
ownState.appear(transformationAmount, notification);
}
ownState.recycle();
}
}
}
@Override
public void setVisible(boolean visible) {
if (mViewTransformationAnimation != null) {
mViewTransformationAnimation.cancel();
}
for (Integer viewType : mTransformedViews.keySet()) {
TransformState ownState = getCurrentState(viewType);
if (ownState != null) {
ownState.setVisible(visible, false /* force */);
ownState.recycle();
}
}
}
private void abortTransformations() {
for (Integer viewType : mTransformedViews.keySet()) {
TransformState ownState = getCurrentState(viewType);
if (ownState != null) {
ownState.abortTransformation();
ownState.recycle();
}
}
}
/**
* Add the remaining transformation views such that all views are being transformed correctly
* @param viewRoot the root below which all elements need to be transformed
*/
public void addRemainingTransformTypes(View viewRoot) {
// lets now tag the right views
int numValues = mTransformedViews.size();
for (int i = 0; i < numValues; i++) {
View view = mTransformedViews.valueAt(i);
while (view != viewRoot.getParent()) {
view.setTag(TAG_CONTAINS_TRANSFORMED_VIEW, true);
view = (View) view.getParent();
}
}
Stack<View> stack = new Stack<>();
// Add the right views now
stack.push(viewRoot);
while (!stack.isEmpty()) {
View child = stack.pop();
if (child.getVisibility() == View.GONE) {
continue;
}
Boolean containsView = (Boolean) child.getTag(TAG_CONTAINS_TRANSFORMED_VIEW);
if (containsView == null) {
// This one is unhandled, let's add it to our list.
int id = child.getId();
if (id != View.NO_ID) {
// We only fade views with an id
addTransformedView(id, child);
continue;
}
}
child.setTag(TAG_CONTAINS_TRANSFORMED_VIEW, null);
if (child instanceof ViewGroup && !mTransformedViews.containsValue(child)){
ViewGroup group = (ViewGroup) child;
for (int i = 0; i < group.getChildCount(); i++) {
stack.push(group.getChildAt(i));
}
}
}
}
public void resetTransformedView(View view) {
TransformState state = TransformState.createFrom(view);
state.setVisible(true /* visible */, true /* force */);
state.recycle();
}
/**
* @return a set of all views are being transformed.
*/
public ArraySet<View> getAllTransformingViews() {
return new ArraySet<>(mTransformedViews.values());
}
public static abstract class CustomTransformation {
/**
* Transform a state to the given view
* @param ownState the state to transform
* @param notification the view to transform to
* @param transformationAmount how much transformation should be done
* @return whether a custom transformation is performed
*/
public abstract boolean transformTo(TransformState ownState,
TransformableView notification,
float transformationAmount);
/**
* Transform to this state from the given view
* @param ownState the state to transform to
* @param notification the view to transform from
* @param transformationAmount how much transformation should be done
* @return whether a custom transformation is performed
*/
public abstract boolean transformFrom(TransformState ownState,
TransformableView notification,
float transformationAmount);
/**
* Perform a custom initialisation before transforming.
*
* @param ownState our own state
* @param otherState the other state
* @return whether a custom initialization is done
*/
public boolean initTransformation(TransformState ownState,
TransformState otherState) {
return false;
}
public boolean customTransformTarget(TransformState ownState,
TransformState otherState) {
return false;
}
}
}
| [
"arnaud@geometry.ee"
] | arnaud@geometry.ee |
d96c3524a73748b32f70ac2b72e353d12ccea775 | 6801f753050cff4e2d553bc29b79c7f9d66bdc65 | /android/app/src/test/java/org/ixuan/vrsensor/ExampleUnitTest.java | 74c51204e16c3b1b54f513b25a9e8fe1255d5f0d | [
"MIT"
] | permissive | Kxuan/AndroidSensorOnPcBrowesr | e0b6fbd235420ffb750528ef88af184b38acb686 | 7e691ff527cb30081326d56dd8d54af60b2c1608 | refs/heads/master | 2021-05-04T10:11:14.383120 | 2019-01-29T02:27:15 | 2019-01-29T02:27:15 | 48,572,260 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package org.ixuan.vrsensor;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"kxuanobj@gmail.com"
] | kxuanobj@gmail.com |
8336313efa7a0ede5d2d12bccb5efef17df8d7a0 | 3bb9e1a187cb72e2620a40aa208bf94e5cee46f5 | /mobile_catalog/src/ong/eu/soon/ifx/element/AcctApplIdent.java | 82d592b45bea8d590eb055bdf9c11a3dfd34859a | [] | no_license | eusoon/Mobile-Catalog | 2e6f766864ea25f659f87548559502358ac5466c | 869d7588447117b751fcd1387cd84be0bd66ef26 | refs/heads/master | 2021-01-22T23:49:12.717052 | 2013-12-10T08:22:20 | 2013-12-10T08:22:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 92 | java | package ong.eu.soon.ifx.element;
public class AcctApplIdent extends Identifier {
}
| [
"eusoon@gmail.com"
] | eusoon@gmail.com |
17d312fa13a8f0c948cd581d3d8731906a8e0077 | 488075cff65eb8608f3be636289bbbf8c48ab4d4 | /core/utilities/definitions/MultiMap.java | 794434849997eef7d59279af5f93b50d6141f47e | [] | no_license | mgulenko/Prototypes | 51ffa592e3e9f77267efe38190dcfd3c9300c6d6 | 745f2d3e8bb10a7dc439ee594b412309c7544d69 | refs/heads/master | 2021-01-23T22:38:29.336162 | 2015-10-08T22:07:56 | 2015-10-08T22:07:56 | 42,370,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,299 | java | package com.brightlightsystems.core.utilities.definitions;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.Map;
/**
* This class is designed to simulate MultiMap behaviour. Essentially it is a wrapper around HashMap
* with a Key to a HashSet of objects. NOTE: This class DOES NOT implement Map interface.
* Use this class whenever you need to associate multiple values with a single key.
* K - the type of keys. Can be mapped to multiple values.
* V - the type of associated values.
* @author Michael Gulenko. Created on 09/06/2015
*/
@SuppressWarnings( {"unused"})
public class MultiMap<K,V>
{
/**
* Data container. Never null. Can't contain nulls.
*/
protected Map<K,Set<V>> _map;
public MultiMap()
{
_map = new HashMap<>();
}
/**
* Removes everything from the map
*/
public void clear()
{
_map.clear();
}
/**
* Tests if the map contains specified key
* @param k - the key which presence to be tested.
* @return - true if the specified key is present in the map.
* false otherwise.
*/
public boolean containsKey(K k)
{
return _map.containsKey(k);
}
/**
* Tests if the map maps one or more keys to the specified set of values.
* @param v - set, presence of which to be tested
* @return - true if the map maps specified set. false otherwise.
*/
public boolean containsSet (Set<V> v)
{
return _map.containsValue(v);
}
/**
* Tests if the map has associated to the specified key a specified value
* @param k - key that is used to test an association of specified value
* @param v - value association of which needs to be tested
* @return - true if specified value is associated to the specified key. false otherwise.
*/
public boolean containsAssociated(K k, V v)
{
assert (_map.get(k) != null);
return _map.get(k).contains(v);
}
/**
* Get a Set representation of the map
* @return - Set representation. Never null.
*/
public Set<Map.Entry<K,Set<V>>> entrySet()
{
return _map.entrySet();
}
/**
* Get a set that is mapped to specified key
* @param k - key which mapped set is to be returned.
* @return - Set that is mapped to specified key, which contains all values that
* are associated to the specified key. Never Null.
*/
public Set<V> get(K k)
{
return _map.get(k);
}
/**
* Get a set of keys that specified value is associated with.
* @param v - value that is used to get a set of keys
* @return - Set of keys with the size of > 0, or null if specified value is not associated
* with any keys in the map.
*/
public Set<K> getKeys(V v)
{
Set<K> keys = new HashSet<>();
for(Map.Entry<K,Set<V>> e : _map.entrySet() )
{
if(e.getValue().contains(v))
keys.add(e.getKey());
}
if(keys.size() > 0)
return keys;
return null;
}
/**
* Tests if map contains any entries.
* @return - true if the map contains entries. false otherwise.
*/
public boolean isEmpty()
{
return _map.isEmpty();
}
/**
* Get a Set representation of all keys containing in the map
* @return - Set of keys containing in the map, or null if map is empty.
*/
public Set<K> keySet()
{
if(_map.isEmpty())
return null;
return _map.keySet();
}
/**
* Add specified value to the set of associated values
* with the specified key. The key can be associated with many values,
* but can not be associated with the same value more than once at a time.
*
* @param k - key with which the specified value is to be added to the list of associated values
* @param v - value that needs to be added to the set of associated keys with the specified value.
*/
public void put(K k, V v)
{
// create new set if we don't have specified key
if(!_map.containsKey(k))
{
Set<V> set = new HashSet<>();
set.add(v);
_map.put(k,set);
}
else
{
// something is REALLY f-ed up if set == null
assert (_map.get(k) != null);
_map.get(k).add(v);
}
}
/**
* Maps specified set of values with specified key. If the specified key already has
* mapped set, then method will combine those 2 sets removing duplicated values.
*
* @param k - key with which the specified set is to be associated with.
* @param values - values that needs to be associated with specified key.
* @throws IllegalArgumentException if set is null.
*/
public void put(K k, Set<V> values)
{
if(values == null)
throw new IllegalArgumentException("Value can't be null");
//add set
if(!_map.containsKey(k))
_map.put(k,values);
else
{
// something is REALLY f-ed up if set == null
assert (_map.get(k) != null);
_map.get(k).addAll(values);
}
}
/**
* Replaces mapped Set of the specified key with a new set. Method does nothing if
* v.size() == 0. If there were no previous mapping, method creates new entry.
* @param k - key which mapped value is to be replaced.
* @param v - Set that is to replace current mapped value.
* @return - replaced value, or null if there were no mapping.
* @throws IllegalArgumentException if k == null, or v == null.
*/
public Set<V> replace(K k, Set<V> v)
{
if(k == null || v == null)
throw new IllegalArgumentException();
return _map.put(k, v);
}
/**
* Removes all values from specified key.
* @param k - key which mapping is needs to be removed.
* @return - a set representation of removed values or null if there were no mapping
*/
public Set<V> removeAll(K k)
{
return _map.remove(k);
}
/**
* Removes associated value from the set of associated values for the specified key.
* @param k - a key association of which is to be removed for specified value.
* @param v - values that is to be removed from the set of associated values for specified key.
* @return - returns true on success, false otherwise.
*/
public boolean remove(K k, V v)
{
assert(_map.get(k) != null);
return _map.get(k).remove(v);
}
/**
* Removes all associations of the specified value from the map
* @param v - value that is to be dissociate from the map
* @return - a map where key is the value that needs to be removed, and a set of
* keys that it was removed from. Returns null if the value
* was not associated to any keys.
*/
public MultiMap<V,K> dissociateAll(V v)
{
MultiMap<V,K> map = new MultiMap<>();
for(Map.Entry<K,Set<V>> e : _map.entrySet())
{
if(e.getValue().remove(v))
map.put(v,e.getKey());
}
if(!map.isEmpty())
return map;
return null;
}
/**
* Get number of mappings in the map
* @return - amount of key-set pairs.
*/
public int size()
{
return _map.size();
}
/**
* Get amount of values that are associated to the specified key
* @param k - key of which number of associated values is to be returned.
* @return - return amount of associated values. returned value is > -1
*/
public int associatedSize(K k)
{
assert(_map.get(k)!=null);
return _map.get(k).size();
}
/**
* Get a Collection representation of sets that are in the map.
* @return - collection of sets. null if map is empty.
*/
public Collection<Set<V>> values()
{
if(_map.isEmpty())
return null;
return _map.values();
}
/******************** end of class********************************/
}
| [
"mgulenko@hotmail.com"
] | mgulenko@hotmail.com |
0b835cd8d9a6571585bcdaa4fd334092dac33a7f | 6f2f3b40d3c19fe4d020bdd6ff89d5e2fd7ac784 | /JXC/src/main/java/com/bie/service/EmployeeService.java | 1dcd02f15e02e003d0df29a811b60dbd783720b5 | [] | no_license | MRbie/JXC | 1d41e649e25fdc37aa09768418bfec5b903db230 | c7a634bc35c87f15fc40fc8149d24dd76f4731f2 | refs/heads/master | 2021-04-09T13:14:37.369252 | 2018-05-17T08:30:16 | 2018-05-17T08:30:16 | 121,503,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,309 | java | package com.bie.service;
import java.util.List;
import java.util.Set;
import com.bie.po.JxcEmployee;
import com.bie.po.Navigation;
/**
* 员工的业务层的接口
* @author 别先生
*
*/
public interface EmployeeService extends BaseService<JxcEmployee>{
public List<JxcEmployee> selectByEmployeeRole(String roleName);
//管理员登录的方法
public JxcEmployee adminLogin(JxcEmployee jxcEmployee) throws Exception;
//根据管理员编号进行密码修改
public boolean modifyPassword(JxcEmployee jxcEmployee) throws Exception;
//结合shiro实现的功能
//根据用户名获取用户所有角色
public Set<String> findRolesByEmployeeName(String employeeName) throws Exception;
//根据用户名获取用户所有权限
public Set<String> findPermissionsByEmployeeName(String employeeName) throws Exception;
//获取导航栏内容
public List<Navigation> getNavigationBar(String employeeName) throws Exception;
//根据用户名获取用户
public JxcEmployee getEmployeeByEmployeeName(String employeeName) throws Exception;
//员工报表统计信息
public List<JxcEmployee> selectByEmployeeRoleType() throws Exception;
//员工薪资统计
public List<JxcEmployee> selectByEmployeeSalary() throws Exception;
}
| [
"1748741328@qq.com"
] | 1748741328@qq.com |
95fab66475542b0a3addf9966b4fa0c4abd56977 | 03508b93ff17cb06e842bdfe9815c4f6435a726d | /Inhdemo3.java | 14c33340ac4de32aa9490cddbcae069753695ccb | [] | no_license | AdityaDhimole/JavaProgram | 091d8ccdc9019b190370842e61bddde2a06bd30c | 4d2f6db7007b8b6b1998839936675b4db5198411 | refs/heads/master | 2021-09-03T04:54:34.578653 | 2018-01-05T19:00:36 | 2018-01-05T19:00:36 | 116,416,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 341 | java | class Bc
{
public Bc(int x)
{
System.out.println("one par con in Bc "+x);
}
}
class Dc extends Bc
{
public Dc()
{
super(5);
System.out.println("default con in Dc");
}
}
class Inhdemo3
{
public static void main(String ar[])
{
Dc ob=new Dc();
}
} | [
"35146903+AdityaDhimole@users.noreply.github.com"
] | 35146903+AdityaDhimole@users.noreply.github.com |
eb93394f15cd46909361587fb9f3d4afeebc22f4 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/Alluxio--alluxio/49cf8b8badb8247c203a4a4c9313d2b6e2585d51/after/EditLogOperationTest.java | 655c63838c5905af26db114c51caa38175cbdc68 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,488 | java | /*
* Licensed to the University of California, Berkeley under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You 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 tachyon.master;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.List;
import org.apache.commons.codec.binary.Base64;
import org.junit.Assert;
import org.junit.Test;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* Unit Test for EditLogOperation
*/
public class EditLogOperationTest {
private static final String CREATE_DEPENDENCY_TYPE = "{\"type\":\"CREATE_DEPENDENCY\","
+ "\"parameters\":{\"parents\":[1,2,3],\"commandPrefix\":\"fake command\","
+ "\"dependencyId\":1,\"frameworkVersion\":\"0.3\",\"data\":[\"AAAAAAAAAAAAAA==\"],"
+ "\"children\":[4,5,6,7],"
+ "\"comment\":\"Comment Test\",\"creationTimeMs\":1409349750338,"
+ "\"dependencyType\":\"Narrow\",\"framework\":\"Tachyon Examples\"}}";
private static final ObjectMapper OBJECT_MAPPER = JsonObject.createObjectMapper();
// Tests for CREATE_DEPENDENCY operation
@Test
public void createDependencyTest() throws IOException {
EditLogOperation editLogOperation =
OBJECT_MAPPER.readValue(CREATE_DEPENDENCY_TYPE.getBytes(), EditLogOperation.class);
// get all parameters for "CREATE_DEPENDENCY"
List<Integer> parents = editLogOperation.get("parents", new TypeReference<List<Integer>>() {});
Assert.assertEquals(3, parents.size());
List<Integer> children =
editLogOperation.get("children", new TypeReference<List<Integer>>() {});
Assert.assertEquals(4, children.size());
String commandPrefix = editLogOperation.getString("commandPrefix");
Assert.assertEquals("fake command", commandPrefix);
List<ByteBuffer> data = editLogOperation.getByteBufferList("data");
Assert.assertEquals(1, data.size());
String decodedBase64 = new String(data.get(0).array(), "UTF-8");
Assert.assertEquals(new String(Base64.decodeBase64("AAAAAAAAAAAAAA==")), decodedBase64);
String comment = editLogOperation.getString("comment");
Assert.assertEquals("Comment Test", comment);
String framework = editLogOperation.getString("framework");
Assert.assertEquals("Tachyon Examples", framework);
String frameworkVersion = editLogOperation.getString("frameworkVersion");
Assert.assertEquals("0.3", frameworkVersion);
DependencyType dependencyType = editLogOperation.get("dependencyType", DependencyType.class);
Assert.assertEquals(DependencyType.Narrow, dependencyType);
Integer depId = editLogOperation.getInt("dependencyId");
Assert.assertEquals(1, depId.intValue());
Long creationTimeMs = editLogOperation.getLong("creationTimeMs");
Assert.assertEquals(1409349750338L, creationTimeMs.longValue());
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
bed3235c3d07bdab7d7d0e50f55d070cf6e06b1e | d25da2472ce37bef326d54a997245b8c9bb9e88c | /Spring/ManyToMany/src/main/java/com/codingdojo/ManyToMany/repositories/CategoryRepository.java | 65677b7630e181280841fe957097bd8eb943c5be | [] | no_license | AlaaMansourn/java | 6e5e0f1d52b3dbb53724c403c459fa65e3e1b353 | 2fdfd4eac7408be69788aa5b6108565d32025836 | refs/heads/main | 2023-05-30T20:02:02.672709 | 2021-06-29T20:11:04 | 2021-06-29T20:11:04 | 375,476,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | package com.codingdojo.ManyToMany.repositories;
import java.util.List;
import java.util.Optional;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.codingdojo.ManyToMany.models.Category;
import com.codingdojo.ManyToMany.models.Product;
@Repository
public interface CategoryRepository extends CrudRepository<Category,Long> {
List<Category> findAll();
Optional<Category> findById(Long id);
List<Category> findByProductsNotContains(Product P);
}
| [
"mansouralaa887@gmail.com"
] | mansouralaa887@gmail.com |
7cdf3e30f5cd4750df4e3c2e0e013f4c9d7e0ec2 | 7105acc9dff8a0a91a150f4ac46d41f2eb073a22 | /src/main/java/com/luv2code/ecommerce/config/MyDataRestConfig.java | 077cb7ab61f0992722e69c474b8805e487fe911b | [] | no_license | Abhinav-Devkar7794/spring-boot-ecommerce | 4732044121619f8919210482ec18986aa26c38c2 | e782a53862c44dab4cae038739a275644c978301 | refs/heads/master | 2022-11-15T21:01:32.440719 | 2020-07-03T03:30:14 | 2020-07-03T03:30:14 | 265,453,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,612 | java | package com.luv2code.ecommerce.config;
import com.luv2code.ecommerce.entity.Product;
import com.luv2code.ecommerce.entity.ProductCategory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurer;
import org.springframework.http.HttpMethod;
import javax.persistence.EntityManager;
import javax.persistence.metamodel.EntityType;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@Configuration
public class MyDataRestConfig implements RepositoryRestConfigurer{
private EntityManager entityManager ;
@Autowired
public MyDataRestConfig(EntityManager theEntityManager){
entityManager = theEntityManager;
}
@Override
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
HttpMethod[] unSupportedActions = {HttpMethod.DELETE,HttpMethod.POST , HttpMethod.PUT};
// Disable HttpMethods Put , Delete , Post For Product
config.getExposureConfiguration()
.forDomainType(Product.class)
.withItemExposure((metdata, httpMethods) -> httpMethods.disable(unSupportedActions))
.withCollectionExposure((metdata, httpMethods) -> httpMethods.disable(unSupportedActions) );
// Disable HttpMethods Put , Delete , Post For Product Category
config.getExposureConfiguration()
.forDomainType(ProductCategory.class)
.withItemExposure((metdata, httpMethods) -> httpMethods.disable(unSupportedActions))
.withCollectionExposure((metdata, httpMethods) -> httpMethods.disable(unSupportedActions) );
exposeIds(config);
}
private void exposeIds(RepositoryRestConfiguration config) {
//expose entity ids
// get list of all entity classes from data manager
Set<EntityType<?>> entities = entityManager.getMetamodel().getEntities();
//create an array of the entity types
List<Class> entityClasses = new ArrayList<>();
for(EntityType tempEntityType : entities){
System.out.println("tempEntityType.getJavaType() : "+tempEntityType.getJavaType());
entityClasses.add(tempEntityType.getJavaType());
}
// expose the entity ids for array of entity / domain types
Class[] domainType = entityClasses.toArray(new Class[0]);
config.exposeIdsFor(domainType);
}
}
| [
"devkarabhinav@gmail.com"
] | devkarabhinav@gmail.com |
b840408dd724bab25b62ef71a79d35ceb579d2a3 | 634c165155f0692dcc71d57bcbddf4c4608c58f0 | /ap/btn/TPortfolioStat.java | ec8bbbba66c21177cc7033cd6301f1a0fd4ee3de | [] | no_license | OleksandrVKononenko/OleksandrVKononenko | 73adbfa598b08a3082da8274120c1395e12907b7 | 35f950ca3975fa8ac2d96f4f3306315c766d397a | refs/heads/main | 2023-06-05T23:49:36.665222 | 2021-06-23T20:17:39 | 2021-06-23T20:17:39 | 371,788,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,941 | java |
package ap.btn;
import java.util.List;
import ap.explorer.Range;
import ap.global.gl;
import ap.utils.DateUtil;
public class TPortfolioStat {
public static int YEAR = 1;
public static int MONTH = 2;
public static int QUARTER = 3;
private String ticker;
private int initiator;
private int closer;
private Range date_range;
private double stop_loss;
private double take_profit;
public double getStop_loss() {
return stop_loss;
}
public void setStop_loss(double stop_loss) {
this.stop_loss = stop_loss;
}
public double getTake_profit() {
return take_profit;
}
public void setTake_profit(double take_profit) {
this.take_profit = take_profit;
}
private double result;
public String getTicker() {
return ticker;
}
public void setTicker(String ticker) {
this.ticker = ticker;
}
public int getInitiator() {
return initiator;
}
public void setIntitiator(int intitiator) {
this.initiator = intitiator;
}
public int getCloser() {
return closer;
}
public void setCloser(int closer) {
this.closer = closer;
}
public Range getDate_range() {
return date_range;
}
public void setDate_range(Range date_range) {
this.date_range = date_range;
}
public double getResult() {
return result;
}
public void setResult(double result) {
this.result = result;
}
public TPortfolioStat() {
}
public TPortfolioStat(int intiator, int closer, Range range,double result) {
this.setIntitiator(intiator);
this.setCloser(closer);
this.setDate_range(range);
this.setResult(result);
}
public TPortfolioStat(String ticker,int initiator, int closer, Range range,double result) {
this(initiator,closer,range,result);
this.setTicker(ticker);
}
public TPortfolioStat(String ticker,int initiator, int closer,double stop_loss,double take_profit, Range range,double result) {
this(initiator,closer,range,result);
this.setStop_loss(stop_loss);
this.setTake_profit(take_profit);
this.setTicker(ticker);
}
public static TPortfolioStat getInstance(String ticker,int initiator, int closer,Range range,double result)
{
return new TPortfolioStat(ticker,initiator,closer,range,result);
}
public static TPortfolioStat getInstance(String ticker,int initiator, int closer,double stop,double take, Range range,double result)
{
return new TPortfolioStat(ticker,initiator,closer,stop,take,range,result);
}
@Override
public String toString()
{
return String.format("%s %2d %2d %s %s %s %s ",
this.getTicker(),
this.getInitiator(),
this.getCloser(),
gl.fmt(this.getStop_loss()),
gl.fmt(this.getTake_profit()),
this.getDate_range().toString(),
gl.fmt(this.getResult())
);
}
public String toString(int format)
{
String data = "";
if(format == YEAR)
data = String.format("%2d %2d %4d %s ",
this.getInitiator(),
this.getCloser(),
DateUtil.year(this.getDate_range().getDate_to()),
gl.fmt(this.getResult())
);
return data;
}
public static String toString(List<TPortfolioStat> list)
{
StringBuilder sb = new StringBuilder();
list.forEach(a->
{
sb.append(a.toString(YEAR));
sb.append(System.lineSeparator());
});
return sb.toString();
}
public static String getPortfolioMembers()
{
StringBuilder sb = new StringBuilder();
TConfiguration.PORTFOLIO_MEMBERS.forEach(a->{
sb.append(a);
sb.append(" ");
});
return sb.toString();
}
public static double getPortfolioResult()
{
return TConfiguration.ratings.stream().mapToDouble(p->p.getResult()).sum();
}
public static void main(String[] args) {
}
}
// Revision : 10.09.2018 12:49:14
| [
"objsql@gmail.com"
] | objsql@gmail.com |
2112063660fbe399c5de8752436950d4f749dcec | 3983fbde9c30cbb422f52e92c9985ec8a9db1728 | /Android/app/src/main/java/vn/edu/activestudy/activestudy/task/gethistoryconfestion/RequestGetHistoryConfestion.java | 49e178f667613b0bd6edcb89e5aafd69e2207aac | [] | no_license | ActiveStudying/JF1 | 4068a5a99798e3c17dd4e88e5700ec523a632b59 | 99bf93cd2c965d239dfa56cee5063c32d1b784af | refs/heads/master | 2020-05-17T07:09:10.575146 | 2015-10-10T03:19:25 | 2015-10-10T03:19:25 | 39,073,233 | 1 | 3 | null | 2015-08-25T16:53:54 | 2015-07-14T12:22:13 | Java | UTF-8 | Java | false | false | 1,120 | java | package vn.edu.activestudy.activestudy.task.gethistoryconfestion;
import com.google.gson.annotations.SerializedName;
/**
* Created by dell123 on 02/10/2015.
*/
public class RequestGetHistoryConfestion {
@SerializedName("sessionId")
private String sessionId;
@SerializedName("accountId")
private String accountId;
@SerializedName("deviceId")
private String deviceId;
@SerializedName("confestionVer")
private int confestionVer;
public String getSessionId() {
return sessionId;
}
public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}
public String getAccountId() {
return accountId;
}
public void setAccountId(String accountId) {
this.accountId = accountId;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public int getConfestionVer() {
return confestionVer;
}
public void setConfestionVer(int confestionVer) {
this.confestionVer = confestionVer;
}
}
| [
"trungvt.bk@gmail.com"
] | trungvt.bk@gmail.com |
480dae7fdf929600a7445949f25f5efb92794d97 | 56e9d6abbf7e56224f773cfba947aa7ea0f54af5 | /kodoWorkSpace/bddFramework/src/test/java/runnerClass/Runner.java | 9746872507e1cc6245089ed5d6283edb701f7424 | [] | no_license | letterashwin/kodoWorkSpace | 8d528b079e4cb096cb5afe7795fea52df1ab9395 | bfa8dc23813f06c8cafaceb8026113e31d0131c6 | refs/heads/master | 2022-12-26T06:51:14.621465 | 2020-05-19T07:32:07 | 2020-05-19T07:32:07 | 264,349,714 | 0 | 0 | null | 2020-10-13T22:01:51 | 2020-05-16T03:19:49 | JavaScript | UTF-8 | Java | false | false | 1,107 | java | package runnerClass;
import java.io.File;
import org.junit.AfterClass;
import org.junit.runner.RunWith;
import com.cucumber.listener.Reporter;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features = "G:/eclipseWorkspace/KodoGit/kodoWorkSpace/kodoWorkSpace/bddFramework/src/test/resources",
glue = {"stepDefinition","baseClass"},
plugin={"com.cucumber.listener.ExtentCucumberFormatter:target/html/ExtentReport.html"}
)
public class Runner {
/**
* Method: ExtentReportsetup() is used to manage the Extent report attributes
* @return Void
*/
@AfterClass
public static void setup()
{
Reporter.loadXMLConfig(new File("src/test/resources/extent-config.xml"));
Reporter.setSystemInfo("User Name", "ASHWIN PT");
Reporter.setSystemInfo("Application Name", "http://automationpractice.com/index.php");
Reporter.setSystemInfo("Operating System Type", System.getProperty("os.name").toString());
Reporter.setSystemInfo("Environment", "Test Environment");
Reporter.setTestRunnerOutput("Test Execution Cucumber Report");
}
}
| [
"letterashwin@gmail.com"
] | letterashwin@gmail.com |
c50b8a81b8694a5ef01886de36232ed73cbdcbee | 3bde803e0a5029277b04595016f4cc83cdfd6676 | /MasterFormat/src/eplus/htmlparser/TransparentEnvelopeSummary.java | cc88ecbb077844f9411da684ab2e927bc5e44917 | [] | no_license | weilixu/CostStandard | bad62c7b3fae9c6d3ea661399ef8a1b64ce55dbd | cfccfbd3812c4b8a256088beb0fca1f3dd6ef528 | refs/heads/master | 2021-01-19T20:24:48.854597 | 2017-11-01T16:59:35 | 2017-11-01T16:59:35 | 29,888,803 | 0 | 0 | null | 2015-11-06T16:27:28 | 2015-01-27T00:08:51 | Java | UTF-8 | Java | false | false | 2,121 | java | package eplus.htmlparser;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
public class TransparentEnvelopeSummary {
private final int areaIndexForConstruction =1;
private final int uvalueIndexForConstruction =6;
private final int shgcIndexForConstruction = 7;
private final int vtIndexForConstruction = 8;
private final Document doc;
private final Elements envelopeTable;
private static final String PLANT_TABLE_ID = "Envelope Summary%Exterior Fenestration";
private static final String TAG = "tableID";
public TransparentEnvelopeSummary(Document d){
doc = d;
envelopeTable = doc.getElementsByAttributeValue(TAG, PLANT_TABLE_ID);
}
public String getContructionArea(String cons){
Elements constructionList = envelopeTable.get(0).getElementsByTag("td");
double area = 0.0;
for(int i=0; i<constructionList.size(); i++){
if(constructionList.get(i).text().equalsIgnoreCase(cons)){
area+= Double.parseDouble(constructionList.get(i+areaIndexForConstruction).text());
}
}
return ""+area;
}
public String getConstructionUValue(String cons){
Elements constructionList = envelopeTable.get(0).getElementsByTag("td");
for(int i=0; i<constructionList.size(); i++){
if(constructionList.get(i).text().equalsIgnoreCase(cons)){
return constructionList.get(i+uvalueIndexForConstruction).text();
}
}
return "";
}
public String getConstructionVisibleTransmittance(String cons){
Elements constructionList = envelopeTable.get(0).getElementsByTag("td");
for(int i=0; i<constructionList.size(); i++){
if(constructionList.get(i).text().equalsIgnoreCase(cons)){
return constructionList.get(i+vtIndexForConstruction).text();
}
}
return "";
}
public String getConstructionSHGC(String cons){
Elements constructionList = envelopeTable.get(0).getElementsByTag("td");
for(int i=0; i<constructionList.size(); i++){
if(constructionList.get(i).text().equalsIgnoreCase(cons)){
return constructionList.get(i+shgcIndexForConstruction).text();
}
}
return "";
}
}
| [
"weilix@andrew.cmu.edu"
] | weilix@andrew.cmu.edu |
59561d285bd2912dfe827d821bad67491b4472e7 | b91e085ccd9403bfc564dd2d31d348dcedfef788 | /src/main/java/c04_trees_and_graphs/trees/datastructures/AbstractHashMap.java | 2f7337ff0d374673d59ab93048c431ce087e4d1f | [] | no_license | sharubhat/cci | 6022d990c6b7ee73a7f8099461f8ae2d4329b8fb | ca8069e79bb827ca83539d66bc447f1f75856144 | refs/heads/master | 2021-06-17T03:03:30.045035 | 2021-06-07T01:33:41 | 2021-06-07T01:33:41 | 22,559,870 | 0 | 0 | null | 2015-01-14T21:32:35 | 2014-08-02T23:05:11 | Java | UTF-8 | Java | false | false | 6,174 | java | /*
* Copyright 2014, Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
*
* Developed for use with the book:
*
* Data Structures and Algorithms in Java, Sixth Edition
* Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
* John Wiley & Sons, 2014
*
* 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 c04_trees_and_graphs.trees.datastructures;
import java.util.ArrayList;
import java.util.Random;
/**
* An abstract base class supporting Map implementations that use hash
* tables with MAD compression.
*
* The base class provides the following means of support:
* 1) Support for calculating hash values with MAD compression
* 2) Support for resizing table when load factor reaches 1/2
*
* Subclass is responsible for providing abstract methods:
* createTable(), bucketGet(h,k), bucketPut(h,k,v),
* bucketRemove(h,k), and entrySet()
* and for accurately maintaining the protected member, n,
* to reflect changes within bucketPut and bucketRemove.
*
* @author Michael T. Goodrich
* @author Roberto Tamassia
* @author Michael H. Goldwasser
*/
public abstract class AbstractHashMap<K,V> extends AbstractMap<K,V> {
protected int n = 0; // number of entries in the dictionary
protected int capacity; // length of the table
private int prime; // prime factor
private long scale, shift; // the shift and scaling factors
/** Creates a hash table with the given capacity and prime factor. */
public AbstractHashMap(int cap, int p) {
prime = p;
capacity = cap;
Random rand = new Random();
scale = rand.nextInt(prime-1) + 1;
shift = rand.nextInt(prime);
createTable();
}
/** Creates a hash table with given capacity and prime factor 109345121. */
public AbstractHashMap(int cap) { this(cap, 109345121); } // default prime
/** Creates a hash table with capacity 17 and prime factor 109345121. */
public AbstractHashMap() { this(17); } // default capacity
// public methods
/**
* Tests whether the map is empty.
* @return true if the map is empty, false otherwise
*/
@Override
public int size() { return n; }
/**
* Returns the value associated with the specified key, or null if no such entry exists.
* @param key the key whose associated value is to be returned
* @return the associated value, or null if no such entry exists
*/
@Override
public V get(K key) { return bucketGet(hashValue(key), key); }
/**
* Removes the entry with the specified key, if present, and returns
* its associated value. Otherwise does nothing and returns null.
* @param key the key whose entry is to be removed from the map
* @return the previous value associated with the removed key, or null if no such entry exists
*/
@Override
public V remove(K key) { return bucketRemove(hashValue(key), key); }
/**
* Associates the given value with the given key. If an entry with
* the key was already in the map, this replaced the previous value
* with the new one and returns the old value. Otherwise, a new
* entry is added and null is returned.
* @param key key with which the specified value is to be associated
* @param value value to be associated with the specified key
* @return the previous value associated with the key (or null, if no such entry)
*/
@Override
public V put(K key, V value) {
V answer = bucketPut(hashValue(key), key, value);
if (n > capacity / 2) // keep load factor <= 0.5
resize(2 * capacity - 1); // (or find a nearby prime)
return answer;
}
// private utilities
/** Hash function applying MAD method to default hash code. */
private int hashValue(K key) {
return (int) ((Math.abs(key.hashCode()*scale + shift) % prime) % capacity);
}
/** Updates the size of the hash table and rehashes all entries. */
private void resize(int newCap) {
ArrayList<Entry<K,V>> buffer = new ArrayList<>(n);
for (Entry<K,V> e : entrySet())
buffer.add(e);
capacity = newCap;
createTable(); // based on updated capacity
n = 0; // will be recomputed while reinserting entries
for (Entry<K,V> e : buffer)
put(e.getKey(), e.getValue());
}
// protected abstract methods to be implemented by subclasses
/** Creates an empty table having length equal to current capacity. */
protected abstract void createTable();
/**
* Returns value associated with key k in bucket with hash value h.
* If no such entry exists, returns null.
* @param h the hash value of the relevant bucket
* @param k the key of interest
* @return associate value (or null, if no such entry)
*/
protected abstract V bucketGet(int h, K k);
/**
* Associates key k with value v in bucket with hash value h, returning
* the previously associated value, if any.
* @param h the hash value of the relevant bucket
* @param k the key of interest
* @param v the value to be associated
* @return previous value associated with k (or null, if no such entry)
*/
protected abstract V bucketPut(int h, K k, V v);
/**
* Removes entry having key k from bucket with hash value h, returning
* the previously associated value, if found.
* @param h the hash value of the relevant bucket
* @param k the key of interest
* @return previous value associated with k (or null, if no such entry)
*/
protected abstract V bucketRemove(int h, K k);
}
| [
"sharath_bhat@apple.com"
] | sharath_bhat@apple.com |
64fd3fbc502fa74c311e6d2f76e3e7053d4fe19a | 1d98d8682500aedf926a2737ca0dadf8532bb494 | /src/com/ede/help/HelpViewService.java | 9f4213bd3d96c3c560207819f43754a1b62b229d | [] | no_license | truly412/ede | 06aec409bdb0e65285582b711937acbe341774ae | 1e4dd963613d8a37404121f18e5b861a7f94d33c | refs/heads/master | 2021-09-04T05:28:03.592801 | 2018-01-05T07:55:59 | 2018-01-05T07:55:59 | 112,597,382 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,233 | java | package com.ede.help;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ede.action.Action;
import com.ede.action.ActionFoward;
import com.ede.board.BoardDTO;
public class HelpViewService implements Action {
@Override
public ActionFoward doProcess(HttpServletRequest request, HttpServletResponse response) {
ActionFoward actionFoward = new ActionFoward();
int num=0;
HelpDAO helpDAO = new HelpDAO();
BoardDTO boardDTO = null;
try {
num = Integer.parseInt(request.getParameter("num"));
helpDAO.hit(num);
} catch (Exception e) {
// TODO: handle exception
}
try {
boardDTO = helpDAO.selectOne(num);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
if(boardDTO != null) {
request.setAttribute("board", "help");
request.setAttribute("title", "1:1 문의 게시판");
request.setAttribute("view", boardDTO);
actionFoward.setPath("../WEB-INF/view/board/boardView.jsp");
}else {
request.setAttribute("message", "Fail");
request.setAttribute("path", "./helpList.help");
actionFoward.setPath("../WEB-INF/view/common/result.jsp");
}
actionFoward.setCheck(true);
return actionFoward;
}
}
| [
"33417071+lovejesus27@users.noreply.github.com"
] | 33417071+lovejesus27@users.noreply.github.com |
3c1322fb67d2e927daa642032b9cdfc8f2be949c | ec9b23ec31f6a33ada03c5b6b30bd1637643325b | /src/main/java/com/muffinsoft/alexa/skills/audiotennis/handlers/TennisHelpIntentHandler.java | b22b7f32c5894a8d147aa28f612e97a69bc9f33a | [] | no_license | muffinsoft/audio-tennis-alexa-skill | ba4f4a8aa0a0d1897cff10a3056c4c27a3d20492 | 78ab0246f6942589fe5605f4189a7788a9023d18 | refs/heads/master | 2021-12-15T01:18:51.781012 | 2019-12-09T19:02:57 | 2019-12-09T19:02:57 | 157,967,295 | 0 | 0 | null | 2021-12-14T21:37:11 | 2018-11-17T08:54:14 | Java | UTF-8 | Java | false | false | 1,801 | java | package com.muffinsoft.alexa.skills.audiotennis.handlers;
import com.amazon.ask.dispatcher.request.handler.HandlerInput;
import com.muffinsoft.alexa.sdk.activities.StateManager;
import com.muffinsoft.alexa.sdk.handlers.HelpIntentHandler;
import com.muffinsoft.alexa.sdk.model.PhraseContainer;
import com.muffinsoft.alexa.skills.audiotennis.activities.HelpStateManager;
import com.muffinsoft.alexa.skills.audiotennis.content.RegularPhraseManager;
import com.muffinsoft.alexa.skills.audiotennis.models.PhraseDependencyContainer;
import com.muffinsoft.alexa.skills.audiotennis.models.SettingsDependencyContainer;
import java.util.List;
import static com.muffinsoft.alexa.skills.audiotennis.constants.PhraseConstants.GENERAL_HELP_PHRASE;
public class TennisHelpIntentHandler extends HelpIntentHandler {
private final RegularPhraseManager regularPhraseManager;
private final SettingsDependencyContainer settingsDependencyContainer;
private final PhraseDependencyContainer phraseDependencyContainer;
public TennisHelpIntentHandler(SettingsDependencyContainer settingsDependencyContainer, PhraseDependencyContainer phraseDependencyContainer) {
super();
this.settingsDependencyContainer = settingsDependencyContainer;
this.phraseDependencyContainer = phraseDependencyContainer;
this.regularPhraseManager = phraseDependencyContainer.getRegularPhraseManager();
}
@Override
public StateManager nextTurn(HandlerInput handlerInput) {
return new HelpStateManager(getSlotsFromInput(handlerInput), handlerInput.getAttributesManager(), settingsDependencyContainer, phraseDependencyContainer);
}
@Override
protected List<PhraseContainer> getPhrase() {
return regularPhraseManager.getValueByKey(GENERAL_HELP_PHRASE);
}
} | [
"oleksandr.solodovnikov@gmail.com"
] | oleksandr.solodovnikov@gmail.com |
143b19803ccf18b17027a4ee16392c6e7adf0ed4 | 74836ca51df5e01a8a54caefd027c5ce7efa4bdb | /ex1-hello-jpa/target/generated-sources/java/proxyPractice/QLazyTeam.java | 9eed4e248c22e8bc407c687627d75ba1d227a4b2 | [] | no_license | blackbutterfly0852/JPA_BASIC | 05f8f20007a4a204eebd81a4eddd6cc97571e218 | 8ef20f384509c8f5f122b36f46254f188a5e8372 | refs/heads/master | 2023-02-03T22:59:42.598125 | 2020-12-11T18:54:33 | 2020-12-11T18:54:33 | 302,410,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 990 | java | package proxyPractice;
import static com.querydsl.core.types.PathMetadataFactory.*;
import com.querydsl.core.types.dsl.*;
import com.querydsl.core.types.PathMetadata;
import javax.annotation.Generated;
import com.querydsl.core.types.Path;
/**
* QLazyTeam is a Querydsl query type for LazyTeam
*/
@Generated("com.querydsl.codegen.EntitySerializer")
public class QLazyTeam extends EntityPathBase<LazyTeam> {
private static final long serialVersionUID = -778611050L;
public static final QLazyTeam lazyTeam = new QLazyTeam("lazyTeam");
public final NumberPath<Long> id = createNumber("id", Long.class);
public final StringPath name = createString("name");
public QLazyTeam(String variable) {
super(LazyTeam.class, forVariable(variable));
}
public QLazyTeam(Path<? extends LazyTeam> path) {
super(path.getType(), path.getMetadata());
}
public QLazyTeam(PathMetadata metadata) {
super(LazyTeam.class, metadata);
}
}
| [
"blackbutterfly0852@gmail.com"
] | blackbutterfly0852@gmail.com |
6a32c7b2b4e751b959b00d629dc07daf4308ce02 | df9cc21e8b8a1b3a6d446f4cc6f39ae74cae940f | /src/main/java/com/github/fjtorres/deckOfCards/Main.java | 9d721b550b92cfd5d686a8926c149f2a7b263acd | [] | no_license | fjtorres/deck-of-cards | ae2914492bab66580bac987c9d983083a0046181 | 41c7fd3c5101634dc51839100b249d06770991c0 | refs/heads/main | 2023-01-24T02:38:55.765113 | 2020-11-17T18:54:57 | 2020-11-17T18:54:57 | 312,867,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 477 | java | package com.github.fjtorres.deckOfCards;
/**
* Application class to execute a deck.
*/
public class Main {
public static void main(String[] args) {
System.out.println("Poker deck: Start");
Deck<PokerCard> pokerDeck = new Deck<>(PokerCard.allCards());
pokerDeck.shuffle();
while(!pokerDeck.isEmpty()) {
pokerDeck.dealOneCard().ifPresent(System.out::println);
}
System.out.println("Poker deck: End");
}
}
| [
"fjtorres@zerocopy.be"
] | fjtorres@zerocopy.be |
43dc997cdb283b57f97d2630d9c5bcd3de902fcd | c8dd21029c8f74df9be06a8768e167a7876848d9 | /src/com/ra4king/opengl/util/GLProgram.java | 776484ff76f9d7525285a20786eb51328b57a303 | [] | no_license | binaryaaron/lamegame | 0a6101fef904585355055081d64a509dfc8cc3b1 | e5e484d47c321e692186a6cda8096bdfd10cf2fb | refs/heads/master | 2021-05-29T09:46:07.285228 | 2015-04-18T02:56:34 | 2015-04-18T02:56:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,240 | java | package com.ra4king.opengl.util;
import static org.lwjgl.opengl.GL11.*;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.ContextAttribs;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.PixelFormat;
/**
* @author Roi Atalla
*/
public abstract class GLProgram {
private int fps;
public GLProgram(boolean vsync) {
try {
Display.setFullscreen(true);
Display.setVSyncEnabled(vsync);
} catch(Exception exc) {
exc.printStackTrace();
}
}
public GLProgram(String name, int width, int height, boolean resizable) {
Display.setTitle(name);
try {
Display.setDisplayMode(new DisplayMode(width, height));
} catch(Exception exc) {
exc.printStackTrace();
}
Display.setResizable(resizable);
fps = 60;
}
public void setFPS(int fps) {
this.fps = fps;
}
public int getFPS() {
return fps;
}
public final void run() {
run(false);
}
public final void run(boolean core) {
run(core, new PixelFormat());
}
public final void run(boolean core, PixelFormat format) {
run(format, core ? new ContextAttribs(3, 3).withProfileCore(true) : null);
}
public final void run(int major, int minor) {
run(major, minor, false);
}
public final void run(int major, int minor, boolean core) {
run(major, minor, core, new PixelFormat());
}
public final void run(int major, int minor, boolean core, PixelFormat format) {
run(format, core ? new ContextAttribs(major, minor).withProfileCore(core) : new ContextAttribs(major, minor));
}
public final void run(PixelFormat format) {
run(format, null);
}
public final void run(ContextAttribs attribs) {
run(new PixelFormat(), attribs);
}
public final void run(PixelFormat format, ContextAttribs attribs) {
try {
Display.create(format, attribs);
} catch(Exception exc) {
exc.printStackTrace();
System.exit(1);
}
gameLoop();
}
private void gameLoop() {
try {
init();
Utils.checkGLError("init");
resized();
Utils.checkGLError("resized");
long lastTime, lastFPS;
lastTime = lastFPS = System.nanoTime();
int frames = 0;
long updateTime = 0, renderTime = 0;
while(!Display.isCloseRequested() && !shouldStop()) {
long deltaTime = System.nanoTime() - lastTime;
lastTime += deltaTime;
if(Display.wasResized())
resized();
while(Keyboard.next()) {
if(Keyboard.getEventKeyState())
keyPressed(Keyboard.getEventKey(), Keyboard.getEventCharacter());
else
keyReleased(Keyboard.getEventKey(), Keyboard.getEventCharacter());
}
long initial = System.nanoTime();
update(deltaTime);
updateTime += System.nanoTime() - initial;
Utils.checkGLError("update");
initial = System.nanoTime();
render();
Display.update();
renderTime += System.nanoTime() - initial;
Utils.checkGLError("render");
frames++;
if(System.nanoTime() - lastFPS >= 1e9) {
System.out.println("FPS: ".concat(String.valueOf(frames)) + "\tUpdate: " + (updateTime / frames) + "ns/" + String.format("%.2fms", updateTime / (frames * 1e6)) + "\tRender: " + (renderTime / frames) + "ns/" + String.format("%.2fms", renderTime / (frames * 1e6)));
lastFPS += 1e9;
updateTime = renderTime = 0;
frames = 0;
}
Display.sync(fps);
}
} catch(Throwable exc) {
exc.printStackTrace();
} finally {
destroy();
}
}
public int getWidth() {
return Display.getWidth();
}
public int getHeight() {
return Display.getHeight();
}
public abstract void init();
public void resized() {
glViewport(0, 0, getWidth(), getHeight());
}
public boolean shouldStop() {
return Keyboard.isKeyDown(Keyboard.KEY_ESCAPE);
}
public void keyPressed(int key, char c) {}
public void keyReleased(int key, char cs) {}
public void update(long deltaTime) {}
public abstract void render();
public void destroy() {
Display.destroy();
System.exit(0);
}
protected String readFromFile(String file) {
try {
return Utils.readFully(getClass().getResourceAsStream(file));
} catch(Exception exc) {
throw new RuntimeException("Failure reading file " + file, exc);
}
}
}
| [
"weston@wortiz.com"
] | weston@wortiz.com |
657993c47118a5a52d8492e25e248613414a56d5 | 7a8432bffb7ce75c08b9fdc1484840b654208b38 | /src/main/java/com/zhangting/controller/SystemController.java | 12fcb780ab39a78f7f2dbeacb786f8f0a81587b0 | [] | no_license | zhangting0228/SpringBoot-SpringSecurity-Demo | 7787a0f1a950966f807635d6da6e0062fe6c487e | e21d816ca6bd705a64bd1b37c4f4c8410f2cd160 | refs/heads/master | 2022-07-01T16:53:05.051484 | 2020-03-12T01:42:58 | 2020-03-12T01:42:58 | 226,544,271 | 0 | 0 | null | 2022-06-17T02:45:53 | 2019-12-07T16:39:16 | Java | UTF-8 | Java | false | false | 738 | java | package com.zhangting.controller;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
/**
* @Author 张挺(zhangting@binfo-tech.com)
* @Description
* @Date 2019/12/7 17:57
*/
@Controller
public class SystemController {
@GetMapping("/login")
public String login() {
return "login.html";
}
/**
* 密码加盐
* @param args
*/
public static void main(String[] args) {
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
String password = bCryptPasswordEncoder.encode("1");
System.out.println(password);
}
}
| [
"cstingzhang@163.com"
] | cstingzhang@163.com |
38671a0b7383f303148d372d145612fc4f906ae9 | cecc479932fe48f48ac4668859d13f470aed9576 | /websiteDB.java | c778e1b8dc7dda5476b6398a0e09434588a644ff | [] | no_license | rsashna/sqLiteProj | d47a921bccd3460892c9eeb6c5110ac08fcd4429 | 424b1ff57c8ffae6b99673fdf8f3dffb7e789442 | refs/heads/master | 2023-07-13T12:23:48.233404 | 2021-08-20T03:26:12 | 2021-08-20T03:26:12 | 291,330,056 | 0 | 0 | null | 2020-08-29T19:02:42 | 2020-08-29T18:49:49 | TSQL | UTF-8 | Java | false | false | 14,676 | java | // made for websiteDB
import java.sql.*;
import java.util.Scanner;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.text.DateFormat;
//usage
//java -classpath ".:sqlite-jdbc-3.30.1.jar" websiteDB
// import java.sql.Connection;
// import java.sql.DriverManager;
// import java.sql.ResultSet;
// import java.sql.SQLException;
// import java.sql.Statement;
public class websiteDB{
public static void main(String args[]) {
System.out.println("Checking Connection...");
Connection c = null;
Statement stmt = null;
try {
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:websiteCompanies.db");
// c = DriverManager.getConnection("jdbc:sqlite:websiteCompanies.db");
}
catch ( Exception e )
{
System.err.println("Problem Encountered.");
}
System.out.println("Opened database successfully.\n\n");
// create a scanner
Scanner scanner = new Scanner(System.in);
// prompt for the user's name
System.out.print("--WEBSITE COMPANIES DATABASE--");
System.out.print("\n\n To list all companies and their URLs select A \n To list all companies and their multimedia select B \n To list publishing dates for each company select C \n To list the country where each company was founded select D \n To list all types of websites on the database select E \n To list all types and their websites select F \n To list all tools with their website select G \n To list all types of websites on the database select H \n To list all types of websites on the database select I \n To list websites by order of publication dates select J \n To list how many devs per company select K \n To list devs per company in ascending order select L\n\n");
// get their input as a String
String sel = scanner.next();
switch(sel) {
case "A":
try
{
stmt = c.createStatement();
}
catch(SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
try
{
ResultSet rs = stmt.executeQuery( "select website.url, company.registeredName from website inner join company where website.companyID=company.companyID;");
System.out.printf("\n---\n");
while ( rs.next() ) {
//code to access rows goes here
String url = rs.getString("url");
String registeredName = rs.getString("registeredName");
System.out.printf("%s, %s\n", registeredName, url);
}
}
catch (SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
break;
case "B":
try
{
stmt = c.createStatement();
}
catch(SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
try
{
ResultSet rs = stmt.executeQuery( "select website.url, websiteMedia.type from website inner join websiteMedia where website.url=websiteMedia.url; ");
System.out.printf("\n---\n");
while ( rs.next() ) {
//code to access rows goes here
String url = rs.getString("url");
String type = rs.getString("type");
System.out.printf("%s, %s\n", url, type);
}
}
catch (SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
break;
case "C":
try
{
stmt = c.createStatement();
}
catch(SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
try
{
ResultSet rs = stmt.executeQuery( "select url, pubDate from website; ");
System.out.printf("\n---\n");
while ( rs.next() ) {
//code to access rows goes here
String url = rs.getString("url");
java.sql.Date date = rs.getDate("pubDate");
System.out.printf("%s, %s\n", url, date);
}
}
catch (SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
break;
case "D":
try
{
stmt = c.createStatement();
}
catch(SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
try
{
ResultSet rs = stmt.executeQuery( "select countryOrigin, registeredName from company;");
System.out.printf("\n---\n");
while ( rs.next() ) {
//code to access rows goes here
String registeredName = rs.getString("registeredName");
String countryOrigin = rs.getString("countryOrigin");
System.out.printf("%s, %s\n", registeredName, countryOrigin);
}
}
catch (SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
break;
case "E":
try
{
stmt = c.createStatement();
}
catch(SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
try
{
ResultSet rs = stmt.executeQuery( "select webType from websiteClassified;");
System.out.printf("\n---\n");
while ( rs.next() ) {
//code to access rows goes here
String webType = rs.getString("webType");
System.out.printf("%s\n", webType);
}
}
catch (SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
break;
case "F":
try
{
stmt = c.createStatement();
}
catch(SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
try
{
ResultSet rs = stmt.executeQuery( "select webType, url from websiteClassified;");
System.out.printf("\n---\n");
while ( rs.next() ) {
//code to access rows goes here
String webType = rs.getString("webType");
String url = rs.getString("url");
System.out.printf("%s\t%s\n", url, webType);
}
}
catch (SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
break;
case "G":
try
{
stmt = c.createStatement();
}
catch(SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
try
{
ResultSet rs = stmt.executeQuery( "select toolName, url from websiteTools");
System.out.printf("\n---\n");
while ( rs.next() ) {
//code to access rows goes here
String toolName = rs.getString("toolName");
String url = rs.getString("url");
System.out.printf("%s\t%s\n", url, toolName);
}
}
catch (SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
break;
case "H":
try
{
stmt = c.createStatement();
}
catch(SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
try
{
ResultSet rs = stmt.executeQuery( "select language, url from tools inner join websiteTools where tools.toolName=websiteTools.toolName;");
System.out.printf("\n---\n");
while ( rs.next() ) {
//code to access rows goes here
String url = rs.getString("url");
String language = rs.getString("language");
System.out.printf("%s\t%s\n", url, language);
}
}
catch (SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
break;
case "I":
try
{
stmt = c.createStatement();
}
catch(SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
try
{
ResultSet rs = stmt.executeQuery( "select developer.firstName, developer.lastName, company.registeredName from developer inner join company where company.companyID=developer.companyID");
System.out.printf("\n---\n");
while ( rs.next() ) {
//code to access rows goes here
String firstName = rs.getString("firstName");
String lastName = rs.getString("lastName");
String registeredName = rs.getString("registeredName");
System.out.printf("%s\t%s\t%s\n", registeredName, firstName, lastName);
}
}
catch (SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
break;
case "J":
try
{
stmt = c.createStatement();
}
catch(SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
try
{
ResultSet rs = stmt.executeQuery( "select url from website order by pubDate;");
System.out.printf("\n---\n");
while ( rs.next() ) {
//code to access rows goes here
String url = rs.getString("url");
System.out.printf("%s\n", url);
}
}
catch (SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
break;
case "K":
try
{
stmt = c.createStatement();
}
catch(SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
try
{
ResultSet rs = stmt.executeQuery( "select registeredName, COUNT(*) AS C from developer inner join company where company.companyID=developer.companyID group by company.companyID; ");
System.out.printf("\n---\n");
while ( rs.next() ) {
//code to access rows goes here
String registeredName = rs.getString("registeredName");
Integer C = rs.getInt("C");
System.out.printf("%s\t%d\n", registeredName, C);
}
}
catch (SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
break;
case "L":
try
{
stmt = c.createStatement();
}
catch(SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
try
{
ResultSet rs = stmt.executeQuery( "select registeredName, COUNT(*) as count from developer inner join company where company.companyID=developer.companyID group by company.companyID order by count asc ");
System.out.printf("\n---\n");
while ( rs.next() ) {
//code to access rows goes here
String registeredName = rs.getString("registeredName");
Integer C = rs.getInt("count");
System.out.printf("%s\t%d\n", registeredName, C);
}
}
catch (SQLException e)
{
// do something appropriate with the exception, *at least*:
e.printStackTrace();
}
break;
default:
System.out.println("\nSELECTION NOT RECOGNISED");
}
}
}
| [
"rashna@ryerson.ca"
] | rashna@ryerson.ca |
3aca39a015a89d08d3894b527a2ef55880d3acf3 | c83d11aec611196a8142bff15ae319a3effa0c65 | /Sum/src/main/java/Login.java | f5731276ade9f0d3864d451989b89ff2300ffd08 | [] | no_license | ipsitabairagi/MagentoTest | 7dcb36932903d2199619eaa771bc22ae289081d4 | 9ce2e3f3e115093773cbd75cf579ecaf601c3599 | refs/heads/master | 2023-05-11T18:11:40.415543 | 2019-05-24T06:59:48 | 2019-05-24T06:59:48 | 188,367,302 | 0 | 0 | null | 2023-05-09T18:07:25 | 2019-05-24T06:42:48 | Java | UTF-8 | Java | false | false | 511 | java |
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class Login {
WebDriver driver;
By email = By.id("email");
By pass = By.id("pass");
By login = By.id("send2");
public Login(WebDriver driver) {
this.driver = driver;
}
public void typeEmail() {
driver.findElement(email).sendKeys("ipsita1996.ib@gmail.com");
}
public void typePass() {
driver.findElement(pass).sendKeys("Welcome123");
}
public void clickOnLogin()
{
driver.findElement(login).click();
}
}
| [
"BAIRAGI@IPSITA"
] | BAIRAGI@IPSITA |
64e6c586f60f23657458beb137940b144a4050ab | 97827612250645bd93cc83e6039e967faa5ad74a | /BackOfficeItic/br/com/dyad/backoffice/entidade/movimentacao/Financeiro.java | 16aeb6bf56dfe3a4a491382f7ab95b9295bce661 | [] | no_license | Eduks/itic-framework-erp-pme | 7b7d93c6e22c622d6383b9f2066af0dd9315a420 | f910fdfe379f3b8b401b03e1a518d70fb6bbe78f | refs/heads/master | 2020-05-16T23:21:25.612398 | 2011-07-13T13:42:26 | 2011-07-13T13:42:26 | 40,271,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 563 | java | package br.com.dyad.backoffice.entidade.movimentacao;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name="OPERACAO")
@DiscriminatorColumn(name = "classId", discriminatorType = DiscriminatorType.STRING)
@DiscriminatorValue(value="-99999899999940")
public abstract class Financeiro extends Operacao {
public static void defineFields( String className){
Operacao.defineFields(className);
}
} | [
"itic.erp@gmail.com"
] | itic.erp@gmail.com |
77e104e215411164a4da093195ee5b9b1f148cf3 | d023a51c734ecf9ee20812329824a2767b5f8eb7 | /LittleSisterServer2/src/main/java/at/htl/entity/Session.java | ca767af118a32293b55cdadc47f989ea5ba8c79f | [
"Apache-2.0"
] | permissive | htl-leonding/2015_LittleSister | 1fcec75202c9fb44dab7d2d2ef21bafc59bf6ac4 | a0656d72a7fe9f5716b114b82b4c019599f7498a | refs/heads/master | 2021-01-01T04:51:45.140467 | 2016-04-22T07:38:01 | 2016-04-22T07:38:01 | 56,835,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,920 | java | package at.htl.entity;
public class Session {
// ----- FIELDS -----
private String name;
private String schoolClass;
private ClientSettings clientSettings;
private String logDirectory;
private String relevantFilesPath;
private String retrieveData;
private boolean isCorrect;
public String getRetrieveData() {
return retrieveData;
}
public void setRetrieveData(String retrieveData) {
this.retrieveData = retrieveData;
}
public boolean isIsCorrect() {
return isCorrect;
}
public void setIsCorrect(boolean isCorrect) {
this.isCorrect = isCorrect;
}
// ----- GETTER && SETTER -----
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSchoolClass() {
return schoolClass;
}
public void setSchoolClass(String schoolClass) {
this.schoolClass = schoolClass;
}
public ClientSettings getClientSettings() {
return clientSettings;
}
public void setClientSettings(ClientSettings clientSettings) {
this.clientSettings = clientSettings;
}
public String getLogDirectory() {
return logDirectory;
}
public void setLogDirectory(String logDirectory) {
this.logDirectory = logDirectory;
}
public String getRelevantFilesPath() {
return relevantFilesPath;
}
public void setRelevantFilesPath(String relevantFilesPath) {
this.relevantFilesPath = relevantFilesPath;
}
// ----- CONSTRUCTORS -----
public Session() {
}
public Session(String name, String schoolClass, ClientSettings settings, String logDirectory) {
this.name = name;
this.schoolClass = schoolClass;
this.clientSettings = settings;
this.logDirectory = logDirectory;
}
}
| [
"vik.baer@gmail.com"
] | vik.baer@gmail.com |
c04efefa68545e462d7fc438f226b49261fe9221 | 479922f758514e7d8e87c4bac948d11ccbe89e91 | /src/EmployeeLog.java | 8a11d8f7b91873713fbf83ce6c2d3e00d5d660ac | [] | no_license | orodas1/TMT | b4f95ed46d7f22725fd08421d4863f772e4cfea1 | 64430e3da992577be4a06701c748abc0459204be | refs/heads/master | 2020-12-03T19:29:18.875000 | 2016-11-11T21:46:48 | 2016-11-11T21:46:48 | 73,506,434 | 0 | 0 | null | 2016-11-11T19:45:00 | 2016-11-11T19:45:00 | null | UTF-8 | Java | false | false | 1,243 | java | import java.sql.Date;
import java.sql.Time;
/**
* Created by Hugo Lucas on 10/29/2016.
*/
public class EmployeeLog {
private Time clockIn;
private Time clockOut;
private Date logDate;
private int taskID;
private int employeeID;
public EmployeeLog(Time ci, Time co, Date ld, int id){
this.clockIn = ci;
this.clockOut = co;
this.logDate = ld;
this.taskID = id;
this.employeeID = -1;
}
public EmployeeLog(Time ci, Time co, Date ld, int id, int eid){
this.clockIn = ci;
this.clockOut = co;
this.logDate = ld;
this.taskID = id;
this.employeeID = eid;
}
public String printLog(){
String out = null;
String clockProxy = null;
if(clockOut != null)
clockProxy = clockOut.toString();
else
clockProxy = "PENDING";
if(employeeID == -1)
out = String.format("IN: %s OUT: %s DATE: %s TASK: %d",clockIn.toString(), clockProxy, logDate.toString(), taskID);
else
out = String.format("IN: %s OUT: %s DATE: %s TASK: %d EmployeeID: %d",clockIn.toString(), clockProxy, logDate.toString(), taskID, employeeID);
return out;
}
}
| [
"hugojlucas@gmail.com"
] | hugojlucas@gmail.com |
ace5c5319032bf42785ca39ea3a89e019d2c6ecf | 3b04fe7ac4b768940378c9194a3081c0baddca12 | /javapractices/src/main/java/designpatterns/singleton/SingletonLazyInit.java | 01f3598d0848879a85f92de4e5844adf140b9128 | [] | no_license | Shivamjr7/Java | d02dc1a0daa095b8092188e6a58b22c44c6f6303 | a831fdaac2e199a95adde72a20e2ef3651e39f20 | refs/heads/master | 2022-06-16T21:12:04.888394 | 2022-05-27T05:26:22 | 2022-05-27T05:26:22 | 245,091,921 | 0 | 0 | null | 2020-10-14T12:04:19 | 2020-03-05T07:02:35 | Java | UTF-8 | Java | false | false | 294 | java | package designpatterns.singleton;
public class SingletonLazyInit {
private static SingletonLazyInit instance;
private SingletonLazyInit() {
}
public static SingletonLazyInit getInstance() {
if (instance == null) {
instance = new SingletonLazyInit();
}
return instance;
}
}
| [
"sjari@paypal.com"
] | sjari@paypal.com |
533359a9d468438d22d836cb3ba7f3678c486145 | ce04225203faaeeae507eafec1f8216fa38ac40c | /app/src/main/java/com/gymnast/view/widget/photoview/scrollerproxy/IcsScroller.java | 36560ad3c3cb2fa4fa4675a5bc1b15efa609d5b3 | [
"Apache-2.0"
] | permissive | 928902646/Gymnast | 4a7062ee5bc910652f92d6789e0fb431701237c4 | aefab7bdb47a7a81e8ecaa6e3f3650fdb795c7d1 | refs/heads/master | 2020-05-23T08:16:14.842151 | 2016-10-18T02:23:49 | 2016-10-18T02:23:49 | 70,256,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 378 | java | package com.gymnast.view.widget.photoview.scrollerproxy;
import android.annotation.TargetApi;
import android.content.Context;
@TargetApi(14)
public class IcsScroller extends GingerScroller {
public IcsScroller(Context context) {
super(context);
}
@Override
public boolean computeScrollOffset() {
return mScroller.computeScrollOffset();
}
}
| [
"928902646@qq.com"
] | 928902646@qq.com |
fff24251a456d740f74da1427ea3d8520d72509c | e2ac3fdc5ad13255cc0f3686d287bf7b7b06a657 | /MYCHANGE/java/change-request-service/src/main/java/com/example/mirai/mychange/changerequestservice/shared/exception/NotAllowedToAddSelfAsDependentException.java | 88b9a801610b9a9d8034ed3e3cb8f8234a65e51d | [] | no_license | Suresh918/mySpringbootMicroServices | c483d876c8b436b8388f5ff7f4b8c1a7f903282d | 378b020c6cf3fdd742f5935f86c3a4821055af7a | refs/heads/main | 2023-06-27T21:15:44.507233 | 2021-07-17T15:28:08 | 2021-07-17T15:28:08 | 379,893,287 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 213 | java | package com.example.mirai.projectname.changerequestservice.shared.exception;
public class NotAllowedToAddSelfAsDependentException extends RuntimeException {
private static final long serialVersionUID = 1L;
}
| [
"suresh.uputhula@asml.com"
] | suresh.uputhula@asml.com |
5b7cb1d594a70ad04df5a9462269021b5d947d99 | 1bdd1ed4acfba08a9f0d8ab38cc91256efb45e02 | /entropiahof/src/studio/coldstream/entropiahof/NewsHandler.java | 0ec163f987bf59b7a4ec49f4881e41fcec11d2ce | [] | no_license | majakk/entropiahof | 4158130c283158b6db6198b53f84da2d3125a4d8 | 4dd8df082d019a6ac6a32cc485c172535912d878 | refs/heads/master | 2021-01-16T02:45:38.564206 | 2012-12-18T21:02:05 | 2012-12-18T21:02:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,162 | java | package studio.coldstream.entropiahof;
import java.util.LinkedList;
import java.util.List;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
//import android.util.Log;
public class NewsHandler extends DefaultHandler{
// ===========================================================
// Fields
// ===========================================================
static final String TAG = "EH"; // for Log
/*boolean in_itemtag = false;
boolean in_titletag = false;
boolean in_descriptiontag = false;
boolean in_pubdatetag = false;*/
boolean in_divtag = false;
boolean in_strongtag = false;
boolean in_title = false;
boolean in_content = false;
String tableClass = "";
String tableClassTitle = "entryTitle";
String tableClassContent = "entryContent";
int counter = 0;
//int trcounter = 0;
//int indexer[] = new int[5];
private ParsedHofDataSet myParsedHofDataSet = new ParsedHofDataSet("", "", "");
private List<ParsedHofDataSet> myData = new LinkedList<ParsedHofDataSet>();
// ===========================================================
// Getter & Setter
// ===========================================================
public ParsedHofDataSet getParsedData(int index) {
//return this.myParsedExampleDataSet;
return this.myData.get(index);
}
public int getCounterValue() {
return counter;
}
// ===========================================================
// Methods
// ===========================================================
@Override
public void startDocument() throws SAXException {
//this.myParsedHofDataSet = new ParsedHofDataSet(null, null, null);
}
@Override
public void endDocument() throws SAXException {
// Nothing to do
}
/** Gets be called on opening tags like:
* <tag>
* Can provide attribute(s), when xml was like:
* <tag attribute="attributeValue">*/
@Override
public void startElement(String namespaceURI, String localName,
String qName, Attributes atts) throws SAXException {
if (localName.equals("div")) {
/*if(counter > 0){
indexer[counter] = myData.size();
Log.v(TAG, String.valueOf(indexer[counter]));
}*/
this.in_divtag = true;
tableClass = atts.getValue("class");
if(tableClass != null){
if(tableClass.equalsIgnoreCase(tableClassTitle)){
this.in_title = true;
this.in_content = false;
//Log.v(TAG, tableClass);
counter++;
}else if(tableClass.equalsIgnoreCase(tableClassContent)){
this.in_title = false;
this.in_content = true;
}
//Log.v(TAG, String.valueOf(counter));
}
}else if (localName.equals("strong")) {
this.in_strongtag = true;
}
/*else if (localName.equals("description")) {
this.in_descriptiontag = true;
}else if (localName.equals("pubDate")) {
this.in_pubdatetag = true;*/
//}else if (localName.equals("tagwithnumber")) {
// Extract an Attribute
//String attrValue = atts.getValue("thenumber");
//int i = Integer.parseInt(attrValue);
//myParsedExampleDataSet.setExtractedInt(i);
//}
}
/** Gets be called on closing tags like:
* </tag> */
@Override
public void endElement(String namespaceURI, String localName, String qName)
throws SAXException {
if (localName.equals("div")) {
//counter++;
this.in_divtag = false;
this.in_title = false;
this.in_content = false;
/*this.myData.add(new ParsedHofDataSet(myParsedHofDataSet.getNameString(),
myParsedHofDataSet.getResourceString(),
myParsedHofDataSet.getValueString()));*/
}else if (localName.equals("strong")) {
this.in_strongtag = false;
this.myData.add(new ParsedHofDataSet(myParsedHofDataSet.getNameString(),
myParsedHofDataSet.getResourceString(),
myParsedHofDataSet.getValueString()));
myParsedHofDataSet.setNameString("");
}
/*else if (localName.equals("description")) {
this.in_descriptiontag = false;
}else if (localName.equals("pubDate")) {
this.in_pubdatetag = false;*/
//}else if (localName.equals("tagwithnumber")) {
// Nothing to do here
//}
}
/** Gets be called on the following structure:
* <tag>characters</tag> */
@Override
public void characters(char ch[], int start, int length) {
if(this.in_divtag){
if(this.in_title){
//myParsedHofDataSet.setNameString("");
myParsedHofDataSet.addToNameString(new String(ch, start, length));
//Log.v(TAG, String.valueOf(length));
}
/*if(this.in_descriptiontag){
//myParsedHofDataSet.setNameString("");
myParsedHofDataSet.addToResourceString(new String(ch, start, length));
//Log.v(TAG, String.valueOf(length));
}*/
if(this.in_content && this.in_strongtag){
//myParsedHofDataSet.setNameString("");
myParsedHofDataSet.setValueString(new String(ch, start, length));
//Log.v(TAG, String.valueOf(length));
}
/*if(this.in_fonttag){
myParsedHofDataSet.addToResourceString(new String(ch, start, length));
//Log.v(TAG, String.valueOf(length));
}
if(this.in_tdtag){
myParsedHofDataSet.setValueString(new String(ch, start, length));
}*/
}
}
} | [
"mattias.jacobsson@gmail.com"
] | mattias.jacobsson@gmail.com |
cf29b3d2c06a41430bdedc083c713d9fff62d86a | 9d647a86d41484d8da6f1497374cc2d8df4b5353 | /app/src/main/java/net/elshaarawy/smartpan/Data/SmartPanDbHelper.java | c5f2c7d266ac4037bd0e9faa30e631f4a132fed1 | [] | no_license | IAmShaarawy/SmartPan | 7886ffac63aa33e2acda941be1bf0109cee58cb4 | 95be96c74786168780bdd9f832314c346f71af3b | refs/heads/master | 2022-01-20T23:08:45.823722 | 2017-06-27T18:46:57 | 2017-06-27T18:46:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,337 | java | package net.elshaarawy.smartpan.Data;
import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import static net.elshaarawy.smartpan.Data.SmartPanContract.*;
/**
* Created by elshaarawy on 25-Jun-17.
*/
public class SmartPanDbHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "smartpan.db";
private static final int DATABASE_VERSION = 1;
public SmartPanDbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
final String CREATE_COUNTRIES_TABLE = "CREATE TABLE " + COUNTRIES_COLUMNS.C_TABLE_NAME + "( " +
COUNTRIES_COLUMNS._ID + " INTEGER PRIMARY KEY AUTOINCREMENT , "+
COUNTRIES_COLUMNS.C_NAME + " TEXT , "+
COUNTRIES_COLUMNS.C_ALPHA2CODE + " TEXT , "+
COUNTRIES_COLUMNS.C_CAPITAL + " TEXT );";
db.execSQL(CREATE_COUNTRIES_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXIST"+ COUNTRIES_COLUMNS.C_TABLE_NAME);
this.onCreate(db);
}
private interface SQLTableCreator{
}
}
| [
"elshaarawy200825@hotmail.com"
] | elshaarawy200825@hotmail.com |
7355dcf9ea9d964bd55a9a894d751d8450109612 | 50cadf826e78f1a17cdceeb6be636c6132503034 | /src/test/java/xyz/isatimur/course/application/config/WebConfigurerTestController.java | 8820e2dffd20c48ca9aa85e30c204b48af3be2d6 | [] | no_license | isatimur/course-application | 4abdc0f704aa5fd4f5d673bc8fb4864f8c1ace87 | a89bd43608492eedef0813282212e9443d2d5faa | refs/heads/master | 2021-06-30T06:06:52.963069 | 2017-09-16T11:55:01 | 2017-09-16T11:55:01 | 103,737,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package xyz.isatimur.course.application.config;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class WebConfigurerTestController {
@GetMapping("/api/test-cors")
public void testCorsOnApiPath() {
}
@GetMapping("/test/test-cors")
public void testCorsOnOtherPath() {
}
}
| [
"tiisachenko@dasreda.ru"
] | tiisachenko@dasreda.ru |
792f8908dba0b8236d3f7cf2ac8b46e24b3348d6 | 911224ed65574ec97c423ad850b17db52979a3e3 | /CommonLibrary/src/main/java/com/highlands/common/dialog/DialogManager.java | 0ed2c7e12a4c21c91524ed8cf4990d6df8801b4b | [] | no_license | xuliangliang1992/gif-maker | b88fef4ea134461e902f4ecdcdae28523f1c2484 | 3b5b010f086a19b4409e51611e615191f7fcc645 | refs/heads/main | 2023-03-06T08:43:39.766597 | 2021-02-22T01:09:55 | 2021-02-22T01:09:55 | 332,381,311 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,691 | java | package com.highlands.common.dialog;
import android.content.Context;
import com.highlands.common.dialog.base.BaseDialog;
import com.highlands.common.view.progresshud.ProgressHUD;
import androidx.databinding.ObservableArrayList;
/**
* @author xll
* @date 2018/12/3
*/
public class DialogManager {
protected static DialogManager dialogManager;
private ProgressHUD hud;
protected BaseDialog mDialog;
public DialogManager() {
}
public static DialogManager getInstance() {
if (null == dialogManager) {
synchronized (DialogManager.class) {
if (null == dialogManager) {
dialogManager = new DialogManager();
}
}
}
return dialogManager;
}
public void showBottomListDialog(Context context, ObservableArrayList<String> titles, ItemClickListener itemClickListener) {
mDialog = new BottomListDialog(context, titles, itemClickListener);
mDialog.show();
}
public void showAuthDialog(Context context,DialogClickListener dialogClickListener) {
mDialog = new AuthDialog(context,dialogClickListener);
mDialog.show();
}
public void showProgressDialog(Context context) {
dismissProgressDialog();
hud = ProgressHUD.create(context)
.setStyle(ProgressHUD.Style.SPIN_INDETERMINATE);
hud.show();
}
public void dismissProgressDialog() {
if (null != hud) {
hud.dismiss();
hud = null;
}
}
public void dismissDialog() {
if (null != mDialog) {
mDialog.dismiss();
mDialog = null;
}
}
}
| [
"xu.liangliang1992@qq.com"
] | xu.liangliang1992@qq.com |
ddf1cd8f34a748643f943bec11ea3fa7c0c216d7 | f5837c59c0f0bd212df65bde9a69a5da5ae5bd04 | /jclazz-decomp/src/ru/andrew/jclazz/decompiler/engine/ops/FakePopView.java | 4fa05b2e5383640b0d181c98601fa0441219d120 | [] | no_license | albfan/jclazz-original | 7bbf605a78fcfc99b8e637ad6dd818b2293494e7 | 8cacb9238272a4a9a9d2f7fb5a911502ad72674f | refs/heads/master | 2021-01-21T12:50:06.152932 | 2016-03-25T11:13:11 | 2016-03-25T12:05:02 | 38,154,511 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,317 | java | package ru.andrew.jclazz.decompiler.engine.ops;
import ru.andrew.jclazz.decompiler.MethodSourceView;
import ru.andrew.jclazz.decompiler.engine.LocalVariable;
import ru.andrew.jclazz.decompiler.engine.blocks.Block;
public class FakePopView extends OperationView
{
private LocalVariable lvar;
private String fakeValue;
public FakePopView(MethodSourceView methodView, LocalVariable lvar, String fakeValue)
{
super(null, methodView);
this.lvar = lvar;
this.fakeValue = fakeValue;
view = new Object[]{lvar.getView(), " = ", fakeValue};
}
public String getPushType()
{
return null;
}
public String source()
{
/*
String src;
if (!lvar.isPrinted())
{
src = alias(getLVType(lvar)) + " ";
lvar.setPrinted(true);
}
else
{
src = "";
}
src += getLVName(lvar);
src += " = " + fakeValue;
return src;
*/
return null;
}
public void analyze2(Block block)
{
}
public int getOpcode()
{
return 58; // astore
}
public long getStartByte()
{
// TODO may be incorrect
return -1;
}
public boolean isPush()
{
return false;
}
}
| [
"albertofanjul@gmail.com"
] | albertofanjul@gmail.com |
2af7f018bf99f10a1edf77975f9e4e20b597fe76 | 396577905a32de28157e72f89e2410ae2ccad6d0 | /apollo/apollo-backend/src/main/java/io/logz/apollo/controllers/DeploymentGroupsController.java | f9e21e3c0f5819e259bcd6538e0907848611b364 | [
"Apache-2.0"
] | permissive | seigneurcui/sanctuaire | 91499e8d3781da4cbc58771bbf2f98fd7f9066e0 | 2339d47356b2d90289c3d00b81e412642bda3fb3 | refs/heads/master | 2022-12-13T18:27:55.872876 | 2018-07-04T08:53:57 | 2018-07-04T08:53:57 | 139,694,900 | 0 | 2 | null | 2022-11-16T07:31:12 | 2018-07-04T08:47:56 | Go | UTF-8 | Java | false | false | 3,063 | java | package io.logz.apollo.controllers;
import com.google.common.base.Splitter;
import io.logz.apollo.deployment.DeploymentHandler;
import io.logz.apollo.models.MultiDeploymentResponseObject;
import io.logz.apollo.excpetions.ApolloDeploymentException;
import io.logz.apollo.models.Deployment;
import io.logz.apollo.models.Group;
import io.logz.apollo.dao.GroupDao;
import org.rapidoid.annotation.Controller;
import org.rapidoid.annotation.POST;
import org.rapidoid.http.Req;
import org.rapidoid.security.annotation.LoggedIn;
import javax.inject.Inject;
import static io.logz.apollo.common.ControllerCommon.assignJsonResponseToReq;
import static java.util.Objects.requireNonNull;
import io.logz.apollo.common.HttpStatus;
import java.util.Optional;
@Controller
public class DeploymentGroupsController {
private final DeploymentHandler deploymentHandler;
private final GroupDao groupDao;
private final static String GROUP_IDS_DELIMITER = ",";
@Inject
public DeploymentGroupsController(DeploymentHandler deploymentHandler, GroupDao groupDao) {
this.deploymentHandler = requireNonNull(deploymentHandler);
this.groupDao = requireNonNull(groupDao);
}
@LoggedIn
@POST("/deployment-groups")
public void addDeployment(int environmentId, int serviceId, int deployableVersionId, String groupIdsCsv, String deploymentMessage, Req req) throws NumberFormatException {
MultiDeploymentResponseObject responseObject = new MultiDeploymentResponseObject();
Iterable<String> groupIds = Splitter.on(GROUP_IDS_DELIMITER).omitEmptyStrings().trimResults().split(groupIdsCsv);
for (String groupIdString : groupIds) {
int groupId = Integer.parseInt(groupIdString);
Group group = groupDao.getGroup(groupId);
if (group == null) {
responseObject.addUnsuccessful(groupId, new ApolloDeploymentException("Non existing group."));
continue;
}
if (group.getServiceId() != serviceId) {
responseObject.addUnsuccessful(groupId, new ApolloDeploymentException("The deployment service ID " + serviceId + " doesn't match the group service ID " + group.getServiceId()));
continue;
}
if (group.getEnvironmentId() != environmentId) {
responseObject.addUnsuccessful(groupId, new ApolloDeploymentException("The deployment environment ID " + environmentId + " doesn't match the group environment ID " + group.getEnvironmentId()));
continue;
}
try {
Deployment deployment = deploymentHandler.addDeployment(environmentId, serviceId, deployableVersionId,
deploymentMessage, Optional.of(group), req);
responseObject.addSuccessful(groupId, deployment);
} catch (ApolloDeploymentException e) {
responseObject.addUnsuccessful(groupId, e);
}
}
assignJsonResponseToReq(req, HttpStatus.CREATED, responseObject);
}
}
| [
"terry.cuish@EF.com"
] | terry.cuish@EF.com |
44fa1c8a4821bdf3c5db758d734c30c4ef7b3c8e | ce349ee3e655a8397f2c3bbd37e75ccb26a625ad | /src/test/java/pl/matadini/hipsterwebapp/context/person/PersonTestSampleFactory.java | 0149e9b2e7ab1e2e7a761b79d5fbc281c0aa1a2c | [] | no_license | matadini/hipster-webapp | 45ad4172da4ea36f580fe4f527e0fb41cb310650 | d3a04da875843575942683950e3de985f5093f23 | refs/heads/master | 2022-06-09T07:14:30.396416 | 2019-05-24T14:27:10 | 2019-05-24T14:27:10 | 187,991,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 721 | java | package pl.matadini.hipsterwebapp.context.person;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import pl.matadini.hipsterwebapp.context.person.dto.PersonSaveDto;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
class PersonTestSampleFactory {
static PersonSaveDto createPersonSaveDtoSampleJanuszNosacz() {
PersonSaveDto build = PersonSaveDto.builder()
.name("Janusz")
.surname("Nosacz")
.email("xxx@gmail.com")
.build();
return build;
}
static PersonSaveDto createPersonSaveDtoSampleJanuszNosaczUpdate() {
PersonSaveDto build = PersonSaveDto.builder()
.name("Janusz-Update")
.surname("Nosacz-update")
.email("xxx@gmail.com-update")
.build();
return build;
}
} | [
"mateusz.iwanek@gfieast.com"
] | mateusz.iwanek@gfieast.com |
b9aa4207c2301ad765238eebc38ad9f36678abec | 551e3aa6bbac57f416c16622d9f4e9081c52aa38 | /cloud-provider-payment8002/src/main/java/com/pro/springcloud/service/PaymentService.java | a8ffb7978583b9cf19c1234c7d702aca130e50b6 | [] | no_license | 1070841863/cloud2020 | 87377778d3aeaa18216e58cbbfa09e2c3d4cdba2 | 63a7f16ee667aa66022235daae622bddc9e08cd9 | refs/heads/master | 2022-07-02T12:28:00.476860 | 2020-03-30T14:03:59 | 2020-03-30T14:03:59 | 247,728,465 | 0 | 0 | null | 2022-06-21T03:00:17 | 2020-03-16T14:43:51 | Java | UTF-8 | Java | false | false | 330 | java | package com.pro.springcloud.service;
import com.pro.springcloud.pojo.Payment;
import org.apache.ibatis.annotations.Param;
/**
* @author study
* @create 2020-03-18 15:43
*/
public interface PaymentService {
//写操作
public int create(Payment payment);
public Payment getPaymentById(@Param("id") Integer id);
}
| [
"1070841863@qq.com"
] | 1070841863@qq.com |
b33a1d640a78f4351d0312adaf9b025c2a41a044 | d7c1917f50f7a9b02144668206dbfd6d7afcd34c | /springBootSample/datasearch/datasearch-core/src/main/java/com/aaron/datasearch/core/service/conference/IConferenceService.java | 2dc3d18dceefbf382184013f974d3cef99d51367 | [] | no_license | qsunny/j2ee | 2d7339ee43e6bb2b97ed243f42cfd19e6e4627c3 | 2ad0c7c1895962a31454061625986c77d9dfbfb9 | refs/heads/master | 2022-01-13T17:30:03.448848 | 2022-01-01T15:18:00 | 2022-01-01T15:18:00 | 49,404,782 | 2 | 2 | null | 2021-06-07T16:53:00 | 2016-01-11T05:42:02 | Java | UTF-8 | Java | false | false | 595 | java | package com.aaron.datasearch.core.service.conference;
import com.aaron.datasearch.bean.Conference;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import java.util.List;
/**
* Created by Administrator on 2018/6/2.
*/
public interface IConferenceService {
Conference save(Conference conference);
void delete(Conference conference);
Conference findOne(String id);
Iterable<Conference> findAll();
public Page<Conference> findByName(String name, PageRequest pageRequest);
List<Conference> findByName(String name);
}
| [
"247986063@qq.com"
] | 247986063@qq.com |
c266996d233296cbce8b94d6487a01ed9ec9a117 | 0deb56bdcf91ca229bf61da0cf3cf3406223fb2c | /iot-channel-app/app/channel-tv/src/main/java/swaiotos/channel/iot/tv/iothandle/data/LocalMediaParams.java | 56dc84f43fe18fca92bcbcf9b94652a70d099951 | [] | no_license | soulcure/airplay | 2ceb0a6707b2d4a69f85dd091b797dcb6f2c9d46 | 37dd3a890148a708d8aa6f95ac84355606af6a18 | refs/heads/master | 2023-04-11T03:49:15.246072 | 2021-04-16T09:15:03 | 2021-04-16T09:15:03 | 357,804,553 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | package swaiotos.channel.iot.tv.iothandle.data;
import java.io.Serializable;
public class LocalMediaParams implements Serializable {
public String name;//媒体文件名称
}
| [
"chenqiongyao@coocaa.com"
] | chenqiongyao@coocaa.com |
6c2ae3a79eaab2422ccd5effa964e3555c6ab504 | c40efb977101232d91e99af0b78778bad3e0950a | /game_db/src/com/hifun/soul/gamedb/entity/HumanTechnologyEntity.java | de7c60bfbb9812f025df7cf57702b459019fc30e | [] | no_license | cietwwl/server | 2bca79a17be6d5e6fee65e57d0df1fc753fb35e3 | d18804f8c182eaa2509666aec10a2212ababc13c | refs/heads/master | 2020-06-14T15:12:16.679591 | 2014-11-19T14:48:04 | 2014-11-19T14:48:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,081 | java | package com.hifun.soul.gamedb.entity;
import java.io.Serializable;
import com.hifun.soul.core.orm.BaseProtobufEntity;
import com.hifun.soul.core.orm.annotation.AutoCreateHumanEntityHolder;
import com.hifun.soul.gamedb.IHumanSubEntity;
import com.hifun.soul.proto.data.entity.Entity.HumanTechnology;
import com.hifun.soul.proto.data.entity.Entity.HumanTechnology.Builder;
/**
* 角色科技实体;
*
* @author magicstone
*
*/
@AutoCreateHumanEntityHolder(EntityHolderClass = "CollectionEntityHolder")
public class HumanTechnologyEntity extends BaseProtobufEntity<HumanTechnology.Builder>
implements IHumanSubEntity {
public HumanTechnologyEntity(Builder builder) {
super(builder);
}
public HumanTechnologyEntity() {
this(HumanTechnology.newBuilder());
}
@Override
public long getHumanGuid() {
return this.builder.getHumanGuid();
}
@Override
public Integer getId() {
return this.builder.getTechnology().getTechnologyId();
}
@Override
public void setId(Serializable id) {
this.builder.getTechnologyBuilder().setTechnologyId((Integer) id);
}
}
| [
"magicstoneljg@163.com"
] | magicstoneljg@163.com |
94630627a651a7cc84f89de363e488fb91751f83 | ca569d3cae860ac0f9f646dcfb2fa74d33cd6677 | /src/main/java/com/cs4227/framework/strategy/StrategyContext.java | 9d07982b18286824608981a45afc377e6e058989 | [] | no_license | ShaneMckenna23/cs4227-client | 2334503fcd1d7b62c1dc6d139d97eb1a779827d7 | 6f4a387e918382ffe99ad90707371ca7a9ec25e7 | refs/heads/master | 2021-05-07T09:18:30.946503 | 2017-11-22T08:30:23 | 2017-11-22T08:30:23 | 109,497,920 | 0 | 1 | null | 2017-11-07T23:32:18 | 2017-11-04T13:42:29 | Java | UTF-8 | Java | false | false | 546 | java | package com.cs4227.framework.strategy;
import com.cs4227.framework.state.StateContext;
import java.awt.image.BufferedImage;
public class StrategyContext {
private SaveAsStrategy saveStrategy;
public SaveAsStrategy getSaveStrategy() {
return saveStrategy;
}
public void setSaveStrategy(SaveAsStrategy saveStrategy) {
this.saveStrategy = saveStrategy;
}
public void save(String destination, BufferedImage image, StateContext context) {
saveStrategy.save(destination, image, context);
}
}
| [
"deanmalo123@gmail.com"
] | deanmalo123@gmail.com |
bd680451682707c49e7430a6a906da9208c7965d | 23bdbd82c73d20f53d7a5a683121dec83a9b1293 | /src/test/java/com/example/admins/AdminsApplicationTests.java | 9497880c2982b9ff7ecf7e8bf811b963bbd9ec7c | [] | no_license | zfx1101804091/admins | 646e192927245914462f2b4b0b276969dc4852b8 | 9544c6f83e77c43ca850beb24d48340412069d27 | refs/heads/master | 2022-07-01T11:54:41.987300 | 2020-03-03T17:06:54 | 2020-03-03T17:06:54 | 244,107,890 | 0 | 0 | null | 2022-06-17T02:57:15 | 2020-03-01T07:43:42 | JavaScript | UTF-8 | Java | false | false | 650 | java | //package com.example.admins;
//
//import com.example.admins.Bean.UserBean_a;
//import com.example.admins.Bean.UserVar;
//import com.example.admins.Dao.UserDao;
//import com.example.admins.Dao.UserVarMapper;
//import org.junit.jupiter.api.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//
//@SpringBootTest
//class AdminsApplicationTests {
// @Autowired
// private UserDao userVarMapper;
// @Test
// void contextLoads() {
// UserBean_a userVar= userVarMapper.userLogin("root");
// System.out.println(userVar.getId());
// }/**/
//
//}
| [
"1875586562@qq.com"
] | 1875586562@qq.com |
773dd9f57f6257075f55f3775bc49a04c3147bee | 3e0a4e03908aa0b4611cefa9261808c6adceb63f | /src/main/java/MethodContractInspection.java | 577ba1e923ef9643a86b0064a1371db72c9aa860 | [
"Apache-2.0"
] | permissive | Charmik/IDEAInspections | 689a2db237471b40a1554963880af5f2dde7bf82 | b07e23090dc96639cc79280904306def0b8d194f | refs/heads/master | 2020-12-27T16:00:49.966668 | 2020-02-03T13:19:22 | 2020-02-03T13:19:22 | 237,961,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,994 | java | import com.intellij.codeInspection.AbstractBaseUastLocalInspectionTool;
import com.intellij.codeInspection.InspectionManager;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.psi.JavaRecursiveElementVisitor;
import com.intellij.psi.PsiAnnotation;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiCodeBlock;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiExpressionList;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiMethodCallExpression;
import com.intellij.psi.PsiPrimitiveType;
import com.intellij.psi.PsiType;
import com.intellij.psi.impl.source.tree.java.PsiIdentifierImpl;
import com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.uast.UMethod;
import org.jetbrains.uast.UParameter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Check that arguments have contracts.
* @author Charm
*/
public class MethodContractInspection extends AbstractBaseUastLocalInspectionTool {
@Nullable
@Override
public ProblemDescriptor[] checkMethod(@NotNull UMethod method,
@NotNull InspectionManager manager,
boolean isOnTheFly) {
final PsiClass clazz = method.getContainingClass();
if (clazz == null) {
return ProblemDescriptor.EMPTY_ARRAY;
}
final List<UParameter> uastParameters = method.getUastParameters();
final Map<String, PsiElement> paramNameCheckedByContract = new HashMap<>();
for (UParameter parameter : uastParameters) {
final PsiAnnotation[] annotations = parameter.getPsi().getAnnotations();
boolean isNullableParameter = false;
for (PsiAnnotation annotation : annotations) {
if (annotation.getQualifiedName() != null && annotation.getQualifiedName().contains("Nullable")) {
isNullableParameter = true;
}
}
final PsiType type = parameter.getType();
if (!isNullableParameter && !(type instanceof PsiPrimitiveType)) {
paramNameCheckedByContract.put(parameter.getName(), parameter.getJavaPsi());
}
}
final PsiCodeBlock body = method.getJavaPsi().getBody();
if (body != null) {
body.accept(new JavaRecursiveElementVisitor() {
@Override
public void visitMethodCallExpression(PsiMethodCallExpression invoke) {
super.visitMethodCallExpression(invoke);
final PsiMethod invokedMethod = invoke.resolveMethod();
if (invokedMethod != null) {
final String methodName = invokedMethod.getName();
if (invokedMethod.getContainingClass() != null &&
"Contracts".equals(invokedMethod.getContainingClass().getName()) &&
("ensureNonNull".equals(methodName) ||
"ensureNonNullArgument".equals(methodName) ||
"requireNonNullArgument".equals(methodName))) {
final PsiExpressionList arguments = invoke.getArgumentList();
final PsiExpression[] expressions = arguments.getExpressions();
for (PsiExpression expression : expressions) {
if (expression instanceof PsiReferenceExpressionImpl) {
final PsiElement[] exprChildren = expression.getChildren();
for (PsiElement exprChild : exprChildren) {
if (exprChild instanceof PsiIdentifierImpl) {
final PsiIdentifierImpl psiParam = (PsiIdentifierImpl) exprChild;
paramNameCheckedByContract.remove(psiParam.getText());
}
}
}
}
}
}
}
});
}
List<ProblemDescriptor> result = new ArrayList<>();
for (Map.Entry<String, PsiElement> entry : paramNameCheckedByContract.entrySet()) {
final ProblemDescriptor problem = manager.createProblemDescriptor(
entry.getValue(), "Need to check it by contract", isOnTheFly,
new LocalQuickFix[0], ProblemHighlightType.WARNING);
result.add(problem);
}
return result.toArray(new ProblemDescriptor[0]);
}
}
| [
"charmik1994@gmail.com"
] | charmik1994@gmail.com |
1ae60d9d40ecfab98e5c40b7a37e7101f6e90dd1 | 5a8f0a86d59f529f1950c6458f7ab9f69e3c987e | /.svn/pristine/1f/1ff63c7fceb83756774d8d0840d5bc0540365473.svn-base | 94d08d9b2acb4c13016841a69ad8d6ba36387b05 | [] | no_license | P79N6A/robot | d0fb43a626c70e970ed537ed21164bccc4819bd1 | ebe2930998fce48d0f4041ab077f7c5f014b85ee | refs/heads/master | 2020-05-02T20:32:52.614929 | 2019-03-28T11:54:56 | 2019-03-28T11:54:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,291 | package com.bossbutler.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.bossbutler.common.AppElementManagerInterceptor;
import com.bossbutler.exception.TransitListException;
import com.bossbutler.pojo.ControllerView;
import com.bossbutler.pojo.apk.upgrade.ApkNoticeDto;
import com.bossbutler.pojo.apk.upgrade.ApkNoticeVo;
import com.bossbutler.service.apk.notice.ApkNoticeUpgradeService;
import com.bossbutler.service.system.AccountService;
import com.bossbutler.service.system.InvitationService;
import com.bossbutler.util.IfConstant;
import com.bossbutler.util.WriteToPage;
import com.company.util.BeanUtility;
/**
* <p>
* 不需要参数token的系统功能.
* </p>
*
* @author wq
*
*/
@RestController
@RequestMapping("")
public class LoginController extends BaseController {
private static Logger logger = Logger.getLogger(LoginController.class);
@Autowired AccountService accountService;
@Autowired
private InvitationService invitationService;
@Autowired
private ApkNoticeUpgradeService apkNoticeUpgradeService;
/**
* 用户登录
* @param ControllerView
* data实体为user
* @return
*/
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(HttpServletRequest request, @ModelAttribute ControllerView view) {
try {
String appCodeName = request.getAttribute(AppElementManagerInterceptor.globalAppNameParamKey).toString();
return accountService.queryUserForLogin02(view, logger,appCodeName);
} catch (Exception e) {
logger.error("login参数obj转换json报错:" + e.getMessage(), e);
return WriteToPage.setResponseMessage("{}", IfConstant.UNKNOWN_ERROR, null);
}
}
/**
* 用户登录
* @param ControllerView
* data实体为user
* @return
*/
@RequestMapping(value = "/login02", method = RequestMethod.POST)
public String login02(HttpServletRequest request, @ModelAttribute ControllerView view) {
try {
String appCodeName = request.getAttribute(AppElementManagerInterceptor.globalAppNameParamKey).toString();
return accountService.queryUserForLogin02(view, logger,appCodeName);
} catch (Exception e) {
logger.error("login参数obj转换json报错:" + e.getMessage(), e);
return WriteToPage.setResponseMessage("{}", IfConstant.UNKNOWN_ERROR, null);
}
}
/**
* 用户注册
* @param ControllerView
* data实体为user
* @return
*/
@RequestMapping(value = "/register", method = RequestMethod.POST)
public String register(HttpServletRequest request, @ModelAttribute ControllerView view) {
try {
String appCodeName = request.getAttribute(AppElementManagerInterceptor.globalAppNameParamKey).toString();
String registerUser = accountService.registerUser(view, logger, appCodeName);
//accountService.synTransit(view);
return registerUser;
} catch(TransitListException e){
return WriteToPage.setResponseMessageForError("有等同步名单,请稍后重试!", IfConstant.UNKNOWN_ERROR.getCode());
} catch (Exception e) {
logger.error("login参数obj转换json报错:" + e.getMessage(), e);
return WriteToPage.setResponseMessage("{}", IfConstant.UNKNOWN_ERROR, null);
}
}
/**
* 用户邀请码登录
*
* @param loginView
* @param request
* @return
*/
@RequestMapping(value = "/inviLogin", method = RequestMethod.POST)
@ResponseBody
public String inviLogin(HttpServletRequest request, @ModelAttribute ControllerView view) {
try {
String appCodeName = request.getAttribute(AppElementManagerInterceptor.globalAppNameParamKey).toString();
String inviLogin = accountService.inviLogin(view, logger, appCodeName);
//accountService.synTransit(view);
return inviLogin;
} catch(TransitListException e){
return WriteToPage.setResponseMessageForError("有等同步名单,请稍后重试!", IfConstant.UNKNOWN_ERROR.getCode());
} catch (Exception e) {
logger.error("login参数obj转换json报错:" + e.getMessage(), e);
return WriteToPage.setResponseMessage("{}", IfConstant.UNKNOWN_ERROR, null);
}
}
/**
* 用户邀请码登录下一步
*
* @param loginView
* @param request
* @return
*/
@RequestMapping(value = "/inviLoginNext", method = RequestMethod.POST)
@ResponseBody
public String inviLoginNext(HttpServletRequest request, @ModelAttribute ControllerView view) {
try {
String appCodeName = request.getAttribute(AppElementManagerInterceptor.globalAppNameParamKey).toString();
return accountService.inviLoginNext(view, logger, appCodeName);
} catch (Exception e) {
logger.error("login参数obj转换json报错:" + e.getMessage(), e);
return WriteToPage.setResponseMessage("{}", IfConstant.UNKNOWN_ERROR, null);
}
}
/**
* 用户登录
*
* @param ControllerView
* data实体为user
* @return
*/
@RequestMapping(value = "/check/account/exist", method = RequestMethod.POST)
public String checkAccountExit(@ModelAttribute ControllerView view) {
try {
return accountService.checkAccountExist(view, logger);
} catch (Exception e) {
logger.error("login参数obj转换json报错:" + e.getMessage(), e);
return WriteToPage.setResponseMessage("{}", IfConstant.UNKNOWN_ERROR, null);
}
}
/**
* 访客机登录 返回项目列表
* @param request
* @return
*/
@RequestMapping(value = "/machinelogin", method = RequestMethod.POST)
@ResponseBody
public String getContents(HttpServletRequest request) {
try {
String data = request.getParameter("data");
Map<String, String> parmap = BeanUtility.jsonStrToObject(data, Map.class, false);
String name = parmap.get("name");
String password = parmap.get("password");
String mackAddress = parmap.get("mackAddress");
return accountService.checMechinekUser(name,password,mackAddress);
} catch (Exception e) {
logger.error("login参数obj转换json报错:" + e.getMessage(), e);
return WriteToPage.setResponseMessage("请正确输入项目代码", IfConstant.UNKNOWN_ERROR, null);
}
}
/**
* 手持机登录 返回项目列表
* @param request
* @return
*/
@RequestMapping(value = "/handset/login", method = RequestMethod.POST)
@ResponseBody
public String handsetLogin(HttpServletRequest request,@ModelAttribute ControllerView view) {
try {
String data = request.getParameter("data");
Map<String, String> parmap = BeanUtility.jsonStrToObject(data, Map.class, false);
String name = parmap.get("name");
String password = parmap.get("password");
String mackAddress = parmap.get("mackAddress");
return accountService.checMechinekUser(name,password,mackAddress);
} catch (Exception e) {
logger.error("login参数obj转换json报错:" + e.getMessage(), e);
return WriteToPage.setResponseMessage("请正确输入项目代码", IfConstant.UNKNOWN_ERROR, null);
}
}
/**
* ios升级兼容版本· 1.1.0 后不再使用
* @param view
* @return
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "/version/ios", method = RequestMethod.POST)
@Deprecated
public String checkVersionIOS(@ModelAttribute ControllerView view) {
String url ="itms-apps://itunes.apple.com/app/id1150851306?mt=8";
try {
Map<String, String> parmap = BeanUtility.jsonStrToObject(view.getData(), Map.class, false);
String version = parmap.get("version");
String appCode = parmap.get("appCode");
logger.error("manage Apk: loginController: checkVersionIOS请求参数版本:version=" + version + "|appCode=" + appCode);
if("IBB".equals(appCode)){
String newVersion = "1.1.0";// 升级分界版本
if (StringUtils.isBlank(version) || StringUtils.isBlank(appCode)) {
return WriteToPage.setResponseMessage("{}", IfConstant.PARA_FAIL, null);
}
ApkNoticeVo vo = new ApkNoticeVo();
vo.setAppSystem("02");
vo.setAppVersion(version);
vo.setCode(appCode);
ApkNoticeDto dto = apkNoticeUpgradeService.getHighestNoticeTypeTbApkNotice(vo);
HashMap<String, String> ret = new HashMap<>();
if(dto != null) {
version = version.replace(".", "");
newVersion = dto.getVersionName();
newVersion = newVersion.replace(".", "");
if (Integer.parseInt(version) >= Integer.parseInt(newVersion)) {
return WriteToPage.setResponseMessage("{}", IfConstant.UNKNOWN_ERROR, null);
}
if ("IBB".equals(appCode)) {
url ="https://itunes.apple.com/cn/app/%E7%88%B1%E5%8C%85%E5%8A%9E/id1150851301?mt=8&t=" + System.currentTimeMillis();
}
ret.put("versionName", dto.getVersionName());
ret.put("url", url);
ret.put("describe", dto.getNoticeContent());
}
return WriteToPage.setResponseMessage(BeanUtility.objectToJsonStr(ret, true), IfConstant.SERVER_SUCCESS, "" + System.currentTimeMillis());
} else {// 非IBB
String newVersion = "1.0.8";
if (StringUtils.isBlank(version) || StringUtils.isBlank(appCode)) {
return WriteToPage.setResponseMessage("{}", IfConstant.PARA_FAIL, null);
}
version = version.replace(".", "");
newVersion = newVersion.replace(".", "");
if (Integer.parseInt(version)>=Integer.parseInt(newVersion)) {
return WriteToPage.setResponseMessage("{}", IfConstant.UNKNOWN_ERROR, null);
}
if ("IBB".equals(appCode)) {
url ="itms-apps://itunes.apple.com/app/id1150851301?mt=8";
}
HashMap<String, String> ret = new HashMap<>();
ret.put("versionName", newVersion);
ret.put("url", url);
ret.put("describe", "修改 页面 Bug ");
return WriteToPage.setResponseMessage(BeanUtility.objectToJsonStr(ret, true), IfConstant.SERVER_SUCCESS, "" + System.currentTimeMillis());
}
} catch (Exception e) {
logger.error("检查版本报错:" + e.getMessage(), e);
return WriteToPage.setResponseMessage("{}", IfConstant.UNKNOWN_ERROR, null);
}
}
@RequestMapping(value = "/refresh/account", method = RequestMethod.POST)
public String refreshAccount(HttpServletRequest request, @ModelAttribute ControllerView view) {
try {
String appCodeName = request.getAttribute(AppElementManagerInterceptor.globalAppNameParamKey).toString();
return accountService.refreshAccount02(view, appCodeName);
} catch (Exception e) {
logger.error("刷新用户信息出错:" + e.getMessage(), e);
return WriteToPage.setResponseMessage("{}", IfConstant.UNKNOWN_ERROR, null);
}
}
@RequestMapping(value = "/refresh/account02", method = RequestMethod.POST)
public String refreshAccount02(HttpServletRequest request, @ModelAttribute ControllerView view) {
try {
String appCodeName = request.getAttribute(AppElementManagerInterceptor.globalAppNameParamKey).toString();
return accountService.refreshAccount02(view, appCodeName);
} catch (Exception e) {
logger.error("刷新用户信息出错:" + e.getMessage(), e);
return WriteToPage.setResponseMessage("{}", IfConstant.UNKNOWN_ERROR, null);
}
}
} | [
"714573326@qq.com"
] | 714573326@qq.com | |
f8e079021ba2f44caea8e0176c80d4f46f8d93c4 | ea8fb2ba093fe8ad8d2b73bcabe580df84841ac3 | /Chapter11/DeadlockDemo.java | ea1308474453f72de8740fa10cca51c7ecf71a97 | [] | no_license | adarshvee/Java-9-A-Complete-Reference | 134d8edb86b73f3b201f0d0bbb972642dbe81b54 | 7132288b211d90b2d3effc1f9c21effc51eccf89 | refs/heads/master | 2020-03-18T08:09:59.857277 | 2018-06-05T14:50:09 | 2018-06-05T14:50:09 | 134,494,008 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,668 | java | /*
* This class shows a deadlock condition. Need to exit manually.
Force deadlock using sleep
*/
package Chapter11;
/**
*
* @author Adarsh V
*/
public class DeadlockDemo implements Runnable {
A a = new A();
B b = new B();
DeadlockDemo() {
Thread.currentThread().setName("Main thread");
Thread t = new Thread(this, "Racing thread");
t.start();
a.foo(b); // get a lock on a in main thread
}
public void run() {
b.bar(a); // Get a lock on b in second thread
System.out.println("Race thread");
}
public static void main(String[] args) {
new DeadlockDemo();
}
}
class A {
synchronized void foo (B b) {
String name = Thread.currentThread().getName();
System.out.println(name + "entered A.foo");
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
System.out.println("A interrupted");
}
System.out.println(name + " trying to call B.last()");
b.last();
}
synchronized void last() {
System.out.println("Chapter11.A.last");
}
}
class B {
synchronized void bar (A b) {
String name = Thread.currentThread().getName();
System.out.println(name + "entered B.bar");
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
System.out.println("B interrupted");
}
System.out.println(name + " trying to call A.last()");
b.last();
}
synchronized void last() {
System.out.println("Chapter11.B.last");
}
}
| [
"adarshvijayaraghavan@gmail.com"
] | adarshvijayaraghavan@gmail.com |
21ea5b816cb013eab3b5dae3442ddd0e512ffc5e | 1f3cdd68a7c24460e4b33f59fc6701e2c4599e9b | /app/src/main/java/cn/com/xibeiuniversity/xibeiuniversity/function/wheelview/OnWheelChangedListener.java | 4cf38a2b00dfd15243c19db2688a7b349019b52f | [] | no_license | sun529417168/XiBeiUniversity | 7c3e5336d646c68e3115c2f6ff4bee8e1e904cf2 | 7e8f21a56fed59b5b018eadc975997a0d4ccfb11 | refs/heads/master | 2021-01-19T13:08:44.937372 | 2017-04-21T07:05:36 | 2017-04-21T07:05:36 | 83,405,504 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,263 | java | /*
* Copyright 2011 Yuri Kanivets
*
* 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 cn.com.xibeiuniversity.xibeiuniversity.function.wheelview;
import cn.com.xibeiuniversity.xibeiuniversity.weight.WheelView;
/**
* Wheel changed listener interface.
* <p>The onChanged() method is called whenever current wheel positions is changed:
* <li> New Wheel position is set
* <li> Wheel view is scrolled
*/
public interface OnWheelChangedListener {
/**
* Callback method to be invoked when current item changed
* @param wheel the wheel view whose state has changed
* @param oldValue the old value of current item
* @param newValue the new value of current item
*/
void onChanged(WheelView wheel, int oldValue, int newValue);
}
| [
"529417168@qq.com"
] | 529417168@qq.com |
c32a31cc1f31217b8cad487f7110b47fa6cd9353 | 495f51577bb66289a798f1ee4671cd5cb9d3c3c8 | /Crypto/Proyecto/BancoCrypto 1000/BancoCrypto/src/bancocliente/Hash.java | 47030723cb2762dc9de51cc50a4e510688dacc86 | [] | no_license | charlis397/proyectosMOCSE | 433cce9ccd8a4330f5af486e66918886c8cd1226 | 1011489388288582e285121791c67d16f6057d7d | refs/heads/master | 2021-04-27T13:13:57.306522 | 2018-02-26T02:08:17 | 2018-02-26T02:08:17 | 122,435,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,376 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package bancocliente;
/**
* @author Samu
*/
public class Hash {
private String llave;
private String iv;
public Hash(String punto_key, String punto_iv ) {
llave=Hash.sha256(punto_key,24);
iv=Hash.sha256(punto_iv,16);
}
public String getLlave() {
return llave;
}
public String getIv() {
return iv;
}
public static String getHash(String txt, String hashType, int tam){
try{
java.security.MessageDigest md = java.security.MessageDigest.getInstance(hashType);
byte[] array = md.digest(txt.getBytes());
StringBuffer sb = new StringBuffer();
for (int i = 0; i < array.length; ++i) {
sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1, 3));
}
return sb.toString().substring(0,tam);
} catch (java.security.NoSuchAlgorithmException e) {
System.out.println(e.getMessage());
}
return null;
}
public static String sha256(String txt, int tamano){
return Hash.getHash(txt, "SHA-256", tamano);
}
}
| [
"charlis397@gmail.com"
] | charlis397@gmail.com |
95ae4d40b6628c483c518a1e7561a6e4642c31d9 | 2d0cf3d7da024daa19e33364c137d9efd7df5fe2 | /src/main/java/org/opengis/cite/cdb10/cdbStructure/MovingModelCodesXml.java | 06af9ac6d5155ae84cbb1c71a916c3712004cd73 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | sarasaeedi/ets-cdb10-1 | afada3c8634bf3493a279738be68e76943dd8ed2 | 9df2781abea8497b0b3fc50e29f10449b8fa348d | refs/heads/master | 2020-03-23T07:37:34.775245 | 2018-03-20T06:03:55 | 2018-03-20T06:03:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,745 | java | package org.opengis.cite.cdb10.cdbStructure;
import org.opengis.cite.cdb10.metadataAndVersioning.MetadataXmlFile;
import org.opengis.cite.cdb10.util.XMLUtils;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class MovingModelCodesXml extends MetadataXmlFile {
public MovingModelCodesXml(String path) {
super(path, "Moving_Model_Codes.xml", "Moving_Model_Codes.xsd");
}
public boolean isValidCategoryCode(Integer code) {
NodeList matches = XMLUtils.getNodeList("/Moving_Model_Codes/Kind/Domain/Category[@code = \"" +
code.toString() + "\"]", this.xmlFile.toPath());
return (matches.getLength() > 0);
}
public boolean isValidDomainCode(Integer code) {
NodeList matches = XMLUtils.getNodeList("/Moving_Model_Codes/Kind/Domain[@code = \"" +
code.toString() + "\"]", this.xmlFile.toPath());
return (matches.getLength() > 0);
}
public boolean isValidKindCode(Integer code) {
NodeList matches = XMLUtils.getNodeList("/Moving_Model_Codes/Kind[@code = \"" + code.toString() +
"\"]", this.xmlFile.toPath());
return (matches.getLength() > 0);
}
public boolean isValidCategoryName(String name) {
NodeList matches = XMLUtils.getNodeList("/Moving_Model_Codes/Kind/Domain/Category[@name = \"" +
name + "\"]", this.xmlFile.toPath());
return (matches.getLength() > 0);
}
public boolean isValidDomainName(String name) {
NodeList matches = XMLUtils.getNodeList("/Moving_Model_Codes/Kind/Domain[@name = \"" + name + "\"]",
this.xmlFile.toPath());
return (matches.getLength() > 0);
}
public boolean isValidKindName(String name) {
NodeList matches = XMLUtils.getNodeList("/Moving_Model_Codes/Kind[@name = \"" + name + "\"]",
this.xmlFile.toPath());
return (matches.getLength() > 0);
}
public String categoryNameForCode(Integer code) {
NodeList matches = XMLUtils.getNodeList("/Moving_Model_Codes/Kind/Domain/Category[@code = \"" +
code.toString() + "\"]", this.xmlFile.toPath());
Node currentItem = matches.item(0);
String name = currentItem.getAttributes().getNamedItem("name").getNodeValue();
return name;
}
public String domainNameForCode(Integer code) {
NodeList matches = XMLUtils.getNodeList("/Moving_Model_Codes/Kind/Domain[@code = \"" +
code.toString() + "\"]", this.xmlFile.toPath());
Node currentItem = matches.item(0);
String name = currentItem.getAttributes().getNamedItem("name").getNodeValue();
return name;
}
public String kindNameForCode(Integer code) {
NodeList matches = XMLUtils.getNodeList("/Moving_Model_Codes/Kind[@code = \"" + code.toString() +
"\"]", this.xmlFile.toPath());
Node currentItem = matches.item(0);
String name = currentItem.getAttributes().getNamedItem("name").getNodeValue();
return name;
}
}
| [
"james@jamesbadger.ca"
] | james@jamesbadger.ca |
dac59a87b84142537bef8f62a44e0c2dd5036c83 | 623ffe6e26031068678ab554286d2756476b1d5d | /src/main/java/net/ldcc/playground/config/SwaggerConfig.java | 23df7eb7945b064d8847d4534685ec57831491cb | [] | no_license | dragon20002/playground | 157e92134d624ac00334a83c881866be17595b60 | f37ed2434b1dd0b03cb38b544ecf0e6ccc8ba74f | refs/heads/main | 2023-04-30T12:09:57.688120 | 2021-05-06T14:37:32 | 2021-05-06T14:37:32 | 301,621,976 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 799 | java | package net.ldcc.playground.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("net.ldcc.playground"))
.paths(PathSelectors.ant("/api/**"))
.build();
}
}
| [
"dragon20002@naver.com"
] | dragon20002@naver.com |
289e2464a82aba02dd09358b8fe77b0ff25cb2ae | fb4405e24ffd9fc8405497fa0fa1724bfe7b3211 | /src/Spec.java | c5fb950c25c6b3e0e8a6b4969e31c5c09df86c26 | [] | no_license | MageMasher/AbstractHelloWorld | 3df159f6510cfe0b0523667d266e97c3cce69d0e | 3461570c010d80ff0017a990599faeede8e6091e | refs/heads/master | 2020-07-27T01:46:28.033300 | 2019-09-16T14:56:42 | 2019-09-16T14:56:42 | 208,827,354 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | abstract class Spec {
private String rootFile = "Im the string that represents rootFile";
public String getRootFile() {
return this.rootFile;
}
}
| [
"me@joelane.net"
] | me@joelane.net |
6cfbe340d8aa0390c77ad0a6309da9ee33dfa651 | c61fb44af5a306f9c06bfa98d29ffd6c529c317d | /src/XMSEngine/src/main/java/com/huawei/generator/ast/CatchNode.java | 901795df6df8bc2bfd023b3a45a235f7aa9f6936 | [
"Apache-2.0"
] | permissive | cughmy/hms-toolkit-convertor | 8014f3fffa2eaeb2d8a4c6c33940db126007455f | 3bf3aca95302cc3f0d5d00479c293af9ff7df9ba | refs/heads/master | 2022-11-01T03:10:07.262534 | 2020-06-17T13:41:46 | 2020-06-17T13:41:46 | 272,872,493 | 2 | 1 | null | 2020-06-17T03:50:22 | 2020-06-17T03:50:21 | null | UTF-8 | Java | false | false | 1,636 | java | /*
* Copyright 2020. Huawei Technologies Co., Ltd. All rights reserved.
*
* 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.huawei.generator.ast;
import java.util.List;
/**
* CatchNode class
*
* @since 2019-11-16
*/
public final class CatchNode extends BraceNode {
private String value;
private BlockNode body;
public BlockNode getBody() {
return body;
}
private CatchNode() {
}
public String getValue() {
return value;
}
@Override
public void accept(AstVisitor visitor) {
visitor.visit(this);
}
public static CatchNode create(String value, BlockNode body) {
CatchNode catchNode = new CatchNode();
catchNode.value = value;
catchNode.body = body;
return catchNode;
}
public static CatchNode create(String value, List<StatementNode> body) {
CatchNode catchNode = new CatchNode();
catchNode.value = value;
catchNode.body = BlockNode.create(body);
return catchNode;
}
}
| [
"hmycug@126.com"
] | hmycug@126.com |
d21303fc8da984cde1490c972ea0f0ead0cb133f | 251139fc877e3760d2c7a4093fe7c9bba3ce2ad7 | /UserProvider02/src/main/java/com/offcn/service/UserService.java | b8dd6f9764ee8dc268617bd2f0c6c7cc9db97e4f | [] | no_license | qifentudu/apartenproject | 9ffff933551cdd4a3737e114e694ae6e055dc980 | 0d9adad51079cd3f58cbac0ad3599eb6f2e2fbd1 | refs/heads/master | 2020-09-12T10:54:50.375585 | 2019-11-20T12:07:00 | 2019-11-20T12:07:00 | 222,401,032 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 361 | java | package com.offcn.service;
import com.offcn.po.User;
import java.util.List;
public interface UserService {
//新增
public void add(User user);
//修改
public void update(User user);
//删除
public void delete(Long id);
//查询全部
public List<User> findAll();
//根据ID查询
public User findOne(Long id);
}
| [
"1156410019@qq.com"
] | 1156410019@qq.com |
bae5889a9c766178e1061b90ae8de855b02345e2 | b0737f00db34c74e0d9c413bbef4809f582f8580 | /src/main/java/services/ActorService.java | fba59cdb000b551202d9bf83423db74a17579467 | [] | no_license | Sprouts-Framework/Acme-Barter | 4524dcaea3fa5c7213ada54502606d8d8dd9aa62 | a3c7652cae64892077323132ac4684602d611b9a | refs/heads/master | 2021-01-20T04:53:50.274726 | 2016-06-24T09:13:54 | 2017-04-29T20:49:55 | 89,746,953 | 1 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 2,259 | java | package services;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import repositories.ActorRepository;
import domain.Actor;
import es.us.lsi.dp.domain.UserAccount;
import es.us.lsi.dp.services.AbstractService;
import es.us.lsi.dp.services.SignInService;
import es.us.lsi.dp.services.contracts.ListService;
@Service
@Transactional
public class ActorService extends AbstractService<Actor, ActorRepository> implements ListService<Actor> {
// Managed repository --------------------
@Autowired
private ActorRepository actorRepository;
// Supporting services --------------------
// Constructors --------------------
public ActorService() {
super();
}
// Simple CRUD methods ------------------
// Encuentra un actor dado un id
public Actor findOne(int actorId) {
Actor result;
result = actorRepository.findOne(actorId);
Assert.notNull(result);
return result;
}
// Encuentra todos los actores registrados en el sistema
public Collection<Actor> findAll() {
Collection<Actor> result;
result = actorRepository.findAll();
Assert.notNull(result);
return result;
}
// Other business methods ---------------------
// Encuentra en actor asociado al nombre de usuario que recibe como
// parámetro
public Actor findActorByUserAccount(String userAccount) {
Actor result;
result = actorRepository.findActorByUserAccount(userAccount);
Assert.notNull(result);
return result;
}
// Devuelve un Actor que se encuentre logueado actualmente en el sistema.
public Actor findActorByPrincipal() {
Actor result;
UserAccount userAccount;
userAccount = SignInService.getPrincipal();
Assert.notNull(userAccount);
result = actorRepository.findActorByPrincipal(userAccount.getId());
Assert.notNull(result);
return result;
}
@Override
public Page<Actor> findPage(Pageable page, String searchCriteria) {
return repository.findAll(page);
}
}
| [
"javierbonillad@gmail.com"
] | javierbonillad@gmail.com |
b48d8d51faf131a161d79bc2067ed55b6590f837 | 6272a913fb1dc228ba294967da54a1a4934be22d | /cardmerchantfront-system/src/main/java/com/pay/typay/system/mapper/SysUserRoleMapper.java | a0abf569003a3daa1e52d046ac78c7c1deb67359 | [] | no_license | ikv163/CardMerchantFront | 485b3a80e776a3c9d8e908d918ae461f593dd294 | 02b41eede4edc7f245df9ff39df59ae8ff4f149e | refs/heads/master | 2022-12-04T02:41:13.430299 | 2020-08-22T08:44:10 | 2020-08-22T08:44:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,574 | java | package com.pay.typay.system.mapper;
import com.pay.typay.common.core.domain.Ztree;
import com.pay.typay.system.domain.SysUserRole;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户与角色关联表 数据层
*
* @author js-oswald
*/
public interface SysUserRoleMapper
{
/**
* 通过用户ID删除用户和角色关联
*
* @param userId 用户ID
* @return 结果
*/
int deleteUserRoleByUserId(Long userId);
/**
* 批量删除用户和角色关联
*
* @param ids 需要删除的数据ID
* @return 结果
*/
int deleteUserRole(Long[] ids);
/**
* 通过角色ID查询角色使用数量
*
* @param roleId 角色ID
* @return 结果
*/
int countUserRoleByRoleId(Long roleId);
/**
* 批量新增用户角色信息
*
* @param userRoleList 用户角色列表
* @return 结果
*/
int batchUserRole(List<SysUserRole> userRoleList);
/**
* 删除用户和角色关联信息
*
* @param userRole 用户和角色关联信息
* @return 结果
*/
int deleteUserRoleInfo(SysUserRole userRole);
/**
* 批量取消授权用户角色
*
* @param roleId 角色ID
* @param userIds 需要删除的用户数据ID
* @return 结果
*/
int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
List<Ztree> userRoleTree(SysUserRole sysUserRole);
List<Ztree> userRoleTreeMultiple(SysUserRole sysUserRole);
}
| [
"jslark@it888.com"
] | jslark@it888.com |
0758a5c6007d458fde095d4246b6a180db421e0e | 3884b64b3f227d7a0e335965431c54792d82fe5d | /vertx-lang-js/src/test/java/io/vertx/test/it/discovery/service/HelloServiceVertxEBProxy.java | 26d49b7a479d739c32416bf1ba0c781bbb5bc741 | [
"Apache-2.0"
] | permissive | vietj/vertx-lang-js | a7ab22876ea5cf7e0c0111f47e3fa7e302488efa | 07e359121c1a650bc28774dcddaddde2eca265c2 | refs/heads/master | 2021-01-23T23:56:21.329694 | 2019-06-17T16:46:34 | 2019-06-17T16:46:34 | 21,736,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,716 | java | /*
* Copyright 2014 Red Hat, Inc.
*
* Red Hat licenses this file to you 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 io.vertx.test.it.discovery.service;
import io.vertx.core.eventbus.DeliveryOptions;
import io.vertx.core.Vertx;
import io.vertx.core.Future;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.function.Function;
import io.vertx.serviceproxy.ServiceException;
import io.vertx.serviceproxy.ServiceExceptionMessageCodec;
import io.vertx.serviceproxy.ProxyUtils;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
/*
Generated Proxy code - DO NOT EDIT
@author Roger the Robot
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public class HelloServiceVertxEBProxy implements HelloService {
private Vertx _vertx;
private String _address;
private DeliveryOptions _options;
private boolean closed;
public HelloServiceVertxEBProxy(Vertx vertx, String address) {
this(vertx, address, null);
}
public HelloServiceVertxEBProxy(Vertx vertx, String address, DeliveryOptions options) {
this._vertx = vertx;
this._address = address;
this._options = options;
try{
this._vertx.eventBus().registerDefaultCodec(ServiceException.class, new ServiceExceptionMessageCodec());
} catch (IllegalStateException ex) {}
}
@Override
public void hello(JsonObject name, Handler<AsyncResult<String>> resultHandler){
if (closed) {
resultHandler.handle(Future.failedFuture(new IllegalStateException("Proxy is closed")));
return;
}
JsonObject _json = new JsonObject();
_json.put("name", name);
DeliveryOptions _deliveryOptions = (_options != null) ? new DeliveryOptions(_options) : new DeliveryOptions();
_deliveryOptions.addHeader("action", "hello");
_vertx.eventBus().<String>send(_address, _json, _deliveryOptions, res -> {
if (res.failed()) {
resultHandler.handle(Future.failedFuture(res.cause()));
} else {
resultHandler.handle(Future.succeededFuture(res.result().body()));
}
});
}
}
| [
"julien@julienviet.com"
] | julien@julienviet.com |
424883eea2fbea9dde2ff09ffea11c6e6b797d52 | 61a6bd24d93e4dc9ac11944d56e53843a3780c27 | /src/mapper/TopMenuMapper.java | 42639aae783af48e847cfbf71c3a0b8a930af1d4 | [] | no_license | qkrqudcks7/SpringFramework_springMVC | 86f364ec5baf474debce231fa142024b7e87e629 | 2df74b1f28baeae0846ae2dbd115d3f521fa9f98 | refs/heads/master | 2023-04-26T16:09:20.170511 | 2021-05-25T14:44:58 | 2021-05-25T14:44:58 | 292,471,520 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package mapper;
import java.util.List;
import org.apache.ibatis.annotations.Select;
import beans.BoardInfoBean;
public interface TopMenuMapper {
// 상단 바 같이 모든 화면에 나오는 것은 인터페이스로 작성하면 편하다
@Select("select * from board_info_table order by board_info_idx")
List<BoardInfoBean> getTopMenuList();
}
| [
"pak7380@naver.com"
] | pak7380@naver.com |
cf4bad2068a400b354320f1282a9b76649375750 | 90dc85e44c4ebd26f2c1f4af2f92d79538d40d81 | /gmall-search-service/src/test/java/com/atguigu/gmall/search/GmallSearchServiceApplicationTests.java | 80142e3b4f5a5c7fc0cc46f85421141d641e0c3e | [] | no_license | eurekaribbon/gmall | b562e83fa20448d405f5d149b081eb69c30bea94 | 8573e770079924ac67b545362f0be064f6424a42 | refs/heads/master | 2022-09-29T09:36:28.172130 | 2020-02-19T04:17:48 | 2020-02-19T04:17:48 | 229,066,732 | 0 | 0 | null | 2022-09-01T23:17:47 | 2019-12-19T14:03:48 | CSS | UTF-8 | Java | false | false | 4,369 | java | package com.atguigu.gmall.search;
import com.alibaba.dubbo.config.annotation.Reference;
import com.atguigu.gmall.bean.PmsSerachSkuInfo;
import com.atguigu.gmall.bean.PmsSkuInfo;
import com.atguigu.gmall.service.SkuService;
import io.searchbox.client.JestClient;
import io.searchbox.core.Index;
import io.searchbox.core.Search;
import io.searchbox.core.SearchResult;
import org.apache.commons.beanutils.BeanUtils;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.MatchQueryBuilder;
import org.elasticsearch.index.query.TermQueryBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
@SpringBootTest
@RunWith(SpringRunner.class)
public class GmallSearchServiceApplicationTests {
@Reference
SkuService skuService;
@Autowired
JestClient jestClient;
@Test
public void search() throws IOException {
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
//bool
BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder();
//term
TermQueryBuilder termQueryBuilder = new TermQueryBuilder("skuAttrValueList.attrId", "25");
//filter
boolQueryBuilder.filter(termQueryBuilder);
//match
MatchQueryBuilder matchQueryBuilder = new MatchQueryBuilder("skuName", "华为");
//must
boolQueryBuilder.must(matchQueryBuilder);
//query
searchSourceBuilder.query(boolQueryBuilder);
//from
searchSourceBuilder.from(0);
//size
searchSourceBuilder.size(20);
//highlight
searchSourceBuilder.highlight(null);
String s = searchSourceBuilder.toString();
System.out.println(s);
String json = "{\n" +
" \"query\": {\n" +
" \"bool\": {\n" +
" \"filter\": [\n" +
" {\n" +
" \"term\": {\n" +
" \"skuAttrValueList.attrId\": \"25\"\n" +
" }\n" +
" },\n" +
" {\n" +
" \"term\": {\n" +
" \"skuAttrValueList.valueId\": \"39\"\n" +
" }\n" +
" \n" +
" }\n" +
" ],\n" +
" \"must\": [\n" +
" {\n" +
" \"match\": {\n" +
" \"skuName\": \"华为\"\n" +
" }\n" +
" }\n" +
" ]\n" +
" }\n" +
" }\n" +
"}";
Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex("gmallpms").addType("PmsSkuInfo").build();
SearchResult result = jestClient.execute(search);
List<SearchResult.Hit<PmsSerachSkuInfo, Void>> hits = result.getHits(PmsSerachSkuInfo.class);
for (SearchResult.Hit<PmsSerachSkuInfo, Void> hit : hits) {
PmsSerachSkuInfo pmsSerachSkuInfo = hit.source;
}
}
//同步mysql库与elasticsearch库
@Test
public void contextLoads() throws InvocationTargetException, IllegalAccessException, IOException {
//查询mysql
List<PmsSerachSkuInfo> lists = new java.util.ArrayList<>();
List<PmsSkuInfo> skuInfoList = skuService.getAllSku();
//转化为es数据结构
for (PmsSkuInfo pmsSkuInfo : skuInfoList) {
PmsSerachSkuInfo serachSkuInfo = new PmsSerachSkuInfo();
BeanUtils.copyProperties(serachSkuInfo,pmsSkuInfo);
lists.add(serachSkuInfo);
}
//导入es
for (PmsSerachSkuInfo list : lists) {
Index index = new Index.Builder(list).index("gmallpms").type("PmsSkuInfo").id(list.getId()).build();
jestClient.execute(index);
}
}
}
| [
"799871836@qq.com"
] | 799871836@qq.com |
d088da0bcab5ebedd8a9b523a7d2e3693c5a8240 | dbe638b961de01f75e6144393e477912c0c1f898 | /ProjetApi/src/TourOperator/Gestion/modele/ModeleDeplacementDB.java | 32793a459ed349cd42a88bbe983b163cd0813589 | [] | no_license | romeombende/ProjetApi | 80f83d3cd54253cb2afc71d963b4780cab6ebc67 | bb0a1676c003852dab909ac657299397178ea9c0 | refs/heads/master | 2022-12-01T00:38:59.237054 | 2020-08-15T07:07:27 | 2020-08-15T07:14:35 | 287,696,733 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,817 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package TourOperator.Gestion.modele;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import myconnections.DBConnection;
import TourOperator.Metier.Classement;
import TourOperator.Metier.Deplacement;
import TourOperator.Metier.Voyage;
import TourOperator.Metier.Ville;
import TourOperator.Metier.Pays;
import TourOperator.Metier.db.ClassementDB;
/**
*
* @author Romeo Mbende
*/
public class ModeleDeplacementDB implements DAODeplacement {
protected Connection dbConnect;
/**
* méthode permettant d'injecter la connexion à la DB venue de l'application
* principale
*/
public ModeleDeplacementDB() {
dbConnect = DBConnection.getConnection();
}
/**
* création d'un deplacement sur base des valeurs de son objet métier
*
* @param obj commande à créer
* @return créé
*/
@Override
public Deplacement create(Deplacement obj) {
String req1 = "insert into api_deplacement(dateHeureDebut, dateHeureFin, cout,idvilleDepart,idvilleArrivee) values(?,?,?,?,?)";
String req2 = "select * from api_deplacement where idvilleDepart=? and idvilleArrivee=?";
try ( PreparedStatement pstm1 = dbConnect.prepareStatement(req1); PreparedStatement pstm2 = dbConnect.prepareStatement(req2)) {
pstm1.setDate(1, Date.valueOf(obj.getDateHeureDebut()));
pstm1.setDate(2, Date.valueOf(obj.getDateHeureFin()));
pstm1.setBigDecimal(3, obj.getCout());
pstm1.setInt(4, obj.getDeparts().getIdville());
pstm1.setInt(5, obj.getArrivees().getIdville());
int n = pstm1.executeUpdate();
if (n == 0) {
return null;
}
pstm2.setInt(1, obj.getDeparts().getIdville());
pstm2.setInt(2, obj.getArrivees().getIdville());
ResultSet rs2 = pstm2.executeQuery();
if (rs2.next()) {
int iddeplacement = rs2.getInt(1);
obj.setIddeplacement(iddeplacement);
return obj;
} else {
return null;
}
} catch (Exception e) {
return null;
}
}
/**
* récupération des données d'un deplacement sur base de son identifiant
*
* @param dprech deplacement recherchée
* @return deplacement trouvé
*/
@Override
public Deplacement read(Deplacement dprech) {
int iddeplacement = dprech.getIddeplacement();
String req = "select * from api_deplacement deplacement left join api_ville ville on ville.idville=deplacement.idvilledepart left join api_ville ville on ville.idville=deplacement.idvillearrivee left join api_pays pays on pays.idpays=ville.idpays left join api_classement classement on deplacement.iddeplacement=classement.iddeplacement left join api_voyage voyage on voyage.idvoyage=classement.idvoyage where deplacement.iddeplacement=?";
//String req = "select * from api_deplacement where iddeplacement=?";
try ( PreparedStatement pstm = dbConnect.prepareStatement(req)) {
pstm.setInt(1, iddeplacement);
ResultSet rs = pstm.executeQuery();
if (rs.next()) {
LocalDate dateHeureDebut = rs.getDate("DATEHEUREDEBUT").toLocalDate();
LocalDate dateHeureFin = rs.getDate("DATEHEUREFIN").toLocalDate();
BigDecimal cout = rs.getBigDecimal("COUT");
int idvilledepart =rs.getInt("IDVILLEARRIVEE");
int idvillearrivee =rs.getInt("IDVILLEDEPART");
int idville = rs.getInt("IDVILLE");
String description = rs.getString("DESCRIPTION");
String nomv = rs.getString("NOM");
Double lattitude = rs.getDouble("LATTITUDE");
Double longitude = rs.getDouble("LONGITUDE");
int idpays = rs.getInt("IDPAYS");
String codeP = rs.getString("CODE");
String nomp = rs.getString("NOMP");
String langue = rs.getString("LANGUE");
String monnaie = rs.getString("MONNAIE");
Pays py = new Pays(idpays, codeP, nomp, langue, monnaie);
Ville vl = new Ville(idville, nomv, description, lattitude, longitude,py);
Ville departs=new Ville(idvilledepart,nomv, description, lattitude, longitude,py);
Ville arrivees=new Ville(idvillearrivee,nomv, description, lattitude, longitude,py);
Deplacement dp = new Deplacement(iddeplacement, dateHeureDebut, dateHeureFin, cout , departs, arrivees);
List<Classement> lc = new ArrayList<>();
int idclassement = rs.getInt("IDCLASSEMENT");
if (idclassement != 0) {
int idvoyage = rs.getInt("IDVOYAGE");
int position = rs.getInt("POSITION");
String code = rs.getString("CODE");
String nom = rs.getString("NOM");
LocalDate dateDebut = rs.getDate("DATEDEBUT").toLocalDate();
LocalDate dateFin = rs.getDate("DATEFIN").toLocalDate();
BigDecimal coutTotal = rs.getBigDecimal("COUTTOTAL");
Voyage vy = new Voyage(idvoyage, code, nom, dateDebut, dateFin, coutTotal);
//Voyage vy = new VoyageDB(idvoyage,"","",null,null,new BigDecimal(0));
//TODO instancer un voyage sur base des infos de la jointure à 3 tables et l.setVoyage(voyage);
Classement c = new ClassementDB(idclassement,position , dprech.getIddeplacement(),idvoyage );
lc.add(c);
while (rs.next()) {
idvoyage = rs.getInt("IDVOYAGE");
position = rs.getInt("POSITION");
code = rs.getString("CODE");
nom = rs.getString("NOM");
dateDebut = rs.getDate("DATEDEBUT").toLocalDate();
dateFin = rs.getDate("DATEFIN").toLocalDate();
coutTotal = rs.getBigDecimal("COUTTOTAL");
vy = new Voyage(idvoyage,code,nom,dateDebut, dateFin, coutTotal);
c = new ClassementDB(idclassement,position , dprech.getIddeplacement(),idvoyage );
lc.add(c);
}
}
dp.setClassements(lc);
return dp;
} else {
return null;
}
} catch (Exception e) {
return null;
}
}
/**
* mise à jour des données d'un classement sur base de son identifiant
*
* @return deplacement
* @param obj deplacement à mettre à jour
*/
@Override
public Deplacement update(Deplacement obj) {
String req = "update api_deplacement set cout=? where iddeplacement = ?";
try ( PreparedStatement pstm = dbConnect.prepareStatement(req)) {
pstm.setInt(2, obj.getIddeplacement());
//pstm.setDate(2, Date.valueOf(obj.getDateHeureDebut()));
//pstm.setDate(3, Date.valueOf(obj.getDateHeureFin()));
pstm.setBigDecimal(1, obj.getCout());
//pstm.setInt(4, obj.getDeparts().getIdville());
//pstm.setInt(5, obj.getArrivees().getIdville());
int n = pstm.executeUpdate();
if (n == 0) {
return null;
}
return read(obj);
} catch (Exception e) {
return null;
}
}
public boolean add(Deplacement dp,Classement cl){
String req= "insert into api_classement(position,iddeplacement,idvoyage) values(?,?,?)";
try ( PreparedStatement pstm = dbConnect.prepareStatement(req)) {
Voyage vy = (Voyage)cl.getVoyage();
int idvoyage = vy.getIdvoyage();
pstm.setInt(2, dp.getIddeplacement());
pstm.setInt(3, idvoyage);
pstm.setInt(1, cl.getPosition());
int n = pstm.executeUpdate();
if (n == 0) {
return false;
} else {
return true;
}
} catch (Exception e) {
return false;
}
}
/**
* effacement du classement sur base de son identifiant
*
* @param obj ville à effacer
*/
@Override
public boolean delete(Deplacement obj) {
String req = "delete from api_deplacement where iddeplacement= ?";
try ( PreparedStatement pstm = dbConnect.prepareStatement(req)) {
pstm.setInt(1, obj.getIddeplacement());
int n = pstm.executeUpdate();
if (n == 0) {
return false;
} else {
return true;
}
} catch (Exception e) {
return false;
}
}
@Override
public List<Deplacement> readAll() {
//String req ="select * from api_deplacement";
String req ="select * from api_deplacement deplacement left join api_ville ville on deplacement.idvilledepart=ville.idville left join api_ville ville on deplacement.idvillearrivee=ville.idville left join api_ville ville on deplacement.idvilledepart=ville.idville left join api_pays pays on ville.idpays=pays.idpays left join api_classement classement on classement.iddeplacement=deplacement.iddeplacement";
List<Deplacement> ldp = new ArrayList<>();
try ( PreparedStatement pstm = dbConnect.prepareStatement(req);ResultSet rs = pstm.executeQuery();) {
while (rs.next()) {
int iddeplacement = rs.getInt("IDDEPLACEMENT");
LocalDate dateHeureDebut = rs.getDate("DATEHEUREDEBUT").toLocalDate();
LocalDate dateHeureFin = rs.getDate("DATEHEUREFIN").toLocalDate();
BigDecimal cout = rs.getBigDecimal("COUT");
int idvillearrivee =rs.getInt("IDVILLEARRIVEE");
int idvilledepart =rs.getInt("IDVILLEDEPART");
int idville = rs.getInt("IDVILLE");
String nom = rs.getString("NOM");
String description = rs.getString("DESCRIPTION");
Double lattitude = rs.getDouble("LATTITUDE");
Double longitude = rs.getDouble("LONGITUDE");
//Pays pays = new Pays("","","","");
int idpays = rs.getInt("IDPAYS");
String nomp = rs.getString("NOMP");
String code = rs.getString("CODE");
String langue = rs.getString("LANGUE");
String monnaie = rs.getString("MONNAIE");
Pays pays = new Pays(idpays, code, nomp, langue, monnaie);
Ville departs=new Ville(idvilledepart,nom,description,lattitude,longitude,pays);
Ville arrivees=new Ville(idvillearrivee,nom,description,lattitude,longitude,pays);
//Deplacement dp = new Deplacement(dateHeureDebut, dateHeureFin, cout, departs, arrivees);
//ldp.add(dp);
ldp.add(new Deplacement(iddeplacement,dateHeureDebut, dateHeureFin, cout, departs, arrivees));
}
return ldp;
} catch (Exception e) {
return ldp;
}
}
}
| [
""
] | |
7e131a49a66dfadd8e581ac92c638395ca3c412b | 3745b8362a76dde7da181b7a53f59005dc2909f4 | /Game/Test1/app/src/main/java/com/hoadt/test1/customview/GameLoopThread.java | ffc23d40f4b599ea36f72ae55fe25ff479b870d5 | [] | no_license | MTA-NAM4/PTPMDD | b50cc49cd4c9c881bcf6ae123f853fb83e7f49ba | edf5b3ca70390fd668234964d6ff62cad5d6c3ea | refs/heads/master | 2020-04-14T07:57:59.640349 | 2019-01-06T15:56:13 | 2019-01-06T15:56:13 | 163,726,137 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,485 | java | package com.hoadt.test1.customview;
import android.graphics.Canvas;
/**
* Created by HoaDT on 10/19/2018.
* đảm nhiệm việc điều khiển hiển thị các đối tượng view
*/
public class GameLoopThread extends Thread {
private DrawView drawView;
private boolean running = false;
public GameLoopThread(DrawView view) {
this.drawView = view;
}
public void setRunning(boolean running) {
this.running = running;
}
@Override
public void run() {
super.run();
while (running) {
Canvas canvas = null;
try {
canvas = drawView.getHolder().lockCanvas();
//lockCanvas:
//tránh việc canvas có nhiều luồng can thiệp vào
//synchronized: toàn bộ công việc trong này thực hiện xong thì mới thực hiện cái khác
synchronized (drawView.getHolder()) {
if (canvas != null) {
drawView.draw(canvas);
}
}
} finally {//luôn thực hiện khối này
if (canvas != null) {
//mở khóa canvas
drawView.getHolder().unlockCanvasAndPost(canvas);
}
}
try {
Thread.sleep(30);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
| [
"hoadt.21.it@gmail.com"
] | hoadt.21.it@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.