blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
689M
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
131 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
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
75e1e8ebea05005b2b67b19817447289caf9cf25
c1ef27859aa920c506a13c853596d1f26dbbf94f
/src/main/java/fxml/Affich_domainesController.java
9a4bb5ad0860a72d109140a79566e5ce7f41b6a1
[]
no_license
houssemyahia/SmartStartJAVA
15ca2b5b5a5fe3238cefb628f0a6cafd71f97b3b
b83554271ecb50871dce1086145db8a84f065d5f
refs/heads/master
2023-01-02T19:01:06.675744
2020-01-15T10:40:20
2020-01-15T10:40:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,148
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 fxml; import fxml.*; import com.jfoenix.controls.JFXTextField; import entities.Domaine; import entities.Formation; import entities.Session; import java.io.IOException; import java.net.URL; import java.sql.SQLException; import java.util.List; import java.util.ResourceBundle; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.AnchorPane; import services.DomaineService; /** * FXML Controller class * * @author lenovo */ public class Affich_domainesController implements Initializable { @FXML private AnchorPane pane_domaine; @FXML private TableView<Domaine> tab_domaine; private TableColumn<Domaine, Integer> id_domaine_cln; @FXML private TableColumn<Domaine, String> nom_domaine_cln; @FXML private JFXTextField domaine_txt; @FXML private Button btn_ajouter_domaine; /** * Initializes the controller class. */ DomaineService ds = new DomaineService(); @FXML private AnchorPane majdi; @FXML private Button btn_retour_action; @Override public void initialize(URL url, ResourceBundle rb) { Domaine i = new Domaine(); ObservableList<Domaine> data2 = FXCollections.observableArrayList(); List<Domaine> domaines = ds.affichercategories(); data2= FXCollections.observableArrayList(domaines); nom_domaine_cln.setCellValueFactory(new PropertyValueFactory<Domaine,String>("nom_domaine")); tab_domaine.setItems(data2); } @FXML private void ajouter_domaine_action(ActionEvent event) throws SQLException, IOException { Domaine d = new Domaine(domaine_txt.getText()); ds.creerDomaine(d); Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("Information Dialog"); alert.setHeaderText(null); alert.setContentText("Domaine insérée avec succés!"); alert.show(); Parent root=(AnchorPane) FXMLLoader.load(getClass().getResource("/fxml/affich_domaines.fxml")); majdi.getChildren().clear(); majdi.getChildren().add(root); } @FXML private void retour_domaine_action(ActionEvent event) throws IOException { Parent root=(AnchorPane) FXMLLoader.load(getClass().getResource("/fxml/affich_mes_formation.fxml")); majdi.getChildren().clear(); majdi.getChildren().add(root); } }
edb6947dc454529023b8d89427e0b0329f292178
704889b1f58ce95253098ae757520229777cf93b
/stockmetrics/src/main/java/com/sixrr/stockmetrics/methodCalculators/NumSameClassMethodsThatCallCalculator.java
1a43c3eef291cf25716224bb0546b315e9ac4c55
[]
no_license
moin99/MetricsReloaded-gradle
ca8bf284549175f967d674587433a5e840966bd3
e59a95411191a72ef87e2fbbbc00d9d904c9765d
refs/heads/master
2023-03-19T02:18:25.015776
2018-11-21T16:52:15
2018-11-21T16:52:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
776
java
package com.sixrr.stockmetrics.methodCalculators; import com.intellij.psi.PsiClass; import org.jetbrains.research.groups.ml_methods.utils.PSIUtil; public class NumSameClassMethodsThatCallCalculator extends AbstractNumMethodsThatCallCalculator { public NumSameClassMethodsThatCallCalculator() { super((callingMethod, currentMethod) -> { PsiClass callingMethodClass = callingMethod.getContainingClass(); PsiClass currentMethodClass = currentMethod.getContainingClass(); return currentMethodClass != null && callingMethodClass != null && (currentMethodClass.equals(callingMethodClass) || PSIUtil.getAllSupers(currentMethodClass).contains(callingMethodClass)); }); } }
e29c65b18a510d135c802c1bc2ae8be90a441344
5a37925f6cb04539766be5cd3104f11ea177b908
/ovirt-engine-4.0.2.6/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java
0bb45624d7761047ea248b431c425329ce823c9a
[ "Apache-2.0" ]
permissive
zhuangquanquan/ovirt
4dc90af2993c1c74b01cda1e8a8e842938a29562
bf83ddfcf0773e3ea632a74b6de221d7805c33fb
refs/heads/master
2020-04-06T06:26:29.881231
2016-09-19T12:43:10
2016-09-19T12:43:10
68,600,404
1
0
null
null
null
null
UTF-8
Java
false
false
13,781
java
package org.ovirt.engine.ui.uicompat; import com.google.gwt.i18n.client.Messages; import java.util.List; import org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepNonEligibilityReason; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotScheduleRecurrence; import org.ovirt.engine.core.common.utils.SizeConverter; public interface UIMessages extends Messages { String customPropertyOneOfTheParamsIsntSupported(String parameters); String customPropertiesValuesShouldBeInFormatReason(String format); String keyValueFormat(); String emptyOrValidKeyValueFormatMessage(String format); String customPropertyValueShouldBeInFormatReason(String parameter, String format); String createOperationFailedDcGuideMsg(String storageName); String nameCanContainOnlyMsg(int maxNameLength); String detachNote(String localStoragesFormattedString); String youAreAboutToDisconnectHostInterfaceMsg(String nicName); String connectingToGuestWithNotResponsiveAgentMsg(); String hostNameMsg(int hostNameMaxLength); String naturalNumber(); String realNumber(); String thisFieldMustContainTypeNumberInvalidReason(String type); String numberValidationNumberBetweenInvalidReason(String prefixMsg, String min, String max); String numberValidationNumberGreaterInvalidReason(String prefixMsg, String min); String numberValidationNumberLessInvalidReason(String prefixMsg, String max); String integerValidationNumberBetweenInvalidReason(String prefixMsg, int min, int max); String integerValidationNumberGreaterInvalidReason(String prefixMsg, int min); String integerValidationNumberLessInvalidReason(String prefixMsg, int max); String lenValidationFieldMusnotExceed(int maxLength); String vmStorageDomainIsNotAccessible(); String noActiveStorageDomain(); String alreadyAssignedClonedVmName(); String suffixCauseToClonedVmNameCollision(String vmName); String alreadyAssignedClonedTemplateName(); String suffixCauseToClonedTemplateNameCollision(String templateName); String createFailedDomainAlreadyExistStorageMsg(String storageName); String importFailedDomainAlreadyExistStorageMsg(String storageName); String memSizeBetween(int minMemSize, int maxMemSize); String maxMemSizeIs(int maxMemSize); String minMemSizeIs(int minMemSize); String memSizeMultipleOf(String architectureName, int multiplier); String nameMustConataionOnlyAlphanumericChars(int maxLen); String newNameWithSuffixCannotContainBlankOrSpecialChars(int maxLen); String importProcessHasBegunForVms(String importedVms); String storageDomainIsNotActive(String storageName); String importProcessHasBegunForTemplates(String importedTemplates); String templatesAlreadyExistonTargetExportDomain(String existingTemplates); String vmsAlreadyExistOnTargetExportDomain(String existingVMs); String templatesWithDependentVMs(String template, String vms); String sharedDisksWillNotBePartOfTheExport(String diskList); String directLUNDisksWillNotBePartOfTheExport(String diskList); String snapshotDisksWillNotBePartOfTheExport(String diskList); String noExportableDisksFoundForTheExport(); String sharedDisksWillNotBePartOfTheSnapshot(String diskList); String directLUNDisksWillNotBePartOfTheSnapshot(String diskList); String snapshotDisksWillNotBePartOfTheSnapshot(String diskList); String noExportableDisksFoundForTheSnapshot(); String sharedDisksWillNotBePartOfTheTemplate(String diskList); String directLUNDisksWillNotBePartOfTheTemplate(String diskList); String snapshotDisksWillNotBePartOfTheTemplate(String diskList); String noExportableDisksFoundForTheTemplate(); String diskAlignment(String alignment, String lastScanDate); String errConnectingVmUsingSpiceMsg(Object errCode); String errConnectingVmUsingRdpMsg(Object errCode); String areYouSureYouWantToDeleteSanpshot(String from, Object description); String editBondInterfaceTitle(String name); String editHostNicVfsConfigTitle(String name); String editManagementNetworkTitle(String networkName); String editNetworkTitle(String name); String setupHostNetworksTitle(String hostName); String noOfBricksSelected(int brickCount); String vncInfoMessage(String hostIp, int port, String password, int seconds); String lunAlreadyPartOfStorageDomainWarning(String storageDomainName); String lunUsedByDiskWarning(String diskAlias); String lunUsedByVG(String vgID); String usedLunIdReason(String id, String reason); String removeBricksReplicateVolumeMessage(int oldReplicaCount, int newReplicaCount); String breakBond(String bondName); String detachNetwork(String networkName); String removeNetwork(String networkName); String attachTo(String name); String bondWith(String name); String addToBond(String name); String extendBond(String name); String removeFromBond(String name); String label(String label); String unlabel(String label); String suggestDetachNetwork(String networkName); String labelInUse(String label, String ifaceName); String incorrectVCPUNumber(); String poolNameLengthInvalid(int maxLength, int vmsInPool); String poolNameWithQuestionMarksLengthInvalid(int maxLength, int vmsInPool, int numberOfQuestionMarks); String numOfVmsInPoolInvalid(int maxNumOfVms, int poolNameLength); String numOfVmsInPoolInvalidWithQuestionMarks(int maxNumOfVms, int poolNameLength, int numberOfQuestionMarks); String refreshInterval(int intervalSec); String importClusterHostNameEmpty(String address); String importClusterHostPasswordEmpty(String address); String importClusterHostFingerprintEmpty(String address); String unreachableGlusterHosts(List<String> hosts); String networkDcDescription(String networkName, String dcName, String description); String networkDc(String networkName, String dcName); String vnicFromVm(String vnic, String vm); String vnicProfileFromNetwork(String vnicProfile, String network); String vnicFromTemplate(String vnic, String template); String bridlessNetworkNotSupported(String version); String mtuOverrideNotSupported(String version); String numberOfVmsForHostsLoad(int numberOfVms); String cpuInfoLabel(int numberOfCpus, int numberOfSockets, int numberOfCpusPerSocket, int numberOfThreadsPerCore); String templateDiskDescription(String diskAlias, String storageDomainName); String interfaceIsRequiredToBootFromNetwork(); String bootableDiskIsRequiredToBootFromDisk(); String disklessVmCannotRunAsStateless(); String urlSchemeMustBeEmpty(String passedScheme); String urlSchemeMustNotBeEmpty(String allowedSchemes); String urlSchemeInvalidScheme(String passedScheme, String allowedSchemes); String providerUrlWarningText(String providedEntities); String nicHotPlugNotSupported(String clusterVersion); String customSpmPriority(int priority); String brickDetailsNotSupportedInClusterCompatibilityVersion(String version); String hostNumberOfRunningVms(String hostName, int runningVms); String commonMessageWithBrackets(String subject, String inBrackets); String removeNetworkQoSMessage(int numOfProfiles); String removeStorageQoSMessage(int numOfProfiles); String removeStorageQoSItem(String qosName, String diskProfileNames); String removeCpuQoSMessage(int numOfProfiles); String removeHostNetworkQosMessage(int numOfNetworks); String cpuInfoMessage(int numOfCpus, int sockets, int coresPerSocket, int threadsPerSocket); String numaTopologyTitle(String hostName); String rebalanceStatusFailed(String name); String volumeProfileStatisticsFailed(String volName); String removeBrickStatusFailed(String name); String confirmStopVolumeRebalance(String name); String cannotMoveDisks(String disks); String cannotCopyDisks(String disks); String moveDisksPreallocatedWarning(String disks); String moveDisksWhileVmRunning(String disks); String errorConnectingToConsole(String name, String s); String errorConnectingToConsoleNoProtocol(String name); String cannotConnectToTheConsole(String vmName); String schedulerOptimizationInfo(int numOfRequests); String schedulerAllowOverbookingInfo(int numOfRequests); String vmTemplateWithCloneProvisioning(String templateName); String vmTemplateWithThinProvisioning(String templateName); String youAreAboutChangeDcCompatibilityVersionWithUpgradeMsg(String version); String haActive(int score); String volumeProfilingStatsTitle(String volumeName); String networkLabelConflict(String nicName, String labelName); String labeledNetworkNotAttached(String nicName, String labelName); String bootMenuNotSupported(String clusterVersion); String diskSnapshotLabel(String diskAlias, String snapshotDescription); String optionNotSupportedClusterVersionTooOld(String clusterVersion); String optionRequiresSpiceEnabled(); String rngSourceNotSupportedByCluster(String source); String glusterVolumeCurrentProfileRunTime(int currentRunTime, String currentRunTimeUnit, int totalRunTime, String totalRunTimeUnit); String bytesReadInCurrentProfileInterval(String currentBytesRead, String currentBytesReadUnit, String totalBytes, String totalBytesUnit); String bytesWrittenInCurrentProfileInterval(String currentBytesWritten, String currentBytesWrittenUnit, String totalBytes, String totalBytesUnit); String defaultMtu(int mtu); String threadsAsCoresPerSocket(int cores, int threads); String approveCertificateTrust(String subject, String issuer, String sha1Fingerprint); String approveRootCertificateTrust(String subject, String sha1Fingerprint); String geoRepForceTitle(String action); String geoRepActionConfirmationMessage(String action); String iconDimensionsTooLarge(int width, int height, int maxWidht, int maxHeight); String iconFileTooLarge(int maxSize); String invalidIconFormat(String s); String clusterSnapshotOptionValueEmpty(String option); String volumeSnapshotOptionValueEmpty(String option); String vmDialogDisk(String name, String sizeInGb, String type, String boot); String confirmRestoreSnapshot(String volumeName); String confirmRemoveSnapshot(String volumeName); String confirmRemoveAllSnapshots(String volumeName); String confirmActivateSnapshot(String volumeName); String confirmDeactivateSnapshot(String volumeName); String confirmVolumeSnapshotDeleteMessage(String snapshotNames); @Messages.AlternateMessage(value = { "UNKNOWN" , "None" , "INTERVAL" , "Minute" , "HOURLY" , "Hourly" , "DAILY" , "Daily" , "WEEKLY" , "Weekly" , "MONTHLY" , "Monthly" }) String recurrenceType(@Messages.Select GlusterVolumeSnapshotScheduleRecurrence recurrence); @Messages.AlternateMessage(value = { "BYTES" , "{0} B" , "KiB" , "{0} KiB" , "MiB" , "{0} MiB" , "GiB" , "{0} GiB" , "TiB" , "{0} TiB" }) String sizeUnitString(String size, @Messages.Select SizeConverter.SizeUnit sizeUnit); String userSessionRow(long sessionId, String UserName); @Messages.AlternateMessage(value = { "SLAVE_AND_MASTER_VOLUMES_SHOULD_NOT_BE_IN_SAME_CLUSTER" , "Destination and master volumes should not be from same cluster." , "SLAVE_VOLUME_SIZE_SHOULD_BE_GREATER_THAN_MASTER_VOLUME_SIZE" , "Capacity of destination volume should be greater than or equal to that of master volume." , "SLAVE_CLUSTER_AND_MASTER_CLUSTER_COMPATIBILITY_VERSIONS_DO_NOT_MATCH" , "Cluster Compatibility version of destination and master volumes should be same." , "SLAVE_VOLUME_SHOULD_NOT_BE_SLAVE_OF_ANOTHER_GEO_REP_SESSION" , "Destination volume is already a part of another geo replication session." , "SLAVE_VOLUME_SHOULD_BE_UP" , "Destination volume should be up." , "SLAVE_VOLUME_SIZE_TO_BE_AVAILABLE" , "Capacity information of the destination volume is not available." , "MASTER_VOLUME_SIZE_TO_BE_AVAILABLE" , "Capacity information of the master volume is not available." , "SLAVE_VOLUME_TO_BE_EMPTY" , "Destination volume should be empty." , "NO_UP_SLAVE_SERVER" , "No up server in the destination volume" }) String geoRepEligibilityViolations(@Messages.Select GlusterGeoRepNonEligibilityReason reason); String testSuccessfulWithPowerStatus(String powerStatus); String testFailedWithErrorMsg(String errorMessage); String uiCommonRunActionPartitialyFailed(String reason); String vnicTypeDoesntMatchPassthroughProfile(String type); String vnicTypeDoesntMatchNonPassthroughProfile(String type); String guestOSVersionOptional(String optional); String guestOSVersionLinux(String distribution, String version, String codeName); String guestOSVersionWindows(String version, String build); String guestOSVersionWindowsServer(String version, String build); String positiveTimezoneOffset(String name, String hours, String minutes); String negativeTimezoneOffset(String name, String hours, String minutes); String bracketsWithGB(int value); String confirmDeleteFenceAgent(String agentDisplayString); String confirmDeleteAgentGroup(String agents); String failedToLoadOva(String ovaPath); String errataForHost(String hostName); String errataForVm(String vmName); String uploadImageFailedToStartMessage(String reason); String uploadImageFailedToResumeMessage(String reason); String uploadImageFailedToResumeSizeMessage(long priorFileBytes, long newFileBytes); String providerFailure(); }
03bd1bfb460acd94754a1b533eae39afdaa04705
0f1a73dc0329cead4fa60981c1c1eb141d758a5d
/kfs-parent/module/endow/src/main/java/org/kuali/kfs/module/endow/document/web/struts/CashDecreaseDocumentAction.java
5c01e41450fb67c2a26957382b9a7504c5690d8e
[]
no_license
r351574nc3/kfs-maven
20d9f1a65c6796e623c4845f6d68834c30732503
5f213604df361a874cdbba0de057d4cd5ea1da11
refs/heads/master
2016-09-06T15:07:01.034167
2012-06-01T07:40:46
2012-06-01T07:40:46
3,441,165
0
0
null
null
null
null
UTF-8
Java
false
false
773
java
/* * Copyright 2011 The Kuali Foundation. * * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php * * 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.kuali.kfs.module.endow.document.web.struts; public class CashDecreaseDocumentAction extends CashDocumentActionBase { }
eb088b316b999b956ee6cbb3c8b568de746b231c
fd41561571750bd5f6067193a9939e3eff776b2f
/algorithms/src/main/java/kovteba/search/jumpsearch/JumpSearch.java
ac2648dac66553489156a10b58903e4e519766b9
[]
no_license
kovteba/study
03caad7986330b5f40fe186d4e510c72d132778c
0329bb08588ff43c1b75aee4c033a4193e45440b
refs/heads/master
2023-07-25T22:39:37.080186
2021-09-07T13:55:24
2021-09-07T13:55:24
371,304,276
0
0
null
null
null
null
UTF-8
Java
false
false
802
java
package kovteba.search.jumpsearch; import java.util.Arrays; public class JumpSearch { public static int jumpSearch(int key, int[] arr) { int jumpSize = (int)Math.floor(Math.sqrt(arr.length)); int step = jumpSize; while (arr[Math.min(step, arr.length) - 1] < key && step < arr.length) { step = step + jumpSize; } for (int i = (step - jumpSize); i < arr.length; i++) { if (arr[i] == key) { return i; } } return -1; } public static void main(String[] args) { var arr = new int[]{1, 2, 3, 4, 12, 0, 100, 543, 65, 9, 23, 34, 9, 1, 4, 5, 6, 90}; Arrays.sort(arr); int index = jumpSearch(2, arr); System.out.println("INDEX : " + index); } }
c1ad3d47eeab01ddd2b6deda7613b1cc36cee57a
80848fad9a06f3973c5aa3886162a0960924a493
/util-ytest/src/main/java/com/yexuejc/util/example/small/tostring/MainTostring.java
36da30a4747909c53cc777fd0ba0b71cd815acb3
[]
no_license
yexuejc/utils
bc32cc8d18431ad5d72f37a79e85d35d216ccb2e
3b4d84acd3ae0636d40da1f0241da1db634ceba2
refs/heads/master
2023-05-01T19:24:58.664223
2023-04-15T02:34:29
2023-04-15T02:34:29
115,595,559
3
0
null
2017-12-28T07:03:23
2017-12-28T07:03:23
null
UTF-8
Java
false
false
587
java
package com.yexuejc.util.example.small.tostring; public class MainTostring { public static void main(String[] args) { Tostring tostring = new Tostring(); tostring.setA("41564565"); tostring.setB("asdasdasd"); System.out.println(tostring.toString()); String sss = "【e分钱】亲爱的唐龙同学您的认证信息审核通过,您可以获得参与百分百中奖的万元红包抢抢抢!详见APP首页活动规则time2018-02-12 15:26:52"; System.out.println(sss.substring(0,sss.indexOf("time"))); System.out.println(sss.substring(sss.indexOf("time")+4)); } }
e3f0a2f0c722e794084f7e360d8ed05ac2dfe8a8
fc7c7e696dec1352a8dfb4308d631eccb6d284c6
/EMSP/src/main/java/com/ems/controllers/EmployeeController.java
6bb26ce2c2640f7ba9e65855a001a154dd992f1e
[]
no_license
pptaj/EmployementMangementSystem_CloudDeployed
ca216295477a311f81e094180f574c3554e32955
c855d8a947551f6ad73a4a80921098141aa8c8f9
refs/heads/master
2021-01-19T19:45:51.875669
2017-04-16T20:58:43
2017-04-16T20:58:43
88,441,968
0
0
null
null
null
null
UTF-8
Java
false
false
7,639
java
/** * */ package com.ems.controllers; import com.ems.doa.*; import com.ems.pojo.*; import org.json.JSONObject; import org.springframework.stereotype.Controller; 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.servlet.ModelAndView; import org.springframework.web.servlet.View; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /**s * @author Christopher Dsouza * */ @Controller public class EmployeeController { @RequestMapping(value="/updateEmployeeDetails.htm", method=RequestMethod.POST) protected void updateEmployeeDetails(HttpServletRequest request, HttpServletResponse response, @ModelAttribute("person") Person person) throws Exception { ModelAndView mv = new ModelAndView(); PersonDAO personDAO = new PersonDAO(); int empID = Integer.parseInt((String)request.getParameter("empID")); String fname = (String)request.getParameter("fname"); String lname = (String)request.getParameter("lname"); String pwd = (String)request.getParameter("password"); long phn = Long.parseLong((String)request.getParameter("phn")); String street = (String)request.getParameter("street"); String city = (String)request.getParameter("city"); String state = (String)request.getParameter("state"); int zip = Integer.parseInt((String)request.getParameter("zip")); int result = personDAO.updateUser(empID, fname, lname, pwd, phn, street, city, state, zip); if(result>0){ person = personDAO.getUser(empID); JSONObject personJson = new JSONObject(); personJson.put("person",person); PrintWriter out = response.getWriter(); out.println(personJson); mv.addObject("message", "Update Successful"); } else mv.addObject("message", "Update Failed. Try again"); } @RequestMapping(value="/leaves.htm", method=RequestMethod.POST) protected ModelAndView leavesRequested(@ModelAttribute(value="leaves") Leaves leaves, HttpServletRequest request, @ModelAttribute(value="tasks") Tasks tasks){ ModelAndView mv = new ModelAndView(); HttpSession session =request.getSession(); EmployeeDAO employeeDAO = new EmployeeDAO(); LeavesDAO leavesDAO = new LeavesDAO(); Person person = (Person)session.getAttribute("person"); int employeeID = person.getEmpID(); Employee emp = employeeDAO.getEmployee(employeeID); leaves = leavesDAO.addLeaves(leaves.getLeaveStartDate(), leaves.getLeaveEndDate(), emp); if(leaves!=null){ mv.addObject("message", "Task Created successfully"); }else{ mv.addObject("message", "Task Creation failed"); } mv = this.navigateToPage(request); return mv; } @RequestMapping(value="/tasks.htm", method=RequestMethod.POST) protected ModelAndView tasksCreated(@ModelAttribute(value="tasks") Tasks tasks, HttpServletRequest request, @ModelAttribute(value="leaves") Leaves leaves){ ModelAndView mv = new ModelAndView(); HttpSession session =request.getSession(); EmployeeDAO employeeDAO = new EmployeeDAO(); TasksDAO tasksDAO = new TasksDAO(); Person person = (Person)session.getAttribute("person"); int employeeID = person.getEmpID(); Employee emp = employeeDAO.getEmployee(employeeID); tasks = tasksDAO.createTasks(tasks.getTaskName(), tasks.getCurrentStatus(), tasks.getEmployeeComments(), "", emp); if(tasks!=null){ mv.addObject("message", "Task Created successfully"); }else{ mv.addObject("message", "Task Creation failed"); } mv = this.navigateToPage(request); return mv; } @RequestMapping(value="/updateEmployeeTask.htm", method=RequestMethod.POST) protected ModelAndView taskUpdate(@ModelAttribute(value="tasks") Tasks tasks, HttpServletRequest request){ ModelAndView mv = new ModelAndView(); TasksDAO tasksDAO = new TasksDAO(); int updateTask = 0; int taskID = Integer.parseInt((String)request.getParameter("taskID")); String employeeComment = (String)request.getParameter("employeeComment"); String currentStatus = (String)request.getParameter("taskStatus"); updateTask = tasksDAO.updateEmployeeTasks(taskID, currentStatus, employeeComment); if(updateTask>0) { mv.addObject("message", "Task Created successfully"); }else{ mv.addObject("message", "Task Creation failed"); } mv = this.navigateToPage(request); // HttpSession session =request.getSession(); // Person person = (Person)session.getAttribute("person"); // EmployeeDAO employeeDAO = new EmployeeDAO(); // List leaveList = new ArrayList(); // List taskList = new ArrayList(); // Employee employee = employeeDAO.getEmployee(person.getEmpID()); // if(employee!=null){ // int showValue=0; // Iterator leaveIterator = employee.getLeav().iterator(); // // while(leaveIterator.hasNext()){ // Leaves lea = (Leaves)leaveIterator.next(); // leaveList.add(lea); // } // // Iterator taskIterator = employee.getTasks().iterator(); // // while(taskIterator.hasNext()){ // Tasks tas = (Tasks)taskIterator.next(); // taskList.add(tas); // } // // FeedbackDAO feedbackDAO = new FeedbackDAO(); // PerformanceFeedback perfFeedback = feedbackDAO.checkperfGiven(person.getEmpID()); // if(perfFeedback!=null){ // showValue=2; // } // mv.addObject("leaveList", leaveList); // mv.addObject("taskList", taskList); // mv.addObject("showValue", showValue); // mv.setViewName("employeeHome"); // }else{ // session.invalidate(); // mv.setViewName("index"); // mv.addObject("message", "Issue with the data in backend. Please contact Admin"); // } // // mv.setViewName("employeeHome"); return mv; } @RequestMapping(value = "/feedback.htm", method = RequestMethod.POST) protected ModelAndView feedbackforemployee(HttpServletRequest request) throws Exception { HttpSession session = request.getSession(); EmployeeDAO employeeDAO = new EmployeeDAO(); Person person = (Person) session.getAttribute("person"); int empID = person.getEmpID(); return new ModelAndView("redirect:" + "https://s3.amazonaws.com/test-cloud-computing-new-new-new/" + empID + ".pdf"); } public ModelAndView navigateToPage(HttpServletRequest request){ ModelAndView mv = new ModelAndView(); HttpSession session =request.getSession(); Person person = (Person)session.getAttribute("person"); EmployeeDAO employeeDAO = new EmployeeDAO(); List leaveList = new ArrayList(); List taskList = new ArrayList(); Employee employee = employeeDAO.getEmployee(person.getEmpID()); if(employee!=null){ int showValue=0; Iterator leaveIterator = employee.getLeav().iterator(); while(leaveIterator.hasNext()){ Leaves lea = (Leaves)leaveIterator.next(); leaveList.add(lea); } Iterator taskIterator = employee.getTasks().iterator(); while(taskIterator.hasNext()){ Tasks tas = (Tasks)taskIterator.next(); taskList.add(tas); } FeedbackDAO feedbackDAO = new FeedbackDAO(); PerformanceFeedback perfFeedback = feedbackDAO.checkperfGiven(person.getEmpID()); if(perfFeedback!=null){ showValue=2; } mv.addObject("leaveList", leaveList); mv.addObject("taskList", taskList); mv.addObject("showValue", showValue); mv.setViewName("employeeHome"); }else{ session.invalidate(); mv.setViewName("/index.jsp"); mv.addObject("message", "Issue with the data in backend. Please contact Admin"); } mv.setViewName("employeeHome"); return mv; } }
709ab8342f5a68905f20f50495f1e181a621b39b
5a59fd99f2c397b268ab515a050778066a6bfcd5
/src/main/java/com/lzheng/coolpan/Service/FileService.java
6f9f0231a14a083036cc4b9adf0cab26d307b9a9
[ "MIT" ]
permissive
6yi/coolPan
7126075a950723e162d25be7656d6747117b0534
41c486f193c2a1535d87043f969668b8f506e934
refs/heads/master
2023-03-18T00:07:08.933357
2021-03-06T16:23:58
2021-03-06T16:23:58
227,990,476
1
0
null
2019-12-20T03:06:51
2019-12-14T08:29:24
Java
UTF-8
Java
false
false
1,537
java
package com.lzheng.coolpan.Service; import com.lzheng.coolpan.dao.FilesDao; import com.lzheng.coolpan.domain.Account; import com.lzheng.coolpan.domain.Files; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.io.File; import java.util.List; /** * @ClassName FileService * @Author 刘正 * @Date 2019/12/14 16:22 * @Version 1.0 * @Description: */ @Component public class FileService { @Autowired private FilesDao dao; @Value("${file.SavePath}") private String SavePath; public List<Files> findFilesById(Integer id){ return dao.findByAccountId(id); } public List<Files> findFilesByType(Integer id,Integer type){ return dao.findByType(id,type); } public void insert(Files files){ dao.insertSelective(files); } public void delete(Integer id,String filepath){ dao.deleteByPrimaryKey(id); File file=new File(SavePath+filepath); if(file.exists()&&file.isFile()) file.delete(); } public List<Files> findPublicFilesByType(int type){ return dao.findPublicFilesByType(type); } public List<Files> findPublicFiles(){ return dao.findPublicFiles(); } public List<Files> findPublicFilesById(Integer id){ return dao.findPublicFilesById(id); } public void UpadateIspublicById(Integer id,int state){ dao.UpadateIspublicById(id,state); } }
007252233f6d9a40f56311a0f71e99fc740dd7f1
283afef1a8dfab5385ebe846d9c845aac19c108a
/src/main/java/com/example/algamoney/api/model/Endereco.java
78bfd3476881d48eba70dd0577824a2778553926
[]
no_license
joaoPBessa/algamoney-api
18c08b34c2f532bc19882ac7bc8dd6b8260f9157
411ee95f89a18cec4969efc3426bac386caead45
refs/heads/main
2023-07-26T11:01:44.190005
2021-09-07T16:04:53
2021-09-07T16:04:53
389,465,311
0
0
null
null
null
null
UTF-8
Java
false
false
1,145
java
package com.example.algamoney.api.model; import javax.persistence.Embeddable; @Embeddable public class Endereco { private String logradouro; private String numero; private String complemento; private String bairro; private String cep; private String cidade; private String estado; public String getLogradouro() { return logradouro; } public void setLogradouro(String logradouro) { this.logradouro = logradouro; } public String getNumero() { return numero; } public void setNumero(String numero) { this.numero = numero; } public String getComplemento() { return complemento; } public void setComplemento(String complemento) { this.complemento = complemento; } public String getBairro() { return bairro; } public void setBairro(String bairro) { this.bairro = bairro; } public String getCep() { return cep; } public void setCep(String cep) { this.cep = cep; } public String getCidade() { return cidade; } public void setCidade(String cidade) { this.cidade = cidade; } public String getEstado() { return estado; } public void setEstado(String estado) { this.estado = estado; } }
49af845ee1e242e4cb7422f12de84d2152928862
2923567c94d6672be689d17575d2f517abd4a9e5
/08_Service/Ch12LocalBoundService/app/src/main/java/kr/ac/koreatech/swkang/ch12localboundservice/MainActivity.java
de98b770e155ea8d752b0de6e3b9ecc20878a6c5
[]
no_license
bbinbbin/MobileProgramming_2017-2
a726786c214bf9ca5a300f0582e933395e9a96f6
9e4900c5219461f63df91a0ac2e64e49c5461373
refs/heads/master
2020-04-24T06:44:47.143719
2019-02-28T04:23:23
2019-02-28T04:23:23
171,775,615
0
0
null
2019-02-21T01:12:12
2019-02-21T01:12:12
null
UTF-8
Java
false
false
2,925
java
package kr.ac.koreatech.swkang.ch12localboundservice; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Toast; public class MainActivity extends AppCompatActivity { LocalService mService; boolean mBound = false; // ServiceConnection 인터페이스를 구현한 ServiceConnection 객체 생성 // onServiceConnected() 콜백 메소드와 onServiceDisconnected() 콜백 메소드를 구현해야 함 private ServiceConnection mConnection = new ServiceConnection() { // Service에 연결(bound)되었을 때 호출되는 callback 메소드 // Service의 onBind() 메소드에서 반환한 IBinder 객체를 받음 (두번째 인자) @Override public void onServiceConnected(ComponentName name, IBinder service) { Log.d("MainActivity", "onServiceConnected()"); // 두번째 인자로 넘어온 IBinder 객체를 LocalService 클래스에 정의된 LocalBinder 클래스 객체로 캐스팅 LocalService.LocalBinder binder = (LocalService.LocalBinder)service; // LocalService 객체를 참조하기 위해 LocalBinder 객체의 getService() 메소드 호출 mService = binder.getService(); mBound = true; } // Service 연결 해제되었을 때 호출되는 callback 메소드 @Override public void onServiceDisconnected(ComponentName name) { Log.d("MainActivity", "onServiceDisconnected()"); mBound = false; } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override protected void onStart() { super.onStart(); // 연결할 Service를 위한 Intent 객체 생성 Intent intent = new Intent(this, LocalService.class); // Service에 연결하기 위해 bindService 호출, 생성한 intent 객체와 구현한 ServiceConnection의 객체를 전달 // boolean bindService(Intent service, ServiceConnection conn, int flags) bindService(intent, mConnection, Context.BIND_AUTO_CREATE); } @Override protected void onStop() { super.onStop(); if(mBound) { unbindService(mConnection); mBound = false; } } // 버튼이 클릭되면 호출 public void onClick(View view) { if(mBound) { // Service에 정의된 getRandomNumber 메소드 호출 int num = mService.getRandomNumber(); Toast.makeText(this, "number: " + num, Toast.LENGTH_SHORT).show(); } } }
0ae87116acc014565855629f4c49821f95761106
7652286d26856a0b9df3f482de7253377f7f042d
/se-project-group8/SMS-Messenger-Group8/src/project/se3354/sms_messenger_group8/SendTo_Activity.java
953a499384af05097a0c39006781d13c6aac7523
[]
no_license
z1234567890b/se-project-group8
bafad437ead4a525af14f68be1dc822fabb2cf0a
6fd9ad8d32922392e928ad81be41b19e2f39c6cc
refs/heads/master
2021-01-15T09:32:18.499977
2014-12-10T03:28:21
2014-12-10T03:28:21
33,165,808
0
1
null
null
null
null
UTF-8
Java
false
false
240
java
package project.se3354.sms_messenger_group8; public class SendTo_Activity { //dummy class used to meet requirements for default app //see: http://android-developers.blogspot.no/2013/10/getting-your-sms-apps-ready-for-kitkat.html }
[ "[email protected]@5f2dbf48-14dc-350a-a83d-0fddc383f475" ]
[email protected]@5f2dbf48-14dc-350a-a83d-0fddc383f475
4d71cd6dd2c248cf73f9d38ca1a11295b31c2a17
138db760643ea892e076b33a64201528a7f3a52c
/src/pro/shef/f8.java
b165058767d4fc52f4c5cbb0aa90fcd22d91d21a
[]
no_license
shefalisachan/Counselling_App
2bdc28f907ea3aa0dd849234e2050014daf2c5a8
e258aa6bef7b91328c7720cabf8c4e111c9ecdc8
refs/heads/master
2023-02-25T22:47:09.138763
2021-01-17T16:45:14
2021-01-17T16:45:14
330,435,735
0
0
null
null
null
null
UTF-8
Java
false
false
268
java
package pro.shef; import android.app.Activity; import android.os.Bundle; public class f8 extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.f8); } }
ea1018edc05f8741a89a07fe755a544def243c36
aa3d5e806610e91ea9a3a13877ce5dcb179b6c3d
/Chapter 2/displacement.java
f303f0e619c738d7787a19178e9cbb2d36a48e3c
[]
no_license
kellytama/practice-it
354d6872dc3d7ee7d553e24eb74f713585a6d1a7
eac6ae4ac209c8698c922f64c27ff92f3ed40c45
refs/heads/master
2022-06-17T01:22:07.093878
2022-06-10T06:52:50
2022-06-10T06:52:50
175,868,660
0
0
null
null
null
null
UTF-8
Java
false
false
730
java
//In physics, a common useful equation for finding the position s of a body in linear motion at a given time t, based on its initial //position s0, initial velocity v0, and rate of acceleration a, is the following: //s = s0 + v0 t + ½ at2 //Write code to declare variables for s0 with a value of 12.0, v0 with a value of 3.5, a with a value of 9.8, and t with a value of 10, //and then write the code to compute s on the basis of these values. At the end of your code, print the value of your variable s to the //console. double s; double initialS; double initialV; double a; double time; initialS = 12.0; initialV = 3.5; time = 10; a = 9.8; s = initialS + initialV * time + (0.5 * a * time * time); System.out.println(s);
031a265a08d200a1b50b927f16d0066450bb7c2a
9d56fc7b9eab12a0d5d86d4b0ee5bda4d81e007d
/smartHMATest/app/src/main/java/pl/wasat/smarthma/ui/frags/base/BaseCollectionListFragment.java
f864abdd8d185f993dec0a1fe1cfdf5e0ba5234c
[]
no_license
prezes873/Smart
d3f0e66c8ec9d8a10d57f8f6edabd9c71eac7d7e
7d11a22267bdc66e266a50853ff554f3e1d821f5
refs/heads/master
2021-01-10T04:38:06.368986
2016-01-16T09:07:47
2016-01-16T09:07:47
49,522,001
0
0
null
null
null
null
UTF-8
Java
false
false
11,715
java
/* package pl.wasat.smarthma.ui.frags.base; import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import com.octo.android.robospice.persistence.exception.SpiceException; import com.octo.android.robospice.request.listener.RequestListener; import java.util.ArrayList; import java.util.List; import pl.wasat.smarthma.R; import pl.wasat.smarthma.adapter.EntryImagesListAdapter; import pl.wasat.smarthma.database.EoDbAdapter; import pl.wasat.smarthma.helper.DataSorter; import pl.wasat.smarthma.model.FedeoRequestParams; import pl.wasat.smarthma.model.feed.Feed; import pl.wasat.smarthma.model.om.EntryOM; import pl.wasat.smarthma.model.om.Footprint; import pl.wasat.smarthma.utils.rss.FedeoSearchRequest; */ /** * A simple {@link android.support.v4.app.Fragment} subclass. Activities that * contain this fragment must implement the * {@link BaseCollectionListFragment.OnBaseShowProductsListFragmentListener} * interface to handle interaction events. Use the * {@link BaseCollectionListFragment#newInstance} factory method to create an * instance of this fragment. * <p/> * Use this factory method to create a new instance of this fragment using * the provided parameters. * * @param fedeoRequestParams Parameter 1. * @return A new instance of fragment SearchProductsFeedsFragment. * @param searchProductFeeds searched Feed * <p/> * <p/> * <p/> * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated to * the activity and potentially other fragments contained in that activity. * <p/> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. * @param searchProductFeeds - Product Feed * @return footPrintsArr * <p/> * Use this factory method to create a new instance of this fragment using * the provided parameters. * @param fedeoRequestParams Parameter 1. * @return A new instance of fragment SearchProductsFeedsFragment. * @param searchProductFeeds searched Feed * <p/> * <p/> * <p/> * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated to * the activity and potentially other fragments contained in that activity. * <p/> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. * @param searchProductFeeds - Product Feed * @return footPrintsArr *//* public class BaseCollectionListFragment extends BaseSpiceFragment { private static final String KEY_PARAM_FEDEO_REQUEST = "pl.wasat.smarthma.KEY_PARAM_FEDEO_REQUEST"; private FedeoRequestParams fedeoRequestParams; private OnBaseShowProductsListFragmentListener mListener; private ListView entryImagesListView; private View loadingView; private static final String STATE_ACTIVATED_POSITION = "activated_position"; private int mActivatedPosition = ListView.INVALID_POSITION; */ /** * Use this factory method to create a new instance of this fragment using * the provided parameters. * * @param fedeoRequestParams Parameter 1. * @return A new instance of fragment SearchProductsFeedsFragment. *//* public static BaseCollectionListFragment newInstance( FedeoRequestParams fedeoRequestParams) { BaseCollectionListFragment fragment = new BaseCollectionListFragment(); Bundle args = new Bundle(); args.putSerializable(KEY_PARAM_FEDEO_REQUEST, fedeoRequestParams); fragment.setArguments(args); return fragment; } public BaseCollectionListFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { fedeoRequestParams = (FedeoRequestParams) getArguments().getSerializable( KEY_PARAM_FEDEO_REQUEST); } } */ /* * (non-Javadoc) * * @see * android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater, * android.view.ViewGroup, android.os.Bundle) *//* @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_collections_group_list, container, false); } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) { setActivatedPosition(savedInstanceState .getInt(STATE_ACTIVATED_POSITION)); } entryImagesListView = (ListView) view.findViewById( R.id.listview_collections_group); loadingView = view.findViewById(R.id.loading_layout); if (fedeoRequestParams != null) { loadSearchProductsFeedResponse(fedeoRequestParams); } } @Override public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (OnBaseShowProductsListFragmentListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnBaseShowProductsListFragmentListener"); } } @Override public void onDetach() { super.onDetach(); mListener = null; } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mActivatedPosition != ListView.INVALID_POSITION) { outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition); } } public void setActivateOnItemClick(boolean activateOnItemClick) { entryImagesListView .setChoiceMode(activateOnItemClick ? ListView.CHOICE_MODE_SINGLE : ListView.CHOICE_MODE_NONE); } void setActivatedPosition(int position) { if (position == ListView.INVALID_POSITION) { entryImagesListView.setItemChecked(mActivatedPosition, false); } else { entryImagesListView.setItemChecked(position, true); } mActivatedPosition = position; } private void updateShowProductsListViewContent(final List<EntryOM> entryList) { View view = getView(); if (view != null) { if (entryList.isEmpty()) { view.setVisibility(View.GONE); loadFailureFrag(); } else { for (EntryOM a : entryList) { EoDbAdapter dba = new EoDbAdapter(getActivity()); dba.openToRead(); EntryOM fetchedSearch = dba.getBlogListing(a.getGuid()); dba.close(); if (fetchedSearch == null) { dba = new EoDbAdapter(getActivity()); dba.openToWrite(); dba.insertBlogListing(a.getGuid()); dba.close(); } else { a.setDbId(fetchedSearch.getDbId()); a.setOffline(fetchedSearch.isOffline()); a.setRead(fetchedSearch.isRead()); } } EntryImagesListAdapter entryImagesListAdapter = new EntryImagesListAdapter(getActivity() .getBaseContext(), getBitmapSpiceManager(), entryList); entryImagesListView.setAdapter(entryImagesListAdapter); loadingView.setVisibility(View.GONE); entryImagesListAdapter.notifyDataSetChanged(); entryImagesListView.setVisibility(View.VISIBLE); // Click event for single list row entryImagesListView .setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { loadProductItemDetails(entryList.get(position)); } }); } } } protected void loadFailureFrag() { } protected void loadProductItemDetails(EntryOM entry) { } */ /** * @param searchProductFeeds searched Feed *//* protected void loadSearchResultProductsIntroDetailsFrag( Feed searchProductFeeds) { } */ /** * *//* private void loadSearchProductsFeedResponse(FedeoRequestParams fedeoRequestParams) { if (fedeoRequestParams != null) { getActivity().setProgressBarIndeterminateVisibility(true); getSpiceManager().execute(new FedeoSearchRequest(fedeoRequestParams, 2), new FeedRequestListener()); } } */ /** * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated to * the activity and potentially other fragments contained in that activity. * <p/> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. *//* public interface OnBaseShowProductsListFragmentListener { public void onBaseShowProductsListFragmentFootprintSend(); } void loadRequestSuccess(Feed searchProductFeeds) { getActivity().setProgressBarIndeterminateVisibility(false); if (searchProductFeeds == null) { searchProductFeeds = new Feed(); } List<EntryOM> entries = searchProductFeeds.getEntriesEO(); DataSorter sorter = new DataSorter(); sorter.sort(entries); updateShowProductsListViewContent(searchProductFeeds.getEntriesEO()); loadSearchResultProductsIntroDetailsFrag(searchProductFeeds); ArrayList<Footprint> footPrints = getFootprints(searchProductFeeds .getEntriesEO()); mListener.onBaseShowProductsListFragmentFootprintSend(); } */ /** * @param searchProductFeeds - Product Feed * @return footPrintsArr *//* private ArrayList<Footprint> getFootprints(List<EntryOM> searchProductFeeds) { ArrayList<Footprint> footPrintsArr = new ArrayList<>(); for (EntryOM searchProductFeed : searchProductFeeds) { if (searchProductFeed.getEarthObservation() != null) { footPrintsArr.add(searchProductFeed.getEarthObservation() .getFeatureOfInterest().getFootprint()); } } return footPrintsArr; } private final class FeedRequestListener implements RequestListener<Feed> { @Override public void onRequestFailure(SpiceException spiceException) { parseRequestFailure(spiceException); } @Override public void onRequestSuccess(Feed feed) { loadRequestSuccess(feed); } } } */
8c93448221d612f5e8b2e1d62609af52f59628ab
2641c432c780e8d2212252d50c1d88db6c027f05
/src/main/java/com/guiaindicado/dominio/usuario/TokenUsuario.java
62f0f721f812f917a53ecfc4747daa659e8ace1d
[]
no_license
uanderson/guia-indicado
63740059eb46f93f6c009b3fbab1730138e01b1c
2f4c2b1cb5ed0b10095c6fa8ed3e644435f0427e
refs/heads/master
2021-01-21T21:54:31.502582
2017-11-09T15:49:16
2017-11-09T15:49:16
30,428,168
0
0
null
null
null
null
UTF-8
Java
false
false
2,857
java
package com.guiaindicado.dominio.usuario; import java.util.Date; import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.time.DateUtils; import com.google.common.base.Objects; import com.google.common.base.Preconditions; @Entity @Table(name = "token_usuario") public class TokenUsuario { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "token_usuario_id", updatable = false) private Integer id; private String token; @Column(name = "data_hora") private Date dataHora; @Enumerated private Tipo tipo; @ManyToOne @JoinColumn(name = "usuario_id") private Usuario usuario; TokenUsuario() { } private TokenUsuario(Usuario usuario, Tipo tipo) { this.token = gerarToken(); this.tipo = Preconditions.checkNotNull(tipo); this.usuario = Preconditions.checkNotNull(usuario); this.dataHora = new Date(); } public static TokenUsuario criar(Usuario usuario, Tipo tipo) { return new TokenUsuario(usuario, tipo); } private String gerarToken() { Date data = new Date(); UUID uuid = UUID.nameUUIDFromBytes(String.valueOf(data).getBytes()); return uuid.toString().replaceAll("-", ""); } public boolean valido() { return tipo.valido(dataHora); } public String getToken() { return token; } public Usuario getUsuario() { return usuario; } public Date getDataHora() { return new Date(dataHora.getTime()); } @Override public int hashCode() { return Objects.hashCode(id); } @Override public boolean equals(Object outro) { if (this == outro) { return true; } if (!(outro instanceof TokenUsuario)) { return false; } TokenUsuario aquele = (TokenUsuario) outro; return Objects.equal(id, aquele.id); } @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) .append("id", id) .append("token", token) .append("dataHora", dataHora) .append("tipo", tipo) .toString(); } public static enum Tipo { CONFIRMACAO_CADASTRO { @Override public boolean valido(Date dataHora) { return dataHora.before(DateUtils.addDays(dataHora, 30)); } }, ESQUECI_SENHA { @Override public boolean valido(Date dataHora) { return dataHora.before(DateUtils.addDays(dataHora, 1)); } }; public abstract boolean valido(Date dataHora); } }
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; } }
34cbe662469fd76f1af845131da41ade918d01b0
080ffc71e7d38a96d3ff78cc88b6e1f7cd1616e3
/app/src/main/java/com/example/larry_sea/norember/utill/commonutils/GetPathFromUrikitkat.java
9798b749bfe62906507e4f5940b88789af6a7826
[]
no_license
luoyiqi/norember
fa305318b546f9d0b6d597cc7dcef814e0f1e923
b34f9af046a6c4ddad4b34d2b9e77dfad9d2f360
refs/heads/master
2021-07-16T12:21:53.860727
2017-10-22T15:05:24
2017-10-22T15:05:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,052
java
package com.example.larry_sea.norember.utill.commonutils; import android.annotation.SuppressLint; import android.content.ContentUris; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.provider.DocumentsContract; import android.provider.MediaStore; /** * Created by Larry-sea on 10/7/2016. * <p> * <p> * android 4.4以后获取uri 中的文件路径工具类 */ public class GetPathFromUrikitkat { /** * 专为Android4.4设计的从Uri获取文件绝对路径,以前的方法已不好使 */ @SuppressLint("NewApi") public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; // DocumentProvider if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { // ExternalStorageProvider if (isExternalStorageDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; if ("primary".equalsIgnoreCase(type)) { return Environment.getExternalStorageDirectory() + "/" + split[1]; } // TODO handle non-primary volumes } // DownloadsProvider else if (isDownloadsDocument(uri)) { final String id = DocumentsContract.getDocumentId(uri); final Uri contentUri = ContentUris.withAppendedId( Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); return getDataColumn(context, contentUri, null, null); } // MediaProvider else if (isMediaDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; } else if ("audio".equals(type)) { contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; } final String selection = "_id=?"; final String[] selectionArgs = new String[]{split[1]}; return getDataColumn(context, contentUri, selection, selectionArgs); } } // MediaStore (and general) else if ("content".equalsIgnoreCase(uri.getScheme())) { return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } /** * Get the value of the data column for this Uri. This is useful for * MediaStore Uris, and other file-based ContentProviders. * * @param context The context. * @param uri The Uri to query. * @param selection (Optional) Filter used in the query. * @param selectionArgs (Optional) Selection arguments used in the query. * @return The value of the _data column, which is typically a file path. */ public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = {column}; try { cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); if (cursor != null && cursor.moveToFirst()) { final int column_index = cursor.getColumnIndexOrThrow(column); return cursor.getString(column_index); } } finally { if (cursor != null) cursor.close(); } return null; } /** * @param uri The Uri to check. * @return Whether the Uri authority is ExternalStorageProvider. */ public static boolean isExternalStorageDocument(Uri uri) { return "com.android.externalstorage.documents".equals(uri.getAuthority()); } /** * @param uri The Uri to check. * @return Whether the Uri authority is DownloadsProvider. */ public static boolean isDownloadsDocument(Uri uri) { return "com.android.providers.downloads.documents".equals(uri.getAuthority()); } /** * @param uri The Uri to check. * @return Whether the Uri authority is MediaProvider. */ public static boolean isMediaDocument(Uri uri) { return "com.android.providers.media.documents".equals(uri.getAuthority()); } }
af8823f539f352c370f3d84a4c802245ab60d3a8
803fe9849392807fa1c86101b2902030642097ec
/cdsh-project-service/src/main/java/com/bimda/cdshproject/service/impl/RoleInfoServiceImpl.java
e388c964962332694379a6a3f7db1dffb2c69f78
[]
no_license
SuperHandsomeHan/cdsh-project
ca6156696ffdbef224fd0bdc1c0a480a5204ed2e
d9169f39aae279f37ae318e58bcbe7cb65f791da
refs/heads/master
2023-01-21T14:54:53.195005
2020-11-30T08:26:57
2020-11-30T08:26:57
312,140,382
0
0
null
null
null
null
UTF-8
Java
false
false
561
java
package com.bimda.cdshproject.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.bimda.cdshproject.mapper.RoleInfoMapper; import com.bimda.cdshproject.pojo.RoleInfo; import com.bimda.cdshproject.service.IRoleInfoService; import org.springframework.stereotype.Service; /** * <p> * role_info 角色信息表 服务实现类 * </p> * * @author jobob * @since 2020-11-23 */ @Service("roleInfoService") public class RoleInfoServiceImpl extends ServiceImpl<RoleInfoMapper, RoleInfo> implements IRoleInfoService { }
9a3d95225d2b6ed66630bb1f0e253c7b435da5eb
13a227003484e4993882e8fbebb081d6bb92fdaa
/apache-async-http-HC4/src/org/apache/http/HC4/impl/auth/NTLMEngineException.java
c92657b31979b38ba66974264ecfe807d9aa9b2a
[ "MIT" ]
permissive
garymabin/YGOMobile
77c3dac5cdfa467afb35bf22b7e4901b45e93405
daa6eb2c7a93e09776686c6c81d11ccb779cde39
refs/heads/master
2021-01-18T21:58:44.685069
2017-09-26T08:25:03
2017-09-26T08:25:03
18,127,475
44
29
null
2016-01-05T14:48:43
2014-03-26T05:08:10
C
UTF-8
Java
false
false
2,335
java
/* * ==================================================================== * Licensed to the Apache Software Foundation (ASF) 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. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.http.HC4.impl.auth; import org.apache.http.HC4.annotation.Immutable; import org.apache.http.HC4.auth.AuthenticationException; /** * Signals NTLM protocol failure. * * * @since 4.0 */ @Immutable public class NTLMEngineException extends AuthenticationException { private static final long serialVersionUID = 6027981323731768824L; public NTLMEngineException() { super(); } /** * Creates a new NTLMEngineException with the specified message. * * @param message the exception detail message */ public NTLMEngineException(final String message) { super(message); } /** * Creates a new NTLMEngineException with the specified detail message and cause. * * @param message the exception detail message * @param cause the {@code Throwable} that caused this exception, or {@code null} * if the cause is unavailable, unknown, or not a {@code Throwable} */ public NTLMEngineException(final String message, final Throwable cause) { super(message, cause); } }
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 &lt;[email protected]&gt; */ @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); } }
d3255470d07bafa0d02ad4fda5e24293011a705e
f45d75214eee81a70768f05e85a8e3123a909b1b
/example-spring-boot-starter/src/main/java/com/gyoomi/example/autoconfigure/ExampleProperties.java
d7a9ea4b025d168cb9a6f883d8293c22a5b2ee32
[]
no_license
gyoomi/starter
1bfe157f9d9ea418d9aacde21acb12506522c5d2
028b3573fb12829a15423a123c8a85a62bd1cd5a
refs/heads/master
2023-03-03T09:28:01.456311
2021-01-21T06:52:09
2021-01-21T06:52:09
331,539,473
0
0
null
null
null
null
UTF-8
Java
false
false
878
java
/** * Copyright © 2020-2021, Glodon Digital Supplier & Purchaser BU. * <p> * All Rights Reserved. */ package com.gyoomi.example.autoconfigure; import org.springframework.boot.context.properties.ConfigurationProperties; import java.util.List; /** * Example - 配置类 * * @author Leon * @date 2021-01-21 10:33 */ @ConfigurationProperties(prefix = "example") public class ExampleProperties { /** * name */ private String name; /** * age */ private Integer age; /** * hobby */ private List<String> hobby; public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public List<String> getHobby() { return hobby; } public void setHobby(List<String> hobby) { this.hobby = hobby; } }
b749299e6ca7ef8169589f2565ec9c7282de0069
d4005a7e9ee5e8421bfa5e614c67c06350df0fa5
/Programmierung/Graph/src/org/util/ExportToGraphML.java
c76c2aab7bd1380b29c3b780372aa236d1a4be2c
[]
no_license
matthiasbode/multiskalen
cccf4ea7473f5362fd4d015881304d03baf15b79
fb555ce9aa49a0e8d80a5688e5106701c36e737f
refs/heads/master
2021-01-18T23:26:29.775565
2016-07-08T20:11:19
2016-07-08T20:11:19
34,849,433
0
1
null
null
null
null
UTF-8
Java
false
false
9,417
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.util; import java.awt.geom.Point2D; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import java.util.ArrayList; import java.util.Map; import org.graph.Graph; /** * Klasse, die eine DirectedGraph und alle davon abgeleiteten Klassen * in einer Datei für YED schreibt. * * In YED kann dann das Layout des Graphens angepasst werden. (Menüpunkt: Layout) * @author bode */ public class ExportToGraphML { public static <E> void exportToGraphML(Graph<E> graph, String filename) { String s = ""; s += "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" + "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:y=\"http://www.yworks.com/xml/graphml\" xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd\">\n" + "<!--Created by yFiles for Java 2.7-->\n" + "<key for=\"graphml\" id=\"d0\" yfiles.type=\"resources\"/>\n" + "<key attr.name=\"url\" attr.type=\"string\" for=\"node\" id=\"d1\"/>\n" + "<key attr.name=\"description\" attr.type=\"string\" for=\"node\" id=\"d2\"/>\n" + "<key for=\"node\" id=\"d3\" yfiles.type=\"nodegraphics\"/>\n" + "<key attr.name=\"Beschreibung\" attr.type=\"string\" for=\"graph\" id=\"d4\">\n" + "<default/>\n" + "</key>\n" + "<key attr.name=\"url\" attr.type=\"string\" for=\"edge\" id=\"d5\"/>\n" + "<key attr.name=\"description\" attr.type=\"string\" for=\"edge\" id=\"d6\"/>\n" + "<key for=\"edge\" id=\"d7\" yfiles.type=\"edgegraphics\"/>\n" + "<graph edgedefault=\"directed\" id=\"G\">"; int numberOfVertex = graph.vertexSet().size(); int numberOfVertexPerRow = (int) (Math.sqrt(numberOfVertex) + 0.5); double x = 0; double y = 0; ArrayList<E> sortedVertices = new ArrayList<E>(graph.vertexSet()); for (int i = 0; i < sortedVertices.size(); i++) { E vertex = sortedVertices.get(i); s += "<node id=\"n" + i + "\">\n" + "<data key=\"d3\">\n" + "<y:ShapeNode>\n" + "<y:Geometry height=\"30.0\" width=\"30.0\" x=\"" + x + "\" y=\"" + y + "\"/>\n" + "<y:Fill color=\"#FFCC00\" transparent=\"false\"/>\n" + "<y:BorderStyle color=\"#000000\" type=\"line\" width=\"1.0\"/>\n" + "<y:NodeLabel alignment=\"center\" autoSizePolicy=\"content\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" hasBackgroundColor=\"false\" hasLineColor=\"false\" height=\"17.96875\" modelName=\"internal\" modelPosition=\"c\" textColor=\"#000000\" visible=\"true\">" + vertex.toString() + "</y:NodeLabel>\n" + "<y:Shape type=\"rectangle\"/>\n" + "</y:ShapeNode>\n" + "</data>\n" + "</node>\n"; if (i % numberOfVertexPerRow == 0) { x = 0; y += 200; continue; } x += 200; } int ei = 0; for (Pair<E, E> pair : graph.edgeSet()) { int source = 0; int target = 0; for (int i = 0; i < sortedVertices.size(); i++) { E vertex = sortedVertices.get(i); if (vertex.equals(pair.getFirst())) { source = i; } if (vertex.equals(pair.getSecond())) { target = i; } } s += "<edge id=\"e" +ei++ +"\" source=\"n" + source + "\" target=\"n" + target + "\">\n" + "<data key=\"d7\">\n" + "<y:PolyLineEdge>\n" + "<y:Path sx=\"0.0\" sy=\"0.0\" tx=\"0.0\" ty=\"0.0\"/>\n" + "<y:LineStyle color=\"#000000\" type=\"line\" width=\"1.0\"/>\n" + "<y:Arrows source=\"none\" target=\"standard\"/>\n" + "<y:BendStyle smoothed=\"false\"/>\n" + "</y:PolyLineEdge>\n" + "</data>\n" + "</edge>"; } s += " </graph>" + "<data key=\"d0\">" + "<y:Resources/>" + "</data>" + "</graphml>"; Writer fw = null; try { fw = new FileWriter(filename); fw.write(s); } catch (IOException e) { System.err.println("Konnte Datei nicht erstellen"); } finally { if (fw != null) { try { fw.close(); } catch (IOException e) { e.printStackTrace(); } } } } public static <E> void exportToGraphML(Graph<E> graph, Map<E,Point2D.Double> positions, String filename) { String s = ""; s += "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" + "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:y=\"http://www.yworks.com/xml/graphml\" xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd\">\n" + "<!--Created by yFiles for Java 2.7-->\n" + "<key for=\"graphml\" id=\"d0\" yfiles.type=\"resources\"/>\n" + "<key attr.name=\"url\" attr.type=\"string\" for=\"node\" id=\"d1\"/>\n" + "<key attr.name=\"description\" attr.type=\"string\" for=\"node\" id=\"d2\"/>\n" + "<key for=\"node\" id=\"d3\" yfiles.type=\"nodegraphics\"/>\n" + "<key attr.name=\"Beschreibung\" attr.type=\"string\" for=\"graph\" id=\"d4\">\n" + "<default/>\n" + "</key>\n" + "<key attr.name=\"url\" attr.type=\"string\" for=\"edge\" id=\"d5\"/>\n" + "<key attr.name=\"description\" attr.type=\"string\" for=\"edge\" id=\"d6\"/>\n" + "<key for=\"edge\" id=\"d7\" yfiles.type=\"edgegraphics\"/>\n" + "<graph edgedefault=\"directed\" id=\"G\">"; ArrayList<E> sortedVertices = new ArrayList<E>(graph.vertexSet()); for (int i = 0; i < sortedVertices.size(); i++) { E vertex = sortedVertices.get(i); double x = positions.get(vertex).getX(); double y = positions.get(vertex).getY(); s += "<node id=\"n" + i + "\">\n" + "<data key=\"d3\">\n" + "<y:ShapeNode>\n" + "<y:Geometry height=\"30.0\" width=\"30.0\" x=\"" + x + "\" y=\"" + y + "\"/>\n" + "<y:Fill color=\"#FFCC00\" transparent=\"false\"/>\n" + "<y:BorderStyle color=\"#000000\" type=\"line\" width=\"1.0\"/>\n" + "<y:NodeLabel alignment=\"center\" autoSizePolicy=\"content\" fontFamily=\"Dialog\" fontSize=\"12\" fontStyle=\"plain\" hasBackgroundColor=\"false\" hasLineColor=\"false\" height=\"17.96875\" modelName=\"internal\" modelPosition=\"c\" textColor=\"#000000\" visible=\"true\">" + vertex.toString() + "</y:NodeLabel>\n" + "<y:Shape type=\"rectangle\"/>\n" + "</y:ShapeNode>\n" + "</data>\n" + "</node>\n"; } int ei = 0; for (Pair<E, E> pair : graph.edgeSet()) { int source = 0; int target = 0; for (int i = 0; i < sortedVertices.size(); i++) { E vertex = sortedVertices.get(i); if (vertex.equals(pair.getFirst())) { source = i; } if (vertex.equals(pair.getSecond())) { target = i; } } s += "<edge id=\"e" +ei++ +"\" source=\"n" + source + "\" target=\"n" + target + "\">\n" + "<data key=\"d7\">\n" + "<y:PolyLineEdge>\n" + "<y:Path sx=\"0.0\" sy=\"0.0\" tx=\"0.0\" ty=\"0.0\"/>\n" + "<y:LineStyle color=\"#000000\" type=\"line\" width=\"1.0\"/>\n" + "<y:Arrows source=\"none\" target=\"standard\"/>\n" + "<y:BendStyle smoothed=\"false\"/>\n" + "</y:PolyLineEdge>\n" + "</data>\n" + "</edge>"; } s += " </graph>" + "<data key=\"d0\">" + "<y:Resources/>" + "</data>" + "</graphml>"; Writer fw = null; try { fw = new FileWriter(filename); fw.write(s); } catch (IOException e) { System.err.println("Konnte Datei nicht erstellen"); } finally { if (fw != null) { try { fw.close(); } catch (IOException e) { e.printStackTrace(); } } } } }
75ebd41685f264c4280e63ab13454e83783b3999
34867b96d902dfd45c5a1a5767a9fccdf38c5ff6
/src/com/org/dp/structural/bridge/Printer.java
b9cac41ac226a51cd0503366ffe2e3504a1ef875
[]
no_license
iamsubho76/CodeDesignPattern
08c9016524c179327d35ef13fc0687cce532dc62
524b683f0013e5a7d896e626a96107de31dafb55
refs/heads/master
2021-08-30T13:35:01.523074
2017-12-18T05:23:19
2017-12-18T05:23:19
114,598,945
0
0
null
null
null
null
UTF-8
Java
false
false
290
java
package com.org.dp.structural.bridge; import java.util.List; public abstract class Printer { public String print(Formatter formatter) { return formatter.format(getHeader(), getDetails()); } abstract protected List<Detail> getDetails(); abstract protected String getHeader(); }
d8c9ab839963812a4f2791e6430d3b6853a99336
e7120cf2ddf3dbd3966cb3e51c0f8d226d5ad869
/.svn/pristine/f3/f3494ca420e33ae4b6b37d74d78be2adef54fc6a.svn-base
76e637f1956587bd2e492ea9e23380d230bc50da
[]
no_license
wankaiss/yljknb
f7e02565870f49b40ebc02f2a19b66354b26c00e
2e60bbb18a36fe656a41caff430df3d851583652
refs/heads/master
2021-01-10T01:37:52.793176
2015-10-29T10:04:37
2015-10-29T10:04:37
45,174,409
0
3
null
null
null
null
UTF-8
Java
false
false
1,917
package com.wondersgroup.local.k2.f10201001.vs; import java.util.Map; import com.wondersgroup.bc.medicarecostaudit.medaudit.model.dto.ZnshTjDTO; import com.wondersgroup.framework.core.bo.Page; public interface F10201001VS { /** * * @Title: queryZnshTj * @Description: 查询智能审核统计的结果 * @param @param baz020 智能审核时间 * @param @param isDay ture表示按年月日统计,false表示按照年月统计 * @param @return 设定文件 * @return ZnshTjDTO 返回类型 * @throws * @author chenlin * @date 2014-7-21 上午09:44:56 */ public ZnshTjDTO queryZnshTj(String baz020,boolean isDay); /** * * @Title: queryZhshMxTjWithYljg * @Description: 查询智能审核医疗机构的统计情况 * @param @param page 分页对象 * @param @param baz020 智能审核时间 * @param @param isDay ture表示按年月日统计,false表示按照年月统计 * @param @param isHosp 0表示统计医院和药店,1表示统计医院,-1表示统计药店 * @param @return 设定文件 * @return Map<String,Object> 返回类型 * @throws * @author chenlin * @date 2014-7-21 下午03:44:54 */ public Map<String,Object> queryZhshMxTjWithYljg(Page page,String baz020,boolean isDay,int isHosp); /** * * @Title: queryZhshMxTjWithGz * @Description: 查询智能审核规则的统计情况 * @param @param page 分页对象 * @param @param baz020 智能审核时间 * @param @param isDay ture表示按年月日统计,false表示按照年月统计 * @param @param isHosp 0表示统计医院和药店,1表示统计医院,-1表示统计药店 * @param @return 设定文件 * @return Map<String,Object> 返回类型 * @throws * @author chenlin * @date 2014-7-21 下午03:46:05 */ public Map<String,Object> queryZhshMxTjWithGz(Page page,String baz020,boolean isDay,int isHosp); }
5b7097c9b8c188d47486a30d80c3dbb76b8259d3
941d2dcae7b610790599d3ed3354ac07a4348b89
/app/src/main/java/com/example/a90678/mm_2017_05_28_15_503/mainList/MainListModule.java
7939836ac4346d9d37056d3a500c169d6bd364a7
[]
no_license
kaixuanluo/MM_2017_05_28_15_505
e0a74452f555a5e5cc04cc341c8dd4793c2beb96
e25e8fd1c91bcca429b7f64cf56c80b3a3d96c63
refs/heads/master
2021-09-06T19:42:48.755177
2017-12-19T05:07:02
2017-12-19T05:07:02
114,721,439
0
0
null
null
null
null
UTF-8
Java
false
false
368
java
package com.example.a90678.mm_2017_05_28_15_503.mainList; import com.example.a90678.lkx_common_17_05_17_16_45.common.module.BaseApiServiceModule; /** * Created by 90678 on 2017/5/28. */ public class MainListModule { public static MainListService provideMainList(){ return BaseApiServiceModule.provideRetrofit().create(MainListService.class); } }
240fbf2a6f9ea0ba6a5153b8451d288aae4745a8
402818a118d86a9e74a70403bd88a5d67600d563
/8.12/src/fitz/socket/SocketTest1.java
c82eaf1751807cbdc8d01ba6f75294c238f25b9c
[]
no_license
coin-mwk/DailyPractice
c8a8c1cb6a5592a68a0173302f9fe0a2fd84d158
b02401d848afc1378f8bad59e8a8f6b5289642e0
refs/heads/master
2023-02-02T12:30:23.465927
2020-12-24T07:09:06
2020-12-24T07:09:06
286,885,746
0
0
null
null
null
null
UTF-8
Java
false
false
1,255
java
package fitz.socket; import java.io.IOException; import java.io.OutputStream; import java.net.Socket; import java.nio.charset.StandardCharsets; /** * @author Fitz * @create 2020-08-22-10:14 下午 * * 1、创建一个客户端对象Socket,构造方法绑定服务器的IP地址和端口号 * 2、使用Socket中的方法getOutputStream()获取网络输出字节流OutputStreaam对象 * 3、使用网络输出字节流OutputStream对象的方法write,给服务器发送数据 * 4、使用Socket对象中的方法getInputStream()获取网络字节输入流InputStream对象 * 5、使用网络输入字节流InputStream对象中的方法read,读取服务器回写的数据 * 6、释放socket资源 * 注意: * 1、客户端和服务器端进行交互,必须使用Socket中提供的网络流,不能使用自己创建的流对象 * */ //TCP客户端 public class SocketTest1 { public static void main(String[] args) throws IOException { Socket socket = new Socket("127.0.0.1", 9955); OutputStream outputStream = socket.getOutputStream(); String message = "你好!"; outputStream.write(message.getBytes(StandardCharsets.UTF_8)); outputStream.close(); socket.close(); } }
99ad699196fa94529fcc2d92ca80ad933890edce
88b0bac88fdbe9b3aa92a8f037389271a657943f
/AllergyIAPWS/src/com/allergyiap/dao/AllergyLevelDao.java
1607a86caf05108cd385b25b092d915be93f382e
[]
no_license
AllergyIAP/AllergyIAPWS
31950852c4b50dff87725a2acdf5c763fd067019
1205a5962ac469711f84029419eeb5074d04fc78
refs/heads/master
2020-06-11T13:16:20.187403
2016-11-28T20:43:54
2016-11-28T20:43:54
75,656,534
0
0
null
null
null
null
UTF-8
Java
false
false
3,441
java
package com.allergyiap.dao; import java.sql.ResultSet; import java.sql.SQLException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import com.allergyiap.beans.AllergyLevel; public class AllergyLevelDao extends Dao<AllergyLevel> { private static final String TABLE_NAME = "allergy_level"; private static String ID = "idallergy_level"; private static String ALLERGY_ID = "allergy_idallergy"; private static String CURRENT_LEVEL = "current_level"; private static String STATION = "STATION"; private static String DATE_START = "date_start"; private static String DATE_END = "date_end"; private static String FORECAST_LEVEL = "forecast_level"; /** * * @param bean */ @Override public void insert(AllergyLevel bean) { StringBuilder query = new StringBuilder(); query.append("INSERT INTO "); query.append(TABLE_NAME); query.append(" ("); query.append(ALLERGY_ID + ", "); query.append(CURRENT_LEVEL + ", "); query.append(STATION + ", "); query.append(DATE_START + ", "); query.append(DATE_END + ", "); query.append(FORECAST_LEVEL); query.append(") "); query.append("VALUES"); query.append(" ("); query.append(bean.getAlleryID() + ", "); query.append(bean.getCurrentLevel() + ", "); query.append(bean.getStation() + ", "); query.append(bean.getDateStart() + ", "); query.append(bean.getDateEnd() + ", "); query.append(bean.getForecastLevel()); query.append(") "); db.executeUpdate(query.toString()); } /** * */ @Override public void delete(int id) { StringBuilder query = new StringBuilder(); query.append("DELETE FROM "); query.append(TABLE_NAME); query.append(" WHERE "); query.append(ID + " = " + id); db.executeUpdate(query.toString()); } /** * * @param bean */ @Override public void update(AllergyLevel bean) { StringBuilder query = new StringBuilder(); query.append("UPDATE "); query.append(TABLE_NAME); query.append(" set "); query.append(ALLERGY_ID + " = " + bean.getAlleryID() + ", "); query.append(CURRENT_LEVEL + " = " + bean.getCurrentLevel() + ", "); query.append(STATION + " = " + bean.getStation() + ", "); query.append(DATE_START + " = " + bean.getDateStart() + ", "); query.append(DATE_END + " = " + bean.getDateEnd() + ", "); query.append(FORECAST_LEVEL + " = " + bean.getForecastLevel()); query.append(" WHERE "); query.append(ID + " = " + bean.getId()); db.executeUpdate(query.toString()); } /** * * @return */ @Override public List<AllergyLevel> getAll() { String selectQuery = "SELECT * FROM " + TABLE_NAME + ";"; return select(selectQuery); } private List<AllergyLevel> select(String query) { List<AllergyLevel> list = new ArrayList<>(); try { DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); ResultSet rs = db.execute(query); while (rs.next()) { long idlevel = rs.getLong(ID); long idallergy = rs.getLong(ALLERGY_ID); float curlevel = rs.getFloat(CURRENT_LEVEL); String station = rs.getString(STATION); String dateStart = df.format(rs.getDate(DATE_START)); String dateEnd = df.format(rs.getDate(DATE_END)); String forecastLevel = rs.getString(FORECAST_LEVEL); list.add(new AllergyLevel(idlevel, idallergy, curlevel, station, dateStart, dateEnd, forecastLevel)); } } catch (SQLException e) { e.printStackTrace(); } return list; } }
1c0e6c8de5b16bce430aa4ad433c23954dd6da30
a0f5a257fd85266e08cea0cc63c015147aff5a5a
/PAP/pap/ass08/TemperatureMonitoring/StopFlag.java
2753e23489469ec87bda4998758cb48e23056b7b
[]
no_license
massimilianomartella/AdvancedParadigmsPrograms
3061713630c8c641a557d6d1fa05427df27aedb2
90421fb9d10f7334650dd62e5cf2fa9a8e9118a5
refs/heads/master
2021-01-10T07:21:55.459252
2016-01-14T12:38:49
2016-01-14T12:38:49
43,847,210
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package pap.ass08.TemperatureMonitoring; /** * Monitor adibito allo start e stop del programma * @author Martella Massimiliano * */ public class StopFlag { private boolean done = false; public StopFlag(){ done = false; } public synchronized void setDone(){ done = true; } public synchronized boolean isDone(){ return done; } }
bab9bcdea99f9e5337eb6c7401f97e7f2c7e303b
9552eeea8217e26ac5d2cdf8c197dbec231014fc
/src/main/java/com/selectica/Package201506161/definitions/CFR1BO/actions/ManageActivationCA3ActionScript.java
ec722174d4c1a35ecd5e3b965e5d29e2ba246791
[]
no_license
epavlovskaya/rcfLenaBaseDemo
05db6503c494b71edb4d748a00ef866fd7768ac2
3675d57a0fd6c2936e62b64606ad3c0f374e327d
refs/heads/master
2021-01-25T10:00:38.924510
2015-06-16T09:52:21
2015-06-16T09:52:21
37,266,126
0
0
null
null
null
null
UTF-8
Java
false
false
341
java
package com.selectica.Package201506161.definitions.CFR1BO.actions; import com.selectica.Package201506161.eclm.definitions.CFR1BO.actions.CreateNotificationAlertAction; import com.selectica.rcfscripts.AbstractBOWriteScript; /**CreateNotificationAlert*/ public class ManageActivationCA3ActionScript extends CreateNotificationAlertAction { }
852a6985d80ab931eb2a6560af58346de95d82e8
bb1503c44558a437f1f7f4015768768f400e3308
/src/com/fheebiy/http/lite/request/Request.java
b4858f3f28fdaa016f610123c1862a8030060181
[]
no_license
wxm419/fragment
a5fccd359c13bedc1d9b240cca74c72ad6b63787
a83cdb351881017278e459aeb719e8044528e3cc
refs/heads/master
2021-01-18T06:08:28.938947
2015-05-25T10:35:10
2015-05-25T10:35:10
37,634,829
1
0
null
2015-06-18T03:21:01
2015-06-18T03:21:01
null
UTF-8
Java
false
false
10,103
java
package com.fheebiy.http.lite.request; import com.fheebiy.http.lite.LiteHttpClient; import com.fheebiy.http.lite.data.Consts; import com.fheebiy.http.lite.data.NameValuePair; import com.fheebiy.http.lite.exception.HttpClientException; import com.fheebiy.http.lite.exception.HttpClientException.ClientException; import com.fheebiy.http.lite.listener.HttpListener; import com.fheebiy.http.lite.parser.DataParser; import com.fheebiy.http.lite.parser.StringParser; import com.fheebiy.http.lite.request.content.HttpBody; import com.fheebiy.http.lite.request.param.HttpMethod; import com.fheebiy.http.lite.request.param.HttpParam; import com.fheebiy.http.lite.request.query.AbstractQueryBuilder; import com.fheebiy.http.lite.request.query.JsonQueryBuilder; import java.io.UnsupportedEncodingException; import java.lang.reflect.InvocationTargetException; import java.net.URLEncoder; import java.util.LinkedHashMap; import java.util.List; import java.util.Map.Entry; /** * Base request for {@link LiteHttpClient} method * * @author MaTianyu * 2014-1-1下午9:51:59 */ public class Request { private static final String TAG = Request.class.getSimpleName(); /** * you can give an id to a request */ private long id; /** * custom tag of request */ private Object tag; /** * request abort */ protected Abortable abort; /** * url of http request */ private String url; /** * add custom header to request. */ private LinkedHashMap<String, String> headers; /** * key value parameters */ private LinkedHashMap<String, String> paramMap; /** * intelligently translate java object into mapping(k=v) parameters */ private HttpParam paramModel; /** * when parameter's value is complex, u can chose one buider, default mode * is build value into json string. */ private AbstractQueryBuilder queryBuilder; /** * defaul method is get(GET). */ private HttpMethod method; /** * charset of request */ private String charSet = Consts.DEFAULT_CHARSET; /** * max number of retry.. */ private int retryMaxTimes = LiteHttpClient.DEFAULT_MAX_RETRY_TIMES; /** * http inputsream parser */ private DataParser<?> dataParser; /** * body of post,put.. */ private HttpBody httpBody; /** * a callback of start,retry,redirect,loading,end,etc. */ private HttpListener httpListener; public Request(String url) { this(url, null); } public Request(String url, HttpParam paramModel) { this(url, paramModel, new StringParser(), null, null); } public Request(String url, HttpParam paramModel, DataParser<?> parser, HttpBody httpBody, HttpMethod method) { if (url == null) throw new RuntimeException("Url Cannot be Null."); this.url = url; this.paramModel = paramModel; this.queryBuilder = new JsonQueryBuilder(); setMethod(method); setDataParser(parser); setHttpBody(httpBody); } public long getId() { return id; } public void setId(long id) { this.id = id; } public Object getTag() { return tag; } public void setTag(Object tag) { this.tag = tag; } public Request addHeader(List<NameValuePair> nps) { if (nps != null) { if (headers == null) { headers = new LinkedHashMap<String, String>(); } for (NameValuePair np : nps) { headers.put(np.getName(), np.getValue()); } } return this; } public Request addHeader(String key, String value) { if (value != null) { if (headers == null) { headers = new LinkedHashMap<String, String>(); } headers.put(key, value); } return this; } /** * 获取消息体 */ public HttpBody getHttpBody() { return httpBody; } /** * 设置消息体:默认POST方式 */ public Request setHttpBody(HttpBody httpBody) { if (httpBody != null) { return setHttpBody(httpBody, HttpMethod.Post); } else { return this; } } /** * 设置消息体与请求方式 */ public Request setHttpBody(HttpBody httpBody, HttpMethod method) { setMethod(method); this.httpBody = httpBody; return this; } public Request addUrlParam(String key, String value) { if (value != null) { if (paramMap == null) { paramMap = new LinkedHashMap<String, String>(); } paramMap.put(key, value); } return this; } /** * if you setUrl as "www.tb.cn" . * you must add prifix "http://" or "https://" yourself. * * @param prifix * @throws HttpClientException */ public Request addUrlPrifix(String prifix) { setUrl(prifix + url); return this; } /** * if your url like this "http://tb.cn/i3.html" . * you can setUrl("http://tb.cn/") then addUrlSuffix("i3.html"). * * @param suffix * @throws HttpClientException */ public Request addUrlSuffix(String suffix) { setUrl(url + suffix); return this; } public String getRawUrl() { return url; } public String getUrl() throws HttpClientException { // check raw url if (url == null) throw new HttpClientException(ClientException.UrlIsNull); if (paramMap == null && paramModel == null) { return url; } try { StringBuilder sb = new StringBuilder(url); sb.append(url.contains("?") ? "&" : "?"); LinkedHashMap<String, String> map = getBasicParams(); int i = 0, size = map.size(); for (Entry<String, String> v : map.entrySet()) { sb.append(URLEncoder.encode(v.getKey(), charSet)).append("=").append(URLEncoder.encode(v.getValue(), charSet)).append(++i == size ? "" : "&"); } //if (Log.isPrint) Log.v(TAG, "lite request url: " + sb.toString()); return sb.toString(); } catch (Exception e) { throw new HttpClientException(e); } } public Request setUrl(String url) { this.url = url; return this; } /** * 融合hashmap和解析到的javamodel里的参数,即所有string 参数. */ public LinkedHashMap<String, String> getBasicParams() throws IllegalArgumentException, UnsupportedEncodingException, IllegalAccessException, InvocationTargetException { LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(); if (paramMap != null) map.putAll(paramMap); LinkedHashMap<String, String> modelMap = queryBuilder.buildPrimaryMap(paramModel); if (modelMap != null) map.putAll(modelMap); return map; } public LinkedHashMap<String, String> getHeaders() { return headers; } public Request setHeaders(LinkedHashMap<String, String> headers) { this.headers = headers; return this; } public LinkedHashMap<String, String> getParamMap() { return paramMap; } public Request setParamMap(LinkedHashMap<String, String> paramMap) { this.paramMap = paramMap; return this; } public HttpParam getParamModel() { return paramModel; } public Request setParamModel(HttpParam paramModel) { this.paramModel = paramModel; return this; } public AbstractQueryBuilder getQueryBuilder() { return queryBuilder; } public Request setQueryBuilder(AbstractQueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; return this; } public HttpMethod getMethod() { return method; } public Request setMethod(HttpMethod method) { if (method != null) { this.method = method; } else { this.method = HttpMethod.Get; } return this; } public String getCharSet() { return charSet; } public Request setCharSet(String charSet) { this.charSet = charSet; return this; } public int getRetryMaxTimes() { return retryMaxTimes; } public Request setRetryMaxTimes(int retryTimes) { this.retryMaxTimes = retryTimes; return this; } public DataParser<?> getDataParser() { return dataParser; } public Request setDataParser(DataParser<?> dataParser) { if (dataParser != null) { this.dataParser = dataParser; } else { this.dataParser = new StringParser(); } return this; } public void setAbort(Abortable abort) { this.abort = abort; } public void abort() { if (abort != null) abort.abort(); } public HttpListener getHttpListener() { return httpListener; } public void setHttpListener(HttpListener httpListener) { this.httpListener = httpListener; if (dataParser != null) dataParser.setHttpReadingListener(httpListener); } @Override public String toString() { return "\turl = " + url + "\n\tmethod = " + method + "\n\theaders = " + headers + "\n\tcharSet = " + charSet + "\n\tretryMaxTimes = " + retryMaxTimes + "\n\tparamModel = " + paramModel + "\n\tdataParser = " + (dataParser != null ? dataParser.getClass().getSimpleName() : "null") + "\n\tqueryBuilder = " + (queryBuilder != null ? queryBuilder.getClass().getSimpleName() : "null") + "\n\tparamMap = " + paramMap + "\n\thttpBody = " + httpBody; } public static interface Abortable { public void abort(); } }
bba7edb461e9a441b4ca85e8859fef98509b70bb
d437dd4af6811af76a1c39af5d733653b0aa69aa
/Cake-dao/src/test/java/com/zhangyuwei/cake/dao/cakeDaoMainTest.java
55320925fc14acd2988a4463b68db5adc775b65d
[]
no_license
zywds/CakeDB
e41c5d51cc9004914a3a9e23754fc46b26e8b6e2
1a12706d16b4f981d049e778c75857380167c9b9
refs/heads/master
2020-04-15T04:05:48.399074
2019-01-07T03:06:14
2019-01-07T03:06:36
164,371,061
0
0
null
null
null
null
UTF-8
Java
false
false
5,747
java
package com.zhangyuwei.cake.dao; import com.zhangyuwei.cake.entities.CakeInformation; import com.zhangyuwei.cake.entities.SmallTypeInformation; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; import java.util.*; @ContextConfiguration(locations = { "classpath:applicationContext.xml"}) @RunWith(SpringJUnit4ClassRunner.class) @Transactional @Rollback public class cakeDaoMainTest { @Autowired IcakeMainDao dao; //查询蛋糕有关的一切信息 @Test public void selectCakeInformationAll(){ System.out.println(dao.selectCakeInformationAll()); } //查询所有的商品 @Test public void selectInformation(){ System.out.println(dao.selectInformation()); } //查询蛋糕类别,蛋糕口味和糕信息表结合 @Test public void selectCaAndCaAndMo(){ Map<String,Object> map=new HashMap<String, Object>(); map.put("page",0);map.put("limit",2); System.out.println(dao.selectCaAndCaAndMo(map)); } //查询蛋糕类别,蛋糕口味和蛋糕信息表结合数量 //@Test /*public void selectCaAndCaAndMoCount(){ System.out.println(dao.selectCaAndCaAndMoCount()); }*/ //查询商品口味 @Test public void selectCakeInformationMouseType(){ System.out.println(dao.selectCakeInformationMouseType()); } //查询商品类型 @Test public void selectCakeInformationCakeType(){ System.out.println(dao.selectCakeInformationCakeType()); } //查询商品口味和商品类型 @Test public void selectCaAndCaAndMoNoPage(){ System.out.println(dao.selectCaAndCaAndMoNoPage()); } //添加数据到蛋糕信息表 @Test public void insertCakeInformation(){ CakeInformation cakeInformation=new CakeInformation(); cakeInformation.setcName("苹果");cakeInformation.setcNameEnglish("MangoJerrya"); cakeInformation.setcDecription("优质芒果的三种姿态");cakeInformation.setcPicture("3.jpg"); cakeInformation.setcDesc("利用富文本进行展示");cakeInformation.setCtId(1); cakeInformation.setMtId(2); int row=dao.insertCakeInformation(cakeInformation); if(row>0){ System.out.println("添加成功!"); } } //添加数据到蛋糕与蛋糕小类型对应表 @Test public void insertSmallTypeInformation(){ SmallTypeInformation smallTypeInformation=new SmallTypeInformation(); smallTypeInformation.setcId(1);smallTypeInformation.setStId(3); int row=dao.insertSmallTypeInformation(smallTypeInformation); if(row>0){ System.out.println("添加成功!"); } } //添加数据到蛋糕与蛋糕小类型对应表(多添加) @Test public void insertSmallTypeInformationSome(){ int[] arr={3,4}; List<SmallTypeInformation> smallTypeInformationList=new ArrayList<SmallTypeInformation>(); for (int i=0;i<2;i++){ smallTypeInformationList.add(new SmallTypeInformation(1,arr[i])); } if(dao.insertSmallTypeInformationSome(smallTypeInformationList)>=2){ System.out.println("添加成功!"); } } //获得最后一条数据的ID @Test public void selectLastId(){ System.out.println(dao.selectLastId().get(dao.selectLastId().size()-1).getcId()); //System.out.println(dao.selectLastId().size()); } //查询蛋糕小类型表 @Test public void selectSmallCakeType(){ System.out.println(dao.selectSmallCakeType()); } //根据蛋糕id查出蛋糕与蛋糕下类型对应表 @Test public void selectSmallTypeInformation(){ int cId=1; System.out.println(dao.selectSmallTypeInformation(cId)); } //修改蛋糕信息 @Test public void updateCakeInformationAll(){ CakeInformation cakeInformation=new CakeInformation(); cakeInformation.setcName("苹果");cakeInformation.setcNameEnglish("MangoJerrya"); cakeInformation.setcDecription("优质芒果的三种姿态");cakeInformation.setcPicture("3.jpg"); cakeInformation.setcDesc("利用富文本进行展示");cakeInformation.setCtId(1); cakeInformation.setMtId(2); int row=dao.updateCakeInformationAll(cakeInformation); if(row>0){ System.out.println("修改成功!"); } } //修改蛋糕与蛋糕小类型对应表 @Test public void updateSmallTypeInformation(){ int[] arr={1,2,3}; SmallTypeInformation smallTypeInformation=new SmallTypeInformation(); int row=0; for (int i=0;i<arr.length;i++){ smallTypeInformation.setcId(1);smallTypeInformation.setStId(arr[i]); dao.updateSmallTypeInformation(smallTypeInformation);row++; } if(row==arr.length){ System.out.println("修改成功!"); } } //根据id查询详情(富文本内容,不可以用url进行传值) @Test public void selectCakeInformationDescById(){ int cId=1; System.out.println(dao.selectCakeInformationDescById(cId)); } //根据ID删除蛋糕与小类型对应表中的数据 @Test public void deleteSmallTypeInformationbyId(){ int cId=1; if(dao.deleteSmallTypeInformationbyId(cId)>0){ System.out.println("删除成功!"); } } }
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 + "]"; } }
bc26817976d9f66afcbdd782d41716ac5a776ed7
aa047f0494e73d022077248f807217258e1d1d0d
/tzhehe/5-25/demo_database/src/com/tz/database/demo/Classes.java
685cdc5291de9c4bc0b8f6f434a3f38f35eaa1ec
[]
no_license
AbnerChenyi/April_PublicWork
1412bd482113e3bb8729132e14964e0572297f14
5a75c3a8314becf5fe53485f7690c2fad75ab004
refs/heads/master
2021-01-22T13:13:55.540762
2015-07-08T10:11:48
2015-07-08T10:11:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
643
java
package com.tz.database.demo; public class Classes { private int _id; private String _name; private String _createdate; public int get_id() { return _id; } public void set_id(int _id) { this._id = _id; } public String get_name() { return _name; } public void set_name(String _name) { this._name = _name; } public String get_createdate() { return _createdate; } public void set_createdate(String _createdate) { this._createdate = _createdate; } public Classes(String _name, String _createdate) { super(); this._name = _name; this._createdate = _createdate; } public Classes() { super(); } }
c37be06d997f7566d9efecda30880aa3ce3e300f
674fc963d05d3237dd5e0d85a1eba07388dec598
/sysgeho-web-core/src/main/code/referentiel/com/bondeko/sysgeho/ui/ref/controleur/TypRdvCtrl.java
96d1cc16214b77d2c331484fbc269dda3be7c3b5
[]
no_license
bondeko/SYSGEHO_1.0.0
b056622edcd2434e509f7cb81bc193f47437e283
1f90255c257521122119cd8e98b0d8eff6cccfb7
refs/heads/master
2021-01-19T02:14:43.275867
2017-04-18T14:26:57
2017-04-18T14:26:57
21,467,304
0
0
null
null
null
null
ISO-8859-2
Java
false
false
2,608
java
package com.bondeko.sysgeho.ui.ref.controleur; import java.util.List; import java.util.Map; import java.util.TreeMap; import com.bondeko.sysgeho.be.core.exception.SysGehoAppException; import com.bondeko.sysgeho.be.core.svco.base.IBaseSvco; import com.bondeko.sysgeho.be.ref.entity.TabTypRdv; import com.bondeko.sysgeho.ui.core.base.ServiceLocatorException; import com.bondeko.sysgeho.ui.core.base.SysGehoCtrl; import com.bondeko.sysgeho.ui.core.base.Traitement; import com.bondeko.sysgeho.ui.ref.util.RefSvcoDeleguate; import com.bondeko.sysgeho.ui.ref.util.RefTrt; import com.bondeko.sysgeho.ui.ref.vue.TypRdvVue; public class TypRdvCtrl extends SysGehoCtrl<TabTypRdv, TabTypRdv>{ /** * Nom du Bean managé par JSF dans le fichier de Configuration */ private static String nomManagedBean = "typRdvCtrl"; public TypRdvCtrl(){ defaultVue = new TypRdvVue(); } /** * Retourne le nom du Bean Managé par JSF dans le Fichier de Configuration * Utilile pour ne pas avoir a ecrire le nom des Beans en dur dans le Code * @return */ public String getNomManagedBean(){ return nomManagedBean; } public IBaseSvco<TabTypRdv> getEntitySvco() throws ServiceLocatorException{ return RefSvcoDeleguate.getSvcoTypRdv(); } public Class<TypRdvCtrl> getMyClass() { return TypRdvCtrl.class; } public String enregistrerModification(){ try { getEntitySvco().modifier(defaultVue.getEntiteCourante()); } catch (SysGehoAppException e) { e.printStackTrace(); } catch (ServiceLocatorException e) { e.printStackTrace(); } return "TypRdvDetails"; } @Override public List<Traitement> getListeTraitements() { String v$codeEntite = "TypRdv"; // Ensemble des traitements standards Map<String, Traitement> v$mapTrt = new TreeMap<String, Traitement>( RefTrt.getTrtStandards(v$codeEntite)); listeTraitements = Traitement.getOrderedTrt(v$mapTrt); return listeTraitements; } @Override public void buildListeTraitement(){ if(getMapTraitements() == null){ setMapTraitements(RefTrt.getTrtStandards("TypRdv")) ; } } @Override public List<TabTypRdv> rechercherParCritere(TabTypRdv p$entity) throws SysGehoAppException { try { super.setTimeOfLastSearch(); return RefSvcoDeleguate.getSvcoTypRdv().rechercherParCritere(p$entity); } catch (ServiceLocatorException e) { e.printStackTrace(); }catch (SysGehoAppException e) { SysGehoAppException sdr = new SysGehoAppException(e.getMessage()); throw sdr; } return null; } }
[ "b.nanfack@gmail" ]
b.nanfack@gmail
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() + "'"); } } } } }
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(); } }
f8267e3bc5a5981bf71ba3f286a51c6f56e47e9e
840badfc99e466bcfd179d0522ef8cc5fc19c7e7
/src/SimpleStudentDatabase/Home.java
921224b8e73d8542dfbaf3d543c791447743cf64
[]
no_license
Harepitlord/Basic_Java_Swing_Forms
a8dfe59767f0536b3d2ae0f37776afbcae04a489
0d6de48b9d515d9d8aaeeb2a5b8aca3fbf3ad30c
refs/heads/master
2023-07-04T00:51:56.964261
2021-08-01T13:56:35
2021-08-01T13:56:35
389,930,589
1
0
null
null
null
null
UTF-8
Java
false
false
4,895
java
package SimpleStudentDatabase; import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.border.LineBorder; import java.awt.*; public class Home { Student student; JFrame frame; JButton login,signup,update,delete,search,logOut; JPanel panel,spanel; JLabel intro,welcome; Database dbase; // Constructors public Home(Database d) { this.student = null; this.dbase = d; this.prepareInterface(); } public Home(Student s,Database d) { this.student = s; this.dbase = d; this.prepareInterface(); } private void prepareInterface() { this.prepareButtons(); this.prepareLabels(); this.prepareActionListeners(); this.preparePanels(); this.prepareFrames(); this.addElements(); } // This function initializes the buttons with text and additional modification private void prepareButtons() { this.login = new JButton("Login"); this.signup = new JButton("SignUp"); this.update = new JButton("Update"); this.delete = new JButton("Delete"); this.search = new JButton("search"); if(this.student != null) { this.logOut = new JButton("Log Out"); this.logOut.setBackground(Color.blue); this.logOut.setForeground(Color.white); } this.login.setForeground(Color.white); this.signup.setForeground(Color.white); this.update.setForeground(Color.white); this.delete.setForeground(Color.white); this.search.setForeground(Color.white); this.login.setBackground(Color.blue); this.signup.setBackground(Color.blue); this.update.setBackground(Color.BLUE); this.delete.setBackground(Color.blue); this.search.setBackground(Color.blue); // this.signup.addActionListener(this); // this.update.addActionListener(this); // this.delete.addActionListener(this); // this.search.addActionListener(this); } private void prepareActionListeners() { this.login.addActionListener(e->{ new LoginForm(this.dbase); this.frame.dispose(); }); if(this.student != null) { this.logOut.addActionListener(e -> this.signOut()); } this.signup.addActionListener(e -> { new RegistrationForm(this.dbase); this.frame.dispose(); }); this.update.addActionListener(e -> { new UpdateForm(this.student,this.dbase); this.frame.dispose(); }); this.delete.addActionListener(e -> { new DeleteForm(this.student,this.dbase); this.frame.dispose(); }); // this.logOut.addActionListener(e-> new Home(this.dbase)); } // This function initializes the labels with text and additional modification private void prepareLabels() { this.intro = new JLabel("Welcome to Student Database."); if (this.student !=null) this.welcome = new JLabel("Hi "+this.student.getName()); } // This function initializes the panels with required configurations. private void preparePanels() { this.spanel = new JPanel(); this.panel = new JPanel(); this.spanel.setBackground(Color.white); this.spanel.setLayout(null); this.spanel.setBorder(new LineBorder(Color.BLACK,2)); this.spanel.setBounds(50,50,400,500); this.panel.setBackground(Color.white); this.panel.setLayout(new GridLayout(8,1,20,20)); this.panel.setBounds(50,50,300,350); this.panel.setBorder(new EmptyBorder(new Insets(10,10,10,10))); } private void prepareFrames() { this.frame = new JFrame("Student Database"); this.frame.getContentPane().setBackground(Color.blue); this.frame.setLayout(null); this.frame.setSize(600,700); this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.frame.setVisible(true); this.frame.setResizable(true); } // This function adds the elements to their respective containers private void addElements() { if(this.student != null) this.panel.add(this.welcome); this.panel.add(this.intro); if(this.student == null) { this.panel.add(this.login); this.panel.add(this.signup); } if(this.student != null) { this.panel.add(this.update); this.panel.add(this.delete); this.panel.add(this.logOut); } this.spanel.add(this.panel); this.frame.add(this.spanel); } // } // else if(this.logOut.isSelected()) { // this.signOut(); // } private void signOut() { this.frame.dispose(); new Home(this.dbase); } }
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; } }
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; } }
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(); } }
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()); } })); } }
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 */
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); } }
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; } }
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); } }
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; } }
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; } }
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(); } }
e6e4cdf4c4320a997671d1a113515b98fae3f261
c8b28dfc3ef72aac635e4e0a25cfa3dbb5edc28b
/Source Code/src/SHA_256.java
4ad851dac85ad8916e9e1cf08b91c911970b784d
[ "Apache-2.0" ]
permissive
ceezay/CryptoKeep
f7e70008c1750dcaaa8d9175f1eb1a0553edee62
0772633ca15a3d25aae7cbfcbf4698853c35bc37
refs/heads/master
2022-11-12T17:44:51.754860
2020-07-12T17:34:05
2020-07-12T17:34:05
279,114,515
1
0
null
null
null
null
UTF-8
Java
false
false
1,149
java
import java.math.BigInteger; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; // Java program to calculate SHA hash value public class SHA_256 { public static byte[] getSHA(String input) throws NoSuchAlgorithmException { // Static getInstance method is called with hashing SHA MessageDigest md = MessageDigest.getInstance("SHA-256"); // digest() method called // to calculate message digest of an input // and return array of byte return md.digest(input.getBytes(StandardCharsets.UTF_8)); } public static String toHexString(byte[] hash) { // Convert byte array into signum representation BigInteger number = new BigInteger(1, hash); // Convert message digest into hex value StringBuilder hexString = new StringBuilder(number.toString(16)); // Pad with leading zeros while (hexString.length() < 32) { hexString.insert(0, '0'); } return hexString.toString(); } }
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
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); } }
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; } }
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."); } }
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); } }
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 ); }
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); } }
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+"]"; } }
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); } }
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
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); } } }
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
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; } }
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; } }
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); }); } }
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); }
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); } }
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("[email protected]")); // // 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(); } // } // // } }
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); } }
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{ }
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"; } }
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(); } } }
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); } }
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); } }
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; } }
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); } }
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(); } }
7d5fd1627c4a6bb585ffe80692f94058e9b390a2
af42f13ff57ed7c478d62c8d35375bb29d0ec9ba
/generated/source/buildConfig/debug/com/arnab/skinsense/BuildConfig.java
fdb18ee89bc45d7fe754d9b13ec940f5aa49eba6
[ "MIT" ]
permissive
Devesh929/UPES_SUBMISSION
c7f7346cd56a5a10c6f9c4f168ca11c8bd489ad0
a08d99139be8946ec1ed00e8be7fa5b6d120f8d6
refs/heads/master
2020-05-07T13:35:45.288433
2019-04-10T10:30:19
2019-04-10T10:30:19
180,556,120
1
0
null
null
null
null
UTF-8
Java
false
false
445
java
/** * Automatically generated file. DO NOT MODIFY */ package com.arnab.skinsense; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.arnab.skinsense"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
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); }
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); } }
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; } }
13ffcf5073464ef31c6154a0c906bd7f2f577ecb
62e454ce323bf602fd61303919faf10726315b0f
/bootJpa/src/main/java/com/example/demo/controller/AlienController.java
25042e4e2b3e09d599b9c9e29736da83d58a382f
[]
no_license
SravanthiMalepati/SpringBoot-SpringMVC-Postman
2875e9fcde89fc349408071930e3e89ef9d4e2a8
83f795951d6135e1cb46573dbb88a7f2114b7625
refs/heads/main
2023-02-24T09:02:44.121193
2021-01-31T02:34:54
2021-01-31T02:34:54
334,554,069
1
0
null
null
null
null
UTF-8
Java
false
false
1,164
java
package com.example.demo.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import com.example.demo.dao.AlienRepo; import com.example.demo.model.Alien; @RestController public class AlienController { @Autowired AlienRepo repo; @RequestMapping("/") //@RequestMapping(value = "/", method = RequestMethod.GET) //@GetMapping(path="/") public String home() { return "home.jsp"; } @RequestMapping("/addAlien") public String addAlien(Alien alien) { repo.save(alien); return "home.jsp"; } @RequestMapping("/getAlien") public ModelAndView getAlien(@RequestParam int aid) { ModelAndView mv=new ModelAndView("ShowAlien.jsp"); Alien alien=repo.findById(aid).orElse(new Alien()); System.out.println(repo.findByTech("Java")); System.out.println(repo.findByAidGreaterThan(102)); System.out.println(repo.findByTechSorted("Java")); mv.addObject(alien); return mv; } }
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()); } }
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; } }
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"); } }
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; }
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 { }
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; } } }
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); } }
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 ""; } }
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********************************/ }
0d7d9db9acc9eefe900a363c9d2c9f15152fec69
eeebe20c8ce21b4fe90ac7eff71712d371a6ba4f
/Part-1/part01-Part01_10.Story/src/main/java/Story.java
79af7275e9c4afd568b0bcc8fb59cad0666380ce
[]
no_license
GuptaAnubhav1/Java-Mooc.fi
9d511d7515384c5f6c943c2476975fd297d7c19c
f7f7b4d18e9ffb75cfff29dc2ff1cf1f34db7d55
refs/heads/master
2023-02-20T18:11:26.424695
2023-02-14T09:55:59
2023-02-14T09:55:59
269,365,109
1
0
null
2023-02-14T09:56:54
2020-06-04T13:19:34
Java
UTF-8
Java
false
false
802
java
import java.util.Scanner; public class Story { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("I will tell you a story, but I need some information first.\n" + "What is the main character called?"); String reply = scanner.nextLine(); System.out.println("What is their job?"); String reply1 =scanner.nextLine(); System.out.println("Here is the story:"); System.out.println("Once upon a time there was "+ reply + ", who was "+ reply1 + "."); System.out.println("On the way to work, "+ reply + " reflected on life."); System.out.println("Perhaps "+ reply + " will not be " + reply1 + " forever."); } }
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()); } }
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); } }
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
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; } }
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); }
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; } } }
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("[email protected]"); } public void typePass() { driver.findElement(pass).sendKeys("Welcome123"); } public void clickOnLogin() { driver.findElement(login).click(); } }
[ "BAIRAGI@IPSITA" ]
BAIRAGI@IPSITA
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; } }
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 张挺([email protected]) * @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); } }