blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
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
listlengths
1
1
author_id
stringlengths
0
313
161097b55227452cf34c1e1d63b46d0cee36a1dd
d713508527f3811a40b80386d998a87e12b7c09d
/core/src/main/java/me/eroshenkoam/examples/rules/WebDriverRule.java
f9433d4ea597efa668c12f83b3913e3f64b9eff1
[]
no_license
pazone/webtests-example
5632517c972c5191417c36b94eb0d957b08c60d3
bfb6f6512e996a04d152a3786b66ae628fd28d9c
refs/heads/master
2020-12-31T01:02:37.304649
2016-04-11T11:34:27
2016-04-11T11:34:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package me.eroshenkoam.examples.rules; import org.junit.rules.ExternalResource; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; /** * @author eroshenkoam */ public class WebDriverRule extends ExternalResource { private WebDriver driver; protected void before() throws Throwable { this.driver = new FirefoxDriver(); } protected void after() { driver.close(); driver.quit(); } public WebDriver getDriver() { return driver; } }
[ "eroshenkoam@iMac-Artem.local" ]
eroshenkoam@iMac-Artem.local
759d73ea5b795b6a82eb5d9bd368559744738a90
4cee3f75b27976b7dd56c343fb2a9be1f50c2e9d
/src/main/java/com/teset/job/Hello3Job.java
d9c125b46f65f50e995876b45b47c1eec42fba9a
[]
no_license
icerun/quartz-timing-task-project
3ccfcb913e6fe81b3590508330475b4387dacc06
d6d0a035c6d6a821aaea8918826409140098f3a9
refs/heads/master
2023-06-28T11:52:39.746116
2021-07-27T15:41:29
2021-07-27T15:41:29
390,030,253
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
package com.teset.job; import org.quartz.JobDataMap; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.springframework.scheduling.quartz.QuartzJobBean; public class Hello3Job extends QuartzJobBean { @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { // 获取参数 JobDataMap jobDataMap = context.getJobDetail().getJobDataMap(); System.err.println("hello world 3333333333"); } }
[ "webber678@163.com" ]
webber678@163.com
d7ae16eb64d2fb2a59a1e9ba464b5d727fcf9c5d
b43a9de04da6c3a6c0cfa6e05c7822b7bec6d344
/hw4/bearmaps/hw4/integerhoppuzzle/IntegerHopGraph.java
740afc3b028ec57c943c5da8701b12389c369bb6
[ "Apache-2.0" ]
permissive
staugust/cs61b
81a7851403ff5471ee2e063f01ec955479d03244
f43b8efaa26b505b75c8437b66e448fdbbec8919
refs/heads/master
2023-08-28T18:27:45.105402
2019-11-15T06:11:16
2019-11-15T06:11:16
206,216,871
0
0
Apache-2.0
2023-08-15T17:40:51
2019-09-04T02:48:16
Java
UTF-8
Java
false
false
1,027
java
package bearmaps.hw4.integerhoppuzzle; import bearmaps.hw4.AStarGraph; import bearmaps.hw4.WeightedEdge; import java.util.ArrayList; import java.util.List; /** * The Integer Hop puzzle implemented as a graph. * Created by hug. */ public class IntegerHopGraph implements AStarGraph<Integer> { @Override public List<WeightedEdge<Integer>> neighbors(Integer v) { ArrayList<WeightedEdge<Integer>> neighbors = new ArrayList<>(); neighbors.add(new WeightedEdge<>(v, v * v, 10)); neighbors.add(new WeightedEdge<>(v, v * 2, 5)); neighbors.add(new WeightedEdge<>(v, v / 2, 5)); neighbors.add(new WeightedEdge<>(v, v - 1, 1)); neighbors.add(new WeightedEdge<>(v, v + 1, 1)); return neighbors; } @Override public double estimatedDistanceToGoal(Integer s, Integer goal) { // possibly fun challenge: Try to find an admissible heuristic that // speeds up your search. This is tough! return 0; } }
[ "josh@joshh.ug" ]
josh@joshh.ug
f61915781cc2483d1fcce469a91f52d4b256f0f7
305b5e2a03383bc31008655ef7b3c270a1e631e3
/src/java/com/aliyuncs/alidns/model/v20150109/DescribeDomainNsResponse.java
a7b58fbbb7d7d4d51e6c9b001b277710de6e6b5e
[]
no_license
key563/ddns
259527386abeeffe2e8ae38b94b8ef135a21331e
cf98b0f14408cfe87133320e4093a7919ce0bbb7
refs/heads/master
2020-03-19T04:09:03.591813
2018-06-02T08:18:43
2018-06-02T08:18:43
135,799,592
1
0
null
null
null
null
UTF-8
Java
false
false
1,802
java
/* * 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.aliyuncs.alidns.model.v20150109; import com.aliyuncs.transform.UnmarshallerContext; import java.util.List; import com.aliyuncs.AcsResponse; import com.aliyuncs.alidns.transform.v20150109.DescribeDomainNsResponseUnmarshaller; /** * @author auto create * @version */ public class DescribeDomainNsResponse extends AcsResponse { private String requestId; private Boolean allAliDns; private Boolean includeAliDns; private List<String> dnsServers; public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public Boolean getAllAliDns() { return this.allAliDns; } public void setAllAliDns(Boolean allAliDns) { this.allAliDns = allAliDns; } public Boolean getIncludeAliDns() { return this.includeAliDns; } public void setIncludeAliDns(Boolean includeAliDns) { this.includeAliDns = includeAliDns; } public List<String> getDnsServers() { return this.dnsServers; } public void setDnsServers(List<String> dnsServers) { this.dnsServers = dnsServers; } @Override public DescribeDomainNsResponse getInstance(UnmarshallerContext context) { return DescribeDomainNsResponseUnmarshaller.unmarshall(this, context); } }
[ "key563563@gmail.com" ]
key563563@gmail.com
4bf2ba4acb42320ad49ec2a9b4274952397c7dc5
03f5ac7039f8b64dffeb68c86e97d4615b39c466
/auth-service/src/main/java/com/vskubev/business/authservice/exception/CustomOAuthExceptionSerializer.java
3748f8eae13e0825db101741d16999a612d4d774
[]
no_license
vskubev/business
c8e98107c63e30b1e4492610b7577a1f3e94fc88
472f0bfd09fdc3bb13feecd91ced511bfac1f7fe
refs/heads/master
2020-09-28T15:33:40.000338
2020-09-08T17:19:53
2020-09-08T17:19:53
226,806,461
0
0
null
2020-09-08T17:19:54
2019-12-09T07:03:32
Java
UTF-8
Java
false
false
1,356
java
package com.vskubev.business.authservice.exception; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import org.springframework.http.HttpStatus; import java.io.IOException; import java.util.Map; /** * @author skubev */ public class CustomOAuthExceptionSerializer extends StdSerializer<CustomOAuthException> { public CustomOAuthExceptionSerializer() { super(CustomOAuthException.class); } @Override public void serialize(CustomOAuthException value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("httpStatus", HttpStatus.valueOf(value.getHttpErrorCode()).name()); jsonGenerator.writeNumberField("status", value.getHttpErrorCode()); jsonGenerator.writeStringField("message", value.getMessage()); if (value.getAdditionalInformation()!=null) { for (Map.Entry<String, String> entry : value.getAdditionalInformation().entrySet()) { String key = entry.getKey(); String add = entry.getValue(); jsonGenerator.writeStringField(key, add); } } jsonGenerator.writeEndObject(); } }
[ "vvskubiev@gmail.com" ]
vvskubiev@gmail.com
3ee536c0d02955f9408accf576f540ae85cb5569
5e9254eef4ca08bec3bb37d79f1daa24f00d9d50
/app/src/main/java/edu/gatecg/cs2340/rattitudem4/User.java
2a56974c443bc5362541935341bb8fc8b590e58a
[]
no_license
daltontouch/RattitudeM4
5e36cb26c79f8273ae7e2fcfeb2e377ea47d9b20
22213895024cd58f9dd1da8f7fa17250a6432250
refs/heads/master
2021-07-05T16:01:18.950753
2017-09-29T18:25:32
2017-09-29T18:25:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
843
java
package edu.gatecg.cs2340.rattitudem4; /** * Created by kcox8 on 9/28/2017. */ public class User { private String username; private String password; private String firstName; private String lastName; public void setPassword(String password) { this.password = password; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } }
[ "kcox40@gatech.edu" ]
kcox40@gatech.edu
d0379876a1164faf6acccc7c26c0fff247aa4ed4
115c49f1c49e2e50db6da314ba8e3c15c015c507
/BrahianVT/day12/RandomConstant.java
e622930af671721a58ef547e8ad1b3ff079ff15e
[]
no_license
aswinavofficial/LeetCode-June-Challenge
181bdf754aa8033427d5d76590913833d2c1acb0
8fa8fefb70126f08cc070f8b79c359b3c09e9c90
refs/heads/master
2022-11-07T00:45:49.148416
2020-07-01T06:09:16
2020-07-01T06:09:16
268,333,902
0
1
null
2020-07-01T06:09:17
2020-05-31T17:54:24
Java
UTF-8
Java
false
false
1,918
java
/** Design a data structure that supports all following operations in amortized time O(1) You should implements the next three operations 1 Insert(val): Inserts an item val to the data structure if not already present 2 Remove(val): Removes an item 3 getRandom: Return a random element from the data structure Note: Duplicates values are not allowed Condiderations : Due to need constime time n average for insert, delete and random that is like a get or search, we can consider the next data structures Hash / HashMap: insert: O(1) delete:O(1) get:O(n) Array/ list indexables: insert at the end:O(1) delete at the end: O(1): get:O(1) So basically here we need to use a combinations of both to resolve the problem Here we will store the elements in a hashMap and in arrayList with the hashMap resolve insert and delete operations, and with arraylist resolve getRandom. So in the hashMap store the value and the index for the arrayList and every time you need to call getRandom get the index from the map and pass it to the array. @author Brahian VT */ import java.util.*; public class RandomConstant{ private Map<Integer, Integer> map; private List<Integer> array; private Random r; public RandomConstant(){ r = new Random(); map = new HashMap<>(); array = new ArrayList<>(); } public boolean insert(int val){ if(map.containsKey(val)) return false; // Here val is the kay and the index will be the index int index = (array.size() == 0)?0:array.size() -1; map.put(val, index ); array.add(val); return true; } public boolean remove(int val){ if(map.containsKey(val)){ int index = map.get(val); int lastElementIndex = array.size() -1; Collections.swap(array, index, lastElementIndex); array.remove(val); map.remove(val); return true; } return false; } public int getRandom(){ return array.get(r.nextInt(array.size())); } }
[ "pumasemj@hotmail.com" ]
pumasemj@hotmail.com
59c983c4209c42f5b79f712bdbd33239c64e99be
45b17c77b8a9d29eaf1fa68c286700bcefe46e12
/app/src/main/java/comq/example/kita/kanemochiandroid/MypageActivity.java
3cee367c39e2b01ac9480acb5d5eb33c44ecf7f6
[]
no_license
khong-gh/kanemochiAndroid
3097ae355b4e4c43e9785e1cdbbb32879a108b03
416f7b7396ca9063848a932f1afe59dcc3d61dcf
refs/heads/master
2021-09-03T09:14:43.652962
2018-01-08T00:30:30
2018-01-08T00:30:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
734
java
package comq.example.kita.kanemochiandroid; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; public class MypageActivity extends AppCompatActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mypage); } public void write(View view){ Intent intent = new Intent(MypageActivity.this, WriteActivity.class); startActivityForResult(intent,100); } public void chart(View view){ Intent intent = new Intent(MypageActivity.this, ChartActivity.class); startActivityForResult(intent,200); } }
[ "gpark5425@gmail.com" ]
gpark5425@gmail.com
02894c6e2904c72aed5ad7e376ba389e6cceff30
7cf78d9f7cdc170b5ae65780dbdb7759721c7f53
/Gurukula/src/Testing/Actions.java
81e7fc508dee8eeecbdcff2ab71d5b8e8210eae5
[]
no_license
BogdanAdamutiu/Gurukula
a0b517d31082160a0e184aa9c4c7c3be1aa9e584
c92c52d987dc32a317ba0602781539c5af8eefec
refs/heads/master
2021-04-03T05:00:07.597430
2018-03-15T22:33:26
2018-03-15T22:33:26
120,810,525
0
0
null
null
null
null
UTF-8
Java
false
false
54,826
java
package Testing; import java.io.IOException; import java.util.Set; import java.util.concurrent.TimeUnit; import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.Cookie; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.Select; import org.testng.Assert; import org.testng.ITestContext; import org.testng.Reporter; import org.testng.annotations.DataProvider; import org.testng.annotations.Parameters; import org.testng.annotations.Test; public class Actions { private static final Logger log = Logger.getLogger(Loggin.class); FirefoxDriver Mozila = new FirefoxDriver(); String Results = ""; String SecondResults = ""; String Status = ""; String BranchCheck = ""; String CodeCheck = ""; String IDCheck = ""; String StaffCheck = ""; String ViewedBranch = ""; String ViewedCode = ""; String BranchSecondCheck = ""; String CodeSecondCheck = ""; String StaffSecondCheck = ""; String FirstNameCheck = ""; String LastNameCheck = ""; String EmailCheck = ""; String LanguageCheck = ""; int NrOfResults = 0; int SecondNrOfResults = 0; int Error = 0; int Matched = 0; int Decrement = 0; int DeletedStaffs = 0; @Test public void OpenBrowser() { Mozila.manage().window().maximize();; Mozila.navigate().to("http://192.168.178.227:8080/"); Mozila.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); log.info("Web application launched"); if (Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div[2]/h1")).isDisplayed()) { Reporter.log("Application lauched successfully"); } else { Reporter.log("Application didn't lauched successfully"); } } @DataProvider(name = "Authentication") public static Object[][] credentials(ITestContext TestName) { if (TestName.getName().equalsIgnoreCase("Login Verification")) { return new Object[][] { { "" , "" , "no"} , { "admin" , "" , "no"} , { "" , "admin" , "no"} , { "admin" , "wrong" , "no"} , { "wrong" , "admin" , "no"} , { "admin" , "admin" , "error"} , { "admin" , "admin" , "no"} }; } else { return new Object[][] { { "admin", "admin" , "no"} }; } } @Test (dependsOnMethods = {"OpenBrowser"} , dataProvider = "Authentication") public void Login(String User, String Password, String RememberMe) throws InterruptedException, IOException { Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[1]/a[2]/span[2]")).click(); Thread.sleep(1000); log.info("Click on Home button"); //click on login Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div[2]/div/div[1]/a")).click(); Thread.sleep(1000); log.info("Click on login button"); //enter user name and password Mozila.findElement(By.xpath("//*[@id=\"username\"]")).clear(); log.info("Cleared the Username text box"); Mozila.findElement(By.xpath("//*[@id=\"password\"]")).clear(); log.info("Cleared the Password text box"); Mozila.findElement(By.xpath("//*[@id=\"username\"]")).sendKeys(User); log.info("Username entered in the Username text box"); Mozila.findElement(By.xpath("//*[@id=\"password\"]")).sendKeys(Password); log.info("Password entered in the Password text box"); Assert.assertTrue(RememberMe.equalsIgnoreCase("yes") || RememberMe.equalsIgnoreCase("no") , "In order to use remeber me functionality a value of \"yes\" or \"no\" must be assigned to the variable RememberMe!"); if (RememberMe == "no") { Mozila.findElement(By.xpath("//*[@id=\"rememberMe\"]")).click(); log.info("RememberMe check box is unchecked"); } else if (RememberMe == "yes"){ log.info("RememberMe check box is checked"); } Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/button")).click(); Thread.sleep(2000); log.info("Click action performed on Authentificate button"); Assert.assertTrue(Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul")).getAttribute("childElementCount").equalsIgnoreCase("4"), "The entered credentials are not correct!"); Reporter.log("Sign in successful"); Thread.sleep(1500); } @Test public void TestRememberLogin() throws InterruptedException, IOException { Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[1]/a[2]/span[2]")).click(); Thread.sleep(1000); log.info("Click on Home button"); //click on login Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div[2]/div/div[1]/a")).click(); Thread.sleep(1000); log.info("Click on login button"); //enter user name and password Mozila.findElement(By.xpath("//*[@id=\"username\"]")).clear(); log.info("Cleared the Username text box"); Mozila.findElement(By.xpath("//*[@id=\"password\"]")).clear(); log.info("Cleared the Password text box"); Mozila.findElement(By.xpath("//*[@id=\"username\"]")).sendKeys("admin"); log.info("Username entered in the Username text box"); Mozila.findElement(By.xpath("//*[@id=\"password\"]")).sendKeys("admin"); log.info("Password entered in the Password text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/button")).click(); Thread.sleep(2000); log.info("Click action performed on Authentificate button"); Thread.sleep(1500); //get cookies Set<Cookie> All = Mozila.manage().getCookies(); Mozila.close(); FirefoxDriver Mozila = new FirefoxDriver(); Mozila.manage().window().maximize();; Mozila.navigate().to("http://192.168.178.227:8080/"); Mozila.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); log.info("Web application launched"); for (Cookie cookie : All) { Mozila.manage().addCookie(cookie); } Mozila.navigate().refresh(); Thread.sleep(2000); Assert.assertTrue(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div[2]/div/div")).isDisplayed(), "User is no longer logged in! Remember me doesn't work"); Reporter.log("User is still logged in. Remember me works"); Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[3]/a/span/span[2]")).click(); log.info("Click action performed on Account drop down menu"); Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[3]/ul/li[4]/a/span[2]")).click(); Thread.sleep(1500); log.info("Click action performed on Log out"); Mozila.close(); } @Test (dependsOnMethods = {"Login"}) public void NavigateToBranch() throws InterruptedException { Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[2]/a/span/b")).click(); log.info("Click action performed on Entities drop down menu"); Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[2]/ul/li[1]/a/span[2]")).click(); Thread.sleep(1000); log.info("Click action performed on Branch"); if (Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/h2")).getAttribute("innerText").equalsIgnoreCase("Branches")) { Reporter.log("Opened Branch page successfully"); } else { Reporter.log("Branch page did not open"); } } @Test (dependsOnMethods = {"Login"}) public void NavigateToStaff() throws InterruptedException { Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[2]/a/span/span[2]")).click(); log.info("Click action performed on Entities drop down menu"); Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[2]/ul/li[2]/a/span[2]")).click(); Thread.sleep(1000); log.info("Click action performed on Staff"); if (Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/h2")).getAttribute("innerText").equalsIgnoreCase("Staffs")) { Reporter.log("Opened Staff page successfully"); } else { Reporter.log("Staff page did not open"); } } @Test (dependsOnMethods = {"Login"}) public void NavigateToAccountInformation() throws InterruptedException { Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[3]/a/span/span[2]")).click(); log.info("Click action performed on Account drop down menu"); Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[3]/ul/li[1]/a/span[2]")).click(); Thread.sleep(500); log.info("Click action performed on Settings"); if (Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/h2")).getAttribute("innerText").equalsIgnoreCase("User settings for [admin]")) { Reporter.log("Opened Account Information page successfully"); } else { Reporter.log("Account Information page did not open"); } } @Test (dependsOnMethods = {"Login"}) public void NavigateToPasswordChange() throws InterruptedException { Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[3]/a/span/span[2]")).click(); log.info("Click action performed on Account drop down menu"); Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[3]/ul/li[2]/a/span[2]")).click(); Thread.sleep(500); log.info("Click action performed on Password"); if (Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/h2")).getAttribute("innerText").equalsIgnoreCase("Password for [admin]")) { Reporter.log("Opened Password page successfully"); } else { Reporter.log("Password page did not open"); } } @DataProvider(name = "Branch") public static Object[][] BranchInfo(ITestContext TestName) { if (TestName.getName().equalsIgnoreCase("Branch Verification")) { return new Object[][] { { "", "" } , { "t", "2" } , { "thisusernameshouldbetolongtobeausernamewithmorethen", "12345678987654321" } , { "TESTING", "TESTING" } , { "1t2e3s4t", "1t2e3s4t" } , { "!@#$%^", "!@#$%^" } , { "1234567", "testing" } }; } else { return new Object[][] { { "Development", "123456" } , { "Financial", "987654" } , { "Human Resources", "246801" } }; } } @Test (dependsOnMethods = {"NavigateToBranch"} , dataProvider = "Branch" , priority = 0) public void CreateBranch(String Branch, String Code) throws InterruptedException, IOException { if (Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[3]/button[1]")).isDisplayed()) { Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[3]/button[1]")).click(); log.info("Click action performed on Cancel button"); } Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[1]/div/div[1]/button")).click(); Thread.sleep(1000); log.info("Click action performed on Create a new Branch button"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/input")).sendKeys(Branch); log.info("Name entered in the Branch Name text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[3]/input")).sendKeys(Code); log.info("Code entered in the Branch Code text box"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/div/p[1]")).isDisplayed(), "Branch name " + Branch + " can't be set as a branch name because it doesn't respect the format standard"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/div/p[2]")).isDisplayed(), "Branch name " + Branch + " can't be set as a branch name because it doesn't respect the format standard"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/div/p[3]")).isDisplayed(), "Branch name " + Branch + " can't be set as a branch name because it doesn't respect the format standard"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/div/p[4]")).isDisplayed(), "Branch name " + Branch + " can't be set as a branch name because it doesn't respect the format standard"); log.info("The format of the branch name was checked and it is according to the standard"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[3]/div/p[1]")).isDisplayed(), "Branch code " + Code + " can't be set as a branch code because it doesn't respect the format standard"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[3]/div/p[2]")).isDisplayed(), "Branch code " + Code + " can't be set as a branch code because it doesn't respect the format standard"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[3]/div/p[3]")).isDisplayed(), "Branch code " + Code + " can't be set as a branch code because it doesn't respect the format standard"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[3]/div/p[4]")).isDisplayed(), "Branch code " + Code + " can't be set as a branch code because it doesn't respect the format standard"); log.info("The format of the branch code was checked and it is according to the standard"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[3]/button[2]")).click(); log.info("Click action performed on Save button"); Thread.sleep(1000); Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).clear(); log.info("Cleared the search text box"); Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).sendKeys(Branch); log.info("Entered the name of the newly created branch in the search text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[1]/div/div[2]/form/button")).click(); Thread.sleep(1000); log.info("Click action performed on Search a Branch button"); //check that there is at least one branch with the given name and code Results = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody")).getAttribute("childElementCount"); NrOfResults = Integer.parseInt(Results); Assert.assertTrue(NrOfResults > 0 , "The branch with the name "+ Branch +" and code "+ Code +" hasn't been created"); for (int i = 1; i <= NrOfResults; i++) { BranchCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[2]")).getAttribute("innerText"); CodeCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[3]")).getAttribute("innerText"); if (BranchCheck.equalsIgnoreCase(Branch) && CodeCheck.equalsIgnoreCase(Code)) { Reporter.log("The branch with the name "+ Branch +" and code "+ Code +" has been created"); } else if (i == NrOfResults){ Reporter.log("The branch with the name "+ Branch +" and code "+ Code +" hasn't been created"); } } } @DataProvider(name = "Staff") public static Object[][] StaffInfo(ITestContext TestName) { if (TestName.getName().equalsIgnoreCase("Staff Verification")) { return new Object[][] { { "" , "QA Team" } , { "t" , "Human Resources" } , { "thisusernameshouldbetolongtobeausernamewithmorethen" , "Human Resources" } , { "TESTING" , "QA Team" } , { "1t2e3s4t" , "Human Resources" } , { "!@#$%^ " , "Human Resources" } , { "1234567" , "QA Team" } }; } else { return new Object[][] { { "Tester" , "QA Team" } , { "QA Engineer" , "QA Team" } , { "Recruter" , "Human Resources" } }; } } @Test (dependsOnMethods = {"NavigateToStaff"} , dataProvider = "Staff" , priority = 5) public void CreateStaff(String Staff, String AssigningBranch) throws InterruptedException, IOException { if (Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[3]/button[1]")).isDisplayed()) { Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[3]/button[1]")).click(); log.info("Click action performed on Cancel button"); } Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[1]/div/div[1]/button")).click(); Thread.sleep(1500); log.info("Click action performed on Create a new Staff button"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/input")).sendKeys(Staff); Thread.sleep(500); log.info("Name entered in the Staff Name text box"); //check that the name of the staff respects the standard Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/div/p[1]")).isDisplayed(), "Staff name "+ Staff +" can't be set as a branch name because it doesn't respect the format standard"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/div/p[2]")).isDisplayed(), "Staff name "+ Staff +" can't be set as a branch name because it doesn't respect the format standard"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/div/p[3]")).isDisplayed(), "Staff name "+ Staff +" can't be set as a branch name because it doesn't respect the format standard"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/div/p[4]")).isDisplayed(), "Staff name "+ Staff +" can't be set as a branch name because it doesn't respect the format standard"); log.info("The format of the staff name was checked and it is according to the standard"); //create a select that contains all the available branches Select SelectBranch = new Select(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[3]/select"))); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[3]/select")).click(); Thread.sleep(500); log.info("Branch list has been opened"); SelectBranch.selectByVisibleText(AssigningBranch); log.info("Desired branch has been selected"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[3]/button[2]")).click(); Thread.sleep(1500); log.info("Click action performed on Save button"); //check that there is at least one staff in the staff list after the save button has been pressed Results = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody")).getAttribute("childElementCount"); NrOfResults = Integer.parseInt(Results); Assert.assertTrue(NrOfResults > 0 , "The Staff with the name "+ Staff +" hasn't been created"); for (int i = 1; i <= NrOfResults; i++) { StaffCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[2]")).getAttribute("innerText"); BranchCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[3]")).getAttribute("innerText"); if (StaffCheck.equalsIgnoreCase(Staff) && BranchCheck.equalsIgnoreCase(AssigningBranch)) { Reporter.log("The staff with the name "+ Staff +" and assigning branch "+ AssigningBranch +" has been created"); } } } @Test (dependsOnMethods = {"NavigateToBranch"} , priority = 1) @Parameters ({"BranchNameView" , "BranchCodeView"}) public void ViewBranch(String BranchName, String BranchCode) throws InterruptedException, IOException { Matched = 0; Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).clear(); log.info("Cleared the branch search text box"); Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).sendKeys(BranchName); log.info("Entered the branch name in to the search text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[1]/div/div[2]/form/button")).click(); Thread.sleep(1000); log.info("Click action performed on the Search button"); //check if a branch with the given name exists Results = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody")).getAttribute("childElementCount"); NrOfResults = Integer.parseInt(Results); Assert.assertFalse(NrOfResults == 0, "You tried to view a non existing branch!"); for (int i = 1; i <= NrOfResults; i++) { //search for the branch with the desired name and code BranchCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[2]")).getAttribute("innerText"); CodeCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[3]")).getAttribute("innerText"); if (BranchCheck.equalsIgnoreCase(BranchName) && CodeCheck.equalsIgnoreCase(BranchCode)) { Matched ++; Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[4]/button[1]")).click(); Thread.sleep(1000); log.info("Click action performed on the View button"); Status = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/h2/span")).getAttribute("innerText"); ViewedBranch = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/table/tbody/tr[1]/td[2]/input")).getAttribute("defaultValue"); ViewedCode = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/table/tbody/tr[2]/td[2]/input")).getAttribute("defaultValue"); Assert.assertTrue(Status.equalsIgnoreCase("Branch"), "You are not on the branch view page"); Assert.assertTrue(ViewedBranch.equalsIgnoreCase(BranchName), "The branch with the name "+ BranchName +" and code "+ BranchCode +" hasn't been viewed!"); Assert.assertTrue(ViewedCode.equalsIgnoreCase(BranchCode), "The branch with the name "+ BranchName +" and code "+ BranchCode +" hasn't been viewed!"); Reporter.log("Branch "+ BranchName +" with code "+ BranchCode +" has been viewed"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/button")).click(); log.info("Click action performed on the Return button"); } } Assert.assertFalse(Matched == 0, "The branch with the name "+ BranchName +" and code "+ BranchCode +" doesn't exist and can't be viewed!"); } @Test (dependsOnMethods = {"NavigateToStaff"} , priority = 6) @Parameters ({"StaffNameView" , "StaffBranchView"}) public void ViewStaff(String StaffName, String StaffBranch) throws InterruptedException, IOException { Matched = 0; Results = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody")).getAttribute("childElementCount"); NrOfResults = Integer.parseInt(Results); Assert.assertFalse(NrOfResults == 0, "You tried to view a non existing staff"); for (int i = 1; i <= NrOfResults; i++) { //search for the staff with the desired name and branch StaffCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[2]")).getAttribute("innerText"); BranchCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[3]")).getAttribute("innerText"); if (StaffCheck.equalsIgnoreCase(StaffName) && BranchCheck.equalsIgnoreCase(StaffBranch)) { Matched ++; Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[4]/button[1]")).click(); Thread.sleep(1000); log.info("Click action performed on the View button"); Status = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/h2/span")).getAttribute("innerText"); String StaffView = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/table/tbody/tr[1]/td[2]/input")).getAttribute("defaultValue"); String BranchView = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/table/tbody/tr[2]/td[2]/input")).getAttribute("defaultValue"); Assert.assertTrue(Status.equalsIgnoreCase("Staff"), "You are not on the staff view page"); Assert.assertTrue(StaffView.equalsIgnoreCase(StaffName), "The staff with the name "+ StaffName +" and assigned branch "+ StaffBranch +" hasn't been viewed!"); Assert.assertTrue(BranchView.equalsIgnoreCase(StaffBranch), "The staff with the name "+ StaffName +" and assigned branch "+ StaffBranch +" hasn't been viewed!"); Reporter.log("Staff "+ StaffName +" with assigned branch "+ StaffBranch +" has been viewed"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/button")).click(); log.info("Click action performed on the Return button"); } } Assert.assertFalse(Matched == 0, "The staff with the name "+ StaffName +" and assigned branch "+ StaffBranch +" doesn't exist and can't be viewed!"); } @Test (dependsOnMethods = {"NavigateToBranch"} , priority = 2) @Parameters ({"BranchToEdit" , "NewBranchName" , "CodeToEdit" , "NewBranchCode"}) public void EditBranch(String Name, String NewName, String Code, String NewCode) throws InterruptedException, IOException { Matched = 0; //search for the branch you want to edit Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).clear(); log.info("Cleared the branch search text box"); Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).sendKeys(Name); log.info("Entered the branch name in to the search text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[1]/div/div[2]/form/button")).click(); Thread.sleep(1500); log.info("Click action performed on the Search button"); Results = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody")).getAttribute("childElementCount"); NrOfResults = Integer.parseInt(Results); Assert.assertFalse(NrOfResults == 0, "You tried to edit a non existing branch!"); for (int i = 1; i <= NrOfResults; i++) { BranchCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[2]")).getAttribute("innerText"); CodeCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[3]")).getAttribute("innerText"); if (BranchCheck.equalsIgnoreCase(Name) && CodeCheck.equalsIgnoreCase(Code)) { Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[4]/button[2]")).click(); Thread.sleep(1000); log.info("Click action performed on the Edit button"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/input")).clear(); log.info("Cleared the branch name text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[3]/input")).clear(); log.info("Cleared the branch code text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/input")).sendKeys(NewName); log.info("Entered the branch new name in to the name text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[3]/input")).sendKeys(NewCode); log.info("Entered the branch new code in to the code text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[3]/button[2]")).click(); Thread.sleep(1500); log.info("Click action performed on the Save button"); Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).clear(); log.info("Cleared the branch search text box"); Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).sendKeys(NewName); log.info("Entered the edited branch name in to the search text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[1]/div/div[2]/form/button")).click(); Thread.sleep(1000); log.info("Click action performed on the Search button"); SecondResults = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody")).getAttribute("childElementCount"); SecondNrOfResults = Integer.parseInt(SecondResults); Assert.assertFalse(SecondNrOfResults == 0, "There is no branch with the edited name! The edit function didn't work!"); for (int j = 1; j <= SecondNrOfResults; j++) { BranchSecondCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ j +"]/td[2]")).getAttribute("innerText"); CodeSecondCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ j +"]/td[3]")).getAttribute("innerText"); Assert.assertTrue(BranchSecondCheck.equalsIgnoreCase(NewName), "The branch with the name "+ Name +" and code "+ Code +" hasn't been edited!"); Assert.assertTrue(CodeSecondCheck.equalsIgnoreCase(NewCode), "The branch with the name "+ Name +" and code "+ Code +" hasn't been edited!"); Matched ++; Reporter.log("Branch "+ Name +" with code "+ Code +" has been edited to branch with name "+ NewName +" and code "+ NewCode); } } } Assert.assertFalse(Matched == 0, "The branch with the name "+ Name +" and code "+ Code +" hasn't been edited!"); } @Test (dependsOnMethods = {"NavigateToStaff"} , priority = 7) @Parameters ({"StaffToEdit" , "NewStaffName" , "ActualStaffBranch" , "NewStaffBranch"}) public void EditStaff(String Name, String NewName, String Branch, String NewBranch) throws InterruptedException, IOException { Matched = 0; Results = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody")).getAttribute("childElementCount"); NrOfResults = Integer.parseInt(Results); Assert.assertFalse(NrOfResults == 0, "You tried to edit a non existing staff!"); for (int i = 1; i <= NrOfResults; i++) { StaffCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[2]")).getAttribute("innerText"); BranchCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[3]")).getAttribute("innerText"); if (StaffCheck.equalsIgnoreCase(Name) && BranchCheck.equalsIgnoreCase(Branch)) { Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[4]/button[2]")).click(); Thread.sleep(1000); log.info("Click action performed on the Edit button"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/input")).clear(); log.info("Cleared the staff name text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[2]/input")).sendKeys(NewName); log.info("Entered the staff new name in to the name text box"); Select SelectBranch = new Select(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[3]/select"))); //open branch list Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[2]/div[3]/select")).click(); Thread.sleep(500); log.info("Opened the branch list"); SelectBranch.selectByVisibleText(NewBranch); log.info("Selected the branch new branch"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div/div/form/div[3]/button[2]")).click(); Thread.sleep(1500); log.info("Click action performed on the Save button"); SecondResults = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody")).getAttribute("childElementCount"); SecondNrOfResults = Integer.parseInt(Results); Assert.assertFalse(SecondNrOfResults == 0, "There is no staff with the edited name! The edit function didn't work!"); for (int j = 1; j <= SecondNrOfResults; j++) { StaffSecondCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ j +"]/td[2]")).getAttribute("innerText"); BranchSecondCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ j +"]/td[3]")).getAttribute("innerText"); Assert.assertTrue(StaffSecondCheck.equalsIgnoreCase(NewName), "The staff with the name "+ Name +" and assigned branch "+ Branch +" hasn't been edited!"); Assert.assertTrue(BranchSecondCheck.equalsIgnoreCase(NewBranch), "The staff with the name "+ Name +" and assigend branch "+ Branch +" hasn't been edited!"); Matched ++; Reporter.log("Staff "+ Name +" with assigned branch "+ Branch +" has been edited to staff with name "+ NewName +" and assigned branch "+ NewBranch); } } } Assert.assertFalse(Matched == 0, "The staff with the name "+ Name +" and assigned branch "+ Branch +" hasn't been edited!"); } @Test (dependsOnMethods = {"NavigateToBranch"} , priority = 3) @Parameters ({"BranchToDelete" , "CodeToDelete"}) public void DeteleBranch(String Name, String Code) throws InterruptedException, IOException { if (Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[3]/div/div/form/div[3]/button[1]")).isDisplayed()) { Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[3]/div/div/form/div[3]/button[1]")).click(); Thread.sleep(1000); log.info("Click action performed on the Cancel button"); } Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).clear(); log.info("Cleared the branch search text box"); Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).sendKeys(Name); log.info("Entered the branch name in to the search text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[1]/div/div[2]/form/button")).click(); Thread.sleep(1000); log.info("Click action performed on the Search button"); Results = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody")).getAttribute("childElementCount"); NrOfResults = Integer.parseInt(Results); Decrement = NrOfResults; Assert.assertFalse(NrOfResults == 0, "You tried to delete a non existing branch!"); for (int i = 1; i <= NrOfResults; i++) { BranchCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ Decrement +"]/td[2]")).getAttribute("innerText"); CodeCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ Decrement +"]/td[3]")).getAttribute("innerText"); if (BranchCheck.equalsIgnoreCase(Name) && CodeCheck.equalsIgnoreCase(Code)) { Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ Decrement +"]/td[4]/button[3]")).click(); Thread.sleep(500); log.info("Click action performed on the Delete button"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[3]/div/div/form/div[3]/button[2]")).click(); Thread.sleep(1000); log.info("Click action performed on the Confirmation delete button"); Status = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[3]/div/div/form/div[3]/button[2]")).getAttribute("disabled"); Assert.assertTrue(Status == null, "Can't delete branch with staff assigned!"); Reporter.log("Succesfully deleted branch "+ Name +" with code "+ Code); } Decrement --; } } @Test (dependsOnMethods = {"NavigateToStaff"} , priority = 8) @Parameters ({"StaffToDelete" , "StaffBranchToDelete"}) public void DeleteStaff(String Name, String Branch) throws InterruptedException, IOException { Results = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody")).getAttribute("childElementCount"); NrOfResults = Integer.parseInt(Results); Decrement = NrOfResults; Assert.assertFalse(NrOfResults == 0, "There are no staff created, so there is nothing to delete!"); for (int i = 1; i <= NrOfResults; i++) { StaffCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[2]")).getAttribute("innerText"); BranchCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[3]")).getAttribute("innerText"); if (StaffCheck.equalsIgnoreCase(Name) && BranchCheck.equalsIgnoreCase(Branch)) { Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[4]/button[3]")).click(); Thread.sleep(500); log.info("Click action performed on the Delete button"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[3]/div/div/form/div[3]/button[2]")).click(); Thread.sleep(500); log.info("Click action performed on the Confirmation delete button"); DeletedStaffs ++; NrOfResults --; i = 1; } } Results = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody")).getAttribute("childElementCount"); NrOfResults = Integer.parseInt(Results); if (NrOfResults == 0) { Reporter.log("Deleted a total number of "+ DeletedStaffs +" staffs with the name "+ Name +" and assigned branch "+ Branch); } for (int i = 1; i <= NrOfResults; i++) { StaffCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[2]")).getAttribute("innerText"); BranchCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[3]")).getAttribute("innerText"); Assert.assertTrue(StaffCheck.equalsIgnoreCase(Name) && BranchCheck.equalsIgnoreCase(Branch), "Staff has not been deleted"); Assert.assertTrue(DeletedStaffs == 0, "There is no staff to delete with name "+ Name +" and branch "+ Branch); Reporter.log("Staff with name "+ Name +" and assigned branch "+ Branch +" has been successfully deleted!"); } } @DataProvider(name = "SearchBranch") public static Object[][] BranchSearchCriteria() { return new Object[][] { { "Development" } , { "246801" } , { "3" } }; } @Test (dependsOnMethods = {"NavigateToBranch"} , dataProvider = "SearchBranch" , priority = 4) public void QueryBranch(String SearchCriteria) throws InterruptedException, IOException { Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).clear(); log.info("Cleared the branch search text box"); Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).sendKeys(SearchCriteria); log.info("Search information entered in the Branch Name text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[1]/div/div[2]/form/button")).click(); Thread.sleep(1000); log.info("Click action performed on the Search button"); Results = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody")).getAttribute("childElementCount"); NrOfResults = Integer.parseInt(Results); Assert.assertFalse(NrOfResults == 0, "There is no branch that contains in it the search infomation!"); for (int i = 1; i <= NrOfResults; i++) { IDCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[1]/a")).getAttribute("innerText"); BranchCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[2]")).getAttribute("innerText"); CodeCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr["+ i +"]/td[3]")).getAttribute("innerText"); Assert.assertTrue(IDCheck.equalsIgnoreCase(SearchCriteria) || BranchCheck.equalsIgnoreCase(SearchCriteria) || CodeCheck.equalsIgnoreCase(SearchCriteria), "There is no branch that contains in it the search infomation!"); Reporter.log("Found branch with the folowing information: ID "+ IDCheck +" Name "+ BranchCheck +" Code "+ CodeCheck); } } @DataProvider(name = "SearchStaff") public static Object[][] StaffSearchCriteria() { return new Object[][] { { "Tester" } , { "QA Team" } , { "3" } }; } @Test (dependsOnMethods = {"NavigateToStaff"} , dataProvider = "SearchStaff" , priority = 9) public void QueryStaff(String SearchCriteria) throws InterruptedException, IOException { Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).clear(); log.info("Cleared the staff search text box"); Mozila.findElement(By.xpath("//*[@id=\"searchQuery\"]")).sendKeys(SearchCriteria); log.info("Search information entered in the Staff Name text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[1]/div/div[2]/form/button")).click(); Thread.sleep(1000); log.info("Click action performed on the Search button"); Results = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody")).getAttribute("childElementCount"); NrOfResults = Integer.parseInt(Results); Assert.assertFalse(NrOfResults == 0, "There is no staff that contains in it the search infomation!"); for (int i = 1; i <= NrOfResults; i++) { IDCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr[" + i + "]/td[1]/a")).getAttribute("innerText"); StaffCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[4]/table/tbody/tr[" + i + "]/td[2]")).getAttribute("innerText"); Assert.assertTrue(IDCheck.equalsIgnoreCase(SearchCriteria) || StaffCheck.equalsIgnoreCase(SearchCriteria), "There is no staff that contains in it the search infomation!"); Reporter.log("Found staff with the folowing information: ID "+ IDCheck +" Name "+ BranchCheck); } } @Test (dependsOnMethods = {"NavigateToAccountInformation"} , priority = 10) @Parameters ({"FirstNameCheck" , "LastNameCheck" , "EmailCheck" , "LanguageCheck"}) public void CheckAccountInformation(String FirstName, String LastName, String Email, String Language) throws IOException { Status = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/h2")).getAttribute("innerText"); FirstNameCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/input")).getAttribute("value"); LastNameCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[2]/input")).getAttribute("value"); EmailCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[3]/input")).getAttribute("value"); LanguageCheck = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[4]/select")).getAttribute("innerText"); Assert.assertTrue(Status.equalsIgnoreCase("User settings for [admin]") && FirstNameCheck.equalsIgnoreCase(FirstName) && LastNameCheck.equalsIgnoreCase(LastName) && EmailCheck.equalsIgnoreCase(Email) && LanguageCheck.equalsIgnoreCase("English"), "The account information is incorrect!"); log.info("Account information has been checked and the information was correct"); Reporter.log("Account information is correct!"); } @DataProvider(name = "VerifyAccountInformation") public static Object[][] AccountInfo() { return new Object[][] { { "" , "" , "" } , { "testing" , "testing", "test@yahoo.com" } , { "test" , "test", "t@t" } , { "thisusernameshouldbetolongtobeausernamewithmorethen" , "thisusernameshouldbetolongtobeausernamewithmorethen" , "thisusernameshouldbetolongtobeausernamewithmorethen@yahoo.com" } , { "TESTING" , "TESTING" , "TESTING@YAHOO.COM" } , { "1t2e3s4t" , "1t2e3s4t" , "1t2e3s4t@yahoo.com" } , { "!@#$%^" , "!@#$%^" , "!@#$%^@yahoo.com" } , { "testing" , "testing" , "wrong@yahoo,com" } , { "testing" , "testing" , "incomplete@yahoo" } }; } @Test (dependsOnMethods = {"NavigateToAccountInformation"} , dataProvider = "VerifyAccountInformation" , priority = 11) public void ChangeAllAccountInformation(String FirstName, String LastName, String Email) throws InterruptedException, IOException { Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/input")).clear(); log.info("Cleared the first name text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[2]/input")).clear(); log.info("Cleared the last name text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[3]/input")).clear(); log.info("Cleared the email text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/input")).sendKeys(FirstName); log.info("Desired first name has been entered in the First Name text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[2]/input")).sendKeys(LastName); log.info("Desired last name has been entered in the Last Name text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[3]/input")).sendKeys(Email); log.info("Desired email address has been entered in the Email text box"); Thread.sleep(1000); Assert.assertTrue(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/div/p[1]")).isDisplayed(), "The chosen first name can't be set as a first name!"); Assert.assertTrue(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[2]/div/p[1]")).isDisplayed(), "The chosen last name can't be set as a last name!"); Assert.assertTrue(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[3]/div/p[1]")).isDisplayed() || Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[3]/div/p[2]")).isDisplayed() || Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[3]/div/p[3]")).isDisplayed() , "The chosen email is not a correct email address!"); Reporter.log("First name, last name and email have the correct format"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/button")).click(); Thread.sleep(1000); log.info("Click action performed on the save button"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/div[3]/strong")).isDisplayed(), "Account information hasn't been changed!"); Assert.assertTrue(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/div[1]/strong")).isDisplayed(), "Account information hasn't been changed!"); Reporter.log("Account information has been changed!"); } @DataProvider(name = "VerifyPassword") public static Object[][] Passwords() { return new Object[][] { { "", "" } , { "test", "test" } , { "thisusernameshouldbetolongtobeausernamewithmorethen", "thisusernameshouldbetolongtobeausernamewithmorethen" } , { "TESTING", "TESTING" } , { "1t2e3s4t", "1t2e3s4t" } , { "!@#$%^", "!@#$%^" } , { "testing", "newtesting" } , { "testing", "testing" } , { "admin", "admin" }}; } @Test (dependsOnMethods = {"NavigateToPasswordChange"} , dataProvider = "VerifyPassword") public void ChangePassword(String Password, String ConfirmationPassword) throws InterruptedException, IOException { Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/input")).clear(); log.info("Cleared the password text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[2]/input")).clear(); log.info("Cleared the confirmation password text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/input")).sendKeys(Password); log.info("New password has been entered in the Password text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[2]/input")).sendKeys(ConfirmationPassword); log.info("New confirmation password has been entered in the Confirmation Password text box"); Thread.sleep(1500); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/div[1]/p[1]")).isDisplayed() || Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/div[1]/p[2]")).isDisplayed() || Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/div[1]/p[3]")).isDisplayed(), "The chosen password doesn't meet the standard format!"); Reporter.log("The chosen password meets the standard format"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/button")).click(); Thread.sleep(1500); log.info("Click action performed on Save button"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/div[2]")).isDisplayed() && !Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/div[3]")).isDisplayed(), "An error has occurred! The password could not be changed."); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/div[3]")).isDisplayed(), "An error has occurred! Password and confirmation password need to be the same"); Reporter.log("Password has benn changed"); } @DataProvider(name = "VerifyUser") public static Object[][] Users() { return new Object[][] { { "testing", "test@yahoo.com" , "testing", "testing" } , { "test", "t@t" , "test", "test" } , { "thisusernameshouldbetolongtobeausernamewithmorethen", "test@" , "thisusernameshouldbetolongtobeausernamewithmorethen" , "thisusernameshouldbetolongtobeausernamewithmorethen" } , { "TESTING", "TESTING@YAHOO.COM" , "TESTING", "TESTING" } , { "1t2e3s4t", "1t2e3s4t@yahoo.com" , "1t2e3s4t", "1t2e3s4t" } , { "!@#$%^", "!@#$%^@yahoo.com" , "!@#$%^", "!@#$%^" } , { "testing", "test@yahoo,com" , "testing", "newtesting" } , { "testing", "test@" , "testing", "testing" } , { "admin", "admin@localhos" , "admin" , "admin" }}; } @Test (dependsOnMethods = {"OpenBrowser"} , dataProvider = "VerifyUser") public void RegisterUser(String User, String Email, String Password, String ConfirmationPassword) throws InterruptedException, IOException { Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[1]/a[2]/span[2]")).click(); Thread.sleep(1000); log.info("Click on Home button"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div[2]/div/div[2]/a")).click(); Thread.sleep(1500); log.info("Click action performed on Register a new user button"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/input")).clear(); log.info("Cleared the user name text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[2]/input")).clear(); log.info("Cleared the email text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[3]/input")).clear(); log.info("Cleared the password text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[4]/input")).clear(); log.info("Cleared the confirmation password text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/input")).sendKeys(User); log.info("User name has been entered in the Login text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[2]/input")).sendKeys(Email); log.info("Email address has been entered in the EMail text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[3]/input")).sendKeys(Password); log.info("Password has been entered in the Password text box"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[4]/input")).sendKeys(ConfirmationPassword); log.info("Confirmation password has been entered in the Confirmation Password text box"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/div/p[1]")).isDisplayed() || Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/div/p[2]")).isDisplayed() || Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/div/p[3]")).isDisplayed() || Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[1]/div/p[4]")).isDisplayed(), "User "+ User +" doesn't respect the standard format!"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[2]/div/p[1]")).isDisplayed() || Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[2]/div/p[2]")).isDisplayed() || Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[2]/div/p[3]")).isDisplayed(), "Email "+ Email +" doesn't respect the standard format!"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[3]/div[1]/p[1]")).isDisplayed() || Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[3]/div[1]/p[2]")).isDisplayed() || Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/div[3]/div[1]/p[3]")).isDisplayed(), "Password "+ Password +" doesn't respect the standard format!"); Reporter.log("Data format chosen for UserID, Email and Password respect the standard"); Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/form/button")).click(); Thread.sleep(1500); log.info("Click action performed on Save button"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/div[5]")).isDisplayed(), "Password "+ Password +" has to be the same as confirmation password "+ ConfirmationPassword); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/div[2]")).isDisplayed(), "An error has appeared and the user hasn't been registered!"); Assert.assertFalse(Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div/div[3]")).isDisplayed(), "A user with this name "+ User +" already exists!"); Reporter.log("User has been successfully registered"); } @Test (priority = 12) public void Logout() throws InterruptedException, IOException { Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[3]/a/span/span[2]")).click(); log.info("Click action performed on Account drop down menu"); Mozila.findElement(By.xpath("/html/body/div[2]/nav/div/div[2]/ul/li[3]/ul/li[4]/a/span[2]")).click(); Thread.sleep(1500); log.info("Click action performed on Log out"); Status = Mozila.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div[2]/h1")).getAttribute("innerText"); Assert.assertTrue(Status.equalsIgnoreCase("Welcome to Gurukula!"), "The log out action was not performed!"); Reporter.log("Logout succcessfully"); } @Test (dependsOnMethods = {"OpenBrowser"} , priority = 13) public void Close() throws InterruptedException { Mozila.close(); Thread.sleep(2000); log.info("Browser was been closed"); Reporter.log("Browser was been closed"); } }
[ "bogdan.adamutiu@gmail.com" ]
bogdan.adamutiu@gmail.com
65032a7e9ccc3a06a5854c3d24eac537be357bf1
80d506e809d3724b547af8c026c8c11e9fe93c5a
/src/qlbh/view/LapPhieuJPanel.java
f72dba4ab5a8eaeabf96b6c6e8b9a9c0dcc1318d
[]
no_license
tangxuanlong/QLBH
54b5fda04cf1dc39ebe879cef2e7c7f5ae55fd85
f7d749095f5ee3b6dc546a101ba30ac2e08db62c
refs/heads/master
2023-02-04T00:32:28.702902
2020-12-22T03:18:34
2020-12-22T03:18:34
323,508,762
0
0
null
null
null
null
UTF-8
Java
false
false
1,414
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 qlbh.view; /** * * @author Steven */ public class LapPhieuJPanel extends javax.swing.JPanel { /** * Creates new form LapPhieuJPanel */ public LapPhieuJPanel() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE) ); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables }
[ "tangxuanlong2000@gmail.com" ]
tangxuanlong2000@gmail.com
7e670c49883eeefa3acb1d6cc4531f66b3b9d73a
7dcf78b770b8ca97e93e0e5c9581d41a2f9b07c7
/App/app/src/main/java/com/example/administrator/myapplication/ui/adapter/Fragment_Adapter.java
72327f4f77413f02daf6d47276313e0bf15d392e
[]
no_license
gaofangliang/New
ade5735cc479bfaee728267875f573dd2915ba96
e49ad33f7327330cb556f9c451e1d93eb22eb1f3
refs/heads/master
2020-03-18T01:05:30.372525
2018-08-13T20:55:21
2018-08-13T20:55:21
134,126,781
0
0
null
null
null
null
UTF-8
Java
false
false
698
java
package com.example.administrator.myapplication.ui.adapter; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import java.util.List; /** * Created by Administrator on 2018/5/13 0013. */ public class Fragment_Adapter extends FragmentPagerAdapter { List<Fragment> mFragment; public Fragment_Adapter(FragmentManager fm, List<Fragment> mFragment) { super(fm); this.mFragment = mFragment; } @Override public Fragment getItem(int position) { return mFragment.get(position); } @Override public int getCount() { return mFragment.size(); } }
[ "120997336@qq.com" ]
120997336@qq.com
33095bedd0b9f99b2346ae58b5a33f9a6e243858
b588c9bc33def2b055de49b0128edceea538f216
/qingcheng_pojo/src/main/java/com/qingcheng/pojo/system/ResourceCombination.java
387feb001b92fce3d7ab9fc682a067a9a9482141
[]
no_license
TonyTcuker/qingcheng
6a4d739189ce98381c04a9b13a7c48a14f4932b7
0be7096c477fce930bbb76a44b387a347c13bd42
refs/heads/master
2022-12-23T06:37:55.467244
2020-02-14T09:36:04
2020-02-14T09:36:04
236,273,925
0
0
null
2022-12-16T04:29:53
2020-01-26T06:03:40
JavaScript
UTF-8
Java
false
false
1,137
java
package com.qingcheng.pojo.system; import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * 保存权限的分类 保存 */ public class ResourceCombination implements Serializable { private Resource headResource ; // 一级分类 parent_id = 0 private List<Resource> itemResource; // 二级分类 private List<Integer> selectResourceIds ;// 保存选择的权限 public ResourceCombination() { this.selectResourceIds = new ArrayList<Integer>(); // 初始化选择权限 } public List<Integer> getSelectResourceIds() { return selectResourceIds; } public void setSelectResourceIds(List<Integer> selectResourceIds) { this.selectResourceIds = selectResourceIds; } public Resource getHeadResource() { return headResource; } public void setHeadResource(Resource headResource) { this.headResource = headResource; } public List<Resource> getItemResource() { return itemResource; } public void setItemResource(List<Resource> itemResource) { this.itemResource = itemResource; } }
[ "tony@TonydeiMac.local" ]
tony@TonydeiMac.local
869a8de084f4c6741d100bd3e5f2f1e40c0d3d25
3fc7c3d4a697c418bad541b2ca0559b9fec03db7
/TestResult/javasource/com/google/android/gms/auth/AccountChangeEventsRequest.java
b70587fa2a43c831d756fa22aee32a9c08ecc4e8
[]
no_license
songxingzai/APKAnalyserModules
59a6014350341c186b7788366de076b14b8f5a7d
47cf6538bc563e311de3acd3ea0deed8cdede87b
refs/heads/master
2021-12-15T02:43:05.265839
2017-07-19T14:44:59
2017-07-19T14:44:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,077
java
package com.google.android.gms.auth; import android.accounts.Account; import android.os.Parcel; import android.os.Parcelable.Creator; import android.text.TextUtils; import com.google.android.gms.common.internal.safeparcel.SafeParcelable; public class AccountChangeEventsRequest implements SafeParcelable { public static final Parcelable.Creator<AccountChangeEventsRequest> CREATOR = new zzb(); final int mVersion; Account zzOY; @Deprecated String zzQE; int zzQG; public AccountChangeEventsRequest() { mVersion = 1; } AccountChangeEventsRequest(int paramInt1, int paramInt2, String paramString, Account paramAccount) { mVersion = paramInt1; zzQG = paramInt2; zzQE = paramString; if ((paramAccount == null) && (!TextUtils.isEmpty(paramString))) { zzOY = new Account(paramString, "com.google"); return; } zzOY = paramAccount; } public int describeContents() { return 0; } public void writeToParcel(Parcel paramParcel, int paramInt) { zzb.zza(this, paramParcel, paramInt); } }
[ "leehdsniper@gmail.com" ]
leehdsniper@gmail.com
6259a4a5b2b15c51b198117a779ef7fd2432f79e
482d6a86d451624681d6dfe76dc65e48ccabc735
/chapter_003/src/main/java/pzubaha/converter/package-info.java
851ad18d4aa0d958e5af36a8bdd9857c891663f9
[ "Apache-2.0" ]
permissive
PavelZubaha/pzubaha
b61d9a75b2b244717a3995734f7535a07dd1570c
360821fd741aeedda6240e98396d963285a906e3
refs/heads/master
2021-01-17T16:02:51.013908
2018-11-19T14:11:30
2018-11-19T14:11:30
82,967,202
5
0
null
null
null
null
UTF-8
Java
false
false
286
java
/** * Chapter_003. Collections. Lite. * Collections Framework. * * The package include some kinds of request classes. * * Package contains solution of task 10035. * * @author Pavel Zubaha (mailto:Apximar@gmail.com) * @since 25.09.17 * @version 1 */ package pzubaha.converter;
[ "Apximar@gmail.com" ]
Apximar@gmail.com
b51d754e454b3e018c4eb7f16b3a32651c023080
0e34f3fd574817565332b795cda6c72e0733a5ac
/app/src/main/java/com/kuanhsien/app/sample/android_mvvm_demo/data/asynctask/GetInfoCallback.java
7a22e62d5b40174c67fdd4935b0e6bbe0d1672f9
[]
no_license
Kuan-Hsien/android-mvvm-demo
5e2c0bc2923247be4e15fc550d2a8c1b49421ed3
8cf0a26f2397b761e36f388b1f49f6bdbb35da26
refs/heads/dev/1.0.0
2020-06-01T18:06:58.454530
2020-05-19T08:26:21
2020-05-19T08:26:21
190,876,239
0
0
null
2020-05-19T08:26:23
2019-06-08T10:45:43
Java
UTF-8
Java
false
false
219
java
package com.kuanhsien.app.sample.android_mvvm_demo.data.asynctask; import com.kuanhsien.app.sample.android_mvvm_demo.data.model.InfoModel; public interface GetInfoCallback { void onCompleted(InfoModel data); }
[ "coson002fy@gmail.com" ]
coson002fy@gmail.com
bf8d9f47a2c0bc302c41e6acc657bddd08997d10
309954b919b259b4c40acce6d197c52a62ef2bac
/app/src/main/java/com/example/diadefeira/task/DetalhesProdutorTask.java
993054a973749f528ad549ca423db7e241d24214
[]
no_license
felipecapelli/tcc-aplicativo-android-Dia-De-Feira
eba0eaee965915e96a6268d1c203615bfc96d7bc
7790148078766f8d8f4c95036c50aafb10fdb791
refs/heads/master
2021-01-05T10:16:59.876481
2020-05-08T11:19:33
2020-05-08T11:19:33
240,989,756
0
1
null
null
null
null
UTF-8
Java
false
false
2,827
java
package com.example.diadefeira.task; import android.content.Context; import android.os.AsyncTask; import android.widget.ListView; import com.example.diadefeira.adapter.ListaProdutosProdutosAdapter; import com.example.diadefeira.modelo.DetalhesFeiraProdutorDetalhado; import com.example.diadefeira.parcer.DetalhesProdutorJsonParcer; import com.example.diadefeira.parcer.FeiraProdutoJsonParcer; import com.example.diadefeira.parcer.FeiraProdutorJsonParcer; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.List; public class DetalhesProdutorTask extends AsyncTask<Void, Void, String> { private final String emailProdutor; private final Long idFeira; private final ListView listViewDetalhes; private final Context contexto; private String resposta; private List<DetalhesFeiraProdutorDetalhado> detalhesProdutoProdutorProdutor; public DetalhesProdutorTask(String email, Long id, ListView listViewDetalhes, Context detalhesDoProdutorActivity) { this.emailProdutor = email; this.idFeira = id; this.listViewDetalhes = listViewDetalhes; this.contexto = detalhesDoProdutorActivity; } @Override protected String doInBackground(Void... voids) { HttpURLConnection connection = null; BufferedReader reader = null; try { URL url = new URL("http://10.0.0.103:8080/produtorProdutoFeira/porProdutorPorFeira/"+emailProdutor+"/"+idFeira); connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("Content-type", "application/json"); connection.setRequestProperty("Accept", "application/json"); connection.connect(); //----------------------------------------------------------------- StringBuilder stringBuilder = new StringBuilder(); reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; while ((line = reader.readLine()) != null){ stringBuilder.append(line+"\n"); } resposta = stringBuilder.toString(); detalhesProdutoProdutorProdutor = DetalhesProdutorJsonParcer.parseDados(resposta); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return "ok"; } @Override protected void onPostExecute(String ok) { ListaProdutosProdutosAdapter listaProdutoresAdapter = new ListaProdutosProdutosAdapter(contexto, detalhesProdutoProdutorProdutor); listViewDetalhes.setAdapter(listaProdutoresAdapter); } }
[ "felipe.ccapelli@gmail.com" ]
felipe.ccapelli@gmail.com
2c9cd2bb62d03c8933797dd04bb5076fd2d978d3
58923e5cff9c09ba7814b055ab244ddd69ab1421
/src/main/java/com/wurmcraft/minecraftnotincluded/common/biome/MNIMushroomForestBiome.java
dd7162f4dd337322453c4096995b9414144fe348
[]
no_license
Wurmatron/Minecraft-Not-Included
a8ee0ef00256ce6b62ebee8415a3d813ae2388ab
4d46ba3f971cdec431b2e40b897152ae0f3470ba
refs/heads/master
2023-01-10T00:37:22.742469
2023-01-03T20:44:45
2023-01-03T20:44:45
151,340,511
0
1
null
null
null
null
UTF-8
Java
false
false
3,101
java
package com.wurmcraft.minecraftnotincluded.common.biome; import static com.wurmcraft.minecraftnotincluded.common.biome.BiomeUtils.spreadFeatures; import com.wurmcraft.minecraftnotincluded.common.biome.feature.WorldGenLargeMushroom; import java.awt.Color; import java.util.Random; import net.minecraft.block.BlockHugeMushroom; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.gen.feature.WorldGenBigMushroom; import net.minecraft.world.gen.feature.WorldGenLakes; public class MNIMushroomForestBiome extends Biome { public int maxPopulationPerChunk = 5; public static WorldGenBigMushroom brownMushroom = new WorldGenBigMushroom(Blocks.BROWN_MUSHROOM_BLOCK); public static WorldGenLakes lake = new WorldGenLakes(Blocks.WATER); public static WorldGenLargeMushroom largeGlowingMushroom = new WorldGenLargeMushroom( Blocks.RED_MUSHROOM_BLOCK.getDefaultState(), Blocks.RED_MUSHROOM_BLOCK .getDefaultState() .withProperty(BlockHugeMushroom.VARIANT, BlockHugeMushroom.EnumType.STEM)); public MNIMushroomForestBiome() { super( new BiomeProperties("mniMushroomForest") .setBaseHeight(1) .setHeightVariation(.2f) .setTemperature(.8f) .setWaterColor(Color.MAGENTA.getRGB())); setRegistryName("mniMushroomForest"); this.topBlock = Blocks.MYCELIUM.getDefaultState(); this.fillerBlock = Blocks.DIRT.getDefaultState(); } @Override public BiomeDecorator createBiomeDecorator() { BiomeDecorator decor = new BiomeDecorator() { @Override public void decorate(World world, Random random, Biome biome, BlockPos pos) { if (this.decorating) { throw new RuntimeException("Already decorating"); } else { this.chunkPos = pos; BlockPos[] features = spreadFeatures(world, pos, maxPopulationPerChunk, 6); for (BlockPos a : features) { for (int y = 0; y < 16; y++) { if (world.getBlockState(a.add(0, y, 0)).getBlock() == Blocks.AIR) { int type = world.rand.nextInt(2); if (type == 0) { largeGlowingMushroom.generate( world, random, a.add(0, y, 0), 3 + (2 * world.rand.nextInt(7))); break; } else if (type == 1) { if (world.rand.nextInt(2) == 0) { largeGlowingMushroom.generate( world, random, a.add(0, y, 0), 3 + (2 * world.rand.nextInt(4))); } else { brownMushroom.generate(world, random, a.add(0, y, 0)); } } } } } this.decorating = false; } } }; return decor; } }
[ "wurmatron@gmail.com" ]
wurmatron@gmail.com
068856d7edeed073557f3ca18501a1fdd1ea110b
c51d7ca739fd380cf74ef149b1e7cdfa7178f510
/majesco-entityinterface-stubs/src/main/java/com/majescomastek/stgicd/ws/meta/entityinterface/requestheader/package-info.java
1fb9c2c9eb92c840d57b00bf2c4d292b8fee2d6a
[]
no_license
pdibenedetto/nd-billingservices-interface-stubs
0c40eabb223d730669f7984c9a39f137ade0946c
b4770f521bc670fbddf445c1278770721e0801b2
refs/heads/master
2020-05-31T09:03:56.526421
2019-06-04T13:03:51
2019-06-04T13:03:51
190,202,319
0
0
null
null
null
null
UTF-8
Java
false
false
194
java
@javax.xml.bind.annotation.XmlSchema(namespace = "http://com/majescomastek/stgicd/ws/meta/entityinterface/requestheader") package com.majescomastek.stgicd.ws.meta.entityinterface.requestheader;
[ "pdibenedetto@users.noreply.github.com" ]
pdibenedetto@users.noreply.github.com
0b92b2cd0756cba211a0a2df8e9824f100e3f70d
267363fa9955ab3a9bf91b80ba1df800d0f2aef7
/Chemistry Help/src/com/pk/chemhelp/CharlesLaw.java
6ebaddce8830400087a812da2d6a97dfd9a2b70f
[]
no_license
Pkmmte/Chemistry-Help
ff5e755f4616e2a154c175afe9adda7630b9d40e
d7f9f0cf29be0d69f691429a49176a0c3ae9395d
refs/heads/master
2020-12-24T15:58:05.620363
2013-09-17T20:23:48
2013-09-17T20:23:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
29,518
java
package com.pk.chemhelp; import android.app.Dialog; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.view.KeyEvent; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.view.WindowManager.LayoutParams; import android.widget.*; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.SherlockActivity; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.SubMenu; public class CharlesLaw extends SherlockActivity { /* Important Objects for Referencing and Problem Solving */ protected DataStorage appState; final String PageID = "Charles Law"; Bookmark BookmarkMethod; Bookmark[] Bookmarks; int numBookmarks; ErrorDetection ErrorDetect = new ErrorDetection(); Laws Laws = new Laws(); private boolean Exit; /* Declare Basic UI Objects */ Spinner spinnerV1; Spinner spinnerT1; Spinner spinnerV2; Spinner spinnerT2; ArrayAdapter<CharSequence> adapterV1; ArrayAdapter<CharSequence> adapterT1; ArrayAdapter<CharSequence> adapterV2; ArrayAdapter<CharSequence> adapterT2; private EditText editTextV1; private EditText editTextT1; private EditText editTextV2; private EditText editTextT2; /* Declare and Instantiate Important Variable for Problem Solving */ double V1 = MySingleton.getInstance().getV1(); double V2 = MySingleton.getInstance().getV2(); double T1 = MySingleton.getInstance().getT1(); double T2 = MySingleton.getInstance().getT2(); int lengthV1; int lengthV2; int lengthT1; int lengthT2; double Result; /* Store Text Field Values Here */ String inputV1; String inputV2; String inputT1; String inputT2; /* Error Message */ TextView errorTextView; String errorMessage = ""; int Empty = -1; /* Set Up Dialog Box and Results */ Dialog answerDialog; Dialog formulaDialog; TextView answerDialogTitle; TextView answerDialogResult; TextView answerWork; ImageView formulaImage; ScrollView answerDialogWork; Button formulaDialogClose; Button answerDialogClose; Button answerDialogShowWork; boolean showWork; String Work; /* Know What Units Are Selected */ String SelectV1; String SelectV2; String SelectT1; String SelectT2; /* Extra Functions */ boolean Gas_SameUnits; boolean Gas_AutoSolve; boolean Gas_FormatHelp; boolean FILLED_V1; boolean FILLED_V2; boolean FILLED_T1; boolean FILLED_T2; /* Bookmarks */ String[] pageValues; String pageValue1; String pageValue2; String pageValue3; String pageValue4; String pageValue5; String pageValue6; String pageValue7; String pageValue8; /* Backport Overflow Menu Workaround */ Menu mainMenu; SubMenu subMenu; /* Debugging */ MenuItem warningIcon; MenuItem debugMenu; boolean DEBUG_MODE = MySingleton.getInstance().getDebugMode(); public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.charleslaw); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle("Gas Laws"); actionBar.setSubtitle("Charles' Law"); Bundle extraBundle; Intent intentValues = getIntent(); pageValues = new String[50]; numBookmarks = MySingleton.getInstance().getNumBookmarks(); Bookmarks = MySingleton.getInstance().getBookmarks(); Gas_SameUnits = MySingleton.getInstance().getGasSameUnits(); Gas_AutoSolve = MySingleton.getInstance().getGasAutoSolve(); Gas_FormatHelp = MySingleton.getInstance().getGasFormatHelp(); pageValue1 = MySingleton.getInstance().getDefaultVolS(); pageValue2 = MySingleton.getInstance().getDefaultTempS(); pageValue3 = MySingleton.getInstance().getDefaultVolS(); pageValue4 = MySingleton.getInstance().getDefaultTempS(); pageValue5 = ""; pageValue6 = ""; pageValue7 = ""; pageValue8 = ""; appState = (DataStorage)getApplication(); addItemsOnSpinners(); addListenerOnSpinnersItemSelection(); editTextV1 = (EditText)findViewById(R.id.editTextV1); editTextT1 = (EditText)findViewById(R.id.editTextT1); editTextV2 = (EditText)findViewById(R.id.editTextV2); editTextT2 = (EditText)findViewById(R.id.editTextT2); errorTextView = (TextView)findViewById(R.id.errorMessage); formulaDialog = new Dialog(CharlesLaw.this); formulaDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); formulaDialog.setContentView(R.layout.dialog_formula); formulaDialog.setCancelable(true); formulaImage = (ImageView) formulaDialog.findViewById(R.id.imageFormula); formulaImage.setImageResource(R.drawable.formula_charles); Button formulaDialogClose = (Button) formulaDialog.findViewById(R.id.Close); this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); answerDialog = new Dialog(CharlesLaw.this); answerDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); answerDialog.setContentView(R.layout.dialog_answer); answerDialog.setCancelable(true); answerDialog.getWindow().getAttributes().width = LayoutParams.MATCH_PARENT; answerDialogTitle = (TextView) answerDialog.findViewById(R.id.Title); answerDialogResult = (TextView) answerDialog.findViewById(R.id.Answer); answerDialogClose = (Button) answerDialog.findViewById(R.id.Close); answerDialogShowWork = (Button) answerDialog.findViewById(R.id.ShowWork); answerDialogWork = (ScrollView) answerDialog.findViewById(R.id.WorkBox); answerWork = (TextView) answerDialog.findViewById(R.id.Work); showWork = false; Work = ""; if(intentValues.hasExtra("Page Values")) { extraBundle = getIntent().getExtras(); pageValues = extraBundle.getStringArray("Page Values"); setPageValues(); } answerDialogClose.setOnClickListener(new View.OnClickListener() { public void onClick(View arg1) { answerDialog.dismiss(); } }); answerDialogShowWork.setOnClickListener(new View.OnClickListener() { public void onClick(View arg1) { if(showWork) { showWork = false; answerDialogWork.setVisibility(View.GONE); answerDialogShowWork.setText("Show Work"); } else { showWork = true; answerDialogWork.setVisibility(View.VISIBLE); answerDialogShowWork.setText("Hide Work"); } } }); formulaDialogClose.setOnClickListener(new View.OnClickListener() { public void onClick(View arg1) { formulaDialog.dismiss(); } }); Button formula = (Button) findViewById(R.id.Formula); Button submit = (Button) findViewById(R.id.Solve); Button clear = (Button) findViewById(R.id.Clear); formula.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { formulaDialog.show(); } }); clear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { editTextV1.setText(""); editTextV2.setText(""); editTextT1.setText(""); editTextT2.setText(""); } }); submit.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { inputV1 = editTextV1.getText().toString(); inputV2 = editTextV2.getText().toString(); inputT1 = editTextT1.getText().toString(); inputT2 = editTextT2.getText().toString(); lengthV1 = inputV1.length(); lengthV2 = inputV2.length(); lengthT1 = inputT1.length(); lengthT2 = inputT2.length(); V1 = -9876.5; V2 = -9876.5; T1 = -9876.5; T2 = -9876.5; if(lengthV1 != 0) V1 = Double.parseDouble(inputV1); if(lengthV2 != 0) V2 = Double.parseDouble(inputV2); if(lengthT1 != 0) T1 = Double.parseDouble(inputT1); if(lengthT2 != 0) T2 = Double.parseDouble(inputT2); errorTextView.setTextColor(0xFFFF0000); Empty = ErrorDetect.getEmptyFieldCharles(lengthV1, lengthT1, lengthV2, lengthT2); if(Empty == -1) // If user filled out everything for some reason { errorTextView.setText("Please leave the field you're solving for empty"); } else if(Empty == 1) // Solving for V1 { errorTextView.setText(""); answerDialogTitle.setText(getString(R.string.GASLAW_SolvingForV1)); Result = Laws.Charles_Law(V1, T1, V2, T2); Work = Laws.Charles_Law_Work(V1, T1, V2, T2); answerWork.setText(Work); Result = Misc.decimalPrecisionAssign(Result); answerDialogResult.setText(Result + " " + SelectV1); answerDialog.show(); } else if(Empty == 2) // Solving for T1 { errorTextView.setText(""); answerDialogTitle.setText(getString(R.string.GASLAW_SolvingForT1)); Result = Laws.Charles_Law(V1, T1, V2, T2); Work = Laws.Charles_Law_Work(V1, T1, V2, T2); answerWork.setText(Work); Result = Misc.decimalPrecisionAssign(Result); answerDialogResult.setText(Result + " " + SelectT1); answerDialog.show(); } else if(Empty == 3) // Solving for V2 { errorTextView.setText(""); answerDialogTitle.setText(getString(R.string.GASLAW_SolvingForV2)); Result = Laws.Charles_Law(V1, T1, V2, T2); Work = Laws.Charles_Law_Work(V1, T1, V2, T2); answerWork.setText(Work); Result = Misc.decimalPrecisionAssign(Result); answerDialogResult.setText(Result + " " + SelectV2); answerDialog.show(); } else if(Empty == 4) // Solving for T2 { errorTextView.setText(""); answerDialogTitle.setText(getString(R.string.GASLAW_SolvingForT2)); Result = Laws.Charles_Law(V1, T1, V2, T2); Work = Laws.Charles_Law_Work(V1, T1, V2, T2); answerWork.setText(Work); Result = Misc.decimalPrecisionAssign(Result); answerDialogResult.setText(Result + " " + SelectT2); answerDialog.show(); } else // Error Messages { errorMessage = ErrorDetect.detectErrorCharles(Empty); errorTextView.setText(errorMessage); } } }); editTextV1.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) { String text = editTextV1.getText().toString(); if (text.length() > 0) FILLED_V1 = true; else FILLED_V1 = false; checkInputs(); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // Do nothing... } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { String text = editTextV1.getText().toString(); if (text.length() > 0) FILLED_V1 = true; else FILLED_V1 = false; checkInputs(); } }); editTextV2.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) { String text = editTextV2.getText().toString(); if (text.length() > 0) FILLED_V2 = true; else FILLED_V2 = false; checkInputs(); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // Do nothing... } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { String text = editTextV2.getText().toString(); if (text.length() > 0) FILLED_V2 = true; else FILLED_V2 = false; checkInputs(); } }); editTextT1.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) { String text = editTextT1.getText().toString(); if (text.length() > 0) FILLED_T1 = true; else FILLED_T1 = false; checkInputs(); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // Do nothing... } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { String text = editTextT1.getText().toString(); if (text.length() > 0) FILLED_T1 = true; else FILLED_T1 = false; checkInputs(); } }); editTextT2.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) { String text = editTextT2.getText().toString(); if (text.length() > 0) FILLED_T2 = true; else FILLED_T2 = false; checkInputs(); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // Do nothing... } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { String text = editTextT2.getText().toString(); if (text.length() > 0) FILLED_T2 = true; else FILLED_T2 = false; checkInputs(); } }); } public void onRestart() { super.onRestart(); Exit = MySingleton.getInstance().getExit(); if(Exit) Exit(); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.action_menu, menu); int sdk = android.os.Build.VERSION.SDK_INT; if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) { mainMenu = menu; subMenu = menu.addSubMenu(""); subMenu.add(Menu.NONE, R.id.AddBookmark_Label, Menu.NONE, "Add Bookmark"); subMenu.add(Menu.NONE, R.id.Settings_Label, Menu.NONE, "Settings"); if(DEBUG_MODE) subMenu.add(Menu.NONE, R.id.Debug_Label, Menu.NONE, "Debug"); subMenu.add(Menu.NONE, R.id.Exit_Label, Menu.NONE, "Exit"); MenuItem subMenuItem = subMenu.getItem(); subMenuItem.setIcon(R.drawable.abs__ic_menu_moreoverflow_normal_holo_dark); subMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } this.warningIcon = menu.findItem(R.id.Warning_Label); this.debugMenu = menu.findItem(R.id.Debug_Label); if(!MySingleton.getInstance().getErrors()[0].equals("pcx_value")) warningIcon.setVisible(true); else warningIcon.setVisible(false); if(DEBUG_MODE) debugMenu.setVisible(true); else debugMenu.setVisible(false); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent intent = new Intent(this, GasLaws.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); return true; case R.id.Warning_Label: showError(); return true; case R.id.AddBookmark_Label: pageValue5 = editTextV1.getText().toString(); pageValue6 = editTextT1.getText().toString(); pageValue7 = editTextV2.getText().toString(); pageValue8 = editTextT2.getText().toString(); MySingleton.getInstance().setPageValues(getPageValues()); MySingleton.getInstance().setPreviousPageID(PageID); Dialogs.getDialog("Add Bookmark", CharlesLaw.this).show(); return true; case R.id.Bookmarks_Label: Dialogs.getDialog("Bookmarks", CharlesLaw.this).show(); return true; case R.id.Settings_Label: MySingleton.getInstance().setPreviousPageID(PageID); Intent settingsIntent = new Intent(this, Settings.class); settingsIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(settingsIntent); return true; /*case R.id.Help_Label: helpDialog.show(); return true; case R.id.Credits_Label: creditsDialog.show(); return true;*/ case R.id.Exit_Label: Exit(); return true; case R.id.Debug_Label: Intent i = new Intent(CharlesLaw.this, Debug.class); startActivity(i); return true; default: return super.onOptionsItemSelected(item); } } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { int sdk = android.os.Build.VERSION.SDK_INT; if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB && keyCode == KeyEvent.KEYCODE_MENU) { mainMenu.performIdentifierAction(subMenu.getItem().getItemId(), 0); return true; } return super.onKeyUp(keyCode, event); } public void checkInputs() { String EmptyField; EmptyField = checkEmpty(FILLED_V1, FILLED_V2, FILLED_T1, FILLED_T2); if(Gas_FormatHelp) { if(EmptyField.equals("V1")) { editTextV1.setEnabled(false); editTextV1.setFocusable(false); editTextV2.setEnabled(true); editTextV2.setFocusable(true); editTextT1.setEnabled(true); editTextT1.setFocusable(true); editTextT2.setEnabled(true); editTextT2.setFocusable(true); editTextV1.setHint(getString(R.string.GASLAW_SolvingForV1)); editTextV2.setHint(getString(R.string.blankForV2)); editTextT1.setHint(getString(R.string.blankForT1)); editTextT2.setHint(getString(R.string.blankForT2)); } else if(EmptyField.equals("V2")) { editTextV1.setEnabled(true); editTextV1.setFocusable(true); editTextV2.setEnabled(false); editTextV2.setFocusable(false); editTextT1.setEnabled(true); editTextT1.setFocusable(true); editTextT2.setEnabled(true); editTextT2.setFocusable(true); editTextV1.setHint(getString(R.string.blankForV1)); editTextV2.setHint(getString(R.string.GASLAW_SolvingForV2)); editTextT1.setHint(getString(R.string.blankForT1)); editTextT2.setHint(getString(R.string.blankForT2)); } else if(EmptyField.equals("T1")) { editTextV1.setEnabled(true); editTextV1.setFocusable(true); editTextV2.setEnabled(true); editTextV2.setFocusable(true); editTextT1.setEnabled(false); editTextT1.setFocusable(false); editTextT2.setEnabled(true); editTextT2.setFocusable(true); editTextV1.setHint(getString(R.string.blankForV1)); editTextV2.setHint(getString(R.string.blankForV2)); editTextT1.setHint(getString(R.string.GASLAW_SolvingForT1)); editTextT2.setHint(getString(R.string.blankForT2)); } else if(EmptyField.equals("T2")) { editTextV1.setEnabled(true); editTextV1.setFocusable(true); editTextV2.setEnabled(true); editTextV2.setFocusable(true); editTextT1.setEnabled(true); editTextT1.setFocusable(true); editTextT2.setEnabled(false); editTextT2.setFocusable(false); editTextV1.setHint(getString(R.string.blankForV1)); editTextV2.setHint(getString(R.string.blankForV2)); editTextT1.setHint(getString(R.string.blankForT1)); editTextT2.setHint(getString(R.string.GASLAW_SolvingForT2)); } else { editTextV1.setEnabled(true); editTextV1.setFocusable(true); editTextV2.setEnabled(true); editTextV2.setFocusable(true); editTextT1.setEnabled(true); editTextT1.setFocusable(true); editTextT2.setEnabled(true); editTextT2.setFocusable(true); editTextV1.setHint(getString(R.string.blankForV1)); editTextV2.setHint(getString(R.string.blankForV2)); editTextT1.setHint(getString(R.string.blankForT1)); editTextT2.setHint(getString(R.string.blankForT2)); } } if(Gas_AutoSolve) { Result = -1; inputV1 = editTextV1.getText().toString(); inputV2 = editTextV2.getText().toString(); inputT1 = editTextT1.getText().toString(); inputT2 = editTextT2.getText().toString(); lengthV1 = inputV1.length(); lengthV2 = inputV2.length(); lengthT1 = inputT1.length(); lengthT2 = inputT2.length(); V1 = -9876.5; V2 = -9876.5; T1 = -9876.5; T2 = -9876.5; if (lengthV1 != 0) V1 = Double.parseDouble(inputV1); if (lengthV2 != 0) V2 = Double.parseDouble(inputV2); if (lengthT1 != 0) T1 = Double.parseDouble(inputT1); if (lengthT2 != 0) T2 = Double.parseDouble(inputT2); if(EmptyField.equals("V1")) { errorTextView.setText(""); editTextV1.setHintTextColor(Color.BLUE); Result = Laws.Charles_Law(V1, T1, V2, T2); Result = Misc.decimalPrecisionAssign(Result); editTextV1.setHint("" + Result); } else if(EmptyField.equals("V2")) { errorTextView.setText(""); editTextV2.setHintTextColor(Color.BLUE); Result = Laws.Charles_Law(V1, T1, V2, T2); Result = Misc.decimalPrecisionAssign(Result); editTextV2.setHint("" + Result); } else if(EmptyField.equals("T1")) { errorTextView.setText(""); editTextT1.setHintTextColor(Color.BLUE); Result = Laws.Charles_Law(V1, T1, V2, T2); Result = Misc.decimalPrecisionAssign(Result); editTextT1.setHint("" + Result); } else if(EmptyField.equals("T2")) { errorTextView.setText(""); editTextT2.setHintTextColor(Color.BLUE); Result = Laws.Charles_Law(V1, T1, V2, T2); Result = Misc.decimalPrecisionAssign(Result); editTextT2.setHint("" + Result); } else { editTextV1.setHintTextColor(Color.GRAY); editTextV2.setHintTextColor(Color.GRAY); editTextT1.setHintTextColor(Color.GRAY); editTextT2.setHintTextColor(Color.GRAY); editTextV1.setHint(getString(R.string.blankForV1)); editTextV2.setHint(getString(R.string.blankForV2)); editTextT1.setHint(getString(R.string.blankForT1)); editTextT2.setHint(getString(R.string.blankForT2)); } } } public String checkEmpty(boolean FILLED_V1, boolean FILLED_V2, boolean FILLED_T1, boolean FILLED_T2) { if(FILLED_V2 && FILLED_T1 && FILLED_T2) return "V1"; else if(FILLED_V1 && FILLED_T1 && FILLED_T2) return "V2"; else if(FILLED_V1 && FILLED_V2 && FILLED_T2) return "T1"; else if(FILLED_V1 && FILLED_V2 && FILLED_T1) return "T2"; else return ""; } public void addItemsOnSpinners() { // Get Position Defaults int spinnerPosition; String defaultVolUnit = MySingleton.getInstance().getDefaultVolS(); String defaultTempUnit = MySingleton.getInstance().getDefaultTempS(); // Initialize Spinners and Adapters. Set Default If Necessary. spinnerV1 = (Spinner) findViewById(R.id.spinnerV1); adapterV1 = ArrayAdapter.createFromResource(this, R.array.UnitVolume_array, android.R.layout.simple_spinner_item); adapterV1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnerV1.setAdapter(adapterV1); spinnerPosition = adapterV1.getPosition(defaultVolUnit); spinnerV1.setSelection(spinnerPosition); spinnerT1 = (Spinner) findViewById(R.id.spinnerT1); adapterT1 = ArrayAdapter.createFromResource(this, R.array.UnitTemperature_array, android.R.layout.simple_spinner_item); adapterT1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnerT1.setAdapter(adapterT1); spinnerPosition = adapterT1.getPosition(defaultTempUnit); spinnerT1.setSelection(spinnerPosition); spinnerV2 = (Spinner) findViewById(R.id.spinnerV2); adapterV2 = ArrayAdapter.createFromResource(this, R.array.UnitVolume_array, android.R.layout.simple_spinner_item); adapterV2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnerV2.setAdapter(adapterV2); spinnerPosition = adapterV2.getPosition(defaultVolUnit); spinnerV2.setSelection(spinnerPosition); spinnerT2 = (Spinner) findViewById(R.id.spinnerT2); adapterT2 = ArrayAdapter.createFromResource(this, R.array.UnitTemperature_array, android.R.layout.simple_spinner_item); adapterT2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnerT2.setAdapter(adapterT2); spinnerPosition = adapterT2.getPosition(defaultTempUnit); spinnerT2.setSelection(spinnerPosition); } public void addListenerOnSpinnersItemSelection() { spinnerV1.setOnItemSelectedListener(new OnV1SelectedListener()); spinnerT1.setOnItemSelectedListener(new OnT1SelectedListener()); spinnerV2.setOnItemSelectedListener(new OnV2SelectedListener()); spinnerT2.setOnItemSelectedListener(new OnT2SelectedListener()); } public class OnV1SelectedListener implements Spinner.OnItemSelectedListener { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { SelectV1 = parent.getItemAtPosition(pos).toString(); MySingleton.getInstance().setSelectV1(SelectV1); pageValue1 = SelectV1; if(Gas_SameUnits) sameSelection("V1"); } @SuppressWarnings("rawtypes") public void onNothingSelected(AdapterView parent) { // Do nothing. } } public class OnT1SelectedListener implements Spinner.OnItemSelectedListener { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { SelectT1 = parent.getItemAtPosition(pos).toString(); MySingleton.getInstance().setSelectT1(SelectT1); pageValue2 = SelectT1; if(Gas_SameUnits) sameSelection("T1"); } @SuppressWarnings("rawtypes") public void onNothingSelected(AdapterView parent) { // Do nothing. } } public class OnV2SelectedListener implements Spinner.OnItemSelectedListener { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { SelectV2 = parent.getItemAtPosition(pos).toString(); MySingleton.getInstance().setSelectV2(SelectV2); pageValue3 = SelectV2; if(Gas_SameUnits) sameSelection("V2"); } @SuppressWarnings("rawtypes") public void onNothingSelected(AdapterView parent) { // Do nothing. } } public class OnT2SelectedListener implements Spinner.OnItemSelectedListener { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { SelectT2 = parent.getItemAtPosition(pos).toString(); MySingleton.getInstance().setSelectT2(SelectT2); pageValue4 = SelectT2; if(Gas_SameUnits) sameSelection("T2"); } @SuppressWarnings("rawtypes") public void onNothingSelected(AdapterView parent) { // Do nothing. } } public void sameSelection(String Type) { SelectV1 = MySingleton.getInstance().getSelectV1(); SelectT1 = MySingleton.getInstance().getSelectT1(); SelectV2 = MySingleton.getInstance().getSelectV2(); SelectT2 = MySingleton.getInstance().getSelectT2(); if (Type.equals("V1")) { if (SelectV1.equals("L")) { spinnerV2.setSelection(0); MySingleton.getInstance().setSelectV2("L"); } else if (SelectV1.equals("mL")) { spinnerV2.setSelection(1); MySingleton.getInstance().setSelectV2("mL"); } else if (SelectV1.equals("g")) { spinnerV2.setSelection(2); MySingleton.getInstance().setSelectV2("g"); } else MySingleton.getInstance().addError("Charles Law: Unable to set spinnerV2 selection."); } else if (Type.equals("T1")) { if (SelectT1.equals("K")) { spinnerT2.setSelection(0); MySingleton.getInstance().setSelectT2("K"); } else if (SelectT1.equals("C")) { spinnerT2.setSelection(1); MySingleton.getInstance().setSelectT2("C"); } else if (SelectT1.equals("F")) { spinnerT2.setSelection(2); MySingleton.getInstance().setSelectT2("F"); } else MySingleton.getInstance().addError("Charles Law: Unable to set spinnerT2 selection."); } else if (Type.equals("V2")) { if (SelectV2.equals("L")) { spinnerV1.setSelection(0); MySingleton.getInstance().setSelectV1("L"); } else if (SelectV2.equals("mL")) { spinnerV1.setSelection(1); MySingleton.getInstance().setSelectV1("mL"); } else if (SelectV2.equals("g")) { spinnerV1.setSelection(2); MySingleton.getInstance().setSelectV1("g"); } else MySingleton.getInstance().addError("Charles Law: Unable to set spinnerV1 selection."); } else if (Type.equals("T2")) { if (SelectT2.equals("K")) { spinnerT1.setSelection(0); MySingleton.getInstance().setSelectT1("K"); } else if (SelectT2.equals("C")) { spinnerT1.setSelection(1); MySingleton.getInstance().setSelectT1("C"); } else if (SelectT2.equals("F")) { spinnerT1.setSelection(2); MySingleton.getInstance().setSelectT1("F"); } else MySingleton.getInstance().addError("Charles Law: Unable to set spinnerT1 selection."); } } public String[] getPageValues() { String[] values = new String[50]; for(int l = 0; l < 50; l++) values[l] = "pcx_value"; values[0] = PageID; values[1] = pageValue1; values[2] = pageValue2; values[3] = pageValue3; values[4] = pageValue4; values[5] = pageValue5; values[6] = pageValue6; values[7] = pageValue7; values[8] = pageValue8; return values; } public void setPageValues() { if(pageValues[0].equals(PageID)) { int spinnerPosition; spinnerPosition = adapterV1.getPosition(pageValues[1]); spinnerV1.setSelection(spinnerPosition); SelectV1 = pageValues[1]; MySingleton.getInstance().setSelectV1(SelectV1); pageValue1 = SelectV1; spinnerPosition = adapterT1.getPosition(pageValues[2]); spinnerT1.setSelection(spinnerPosition); SelectT1 = pageValues[2]; MySingleton.getInstance().setSelectP1(SelectT1); pageValue2 = SelectT1; spinnerPosition = adapterV2.getPosition(pageValues[3]); spinnerV2.setSelection(spinnerPosition); SelectV2 = pageValues[3]; MySingleton.getInstance().setSelectV2(SelectV2); pageValue3 = SelectV2; spinnerPosition = adapterT2.getPosition(pageValues[4]); spinnerT2.setSelection(spinnerPosition); SelectT2 = pageValues[4]; MySingleton.getInstance().setSelectT2(SelectT2); pageValue4 = SelectT2; editTextV1.setText(pageValues[5]); editTextT1.setText(pageValues[6]); editTextV2.setText(pageValues[7]); editTextT2.setText(pageValues[8]); } } public void showError() { Toast.makeText(CharlesLaw.this, "A small error happened. Please report the following to the developer: \n" + MySingleton.getInstance().getErrors()[0], Toast.LENGTH_SHORT).show(); } public void Exit() { Exit = true; MySingleton.getInstance().setExit(Exit); finish(); } }
[ "pkx7225@gmail.com" ]
pkx7225@gmail.com
c8376e4097a63ea88b8e8e658a0226ff9adfbd8a
3c68b973f70d718886f07ea065b7eed612646132
/String-2/Q18_ZipZap.java
8b89cf61d6dac2c81803902018943213e140192c
[]
no_license
DanielHaugen/CodingBat-Java
09cef6f1b9c5d488d53263d30db2c1267e66cb97
0feef488be02e9dc0cee639206eb6e9115e289c5
refs/heads/master
2020-05-25T01:30:17.443598
2019-05-20T03:07:33
2019-05-20T03:07:33
187,557,572
0
0
null
null
null
null
UTF-8
Java
false
false
654
java
/* Look for patterns like "zip" and "zap" in the string -- length-3, starting with 'z' and ending with 'p'. Return a string where for all such words, the middle letter is gone, so "zipXzap" yields "zpXzp". zipZap("zipXzap") → "zpXzp" zipZap("zopzop") → "zpzp" zipZap("zzzopzop") → "zzzpzp" */ public String zipZap(String str) { String newStr = ""; if(str.length()<3) return str; for(int k = 0; k < str.length();k++){ if(str.charAt(k) == 'z' && (str.charAt(k+2) == 'p')){ newStr += "zp"; k+=2; } else newStr += str.substring(k,k+1); } return newStr; }
[ "noreply@github.com" ]
DanielHaugen.noreply@github.com
b3302ce68578cfdc7f1a0191bd959c55b5f710e5
282c614f15d30c7ecbf51a77112e1ade8e4a62ee
/galen-core/src/test/java/com/galenframework/tests/speclang2/AlphanumericComparatorTest.java
be1822a26927b8935b752d6a5925b17ee90ab1ed
[ "Apache-2.0" ]
permissive
GreiNvrn/galen
0e8d347d392bbb1ac8968b1be818fe7ab5e86466
a0135a94b5677615e5ea424f478335898379700f
refs/heads/master
2021-01-13T03:01:26.840839
2016-11-20T19:52:14
2016-11-20T19:52:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,776
java
/******************************************************************************* * Copyright 2016 Ivan Shubin http://galenframework.com * * 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.galenframework.tests.speclang2; import com.galenframework.parser.AlphanumericComparator; import org.testng.annotations.Test; import java.util.Collections; import java.util.List; import static java.util.Arrays.asList; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; public class AlphanumericComparatorTest { @Test public void shouldSortProperly() { List<String> list = asList( "abc 123 edf2", "abc 123 edf", "abc 2 edf", "abc 13 edf", "abc 12 edf", "abd 2 edf", "abb 2 edf" ); Collections.sort(list, new AlphanumericComparator()); assertThat(list, is(asList( "abb 2 edf", "abc 2 edf", "abc 12 edf", "abc 13 edf", "abc 123 edf", "abc 123 edf2", "abd 2 edf" ))); } }
[ "ivan.ishubin@gmail.com" ]
ivan.ishubin@gmail.com
e14f3f57fd35ba1d8a019b68f0bb7a9abbc50f11
921ebff0c8604ecfbc38a0e333418284a566a902
/app/src/main/java/com/example/smtprk/directionhelper/FetchURL.java
1400623329dc55ebe45271e09e84738923f12566
[]
no_license
2015998/smtprkforgrad
5d3951ea78a0f292b7c16696f69bba4d30f05794
2e071296f150b856d22a7ae9c96b47a25f25ade8
refs/heads/master
2022-11-02T11:35:10.237651
2020-06-07T02:26:23
2020-06-07T02:26:23
270,167,443
0
0
null
null
null
null
UTF-8
Java
false
false
2,452
java
package com.example.smtprk.directionhelper; import android.content.Context; import android.os.AsyncTask; import android.util.Log; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; /** * Created by Vishal on 10/20/2018. */ public class FetchURL extends AsyncTask<String, Void, String> { Context mContext; String directionMode = "driving"; public FetchURL(Context mContext) { this.mContext = mContext; } @Override protected String doInBackground(String... strings) { // For storing data from web service String data = ""; directionMode = strings[1]; try { // Fetching the data from web service data = downloadUrl(strings[0]); Log.d("mylog", "Background task data " + data.toString()); } catch (Exception e) { Log.d("Background Task", e.toString()); } return data; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); PointsParser parserTask = new PointsParser(mContext, directionMode); // Invokes the thread for parsing the JSON data parserTask.execute(s); } private String downloadUrl(String strUrl) throws IOException { String data = ""; InputStream iStream = null; HttpURLConnection urlConnection = null; try { URL url = new URL(strUrl); // Creating an http connection to communicate with url urlConnection = (HttpURLConnection) url.openConnection(); // Connecting to url urlConnection.connect(); // Reading data from url iStream = urlConnection.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(iStream)); StringBuffer sb = new StringBuffer(); String line = ""; while ((line = br.readLine()) != null) { sb.append(line); } data = sb.toString(); Log.d("mylog", "Downloaded URL: " + data.toString()); br.close(); } catch (Exception e) { Log.d("mylog", "Exception downloading URL: " + e.toString()); } finally { iStream.close(); urlConnection.disconnect(); } return data; } }
[ "esmafer.direybatogullari@softtech.com.tr" ]
esmafer.direybatogullari@softtech.com.tr
4022e4042fa19fd67916bc5b762ab6e13de05cbe
996dbab305846b685304e69a773dea6f7537c777
/src/main/java/com/example/xpdayone/businesslogic/StatsCalculator.java
7a7213d1b0788bd1f92707360f976c5d551e73e1
[]
no_license
dat17v1/xpdayone
a6a86758980212b0b0eb61f9865403978e1bdbf5
f366f5dc00cb23841ce0c96ae22f7b419b4df588
refs/heads/master
2021-04-26T23:57:41.117294
2018-03-19T10:41:18
2018-03-19T10:41:18
123,885,716
0
0
null
null
null
null
UTF-8
Java
false
false
709
java
package com.example.xpdayone.businesslogic; import com.example.xpdayone.model.Database; import com.example.xpdayone.model.User; import java.text.DecimalFormat; import java.util.List; public class StatsCalculator { private Database database; public StatsCalculator(Database database) { this.database = database; } public double getAverageAmount(){ double sum = 0.0; List<User> users = database.getAllUsers(); for (User user : users) { sum += user.getAmount(); } DecimalFormat decimalFormat = new DecimalFormat("#.##"); double avg = sum / users.size(); return Double.parseDouble(decimalFormat.format(avg)); } }
[ "joneikholm@gmail.com" ]
joneikholm@gmail.com
e5da9489b6373799158094422e9e9cacbb9ff0a7
670a4af2090a993605c5af2a588ed13f686a11dd
/src/baidumapsdk/demo/GeoCoderDemo.java
000cfe614f5a57cadda1570c19c159c2d9a35fb7
[]
no_license
wolf0931/Map_of_baidu
01d6f7ae8f83ce1d9576e201e04fb1da2de132b8
748831a01c90d822f9f85b957281a2ea10468c40
refs/heads/master
2021-01-16T21:19:27.873832
2013-10-17T00:38:32
2013-10-17T00:38:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,630
java
package baidumapsdk.demo; import android.app.Activity; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.baidu.mapapi.map.ItemizedOverlay; import com.baidu.mapapi.map.MapView; import com.baidu.mapapi.map.OverlayItem; import com.baidu.mapapi.search.MKAddrInfo; import com.baidu.mapapi.search.MKBusLineResult; import com.baidu.mapapi.search.MKDrivingRouteResult; import com.baidu.mapapi.search.MKPoiResult; import com.baidu.mapapi.search.MKSearch; import com.baidu.mapapi.search.MKSearchListener; import com.baidu.mapapi.search.MKShareUrlResult; import com.baidu.mapapi.search.MKSuggestionResult; import com.baidu.mapapi.search.MKTransitRouteResult; import com.baidu.mapapi.search.MKWalkingRouteResult; import com.baidu.platform.comapi.basestruct.GeoPoint; /** * 此demo用来展示如何进行地理编码搜索(用地址检索坐标)、反地理编码搜索(用坐标检索地址) * 同时展示了如何使用ItemizedOverlay在地图上标注结果点 * */ public class GeoCoderDemo extends Activity { //UI相关 Button mBtnReverseGeoCode = null; // 将坐标反编码为地址 Button mBtnGeoCode = null; // 将地址编码为坐标 //地图相关 MapView mMapView = null; // 地图View //搜索相关 MKSearch mSearch = null; // 搜索模块,也可去掉地图模块独立使用 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); DemoApplication app = (DemoApplication)this.getApplication(); setContentView(R.layout.geocoder); CharSequence titleLable="地理编码功能"; setTitle(titleLable); //地图初始化 mMapView = (MapView)findViewById(R.id.bmapView); mMapView.getController().enableClick(true); mMapView.getController().setZoom(12); // 初始化搜索模块,注册事件监听 mSearch = new MKSearch(); mSearch.init(app.mBMapManager, new MKSearchListener() { @Override public void onGetPoiDetailSearchResult(int type, int error) { } public void onGetAddrResult(MKAddrInfo res, int error) { if (error != 0) { String str = String.format("错误号:%d", error); Toast.makeText(GeoCoderDemo.this, str, Toast.LENGTH_LONG).show(); return; } //地图移动到该点 mMapView.getController().animateTo(res.geoPt); if (res.type == MKAddrInfo.MK_GEOCODE){ //地理编码:通过地址检索坐标点 String strInfo = String.format("纬度:%f 经度:%f", res.geoPt.getLatitudeE6()/1e6, res.geoPt.getLongitudeE6()/1e6); Toast.makeText(GeoCoderDemo.this, strInfo, Toast.LENGTH_LONG).show(); } if (res.type == MKAddrInfo.MK_REVERSEGEOCODE){ //反地理编码:通过坐标点检索详细地址及周边poi String strInfo = res.strAddr; Toast.makeText(GeoCoderDemo.this, strInfo, Toast.LENGTH_LONG).show(); } //生成ItemizedOverlay图层用来标注结果点 ItemizedOverlay<OverlayItem> itemOverlay = new ItemizedOverlay<OverlayItem>(null, mMapView); //生成Item OverlayItem item = new OverlayItem(res.geoPt, "", null); //得到需要标在地图上的资源 Drawable marker = getResources().getDrawable(R.drawable.icon_markf); //为maker定义位置和边界 marker.setBounds(0, 0, marker.getIntrinsicWidth(), marker.getIntrinsicHeight()); //给item设置marker item.setMarker(marker); //在图层上添加item itemOverlay.addItem(item); //清除地图其他图层 mMapView.getOverlays().clear(); //添加一个标注ItemizedOverlay图层 mMapView.getOverlays().add(itemOverlay); //执行刷新使生效 mMapView.refresh(); } public void onGetPoiResult(MKPoiResult res, int type, int error) { } public void onGetDrivingRouteResult(MKDrivingRouteResult res, int error) { } public void onGetTransitRouteResult(MKTransitRouteResult res, int error) { } public void onGetWalkingRouteResult(MKWalkingRouteResult res, int error) { } public void onGetBusDetailResult(MKBusLineResult result, int iError) { } @Override public void onGetSuggestionResult(MKSuggestionResult res, int arg1) { } @Override public void onGetShareUrlResult(MKShareUrlResult result, int type, int error) { // TODO Auto-generated method stub } }); // 设定地理编码及反地理编码按钮的响应 mBtnReverseGeoCode = (Button)findViewById(R.id.reversegeocode); mBtnGeoCode = (Button)findViewById(R.id.geocode); OnClickListener clickListener = new OnClickListener(){ public void onClick(View v) { SearchButtonProcess(v); } }; mBtnReverseGeoCode.setOnClickListener(clickListener); mBtnGeoCode.setOnClickListener(clickListener); } /** * 发起搜索 * @param v */ void SearchButtonProcess(View v) { if (mBtnReverseGeoCode.equals(v)) { EditText lat = (EditText)findViewById(R.id.lat); EditText lon = (EditText)findViewById(R.id.lon); GeoPoint ptCenter = new GeoPoint((int)(Float.valueOf(lat.getText().toString())*1e6), (int)(Float.valueOf(lon.getText().toString())*1e6)); //反Geo搜索 mSearch.reverseGeocode(ptCenter); } else if (mBtnGeoCode.equals(v)) { EditText editCity = (EditText)findViewById(R.id.city); EditText editGeoCodeKey = (EditText)findViewById(R.id.geocodekey); //Geo搜索 mSearch.geocode(editGeoCodeKey.getText().toString(), editCity.getText().toString()); } } @Override protected void onPause() { mMapView.onPause(); super.onPause(); } @Override protected void onResume() { mMapView.onResume(); super.onResume(); } @Override protected void onDestroy() { mMapView.destroy(); super.onDestroy(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mMapView.onSaveInstanceState(outState); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); mMapView.onRestoreInstanceState(savedInstanceState); } }
[ "1018573693@qq.com" ]
1018573693@qq.com
4e6a64cb024170a8eb60e6deb0678d68fb056c89
375d3b6f123f102ce7c24b85be2aa22775c4442a
/src/main/java/com/nxsol/entity/Role.java
420f3ce994210960c37ed5e28a39543e4a8fe509
[]
no_license
nxsol-india/property
b95bc373f241b56b2ec56bbe0a87578b407a9f6c
58d19a61c540754279b02363bd4631a1366092d3
refs/heads/master
2023-04-11T06:07:21.215803
2021-04-21T12:29:23
2021-04-21T12:29:23
360,156,141
0
0
null
null
null
null
UTF-8
Java
false
false
950
java
package com.nxsol.entity; import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import org.hibernate.annotations.NaturalId; @Entity @Table(name = "roles") public class Role { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long id; @Enumerated(EnumType.STRING) @NaturalId @Column(length = 60) private RoleName name; public Role() { } public Role(RoleName name) { this.name = name; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public RoleName getName() { return name; } public void setName(RoleName name) { this.name = name; } }
[ "minesh,b.java" ]
minesh,b.java
3c3d7dacd30295ead6cfe04c0548e2f9ae67d513
55dd60fe01ee88deda273f9ab1e3616e390b2d5b
/JDK1.8/src/javax/annotation/Resource.java
c7f80cafcbc392fbef160627092f658a06639c73
[]
no_license
wanghengGit/JDK-1
d7c1a86ecadb2590c8d58a23c47fdd7ebfcc3a66
1be52fd27316c82e06296dbdd25e41ad3da37d12
refs/heads/master
2021-09-10T07:23:17.576037
2021-09-09T07:19:16
2021-09-09T07:19:16
202,044,942
0
0
null
2019-08-13T02:13:35
2019-08-13T02:13:34
null
UTF-8
Java
false
false
4,728
java
/* * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package javax.annotation; import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; import static java.lang.annotation.RetentionPolicy.*; /** * The Resource annotation marks a resource that is needed * by the application. This annotation may be applied to an * application component class, or to fields or methods of the * component class. When the annotation is applied to a * field or method, the container will inject an instance * of the requested resource into the application component * when the component is initialized. If the annotation is * applied to the component class, the annotation declares a * resource that the application will look up at runtime. <p> * * Even though this annotation is not marked Inherited, deployment * tools are required to examine all superclasses of any component * class to discover all uses of this annotation in all superclasses. * All such annotation instances specify resources that are needed * by the application component. Note that this annotation may * appear on private fields and methods of superclasses; the container * is required to perform injection in these cases as well. * * @since Common Annotations 1.0 * @date 20200403 * @Resource的作用相当于@Autowired * 只不过@Autowired按byType自动注入, * 而@Resource默认按 byName自动注入罢了 */ @Target({TYPE, FIELD, METHOD}) @Retention(RUNTIME) public @interface Resource { /** * The JNDI name of the resource. For field annotations, * the default is the field name. For method annotations, * the default is the JavaBeans property name corresponding * to the method. For class annotations, there is no default * and this must be specified. */ String name() default ""; /** * The name of the resource that the reference points to. It can * link to any compatible resource using the global JNDI names. * * @since Common Annotations 1.1 */ String lookup() default ""; /** * The Java type of the resource. For field annotations, * the default is the type of the field. For method annotations, * the default is the type of the JavaBeans property. * For class annotations, there is no default and this must be * specified. */ Class<?> type() default java.lang.Object.class; /** * The two possible authentication types for a resource. */ enum AuthenticationType { CONTAINER, APPLICATION } /** * The authentication type to use for this resource. * This may be specified for resources representing a * connection factory of any supported type, and must * not be specified for resources of other types. */ AuthenticationType authenticationType() default AuthenticationType.CONTAINER; /** * Indicates whether this resource can be shared between * this component and other components. * This may be specified for resources representing a * connection factory of any supported type, and must * not be specified for resources of other types. */ boolean shareable() default true; /** * A product specific name that this resource should be mapped to. * The name of this resource, as defined by the <code>name</code> * element or defaulted, is a name that is local to the application * component using the resource. (It's a name in the JNDI * <code>java:comp/env</code> namespace.) Many application servers * provide a way to map these local names to names of resources * known to the application server. This mapped name is often a * <i>global</i> JNDI name, but may be a name of any form. <p> * * Application servers are not required to support any particular * form or type of mapped name, nor the ability to use mapped names. * The mapped name is product-dependent and often installation-dependent. * No use of a mapped name is portable. */ String mappedName() default ""; /** * Description of this resource. The description is expected * to be in the default language of the system on which the * application is deployed. The description can be presented * to the Deployer to help in choosing the correct resource. */ String description() default ""; }
[ "1012056369@qq.com" ]
1012056369@qq.com
9dbeeabcd647f29713620be0a67dd474a0394076
b053d89aab33daa69a8b59141595b849fb1fa2e5
/app/src/test/java/id/ac/ui/cs/mobileprogramming/aviliani/dailyworkouts/ExampleUnitTest.java
f0680551dc02de0594612e210cfeaf691bfb1997
[]
no_license
AvilianiPramestya/daily-workout
6beddf93cd9bedf16328f2d096f9754da199ae39
f0399f39f82e8f707bd88cb7e494228a96d4ee6b
refs/heads/master
2020-09-07T02:19:14.001097
2019-12-26T18:12:00
2019-12-26T18:12:00
220,627,696
0
0
null
null
null
null
UTF-8
Java
false
false
413
java
package id.ac.ui.cs.mobileprogramming.aviliani.dailyworkouts; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "avipramestya14@gmail.com" ]
avipramestya14@gmail.com
1e124cedfe32eeb0b53fdf2a2e530ec1c1bf88e1
2aae974c2c207e715d040866d807a5c8e72e8a18
/Character_Equipment_Impl/src/net/sf/anathema/character/equipment/impl/reporting/content/stats/weapons/FirstEditionAccuracyWeaponStatsGroup.java
eb1155f34287573c731da13facdd2065dd119eaf
[]
no_license
Shadow493/anathema
5ec7afeea4b12360d6fd623ecde28f2c01905463
3f3a3de643bd3ef0462dc3511a37fbd0bcbb7602
refs/heads/master
2020-12-30T18:51:17.548460
2012-03-17T18:40:43
2012-03-17T18:40:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,319
java
package net.sf.anathema.character.equipment.impl.reporting.content.stats.weapons; import net.sf.anathema.character.generic.character.IGenericCharacter; import net.sf.anathema.character.generic.character.IGenericTraitCollection; import net.sf.anathema.character.generic.equipment.IEquipmentModifiers; import net.sf.anathema.character.generic.equipment.weapon.IWeaponStats; import net.sf.anathema.character.generic.impl.CharacterUtilties; import net.sf.anathema.lib.resources.IResources; public class FirstEditionAccuracyWeaponStatsGroup extends AccuracyWeaponStatsGroup { private final IGenericCharacter character; public FirstEditionAccuracyWeaponStatsGroup(IResources resources, IGenericCharacter character, IGenericTraitCollection traitCollection, IEquipmentModifiers equipment) { super(resources, traitCollection, equipment); this.character = character; } @Override protected int getFinalValue(IWeaponStats weapon, int weaponValue, IEquipmentModifiers equipment) { int value = super.getFinalValue(weapon, weaponValue, equipment); value = Math.max(0, value - CharacterUtilties.getUntrainedActionModifier(character, weapon.getTraitType())); value += weapon.isRangedCombat() ? equipment.getRangedAccuracyMod() : equipment.getMeleeAccuracyMod(); return value; } }
[ "sandra.sieroux@googlemail.com" ]
sandra.sieroux@googlemail.com
99c3bfd34077cef28601c4e956bbf6f6ce79d6fa
05c6ae6a8d41b191afb7ff5bb507ecec2774698f
/lesson_5_2/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/compat/R.java
0964d9ca39a919c5a5b41fb33e11f253ebf5485f
[]
no_license
dan1603/ITVDN
9106b534847d466af747dca4ca38aeb089a551e3
af767e4aca74a29bbde36619d9fde566a471a71e
refs/heads/master
2020-06-29T23:44:20.536187
2019-08-05T13:25:20
2019-08-05T13:25:20
182,649,020
1
0
null
null
null
null
UTF-8
Java
false
false
10,453
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.compat; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f030027; public static final int font = 0x7f0300d7; public static final int fontProviderAuthority = 0x7f0300d9; public static final int fontProviderCerts = 0x7f0300da; public static final int fontProviderFetchStrategy = 0x7f0300db; public static final int fontProviderFetchTimeout = 0x7f0300dc; public static final int fontProviderPackage = 0x7f0300dd; public static final int fontProviderQuery = 0x7f0300de; public static final int fontStyle = 0x7f0300df; public static final int fontVariationSettings = 0x7f0300e0; public static final int fontWeight = 0x7f0300e1; public static final int ttcIndex = 0x7f030208; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f05006b; public static final int notification_icon_bg_color = 0x7f05006c; public static final int ripple_material_light = 0x7f050077; public static final int secondary_text_default_material_light = 0x7f050079; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f06004e; public static final int compat_button_inset_vertical_material = 0x7f06004f; public static final int compat_button_padding_horizontal_material = 0x7f060050; public static final int compat_button_padding_vertical_material = 0x7f060051; public static final int compat_control_corner_material = 0x7f060052; public static final int compat_notification_large_icon_max_height = 0x7f060053; public static final int compat_notification_large_icon_max_width = 0x7f060054; public static final int notification_action_icon_size = 0x7f0600c4; public static final int notification_action_text_size = 0x7f0600c5; public static final int notification_big_circle_margin = 0x7f0600c6; public static final int notification_content_margin_start = 0x7f0600c7; public static final int notification_large_icon_height = 0x7f0600c8; public static final int notification_large_icon_width = 0x7f0600c9; public static final int notification_main_column_padding_top = 0x7f0600ca; public static final int notification_media_narrow_margin = 0x7f0600cb; public static final int notification_right_icon_size = 0x7f0600cc; public static final int notification_right_side_padding_top = 0x7f0600cd; public static final int notification_small_icon_background_padding = 0x7f0600ce; public static final int notification_small_icon_size_as_large = 0x7f0600cf; public static final int notification_subtext_size = 0x7f0600d0; public static final int notification_top_pad = 0x7f0600d1; public static final int notification_top_pad_large_text = 0x7f0600d2; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f07006b; public static final int notification_bg = 0x7f07006c; public static final int notification_bg_low = 0x7f07006d; public static final int notification_bg_low_normal = 0x7f07006e; public static final int notification_bg_low_pressed = 0x7f07006f; public static final int notification_bg_normal = 0x7f070070; public static final int notification_bg_normal_pressed = 0x7f070071; public static final int notification_icon_background = 0x7f070072; public static final int notification_template_icon_bg = 0x7f070073; public static final int notification_template_icon_low_bg = 0x7f070074; public static final int notification_tile_bg = 0x7f070075; public static final int notify_panel_notification_icon_bg = 0x7f070076; } public static final class id { private id() {} public static final int action_container = 0x7f08000e; public static final int action_divider = 0x7f080010; public static final int action_image = 0x7f080011; public static final int action_text = 0x7f080017; public static final int actions = 0x7f080018; public static final int async = 0x7f08001e; public static final int blocking = 0x7f080022; public static final int chronometer = 0x7f08002b; public static final int forever = 0x7f08004c; public static final int icon = 0x7f080053; public static final int icon_group = 0x7f080054; public static final int info = 0x7f080057; public static final int italic = 0x7f080059; public static final int line1 = 0x7f08005e; public static final int line3 = 0x7f08005f; public static final int normal = 0x7f08006d; public static final int notification_background = 0x7f08006e; public static final int notification_main_column = 0x7f08006f; public static final int notification_main_column_container = 0x7f080070; public static final int right_icon = 0x7f08007d; public static final int right_side = 0x7f08007e; public static final int tag_transition_group = 0x7f0800ac; public static final int tag_unhandled_key_event_manager = 0x7f0800ad; public static final int tag_unhandled_key_listeners = 0x7f0800ae; public static final int text = 0x7f0800af; public static final int text2 = 0x7f0800b0; public static final int time = 0x7f0800b8; public static final int title = 0x7f0800b9; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f09000e; } public static final class layout { private layout() {} public static final int notification_action = 0x7f0b0030; public static final int notification_action_tombstone = 0x7f0b0031; public static final int notification_template_custom_big = 0x7f0b0038; public static final int notification_template_icon_group = 0x7f0b0039; public static final int notification_template_part_chronometer = 0x7f0b003d; public static final int notification_template_part_time = 0x7f0b003e; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0d0040; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0e0117; public static final int TextAppearance_Compat_Notification_Info = 0x7f0e0118; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0e011a; public static final int TextAppearance_Compat_Notification_Time = 0x7f0e011d; public static final int TextAppearance_Compat_Notification_Title = 0x7f0e011f; public static final int Widget_Compat_NotificationActionContainer = 0x7f0e01c6; public static final int Widget_Compat_NotificationActionText = 0x7f0e01c7; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f030027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f0300d9, 0x7f0300da, 0x7f0300db, 0x7f0300dc, 0x7f0300dd, 0x7f0300de }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0300d7, 0x7f0300df, 0x7f0300e0, 0x7f0300e1, 0x7f030208 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
[ "kalashnyk.denys@gmail.com" ]
kalashnyk.denys@gmail.com
5f12449f1623e926ed3c8b04fe21009684a34d1f
e3fe1fafe89b40f76b41abaf401a234e3b6ec9f7
/07_Java_parte07_java.io/aulas/java-io/src/br/com/alura/java/io/modelo/Conta.java
9bc6f03a92d144618cf37c87d15f7d5043f86fe5
[]
no_license
IvanConsalter/Formacao_ONE_Java
45a335d154322a28f64c85c11eef76753204bbc3
710d4bc0ff4473a3b65da6a5c92e74af098f10df
refs/heads/master
2022-04-27T19:17:56.441567
2020-04-30T17:35:50
2020-04-30T17:35:50
254,634,578
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
2,251
java
package br.com.alura.java.io.modelo; import java.io.Serializable; public abstract class Conta implements Comparable<Conta>, Serializable{ /** * */ private static final long serialVersionUID = 1L; private int agencia; private int numero; private Cliente titular; protected double saldo; private static int total = 0; public Conta() { //System.out.println("Criando uma Conta"); } /** * Construtor para inicializar o objeto Conta * a partir da agencia e numero * @param agencia * @param numero */ public Conta(int agencia, int numero) { // Conta.total++; // System.out.println("O total de Contas é: " + Conta.total); this.agencia = agencia; this.numero = numero; // System.out.println("Estou criando uma Conta"); } public abstract void deposita(double valor); /** * Valor precisa ser menor ou igual ao saldo * @param valor * @return */ public boolean saca(double valor) { if(this.saldo >= valor) { this.saldo -= valor; return true; } return false; } public boolean transfere(double valor, Conta destino) { if(this.saldo >= valor) { this.saldo -= valor; destino.deposita(valor); return true; } return false; } public double getSaldo() { return saldo; } public int getNumero() { return numero; } public void setNumero(int numero) { this.numero = numero; } public int getAgencia() { return agencia; } public void setAgencia(int agencia) { this.agencia = agencia; } public void setTitular(Cliente titular) { this.titular = titular; } public Cliente getTitular() { return titular; } public static int getTotal() { return Conta.total; } @Override public String toString() { return "Numero: " + this.numero + ", Agencia " + this.agencia; } /* public boolean eIgual(Conta outraConta) { if(this.agencia != outraConta.agencia) { return false; } if(this.numero != outraConta.numero) { return false; } return true; } */ @Override public boolean equals(Object ref) { Conta outraConta = (Conta) ref; if(this.agencia != outraConta.agencia) { return false; } if(this.numero != outraConta.numero) { return false; } return true; } }
[ "ivanconsalter1@gmail.com" ]
ivanconsalter1@gmail.com
c2164e5c7311946f640feca8526b082600d557fa
a579f76462681129bf725d5c73ccde010fc0d615
/src/main/java/com/tonfun/tools/Auditing/hibernate/AuditListener.java
bdece6b49b43dba2e928739a8e6dd54a1f5d920d
[]
no_license
zgy520/codeGenerate
2dd8b17769abec132fd2436c621d1e44190f600d
4ab7f026ce6a571d1e1878f2d73ad496217cfbf9
refs/heads/master
2020-03-16T09:42:02.942435
2018-06-21T14:57:36
2018-06-21T14:57:36
132,620,915
0
0
null
null
null
null
UTF-8
Java
false
false
3,948
java
/* ** TONFUN CONFIDENTIAL AND PROPRIETARY. ** ** This source is the sole property of Tonfun CO.,Ltd. Reproduction or Utilization of this source ** in whole or in part is forbidden without the written consent of Tonfun CO.,Ltd. ** 此文件所有权仅归天津同丰信息技术有限公司所有。 ** 未经天津同丰信息技术有限公司书面同意,严禁对此文件的全部或部分进行复制或使用。 ** ** Tonfun CONFIDENTIAL. ** Copyright 2011-2018 Tonfun Corporation All Rights Reserved. ** 天津同丰信息技术有限公司机密。 ** Copyright 2011-2018 天津同丰信息技术有限公司保留所有权利。 **-------------------------------------------------------------------------------------------------- ** ** 文件名: AuditListener.java ** 描 述: ** 作 者: a4423 ** 时 间: 2018年5月30日 下午8:20:17 **------------------------------------------------------------------------------------------------*/ package com.tonfun.tools.Auditing.hibernate; import java.util.Map; import javax.persistence.PostPersist; import javax.persistence.PostUpdate; import javax.persistence.PreRemove; import javax.persistence.PreUpdate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import com.tonfun.tools.Model.sys.Log; import com.tonfun.tools.Model.sys.Log_content; import com.tonfun.tools.helper.Utils; import com.tonfun.tools.helper.NoSpringContext.AutowireHelper; import com.tonfun.tools.service.I.module.sys.CI.sys.ILogService; import com.tonfun.tools.service.I.module.sys.CI.sys.ILog_contentService; /** ======================================================================================== * @author a4423 * 操作日志监听器 * =======================================================================================*/ public class AuditListener { private static final Logger LOGGER = LoggerFactory.getLogger(AuditListener.class); @Autowired ILogService logService; @Autowired ILog_contentService logContentService; @PreRemove private void beforeDeleteEntity(Object object) { LOGGER.info("删除实体之前调用"); Map<String, Object> map = this.getMapByObj(object); } @PostPersist private void afterSaveEntity(Object object) { AutowireHelper.autowire(this, this.logService); AutowireHelper.autowire(this, this.logContentService); LOGGER.info("保存实体之后调用"+object.getClass().getSimpleName()); String entityName = object.getClass().getSimpleName(); if (entityName.equals("Log") || entityName.equals("Log_content")) { return; } Log log = new Log(); log.setLoginName("zgy"); log.setMessage("测试消息"); log.setOperation("add"); log.setTblName(entityName.toLowerCase()); log.setTblComment("无"); logService.save(log); Map<String, Object> map = this.getMapByObj(object); for (Map.Entry<String, Object> entry : map.entrySet()){ if (!entry.getKey().contains("FIELD_")) { Log_content log_content = new Log_content(); log_content.setFldName(entry.getKey()); log_content.setLog(log); if (entry.getValue()!=null) { log_content.setNewValue(entry.getValue().toString()); } logContentService.save(log_content); System.out.println(entry.getKey() + ":" + entry.getValue()); } } } @PreUpdate private void beforeUpdateEntity(Object object) { LOGGER.info("更新实体之前调用"); Map<String, Object> map = this.getMapByObj(object); } @PostUpdate private void afterUpdateEntity(Object object) { LOGGER.info("更新实体之后调用"); Map<String, Object> map = this.getMapByObj(object); } private Map<String, Object> getMapByObj(Object object){ try { Map<String,Object> map = Utils.getFields(object, false); return map; } catch (IllegalArgumentException | IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } }
[ "a442391947@gmail.com" ]
a442391947@gmail.com
a34f47f15348b55636d7c6976dffbb4da25a0300
5fad01d8108d4dbb6897af64a6506ab1db699d0f
/src/main/java/org/glavo/javah/NativeMethodVisitor.java
855724116006bf7d2606644d2ed4227c92b6e594
[ "MIT" ]
permissive
briandilley/gjavah
11539421980e66859631f9a9705ed1b16cb33ca9
e2b97e9624d96e67492124f68a3b5ff2ecdc2346
refs/heads/master
2023-07-12T01:33:20.327395
2020-03-08T04:44:13
2020-03-08T04:44:13
224,506,011
0
0
MIT
2019-11-27T19:49:11
2019-11-27T19:49:10
null
UTF-8
Java
false
false
2,082
java
package org.glavo.javah; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; class NativeMethodVisitor extends ClassVisitor { private String className; private Map<String, Object> constants = new LinkedHashMap<>(); private Map<String, Set<MethodDesc>> methods = new LinkedHashMap<>(); NativeMethodVisitor() { super(Opcodes.ASM5); } @Override public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { className = name; } @Override public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) { if (value instanceof Number) { constants.put(name, value); } return null; } @Override public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { if ((access & Opcodes.ACC_NATIVE) != 0) { if (methods.containsKey(name)) { methods.get(name).add(new MethodDesc((access & Opcodes.ACC_STATIC) != 0, descriptor)); } else { LinkedHashSet<MethodDesc> set = new LinkedHashSet<>(); set.add(new MethodDesc((access & Opcodes.ACC_STATIC) != 0, descriptor)); methods.put(name, set); } } return null; } public String getClassName() { return className; } public Map<String, Set<MethodDesc>> getMethods() { return methods; } public Map<String, Object> getConstants() { return constants; } public boolean hasConstants() { return constants.size() > 0; } public boolean hasNativeMethods() { return methods.size() > 0; } public boolean isEmpty() { return !hasConstants() && !hasNativeMethods(); } }
[ "briandilley@briandilley.com" ]
briandilley@briandilley.com
0ae2522ba303c57ff9c4694ae88880b3a31f85c0
05fe154644f35f1ff5d731ea8d300567a5c236ab
/CoreJava_MarToMay18/com/vtalent/sahithi/Empdel.java
7451ee9978061ea51f57525951b3907294346411
[]
no_license
narsinghraom/JavaMar_May_2018
b6de8298599f35ef1ec5c64e7db1e66aa34ce4e7
030a0d44172764cf339db618d632a9aab5e2e8e1
refs/heads/master
2021-04-03T04:17:59.058813
2018-07-19T06:19:14
2018-07-19T06:19:14
124,994,050
0
0
null
2018-03-15T05:49:44
2018-03-13T04:50:50
Java
UTF-8
Java
false
false
1,072
java
package com.vtalent.sahithi; import java.util.Scanner; public class Empdel { int eId; double eSalary; long eMobile; static Empdel[] empArray=new Empdel[4]; public static void insertData(){ for(int i=0;i<=empArray.length-1;i++) { Empdel emp=new Empdel(); emp.eId=100+i; emp.eSalary=2500*(10+i); emp.eMobile=70754435+(i*2); empArray[i]=emp; } } public static void main(Strng args[]) { insertData(); displayEmp(); display(); } public static void displayEmp() { for(int i=0;i<=empArray.length-1;i++) { Empdel emp=(Empdel)empArray[i]; System.out.println("Id="+emp.eId +" "+"Salary="+emp.eSalary +" "+"Mobile="+emp.eMobile); } } public static void display() { Scanner sc=new Scanner(System.in); System.out.println("enter eId"); int tempeId=sc.nextInt(); for(int i=0;i<=empArray.length-1;i++) { Empdel emp=(Empdel)empArray[i]; if(tempeId==emp.eId) { System.out.println("Id="+emp.eId +" "+"Salary="+emp.eSalary +" "+"Mobile="+emp.eMobile); empArray[i]=null; break; } } }}
[ "kandakatlasahithi@gmail.com" ]
kandakatlasahithi@gmail.com
887e9ca22120b720caaf15d6764c3d7dd72e59ac
90cfd5d6897b0c04e880587b31f65473cf659565
/scat/src/main/java/com/plan111mil/GUI/ScatView.java
15baed7668183b3d01e81e80895fcb3b0bada092
[]
no_license
rbeltracchi/ET5002
2a9141cf2aa28de63ba71ae0a20e9fc9a7999171
2a995aef3244c05d0ab13be48ad3516607316f60
refs/heads/master
2020-03-21T07:59:25.347124
2018-07-23T15:01:52
2018-07-23T15:01:52
138,312,503
0
0
null
null
null
null
UTF-8
Java
false
false
69,512
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 com.plan111mil.GUI; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GraphicsConfiguration; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.DefaultListModel; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.ListSelectionModel; import javax.swing.SwingConstants; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import com.plan111mil.data.ServicesDAO.HousingServices; import com.plan111mil.data.ServicesDAO.UserServices; import com.plan111mil.data.entity.HostService; import com.plan111mil.data.entity.Housing; import com.plan111mil.data.entity.OfficeAdmin; import com.plan111mil.data.entity.Room; import com.plan111mil.data.entity.User; import com.plan111mil.exception.InvalidCredentialsException; import com.plan111mil.filter.AvailableFilter; import com.plan111mil.filter.CapacityFilter; import com.plan111mil.filter.CommodityFilter; import com.plan111mil.filter.Filter; import com.plan111mil.filter.NameFilter; import com.plan111mil.filter.TypeFilter; import com.plan111mil.message.Message; /** * * @author ET5002 */ public class ScatView { private JFrame scatView; private User hUser; private JPanel rightPanel; // constantes para el archivo de configuración para recordar usuario private static final String CONF_FILE_NAME = "conf.properties"; private static final String CONF_KEY_REMEMBER = "remember"; private static final String CONF_KEY_USER = "user"; private static final String CONF_KEY_PASSWORD = "pass"; public ScatView() { this.scatView = new JFrame("Scat"); scatView.setIconImage(new ImageIcon(getClass().getResource(LookAndFeel.SCAT_ICON)).getImage()); GraphicsConfiguration config = scatView.getGraphicsConfiguration(); int left = Toolkit.getDefaultToolkit().getScreenInsets(config).left; int right = Toolkit.getDefaultToolkit().getScreenInsets(config).right; int top = Toolkit.getDefaultToolkit().getScreenInsets(config).top; int bottom = Toolkit.getDefaultToolkit().getScreenInsets(config).bottom; Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = screenSize.width - left - right; int height = screenSize.height - top - bottom; scatView.setResizable(false); scatView.setSize(width, height); scatView.setBackground(Color.white); scatView.getContentPane().add(returnWelcomeView()); scatView.setVisible(true); scatView.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } // ------------------------------REUSABLE SCAT LOGO // PANEL------------------------------// private JPanel returnScatLogoPanel() { JPanel scatLogoPanelPanel = new JPanel(); JLabel scatLogoLabel = new JLabel(new ImageIcon(getClass().getResource(LookAndFeel.SCAT_LOGO))); scatLogoPanelPanel.add(Box.createRigidArea(new Dimension(200, 200))); scatLogoPanelPanel.add(scatLogoLabel); scatLogoPanelPanel.setBackground(LookAndFeel.CUSTOM_GREY); scatLogoPanelPanel.setLayout(new BoxLayout(scatLogoPanelPanel, BoxLayout.Y_AXIS)); scatLogoPanelPanel.setVisible(true); return scatLogoPanelPanel; } // ------------------------------WELCOME VIEW------------------------------// private JPanel returnWelcomeView() { JPanel welcomeMainPanel = new JPanel(); // ----------RIGHT PANEL----------// JPanel welcomeRightPanel = new JPanel(); JLabel welcomeText = new JLabel("¡Bienvenido a Scat!"); welcomeText.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); welcomeText.setAlignmentX(welcomeText.CENTER_ALIGNMENT); welcomeText.setFont(new Font("Bauhaus 93", Font.PLAIN, 34)); PlaceHolder userText = new PlaceHolder(); userText.setPlaceholder("Usuario"); userText.setAlignmentX(userText.CENTER_ALIGNMENT); userText.setMaximumSize(new Dimension(400, 38)); userText.setForeground(Color.gray); PlaceHolderPass passText = new PlaceHolderPass(); passText.setPlaceholder("Contraseña"); passText.setMaximumSize(new Dimension(400, 38)); passText.setForeground(Color.gray); JCheckBox recordarmeCheck = new JCheckBox("Recordarme"); recordarmeCheck.setBackground(LookAndFeel.CUSTOM_GREY); recordarmeCheck.setForeground(LookAndFeel.CUSTOM_BLUE); recordarmeCheck.setAlignmentX(recordarmeCheck.CENTER_ALIGNMENT); JButton loginButton = new JButton("INGRESAR"); loginButton.setBackground(LookAndFeel.CUSTOM_DARK_BLUE); loginButton.setForeground(Color.white); loginButton.setAlignmentX(loginButton.CENTER_ALIGNMENT); loginButton.setMaximumSize(new Dimension(400, 38)); JLabel message = new JLabel(""); message.setForeground(Color.red); message.setAlignmentX(message.CENTER_ALIGNMENT); welcomeRightPanel.add(Box.createRigidArea(new Dimension(0, 170))); welcomeRightPanel.add(welcomeText); welcomeRightPanel.add(Box.createRigidArea(new Dimension(0, 30))); welcomeRightPanel.add(userText); welcomeRightPanel.add(Box.createRigidArea(new Dimension(0, 25))); welcomeRightPanel.add(passText); welcomeRightPanel.add(Box.createRigidArea(new Dimension(0, 25))); welcomeRightPanel.add(recordarmeCheck); welcomeRightPanel.add(Box.createRigidArea(new Dimension(0, 25))); welcomeRightPanel.add(loginButton); welcomeRightPanel.add(Box.createRigidArea(new Dimension(0, 15))); welcomeRightPanel.add(message); welcomeRightPanel.setBackground(LookAndFeel.CUSTOM_GREY); welcomeRightPanel.setLayout(new BoxLayout(welcomeRightPanel, BoxLayout.Y_AXIS)); welcomeRightPanel.setVisible(true); welcomeMainPanel.setBackground(LookAndFeel.CUSTOM_GREY); BorderLayout mainLayout = new BorderLayout(); welcomeMainPanel.setLayout(mainLayout); welcomeMainPanel.add(returnScatLogoPanel(), BorderLayout.WEST); welcomeMainPanel.add(welcomeRightPanel, BorderLayout.CENTER); mainLayout.setHgap(200); mainLayout.setVgap(70); welcomeMainPanel.setVisible(true); // cargo las configuraciones de recordar usuario y contraseña desde el archivo // de propiedades Properties conf = loadConf(); // si en la configuracion de recordar usuario esta remember en 'true' if (Boolean.parseBoolean(conf.getProperty(CONF_KEY_REMEMBER))) { recordarmeCheck.setSelected(true); // se mantiene el tilde en recordarme userText.setText(conf.getProperty(CONF_KEY_USER));// el texto de user se carga con el guardado passText.setText(conf.getProperty(CONF_KEY_PASSWORD));// el texto de pass se carga con el guardado } else recordarmeCheck.setSelected(false);// sino recordarme se destilda // Botón ingresar, validación usuario y contraseña loginButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { try { String password = new String(passText.getPassword()); UserServices uS = new UserServices(); User user = uS.validateUser(userText.getText(), password); // si pasa la validación se salvan los datos de recordarme if (recordarmeCheck.isSelected()) { // si recordarme está seleccionado conf.setProperty(CONF_KEY_REMEMBER, Boolean.TRUE.toString());// la propiedad con clave // 'remember' se vuelve 'true' conf.setProperty(CONF_KEY_USER, userText.getText());// la popiedad con clave 'user' se vuelve // userText conf.setProperty(CONF_KEY_PASSWORD, password);// la propiedad con clave 'pass' se vuelve el // texto de passText } else { conf.setProperty(CONF_KEY_REMEMBER, Boolean.FALSE.toString());// si es falso conf.setProperty(CONF_KEY_USER, "");// los valores estan vacios conf.setProperty(CONF_KEY_PASSWORD, ""); } saveConf(conf); userText.setText(""); passText.setText(""); message.setText(""); // dependiendo del tipo de usuario se redirecciona a la vista correspondiente if (user.isOfficeAdmin()) { hUser = user; scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnOfficeHomeView()); scatView.validate(); scatView.repaint(); } else { hUser = user; scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnHousingHomeView()); scatView.validate(); scatView.repaint(); } } catch (InvalidCredentialsException ex) { message.setText(ex.getMessage());// si no se puede validar el usuario se muestra msj de error userText.setText(""); passText.setText(""); } } }); return welcomeMainPanel; } /** * Devuelve un Properties con los datos del archivo de configuración si no * existe el archivo crea el objeto con valores por defecto * * @return Properties con los datos de recordarme (usuario, contraseña, * recordarme) */ private Properties loadConf() { // se crea un objeto de propiedades Properties conf = new Properties(); InputStream is = null; try { // se inicializa desde un archivo is = new FileInputStream(CONF_FILE_NAME); conf.load(is); } catch (IOException e) { // valores por defecto en caso que no exista el archivo conf.setProperty(CONF_KEY_USER, ""); conf.setProperty(CONF_KEY_PASSWORD, "**********"); conf.setProperty(CONF_KEY_REMEMBER, Boolean.FALSE.toString()); } finally { if (is != null) { try { is.close(); } catch (IOException ex) { Logger.getLogger(ScatView.class.getName()).log(Level.SEVERE, null, ex); } } } return conf; } /** * Pesiste en un archivo el Properties de configuración * * @param conf */ private void saveConf(Properties conf) { FileOutputStream os = null; try { // se abre el archivo para escribir las propiedades os = new FileOutputStream(CONF_FILE_NAME); conf.store(os, "Archivo de configuracion local de SCAT"); } catch (IOException ioe) { Logger.getLogger(ScatView.class.getName()).log(Level.SEVERE, null, ioe); } finally { if (os != null) { try { os.close(); } catch (IOException ex) { Logger.getLogger(ScatView.class.getName()).log(Level.SEVERE, null, ex); } } } } // **********************************************OFFICE ADMIN // VIEW**********************************************// // ------------------------------REUSABLE OFFICE MENU // PANEL------------------------------// private JPanel returnOfficeMenuPanel(int selection) { JPanel menuPanel = new JPanel(); JButton homeButton = new JButton("Home", new ImageIcon(getClass().getResource(LookAndFeel.HOME_BUTTON_ICON))); homeButton.setHorizontalTextPosition(SwingConstants.RIGHT); homeButton.setBackground(LookAndFeel.CUSTOM_BLUE); homeButton.setBorderPainted(false); homeButton.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); homeButton.setFont(new Font("Bauhaus", Font.BOLD, 16)); homeButton.setForeground(Color.white); JButton buscarButton = new JButton("Buscar Hospedaje", new ImageIcon(getClass().getResource(LookAndFeel.BUSCAR_BUTTON_ICON))); buscarButton.setBackground(LookAndFeel.CUSTOM_BLUE); buscarButton.setBorderPainted(false); buscarButton.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); buscarButton.setFont(new Font("Bauhaus", Font.BOLD, 16)); buscarButton.setForeground(Color.white); JButton agregarButton = new JButton("Agregar Hospedaje", new ImageIcon(getClass().getResource(LookAndFeel.AGREGAR_BUTTON_ICON))); agregarButton.setBackground(LookAndFeel.CUSTOM_BLUE); agregarButton.setBorderPainted(false); agregarButton.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); agregarButton.setFont(new Font("Bauhaus", Font.BOLD, 16)); agregarButton.setForeground(Color.white); JButton salirButton = new JButton("Salir", new ImageIcon(getClass().getResource(LookAndFeel.SALIR_BUTTON_ICON))); salirButton.setBackground(LookAndFeel.CUSTOM_BLUE); salirButton.setBorderPainted(false); salirButton.setOpaque(false); salirButton.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); salirButton.setFont(new Font("Bauhaus", Font.BOLD, 16)); salirButton.setForeground(Color.white); // muestra como seleccionado el boton de acuerdo a la vista que se este // mostrando switch (selection) { case 1: homeButton.setOpaque(true); buscarButton.setOpaque(false); agregarButton.setOpaque(false); break; case 2: homeButton.setOpaque(false); buscarButton.setOpaque(true); agregarButton.setOpaque(false); break; case 3: homeButton.setOpaque(false); buscarButton.setOpaque(false); agregarButton.setOpaque(true); break; } menuPanel.add(Box.createRigidArea(new Dimension(0, 15))); menuPanel.add(homeButton); menuPanel.add(buscarButton); menuPanel.add(agregarButton); menuPanel.add(Box.createRigidArea(new Dimension(0, 500))); menuPanel.add(salirButton); menuPanel.setBackground(LookAndFeel.CUSTOM_GREEN); menuPanel.setLayout(new BoxLayout(menuPanel, BoxLayout.Y_AXIS)); menuPanel.setVisible(true); // cambia a la vista "Home" homeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnOfficeHomeView()); scatView.validate(); scatView.repaint(); } }); // cambia a la vista "Buscar Hospedaje" buscarButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnOfficeSearchView(new HousingServices().getHousings())); scatView.validate(); scatView.repaint(); } }); // cambia a la vista "Agregar Hospedaje" agregarButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnOfficeAddUserView()); scatView.validate(); scatView.repaint(); } }); // sale de la sesión y cambia a la pantalla de bienvenida/login salirButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnWelcomeView()); scatView.validate(); scatView.repaint(); } }); return menuPanel; } // ------------------------------OFFICE HOME // VIEW------------------------------// private JPanel returnOfficeHomeView() { JPanel officeHomePanel = new JPanel(); // ----------RIGHT PANEL----------// JPanel officeHomeRightPanel = new JPanel(); JLabel welcomeLabel = new JLabel("¡Bienvenido!"); welcomeLabel.setFont(new Font("Bauhaus 93", Font.BOLD, 35)); welcomeLabel.setForeground(LookAndFeel.CUSTOM_BLUE); JTextArea welcomeText = new JTextArea(Message.WELCOME_MESSAGE_1); welcomeText.setLineWrap(true); welcomeText.setWrapStyleWord(true); welcomeText.setOpaque(false); welcomeText.setEditable(false); welcomeText.setFont(new Font("Calibri", Font.BOLD, 18)); welcomeText.setForeground(LookAndFeel.CUSTOM_BLUE); officeHomeRightPanel.add(welcomeLabel); officeHomeRightPanel.add(welcomeText); officeHomeRightPanel.setBackground(LookAndFeel.CUSTOM_GREY); officeHomeRightPanel.setLayout(new GridLayout(0, 1, 0, 0)); officeHomeRightPanel.setPreferredSize(new Dimension(500, 600)); officeHomeRightPanel.setVisible(true); officeHomePanel.setBackground(LookAndFeel.CUSTOM_GREY); BorderLayout mainLayout = new BorderLayout(); officeHomePanel.setLayout(mainLayout); officeHomePanel.add(returnOfficeMenuPanel(1), BorderLayout.WEST); officeHomePanel.add(returnScatLogoPanel(), BorderLayout.CENTER); officeHomePanel.add(officeHomeRightPanel, BorderLayout.EAST); officeHomePanel.setVisible(true); return officeHomePanel; } // ------------------------------OFFICE SEARCH // VIEW------------------------------// private JPanel returnOfficeSearchView(List<Housing> list) { JPanel officeSearchPanel = new JPanel(); // ----------CENTER PANEL----------// JPanel officeSearchCenterPanel = new JPanel(); DefaultListModel<HostService> listModel = new DefaultListModel(); // Se actualiza los items de la JList refreshListPanel(list, listModel); JList<HostService> hsList = new JList(listModel); hsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); hsList.setCellRenderer(new HousingListRenderer()); JScrollPane listScroller = new JScrollPane(hsList); listScroller.setPreferredSize(new Dimension(500, 650)); listScroller.setVerticalScrollBarPolicy(listScroller.VERTICAL_SCROLLBAR_AS_NEEDED); JButton volverButton = new JButton("Volver"); volverButton.setMaximumSize(new Dimension(400, 38)); volverButton.setBackground(LookAndFeel.CUSTOM_DARK_BLUE); volverButton.setForeground(Color.white); volverButton.setAlignmentX(volverButton.LEFT_ALIGNMENT); volverButton.setVisible(false); JCheckBox checkDisp = new JCheckBox("Disponibles"); checkDisp.setFont(new Font("Calibri", Font.BOLD, 16)); checkDisp.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); checkDisp.setAlignmentX(checkDisp.RIGHT_ALIGNMENT); officeSearchCenterPanel.add(Box.createRigidArea(new Dimension(0, 15))); officeSearchCenterPanel.add(checkDisp); officeSearchCenterPanel.add(Box.createRigidArea(new Dimension(0, 15))); officeSearchCenterPanel.add(listScroller); officeSearchCenterPanel.add(volverButton); officeSearchCenterPanel.add(Box.createRigidArea(new Dimension(0, 10))); officeSearchCenterPanel.setLayout(new BoxLayout(officeSearchCenterPanel, BoxLayout.Y_AXIS)); officeSearchCenterPanel.setBackground(LookAndFeel.CUSTOM_GREY); officeSearchCenterPanel.setVisible(true); // ----------RIGHT PANEL----------// JPanel officeSearchRightPanel = new JPanel(); // ----------RIGHT top PANEL----------// JPanel officeSearchRightTopPanel = new JPanel(); JLabel filterLabel = new JLabel("Filtros de búsqueda"); filterLabel.setAlignmentX(filterLabel.LEFT_ALIGNMENT); filterLabel.setFont(new Font("Calibri", Font.BOLD, 20)); filterLabel.setBackground(Color.white); filterLabel.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); PlaceHolder nombreText = new PlaceHolder(); nombreText.setPlaceholder("Nombre"); nombreText.setMaximumSize(new Dimension(400, 38)); nombreText.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); PlaceHolder cantPersonasText = new PlaceHolder(); cantPersonasText.setPlaceholder("Cantidad de personas"); cantPersonasText.setMaximumSize(new Dimension(400, 38)); cantPersonasText.setBackground(Color.white); cantPersonasText.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); ArrayList<String> opcionesHousing = new ArrayList(); opcionesHousing.add("Tipo de Hospedaje"); opcionesHousing.addAll(Arrays.asList(Housing.HOUSING_TYPES)); JComboBox tipoHousingCombo = new JComboBox(opcionesHousing.toArray()); tipoHousingCombo.setMaximumSize(new Dimension(400, 38)); tipoHousingCombo.setBackground(Color.white); tipoHousingCombo.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); ArrayList<String> opcionesRoom = new ArrayList<>(); opcionesRoom.add("Tipo de Habitación"); opcionesRoom.addAll(Arrays.asList(Room.ROOM_TYPES)); JComboBox tipoRoomCombo = new JComboBox(opcionesRoom.toArray()); tipoRoomCombo.setMaximumSize(new Dimension(400, 38)); tipoRoomCombo.setBackground(Color.white); tipoRoomCombo.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); officeSearchRightTopPanel.add(filterLabel); officeSearchRightTopPanel.add(nombreText); officeSearchRightTopPanel.add(Box.createRigidArea(new Dimension(0, 10))); officeSearchRightTopPanel.add(cantPersonasText); officeSearchRightTopPanel.add(Box.createRigidArea(new Dimension(0, 1))); officeSearchRightTopPanel.add(tipoHousingCombo); officeSearchRightTopPanel.add(Box.createRigidArea(new Dimension(0, 1))); officeSearchRightTopPanel.add(tipoRoomCombo); officeSearchRightTopPanel.add(Box.createRigidArea(new Dimension(0, 1))); officeSearchRightTopPanel.setLayout(new GridLayout(0, 1)); officeSearchRightTopPanel.setBackground(LookAndFeel.CUSTOM_GREY); officeSearchRightTopPanel.setVisible(true); // ----------RIGHT bottom PANEL----------// JPanel officeSearchRightBottomPanel = new JPanel(); JLabel housingCommoditiesLabel = new JLabel("Servicios del Hospedaje"); housingCommoditiesLabel.setAlignmentX(housingCommoditiesLabel.LEFT_ALIGNMENT); housingCommoditiesLabel.setFont(new Font("Calibri", Font.BOLD, 18)); housingCommoditiesLabel.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); JCheckBox housingCommodityCheck1 = new JCheckBox("Estacionamiento"); housingCommodityCheck1.setFont(new Font("Calibri", Font.BOLD, 14)); housingCommodityCheck1.setAlignmentX(housingCommodityCheck1.LEFT_ALIGNMENT); housingCommodityCheck1.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); housingCommodityCheck1.setBackground(LookAndFeel.CUSTOM_GREY); JCheckBox housingCommodityCheck2 = new JCheckBox("Pileta de natacion"); housingCommodityCheck2.setFont(new Font("Calibri", Font.BOLD, 14)); housingCommodityCheck2.setAlignmentX(housingCommodityCheck2.LEFT_ALIGNMENT); housingCommodityCheck2.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); housingCommodityCheck2.setBackground(LookAndFeel.CUSTOM_GREY); JCheckBox housingCommodityCheck3 = new JCheckBox("WIFI"); housingCommodityCheck3.setFont(new Font("Calibri", Font.BOLD, 14)); housingCommodityCheck3.setAlignmentX(housingCommodityCheck3.LEFT_ALIGNMENT); housingCommodityCheck3.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); housingCommodityCheck3.setBackground(LookAndFeel.CUSTOM_GREY); JCheckBox housingCommodityCheck4 = new JCheckBox("Desayuno"); housingCommodityCheck4.setFont(new Font("Calibri", Font.BOLD, 14)); housingCommodityCheck4.setAlignmentX(housingCommodityCheck4.LEFT_ALIGNMENT); housingCommodityCheck4.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); housingCommodityCheck4.setBackground(LookAndFeel.CUSTOM_GREY); JLabel roomCommoditiesLabel = new JLabel("Servicios de la Habitación"); roomCommoditiesLabel.setAlignmentX(roomCommoditiesLabel.LEFT_ALIGNMENT); roomCommoditiesLabel.setFont(new Font("Calibri", Font.BOLD, 18)); roomCommoditiesLabel.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); JCheckBox roomCommodityCheck1 = new JCheckBox("Jacuzzi"); roomCommodityCheck1.setFont(new Font("Calibri", Font.BOLD, 14)); roomCommodityCheck1.setAlignmentX(roomCommodityCheck1.LEFT_ALIGNMENT); roomCommodityCheck1.setBackground(LookAndFeel.CUSTOM_GREY); roomCommodityCheck1.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); JCheckBox roomCommodityCheck2 = new JCheckBox("TV"); roomCommodityCheck2.setFont(new Font("Calibri", Font.BOLD, 14)); roomCommodityCheck2.setAlignmentX(roomCommodityCheck2.LEFT_ALIGNMENT); roomCommodityCheck2.setBackground(LookAndFeel.CUSTOM_GREY); roomCommodityCheck2.setForeground(LookAndFeel.CUSTOM_DARK_BLUE); JButton clearFiltersButton = new JButton("Limpiar filtros"); clearFiltersButton.setBackground(LookAndFeel.CUSTOM_BLUE); clearFiltersButton.setAlignmentX(filterLabel.CENTER_ALIGNMENT); clearFiltersButton.setFont(new Font("Bauhaus", Font.BOLD, 14)); clearFiltersButton.setForeground(Color.white); clearFiltersButton.setBorder(BorderFactory.createEmptyBorder()); clearFiltersButton.setMaximumSize(new Dimension(50, 48)); JButton buscarButton = new JButton("Buscar"); buscarButton.setBackground(LookAndFeel.CUSTOM_BLUE); buscarButton.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); buscarButton.setAlignmentX(filterLabel.CENTER_ALIGNMENT); buscarButton.setFont(new Font("Bauhaus", Font.BOLD, 14)); buscarButton.setForeground(Color.white); buscarButton.setBorder(BorderFactory.createEmptyBorder()); buscarButton.setSize(new Dimension(50, 38)); officeSearchRightBottomPanel.add(housingCommoditiesLabel); officeSearchRightBottomPanel.add(housingCommodityCheck1); officeSearchRightBottomPanel.add(housingCommodityCheck2); officeSearchRightBottomPanel.add(housingCommodityCheck3); officeSearchRightBottomPanel.add(housingCommodityCheck4); officeSearchRightBottomPanel.add(Box.createRigidArea(new Dimension(0, 15))); officeSearchRightBottomPanel.add(roomCommoditiesLabel); officeSearchRightBottomPanel.add(roomCommodityCheck1); officeSearchRightBottomPanel.add(roomCommodityCheck2); // officeSearchRightBottomPanel.add(Box.createRigidArea(new Dimension(0,8))); officeSearchRightBottomPanel.add(buscarButton); officeSearchRightBottomPanel.add(Box.createRigidArea(new Dimension(0, 1))); officeSearchRightBottomPanel.add(clearFiltersButton); officeSearchRightBottomPanel.setLayout(new GridLayout(0, 1, 0, 0)); officeSearchRightBottomPanel.setBackground(LookAndFeel.CUSTOM_GREY); officeSearchRightBottomPanel.setVisible(true); officeSearchRightPanel.add(officeSearchRightTopPanel); officeSearchRightPanel.add(officeSearchRightBottomPanel); officeSearchRightPanel.setLayout(new BoxLayout(officeSearchRightPanel, BoxLayout.PAGE_AXIS)); officeSearchRightPanel.setBackground(LookAndFeel.CUSTOM_GREY); officeSearchRightPanel.setPreferredSize(new Dimension(300, 600)); rightPanel = officeSearchRightPanel; officeSearchPanel.setBackground(LookAndFeel.CUSTOM_GREY); BorderLayout mainLayout = new BorderLayout(); officeSearchPanel.setLayout(mainLayout); officeSearchPanel.add(returnOfficeMenuPanel(2), BorderLayout.WEST); officeSearchPanel.add(officeSearchCenterPanel, BorderLayout.CENTER); officeSearchPanel.add(rightPanel, BorderLayout.EAST); mainLayout.setHgap(50); officeSearchPanel.setVisible(true); cantPersonasText.addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { char caracter = e.getKeyChar(); if (!Character.isDigit(caracter)) { e.consume(); } } }); clearFiltersButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { nombreText.setText(""); cantPersonasText.setText(""); tipoHousingCombo.setSelectedIndex(0); tipoRoomCombo.setSelectedIndex(0); housingCommodityCheck1.setSelected(false); housingCommodityCheck2.setSelected(false); housingCommodityCheck3.setSelected(false); housingCommodityCheck4.setSelected(false); roomCommodityCheck1.setSelected(false); roomCommodityCheck2.setSelected(false); checkDisp.setSelected(false); } }); buscarButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { List<Filter> fl = new ArrayList<>(); // name filter / nombre if (!nombreText.getText().equals("")) fl.add(new NameFilter((nombreText.getText()))); // capacity filter/cantidad de huespedes if (!cantPersonasText.getText().equals("")) fl.add(new CapacityFilter(Integer.parseInt(cantPersonasText.getText()))); // type filter / tipo de hospedaje if (!(String.valueOf(tipoHousingCombo.getSelectedItem()).equals("Tipo de Hospedaje"))) fl.add(new TypeFilter(String.valueOf(tipoHousingCombo.getSelectedItem()))); // type filter / tipo de habitacion if (!(String.valueOf(tipoRoomCombo.getSelectedItem()).equals("Tipo de Habitación"))) fl.add(new TypeFilter(String.valueOf(tipoRoomCombo.getSelectedItem()))); // commodities filter / servicios if (housingCommodityCheck1.isSelected()) fl.add(new CommodityFilter(housingCommodityCheck1.getText())); if (housingCommodityCheck2.isSelected()) fl.add(new CommodityFilter(housingCommodityCheck2.getText())); if (housingCommodityCheck3.isSelected()) fl.add(new CommodityFilter(housingCommodityCheck3.getText())); if (housingCommodityCheck4.isSelected()) fl.add(new CommodityFilter(housingCommodityCheck4.getText())); if (roomCommodityCheck1.isSelected()) fl.add(new CommodityFilter(roomCommodityCheck1.getText())); if (roomCommodityCheck2.isSelected()) fl.add(new CommodityFilter(roomCommodityCheck2.getText())); if (checkDisp.isSelected()) fl.add(new AvailableFilter()); refreshListPanel(new HousingServices().getFilteredListOfHousings(fl), (DefaultListModel<HostService>) hsList.getModel()); scatView.validate(); scatView.repaint(); } }); // recupera las rooms del housing seleccionado y las muestra hsList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent lse) { if (!lse.getValueIsAdjusting()) { if (hsList.getSelectedIndex() >= 0) { Housing selectedHousing = ((Housing) hsList.getSelectedValue()); List<Room> rList = selectedHousing.getRooms(); JList<HostService> roomsList = new JList(rList.toArray()); roomsList.setCellRenderer(new RoomListRenderer()); // pongo invisible el panel que muestra los housings listScroller.setVisible(false); JScrollPane roomsListScroller = new JScrollPane(roomsList); roomsListScroller.setPreferredSize(new Dimension(500, 650)); roomsListScroller.setVerticalScrollBarPolicy(roomsListScroller.VERTICAL_SCROLLBAR_AS_NEEDED); // muestro la lista de las habitaciones officeSearchCenterPanel.add(roomsListScroller); volverButton.setVisible(true); // muestro la info del hospedaje seleccionado officeSearchPanel.remove(rightPanel); rightPanel = returnHousingInfoPanel(selectedHousing); officeSearchPanel.add(rightPanel, BorderLayout.EAST); scatView.validate(); scatView.repaint(); // vuelve a mostrar los hospedajes y el panel de filtros volverButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { volverButton.setVisible(false); roomsListScroller.setVisible(false); listScroller.setVisible(true); hsList.clearSelection(); officeSearchPanel.remove(rightPanel); rightPanel = officeSearchRightPanel; officeSearchPanel.add(rightPanel, BorderLayout.EAST); scatView.validate(); scatView.repaint(); } }); } } } }); return officeSearchPanel; } /** * Este método actualiza la lista de los hospedajes que debe mostrar de acuerdo * a los filtros que fueron aplicados * * @param hList * @param hsListModel */ private void refreshListPanel(List<Housing> hList, DefaultListModel<HostService> hsListModel) { hsListModel.clear(); for (HostService host : hList) hsListModel.addElement(host); } private JPanel returnHousingInfoPanel(Housing selectedHousing) { // ----------RIGHT PANEL 2----------// JPanel officeSearchRightPanel2 = new JPanel(); JLabel hName = new JLabel(selectedHousing.getName()); hName.setFont(new Font("Bauhaus", Font.BOLD, 20)); JLabel hAddress = new JLabel(selectedHousing.getAddress()); hAddress.setFont(new Font("Calibri", Font.BOLD, 16)); JLabel hPhone = new JLabel(selectedHousing.getPhone()); hPhone.setFont(new Font("Calibri", Font.BOLD, 16)); JLabel hMail = new JLabel(selectedHousing.getMail()); hMail.setFont(new Font("Calibri", Font.BOLD, 16)); JLabel hDescription = new JLabel(selectedHousing.getDescription()); hDescription.setFont(new Font("Calibri", Font.BOLD, 18)); JLabel hCommodities = new JLabel("Servicios: " + selectedHousing.getCommodities().toString()); hDescription.setFont(new Font("Calibri", Font.BOLD, 18)); JButton volverButton = new JButton("Volver"); volverButton.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); volverButton.setBackground(LookAndFeel.CUSTOM_BLUE); volverButton.setAlignmentX(volverButton.CENTER_ALIGNMENT); volverButton.setVisible(false); officeSearchRightPanel2.add(Box.createRigidArea(new Dimension(0, 30))); officeSearchRightPanel2.add(hName); officeSearchRightPanel2.add(Box.createRigidArea(new Dimension(0, 5))); officeSearchRightPanel2.add(hAddress); officeSearchRightPanel2.add(Box.createRigidArea(new Dimension(0, 5))); officeSearchRightPanel2.add(hPhone); officeSearchRightPanel2.add(Box.createRigidArea(new Dimension(0, 5))); officeSearchRightPanel2.add(hMail); officeSearchRightPanel2.add(Box.createRigidArea(new Dimension(0, 5))); officeSearchRightPanel2.add(hDescription); officeSearchRightPanel2.add(Box.createRigidArea(new Dimension(0, 5))); officeSearchRightPanel2.add(hCommodities); officeSearchRightPanel2.setLayout(new BoxLayout(officeSearchRightPanel2, BoxLayout.PAGE_AXIS)); officeSearchRightPanel2.setBackground(LookAndFeel.CUSTOM_GREY); officeSearchRightPanel2.setPreferredSize(new Dimension(400, 600)); officeSearchRightPanel2.setVisible(true); return officeSearchRightPanel2; } // ------------------------------OFFICE ADD USER // VIEW------------------------------// private JPanel returnOfficeAddUserView() { JPanel officeAddUserPanel = new JPanel(); JPanel officeAddUserRightPanel = new JPanel(); JLabel crearUserLabel = new JLabel("Crear Usuario"); crearUserLabel.setAlignmentX(crearUserLabel.LEFT_ALIGNMENT); crearUserLabel.setFont(new Font("Calibri", Font.BOLD, 35)); PlaceHolder crearUserText = new PlaceHolder(); crearUserText.setPlaceholder("Usuario"); crearUserText.setAlignmentX(crearUserLabel.LEFT_ALIGNMENT); crearUserText.setMaximumSize(new Dimension(400, 25)); crearUserText.setForeground(Color.gray); PlaceHolder crearPassText = new PlaceHolder(); crearPassText.setPlaceholder("Contraseña"); crearPassText.setAlignmentX(crearUserLabel.LEFT_ALIGNMENT); crearPassText.setMaximumSize(new Dimension(400, 25)); crearPassText.setForeground(Color.gray); JCheckBox userCheck = new JCheckBox("Usuario Hospedaje"); userCheck.setBackground(LookAndFeel.CUSTOM_GREY); JCheckBox adminCheck = new JCheckBox("Usuario Oficina de Turismo"); adminCheck.setBackground(LookAndFeel.CUSTOM_GREY); ButtonGroup group = new ButtonGroup(); group.add(userCheck); group.add(adminCheck); JButton crearButton = new JButton("CREAR"); crearButton.setMaximumSize(new Dimension(400, 20)); JLabel selectOne = new JLabel("Seleccione el tipo de usuario por favor"); selectOne.setFont(new Font("Calibri", Font.BOLD, 16)); selectOne.setForeground(Color.red); selectOne.setVisible(false); officeAddUserRightPanel.add(Box.createRigidArea(new Dimension(150, 200))); officeAddUserRightPanel.add(crearUserLabel); officeAddUserRightPanel.add(Box.createRigidArea(new Dimension(0, 35))); officeAddUserRightPanel.add(crearUserText); officeAddUserRightPanel.add(Box.createRigidArea(new Dimension(0, 25))); officeAddUserRightPanel.add(crearPassText); officeAddUserRightPanel.add(Box.createRigidArea(new Dimension(0, 25))); officeAddUserRightPanel.add(userCheck); officeAddUserRightPanel.add(adminCheck); officeAddUserRightPanel.add(Box.createRigidArea(new Dimension(0, 25))); officeAddUserRightPanel.add(crearButton); officeAddUserRightPanel.add(Box.createRigidArea(new Dimension(0, 25))); officeAddUserRightPanel.add(selectOne); officeAddUserRightPanel.setBackground(LookAndFeel.CUSTOM_GREY); officeAddUserRightPanel.setLayout(new BoxLayout(officeAddUserRightPanel, BoxLayout.Y_AXIS)); officeAddUserRightPanel.setVisible(true); officeAddUserPanel.setBackground(LookAndFeel.CUSTOM_GREY); BorderLayout mainLayout = new BorderLayout(); officeAddUserPanel.setLayout(mainLayout); officeAddUserPanel.add(returnOfficeMenuPanel(3), BorderLayout.WEST); officeAddUserPanel.add(officeAddUserRightPanel, BorderLayout.CENTER); mainLayout.setVgap(100); officeAddUserPanel.setVisible(true); // chequea el tipo de usuario a crear y cambia a la vista correspondiente crearButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { // chequea que los campos no esten vacios if (crearUserText.getText().equals("") || crearPassText.getText().equals("")) { JOptionPane.showMessageDialog(scatView, Message.CREARBUTTON_MESSAGE_1); } else { // si se seleccionó un usuario de hospedaje, crea el objeto User // y pasa a la vista de creación de hospedaje if (userCheck.isSelected()) { if (new UserServices().userExists(crearUserText.getText()) == false) { hUser = new User(crearUserText.getText(), crearPassText.getText(), User.USER_TYPE_HOUSING_USER); scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnOfficeAddHousingView()); scatView.validate(); scatView.repaint(); } else {// sino se guardó muestra un error de posible usuario duplicado JOptionPane.showMessageDialog(scatView, Message.CREARBUTTON_MESSAGE_2); } } // si se seleccionó un usuario de oficina de turismo, crea el objeto OfficeAdmin // y cambia a la vista Home de oficina de turismo else { if (adminCheck.isSelected()) { hUser = new OfficeAdmin(crearUserText.getText(), crearPassText.getText(), User.USER_TYPE_OFFICE_ADMIN); if (new UserServices().persistUser(hUser)) { // si se pudo guardar el usuario en BD JOptionPane.showMessageDialog(scatView, Message.SUCCESS_MESSAGE_1); crearUserText.setText(""); crearPassText.setText(""); group.clearSelection(); } else // sino se guardó muestra un error de posible usuario duplicado { JOptionPane.showMessageDialog(scatView, Message.CREARBUTTON_MESSAGE_2); } } else { selectOne.setVisible(true); } } } } }); return officeAddUserPanel; } // ------------------------------OFFICE ADD HOUSING // VIEW------------------------------// private JPanel returnOfficeAddHousingView() { // ----------LEFT PANEL----------// JPanel officeAddHousingLeftPanel = new JPanel(); JLabel agregarHospedajeText = new JLabel(); agregarHospedajeText.setAlignmentX(agregarHospedajeText.LEFT_ALIGNMENT); agregarHospedajeText.setMaximumSize(new Dimension(400, 20)); agregarHospedajeText.setFont(new Font("Calibri", Font.BOLD, 18)); // si lo llamo desde la vista de crear user... if (hUser.getHousing() == null) agregarHospedajeText.setText("Agregar Hospedaje"); // si lo llamo desde la vista de modificar hospedaje... else agregarHospedajeText.setText("Actualizar datos del hospedaje"); PlaceHolder housingName = new PlaceHolder(); housingName.setPlaceholder("Nombre del hospedaje"); housingName.setMaximumSize(new Dimension(400, 25)); housingName.setBackground(LookAndFeel.CUSTOM_GREY); PlaceHolder housingPhone = new PlaceHolder(); housingPhone.setPlaceholder("Teléfono"); housingPhone.setMaximumSize(new Dimension(400, 25)); housingPhone.setBackground(LookAndFeel.CUSTOM_GREY); ArrayList<String> opcionesHousing = new ArrayList(); opcionesHousing.add("Tipo de hospedaje"); opcionesHousing.addAll(Arrays.asList(Housing.HOUSING_TYPES)); JComboBox tipoHousingCombo = new JComboBox(opcionesHousing.toArray()); tipoHousingCombo.setMaximumSize(new Dimension(400, 25)); tipoHousingCombo.setBackground(LookAndFeel.CUSTOM_GREY); PlaceHolderTextArea description = new PlaceHolderTextArea(); description.setPlaceholder("Descripción"); description.setBorder(BorderFactory.createLineBorder(Color.GRAY)); description.setMaximumSize(new Dimension(400, 100)); description.setBackground(LookAndFeel.CUSTOM_GREY); officeAddHousingLeftPanel.add(Box.createRigidArea(new Dimension(0, 70))); officeAddHousingLeftPanel.add(agregarHospedajeText); officeAddHousingLeftPanel.add(Box.createRigidArea(new Dimension(0, 20))); officeAddHousingLeftPanel.add(housingName); officeAddHousingLeftPanel.add(Box.createRigidArea(new Dimension(0, 20))); officeAddHousingLeftPanel.add(housingPhone); officeAddHousingLeftPanel.add(Box.createRigidArea(new Dimension(0, 20))); officeAddHousingLeftPanel.add(tipoHousingCombo); officeAddHousingLeftPanel.add(Box.createRigidArea(new Dimension(0, 20))); officeAddHousingLeftPanel.add(description); officeAddHousingLeftPanel.setLayout(new BoxLayout(officeAddHousingLeftPanel, BoxLayout.Y_AXIS)); officeAddHousingLeftPanel.setBackground(LookAndFeel.CUSTOM_GREY); // ----------RIGHT top PANEL----------// JPanel officeAddHousingRightTopPanel = new JPanel(); PlaceHolder housingAddress = new PlaceHolder(); housingAddress.setPlaceholder("Dirección"); housingAddress.setMaximumSize(new Dimension(400, 25)); housingAddress.setBackground(LookAndFeel.CUSTOM_GREY); PlaceHolder housingEmail = new PlaceHolder(); housingEmail.setPlaceholder("Dirección de correo electrónico"); housingEmail.setMaximumSize(new Dimension(400, 25)); housingEmail.setBackground(LookAndFeel.CUSTOM_GREY); JLabel housingCommoditiesLabel = new JLabel("Servicios del Hospedaje"); JCheckBox housingCommodityCheck1 = new JCheckBox("Estacionamiento"); housingCommodityCheck1.setBackground(LookAndFeel.CUSTOM_GREY); JCheckBox housingCommodityCheck2 = new JCheckBox("Pileta de natacion"); housingCommodityCheck2.setBackground(LookAndFeel.CUSTOM_GREY); JCheckBox housingCommodityCheck3 = new JCheckBox("WIFI"); housingCommodityCheck3.setBackground(LookAndFeel.CUSTOM_GREY); JCheckBox housingCommodityCheck4 = new JCheckBox("Desayuno"); housingCommodityCheck4.setBackground(LookAndFeel.CUSTOM_GREY); officeAddHousingRightTopPanel.add(Box.createRigidArea(new Dimension(0, 110))); officeAddHousingRightTopPanel.add(housingAddress); officeAddHousingRightTopPanel.add(Box.createRigidArea(new Dimension(0, 20))); officeAddHousingRightTopPanel.add(housingEmail); officeAddHousingRightTopPanel.add(Box.createRigidArea(new Dimension(0, 20))); officeAddHousingRightTopPanel.add(housingCommoditiesLabel); officeAddHousingRightTopPanel.add(Box.createRigidArea(new Dimension(0, 15))); officeAddHousingRightTopPanel.add(housingCommodityCheck1); officeAddHousingRightTopPanel.add(housingCommodityCheck2); officeAddHousingRightTopPanel.add(housingCommodityCheck3); officeAddHousingRightTopPanel.add(housingCommodityCheck4); officeAddHousingRightTopPanel.add(Box.createRigidArea(new Dimension(0, 100))); officeAddHousingRightTopPanel.setLayout(new BoxLayout(officeAddHousingRightTopPanel, BoxLayout.Y_AXIS)); officeAddHousingRightTopPanel.setBackground(LookAndFeel.CUSTOM_GREY); // ----------RIGHT bottom PANEL----------// JPanel officeAddHousingRightBottomPanel = new JPanel(); JButton cancelButton = new JButton("CANCELAR"); cancelButton.setBackground(LookAndFeel.CUSTOM_DARK_BLUE); cancelButton.setForeground(Color.white); JButton saveButton = new JButton("GUARDAR"); saveButton.setBackground(LookAndFeel.CUSTOM_DARK_BLUE); saveButton.setForeground(Color.white); officeAddHousingRightBottomPanel.add(Box.createRigidArea(new Dimension(0, 600))); officeAddHousingRightBottomPanel.add(cancelButton); officeAddHousingRightBottomPanel.add(Box.createRigidArea(new Dimension(20, 0))); officeAddHousingRightBottomPanel.add(saveButton); officeAddHousingRightBottomPanel.setLayout(new FlowLayout()); officeAddHousingRightBottomPanel.setBackground(LookAndFeel.CUSTOM_GREY); // ----------RIGHT PANEL----------// JPanel officeAddHousingRightPanel = new JPanel(); officeAddHousingRightPanel.add(officeAddHousingRightTopPanel); officeAddHousingRightPanel.add(officeAddHousingRightBottomPanel); officeAddHousingRightPanel.setLayout(new GridLayout(0, 1)); officeAddHousingRightPanel.setPreferredSize(new Dimension(600, 600)); officeAddHousingRightPanel.setBackground(LookAndFeel.CUSTOM_GREY); JPanel officeAddHousingPanel = new JPanel(); officeAddHousingPanel.setBackground(LookAndFeel.CUSTOM_GREY); BorderLayout mainLayout = new BorderLayout(); officeAddHousingPanel.setLayout(mainLayout); housingPhone.addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { char caracter = e.getKeyChar(); if (!Character.isDigit(caracter)) { e.consume(); } } }); // si estoy creando el usuario... if (hUser.getHousing() == null) { officeAddHousingPanel.add(returnOfficeMenuPanel(3), BorderLayout.WEST); // Si es usuario de hospedaje, carga la informacion existente } else { officeAddHousingPanel.add(returnHousingMenuPanel(2), BorderLayout.WEST); housingAddress.setText(hUser.getHousing().getAddress()); housingEmail.setText(hUser.getHousing().getMail()); housingPhone.setText(hUser.getHousing().getPhone()); housingName.setText(hUser.getHousing().getName()); description.setText(hUser.getHousing().getDescription()); tipoHousingCombo.setSelectedItem(String.valueOf(hUser.getHousing().getHostServiceType())); if (hUser.getHousing().getCommodities().contains("Estacionamiento")) housingCommodityCheck1.setSelected(true); if (hUser.getHousing().getCommodities().contains("Pileta de natacion")) housingCommodityCheck2.setSelected(true); if (hUser.getHousing().getCommodities().contains("WIFI")) housingCommodityCheck3.setSelected(true); if (hUser.getHousing().getCommodities().contains("Desayuno")) housingCommodityCheck4.setSelected(true); } officeAddHousingPanel.add(officeAddHousingLeftPanel, BorderLayout.CENTER); officeAddHousingPanel.add(officeAddHousingRightPanel, BorderLayout.EAST); mainLayout.setVgap(100); mainLayout.setHgap(100); officeAddHousingPanel.setVisible(true); // guarda el hospedaje creado saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { // si viene desde crear user/housing... if (hUser.getHousing() == null) { // comprueba que no haya ningun campo vacio if (housingName.getText().equals("") || housingPhone.getText().equals("") || tipoHousingCombo.getSelectedIndex() == 0 || description.getText().equals("") || housingAddress.getText().equals("") || housingEmail.getText().equals("")) { JOptionPane.showMessageDialog(scatView, Message.CREARBUTTON_MESSAGE_1); } else { Housing h = new Housing(housingAddress.getText(), housingEmail.getText(), housingPhone.getText(), housingName.getText(), description.getText(), String.valueOf(tipoHousingCombo.getSelectedItem()), hUser); if (housingCommodityCheck1.isSelected()) { h.addCommodity(housingCommodityCheck1.getText()); } if (housingCommodityCheck2.isSelected()) { h.addCommodity(housingCommodityCheck2.getText()); } if (housingCommodityCheck3.isSelected()) { h.addCommodity(housingCommodityCheck3.getText()); } if (housingCommodityCheck4.isSelected()) { h.addCommodity(housingCommodityCheck4.getText()); } if (new UserServices().userExists(h.getName())) JOptionPane.showMessageDialog(scatView, Message.FAILED_MESSAGE_1); else { new UserServices().persistUser(hUser); new HousingServices().persistHousing(h); JOptionPane.showMessageDialog(scatView, Message.SUCCESS_MESSAGE_2); scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnOfficeAddUserView()); scatView.validate(); scatView.repaint(); } } } // Si es usuario de hospedaje, guarda los cambios realizados al hospedaje else { hUser.getHousing().setAddress(housingAddress.getText()); hUser.getHousing().setMail(housingEmail.getText()); hUser.getHousing().setPhone(housingPhone.getText()); hUser.getHousing().setName(housingName.getText()); hUser.getHousing().setDescription(description.getText()); hUser.getHousing().setHostServiceType(String.valueOf(tipoHousingCombo.getSelectedItem())); hUser.getHousing().getCommodities().clear(); if (housingCommodityCheck1.isSelected()) { hUser.getHousing().addCommodity(housingCommodityCheck1.getText()); } if (housingCommodityCheck2.isSelected()) { hUser.getHousing().addCommodity(housingCommodityCheck2.getText()); } if (housingCommodityCheck3.isSelected()) { hUser.getHousing().addCommodity(housingCommodityCheck3.getText()); } if (housingCommodityCheck4.isSelected()) { hUser.getHousing().addCommodity(housingCommodityCheck4.getText()); } new HousingServices().persistHousing(hUser.getHousing()); JOptionPane.showMessageDialog(scatView, Message.SUCCESS_MESSAGE_3); } } }); // Muestra un cartel de advertencia. Si selecciona aceptar, cancela la creacion // del hospedaje, // borra el usuario y muestra la vista "Home" // Si selecciona cancelar, le permite continuar con la creación del hospedaje. cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { // si viene desde crear user/housing... if (hUser.getHousing() == null) { int selection = JOptionPane.showConfirmDialog(scatView, Message.CANCELBUTTON_MESSAGE_3, "Advertencia", JOptionPane.WARNING_MESSAGE); // si presiona aceptar if (selection == 0) { scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnOfficeHomeView()); scatView.validate(); scatView.repaint(); } // si esta modificando el housing existente... } else { int selection = JOptionPane.showConfirmDialog(scatView, Message.CANCELBUTTON_MESSAGE_4, "Advertencia", JOptionPane.WARNING_MESSAGE); // si presiona aceptar if (selection == 0) { scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnHousingHomeView()); scatView.validate(); scatView.repaint(); } } } }); return officeAddHousingPanel; } // **********************************************HOUSING // VIEW**********************************************// // ------------------------------REUSABLE HOUSING MENU // PANEL------------------------------// private JPanel returnHousingMenuPanel(int selection) { JPanel menuPanel = new JPanel(); JButton homeButton = new JButton("Home", new ImageIcon(getClass().getResource(LookAndFeel.HOME_BUTTON_ICON))); homeButton.setHorizontalTextPosition(SwingConstants.RIGHT); homeButton.setBackground(LookAndFeel.CUSTOM_BLUE); homeButton.setBorderPainted(false); homeButton.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); homeButton.setFont(new Font("Bauhaus", Font.BOLD, 16)); homeButton.setForeground(Color.white); homeButton.setAlignmentX(homeButton.LEFT_ALIGNMENT); JButton editarButton = new JButton("Editar Perfil", new ImageIcon(getClass().getResource(LookAndFeel.EDITAR_HOUSING_BUTTON_ICON))); editarButton.setHorizontalTextPosition(SwingConstants.RIGHT); editarButton.setBackground(LookAndFeel.CUSTOM_BLUE); editarButton.setBorderPainted(false); editarButton.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); editarButton.setFont(new Font("Bauhaus", Font.BOLD, 16)); editarButton.setForeground(Color.white); JButton habitacionesButton = new JButton("Habitaciones", new ImageIcon(getClass().getResource(LookAndFeel.HABITACIONES_BUTTON_ICON))); habitacionesButton.setHorizontalTextPosition(SwingConstants.RIGHT); habitacionesButton.setBackground(LookAndFeel.CUSTOM_BLUE); habitacionesButton.setBorderPainted(false); habitacionesButton.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); habitacionesButton.setFont(new Font("Bauhaus", Font.BOLD, 16)); habitacionesButton.setForeground(Color.white); JButton salirButton = new JButton("Salir", new ImageIcon(getClass().getResource(LookAndFeel.SALIR_BUTTON_ICON))); salirButton.setHorizontalTextPosition(SwingConstants.RIGHT); salirButton.setBackground(LookAndFeel.CUSTOM_BLUE); salirButton.setBorderPainted(false); salirButton.setOpaque(false); salirButton.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); salirButton.setFont(new Font("Bauhaus", Font.BOLD, 16)); salirButton.setForeground(Color.white); // muestra como seleccionado el boton de acuerdo a la vista que se este // mostrando switch (selection) { case 1: homeButton.setOpaque(true); editarButton.setOpaque(false); habitacionesButton.setOpaque(false); break; case 2: homeButton.setOpaque(false); editarButton.setOpaque(true); habitacionesButton.setOpaque(false); break; case 3: homeButton.setOpaque(false); editarButton.setOpaque(false); habitacionesButton.setOpaque(true); break; } menuPanel.add(Box.createRigidArea(new Dimension(0, 15))); menuPanel.add(homeButton); menuPanel.add(editarButton); menuPanel.add(habitacionesButton); menuPanel.add(Box.createRigidArea(new Dimension(0, 500))); menuPanel.add(salirButton); menuPanel.setBackground(LookAndFeel.CUSTOM_GREEN); menuPanel.setLayout(new BoxLayout(menuPanel, BoxLayout.Y_AXIS)); menuPanel.setVisible(true); homeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnHousingHomeView()); scatView.validate(); scatView.repaint(); } }); editarButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnOfficeAddHousingView()); scatView.validate(); scatView.repaint(); } }); habitacionesButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnRoomsView(hUser.getHousing().getRooms())); scatView.validate(); scatView.repaint(); } }); salirButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnWelcomeView()); scatView.validate(); scatView.repaint(); } }); return menuPanel; } // ------------------------------HOUSING HOME // VIEW------------------------------// private JPanel returnHousingHomeView() { JPanel housingHomePanel = new JPanel(); // ----------RIGHT PANEL----------// JPanel housingHomeRightPanel = new JPanel(); JLabel welcomeLabel = new JLabel("¡Bienvenido!"); welcomeLabel.setFont(new Font("Bauhaus 93", Font.BOLD, 35)); welcomeLabel.setForeground(LookAndFeel.CUSTOM_BLUE); JTextArea welcomeText = new JTextArea(Message.WELCOME_MESSAGE_2); welcomeText.setLineWrap(true); welcomeText.setWrapStyleWord(true); welcomeText.setOpaque(false); welcomeText.setEditable(false); welcomeText.setFont(new Font("Calibri", Font.BOLD, 18)); welcomeText.setForeground(LookAndFeel.CUSTOM_BLUE); housingHomeRightPanel.add(welcomeLabel); housingHomeRightPanel.add(welcomeText); housingHomeRightPanel.setBackground(LookAndFeel.CUSTOM_GREY); housingHomeRightPanel.setLayout(new GridLayout(0, 1, 0, 0)); housingHomeRightPanel.setPreferredSize(new Dimension(500, 600)); housingHomeRightPanel.setVisible(true); housingHomePanel.setBackground(LookAndFeel.CUSTOM_GREY); BorderLayout mainLayout = new BorderLayout(); housingHomePanel.setLayout(mainLayout); housingHomePanel.add(returnHousingMenuPanel(1), BorderLayout.WEST); housingHomePanel.add(returnScatLogoPanel(), BorderLayout.CENTER); housingHomePanel.add(housingHomeRightPanel, BorderLayout.EAST); housingHomePanel.setVisible(true); return housingHomePanel; } // ------------------------------HOUSING ROOMS // VIEW------------------------------// private JPanel returnRoomsView(List<Room> list) { JPanel housingRoomsPanel = new JPanel(); // ----------CENTER PANEL----------// JPanel housingRoomsCenterPanel = new JPanel(); JList<HostService> hsList = new JList(list.toArray()); hsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); hsList.setCellRenderer(new RoomListRenderer()); JScrollPane listScroller = new JScrollPane(hsList); listScroller.setPreferredSize(new Dimension(500, 650)); listScroller.setVerticalScrollBarPolicy(listScroller.VERTICAL_SCROLLBAR_AS_NEEDED); housingRoomsCenterPanel.add(Box.createRigidArea(new Dimension(0, 40))); housingRoomsCenterPanel.add(listScroller); housingRoomsCenterPanel.setBackground(LookAndFeel.CUSTOM_GREY); housingRoomsCenterPanel.setVisible(true); // ----------RIGHT top PANEL----------// JPanel housingRoomsRightTopPanel = new JPanel(); JButton agregarHabitacion = new JButton("Agregar Habitacion"); agregarHabitacion.setBackground(LookAndFeel.CUSTOM_BLUE); agregarHabitacion.setForeground(Color.white); agregarHabitacion.setMaximumSize(new Dimension(400, 38)); agregarHabitacion.setFont(new Font("Bauhaus", Font.BOLD, 14)); agregarHabitacion.setAlignmentX(agregarHabitacion.LEFT_ALIGNMENT); housingRoomsRightTopPanel.add(Box.createRigidArea(new Dimension(0, 40))); housingRoomsRightTopPanel.add(agregarHabitacion); housingRoomsRightTopPanel.setBackground(LookAndFeel.CUSTOM_GREY); BorderLayout mainLayout = new BorderLayout(); housingRoomsPanel.setLayout(mainLayout); housingRoomsPanel.add(returnHousingMenuPanel(3), BorderLayout.WEST); housingRoomsPanel.add(housingRoomsCenterPanel, BorderLayout.CENTER); housingRoomsPanel.add(housingRoomsRightTopPanel, BorderLayout.EAST); housingRoomsPanel.setBackground(LookAndFeel.CUSTOM_GREY); housingRoomsPanel.setVisible(true); hsList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent lse) { scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnHousingAddRoomView((Room) hsList.getSelectedValue())); scatView.validate(); scatView.repaint(); } }); // va a la vista de agregar/modificar habitacion agregarHabitacion.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Room r = null; scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnHousingAddRoomView(r)); scatView.validate(); scatView.repaint(); } }); return housingRoomsPanel; } // ------------------------------HOUSING ADD ROOM // VIEW------------------------------// public JPanel returnHousingAddRoomView(Room currentRoom) { // ----------LEFT PANEL----------// JPanel housingAddRoomLeftPanel = new JPanel(); JLabel agregarRoom = new JLabel("Agregar Habitación"); agregarRoom.setAlignmentX(agregarRoom.LEFT_ALIGNMENT); agregarRoom.setMaximumSize(new Dimension(400, 25)); agregarRoom.setFont(new Font("Calibri", Font.BOLD, 18)); PlaceHolder nameRoom = new PlaceHolder(); nameRoom.setPlaceholder("Nombre de la habitacion"); nameRoom.setAlignmentX(nameRoom.LEFT_ALIGNMENT); nameRoom.setMaximumSize(new Dimension(400, 25)); nameRoom.setBackground(Color.white); PlaceHolderTextArea descripcion = new PlaceHolderTextArea(); descripcion.setPlaceholder("Descripcion"); descripcion.setAlignmentX(descripcion.LEFT_ALIGNMENT); descripcion.setBorder(BorderFactory.createLineBorder(Color.GRAY)); descripcion.setMaximumSize(new Dimension(400, 100)); descripcion.setBackground(Color.white); JComboBox setDisponible = new JComboBox(); setDisponible.addItem("Disponibilidad"); setDisponible.addItem("Disponible"); setDisponible.addItem("No disponible"); setDisponible.setAlignmentX(setDisponible.LEFT_ALIGNMENT); setDisponible.setMaximumSize(new Dimension(400, 25)); setDisponible.setBackground(Color.white); housingAddRoomLeftPanel.add(Box.createRigidArea(new Dimension(0, 70))); housingAddRoomLeftPanel.add(agregarRoom); housingAddRoomLeftPanel.add(Box.createRigidArea(new Dimension(0, 20))); housingAddRoomLeftPanel.add(nameRoom); housingAddRoomLeftPanel.add(Box.createRigidArea(new Dimension(0, 20))); housingAddRoomLeftPanel.add(descripcion); housingAddRoomLeftPanel.add(Box.createRigidArea(new Dimension(0, 20))); housingAddRoomLeftPanel.add(setDisponible); housingAddRoomLeftPanel.setLayout(new BoxLayout(housingAddRoomLeftPanel, BoxLayout.Y_AXIS)); housingAddRoomLeftPanel.setBackground(LookAndFeel.CUSTOM_GREY); // ----------RIGHT top PANEL----------// JPanel housingAddRoomRightTopPanel = new JPanel(); ArrayList<String> tiposRoom = new ArrayList(); tiposRoom.add("Tipo de habitación"); tiposRoom.addAll(Arrays.asList(Room.ROOM_TYPES)); JComboBox tipoRoom = new JComboBox(tiposRoom.toArray()); tipoRoom.setMaximumSize(new Dimension(400, 25)); tipoRoom.setBackground(Color.white); PlaceHolder capacidad = new PlaceHolder(); capacidad.setPlaceholder("Capacidad"); capacidad.setMaximumSize(new Dimension(400, 25)); capacidad.setBorder(BorderFactory.createLineBorder(Color.GRAY)); JLabel servicesRoom = new JLabel("Servicios de la habitacion"); servicesRoom.setAlignmentX(JLabel.LEFT_ALIGNMENT); JCheckBox roomCommodity1 = new JCheckBox("Jacuzzi"); roomCommodity1.setAlignmentX(JCheckBox.LEFT_ALIGNMENT); roomCommodity1.setBackground(LookAndFeel.CUSTOM_GREY); JCheckBox roomCommodity2 = new JCheckBox("TV"); roomCommodity2.setAlignmentX(JCheckBox.LEFT_ALIGNMENT); roomCommodity2.setBackground(LookAndFeel.CUSTOM_GREY); housingAddRoomRightTopPanel.add(Box.createRigidArea(new Dimension(0, 110))); housingAddRoomRightTopPanel.add(tipoRoom); housingAddRoomRightTopPanel.add(Box.createRigidArea(new Dimension(0, 20))); housingAddRoomRightTopPanel.add(capacidad); housingAddRoomRightTopPanel.add(Box.createRigidArea(new Dimension(0, 20))); housingAddRoomRightTopPanel.add(servicesRoom); housingAddRoomRightTopPanel.add(Box.createRigidArea(new Dimension(0, 15))); housingAddRoomRightTopPanel.add(roomCommodity1); housingAddRoomRightTopPanel.add(roomCommodity2); housingAddRoomRightTopPanel.add(Box.createRigidArea(new Dimension(0, 100))); housingAddRoomRightTopPanel.setLayout(new BoxLayout(housingAddRoomRightTopPanel, BoxLayout.Y_AXIS)); housingAddRoomRightTopPanel.setBackground(LookAndFeel.CUSTOM_GREY); // ----------RIGHT bottom PANEL----------// JPanel housingAddRoomRightBottomPanel = new JPanel(); JButton cancelButton = new JButton("CANCELAR"); cancelButton.setBackground(LookAndFeel.CUSTOM_BLUE); JButton saveButton = new JButton("GUARDAR"); saveButton.setBackground(LookAndFeel.CUSTOM_BLUE); JButton deleteRoomButton = new JButton("BORRAR HABITACIÓN"); deleteRoomButton.setBackground(LookAndFeel.CUSTOM_BLUE); housingAddRoomRightBottomPanel.add(Box.createRigidArea(new Dimension(0, 600))); housingAddRoomRightBottomPanel.add(deleteRoomButton); housingAddRoomRightBottomPanel.add(Box.createRigidArea(new Dimension(20, 0))); housingAddRoomRightBottomPanel.add(cancelButton); housingAddRoomRightBottomPanel.add(Box.createRigidArea(new Dimension(20, 0))); housingAddRoomRightBottomPanel.add(saveButton); housingAddRoomRightBottomPanel.setLayout(new FlowLayout()); housingAddRoomRightBottomPanel.setBackground(LookAndFeel.CUSTOM_GREY); // ----------RIGHT PANEL----------// JPanel housingAddRoomRightPanel = new JPanel(); housingAddRoomRightPanel.add(housingAddRoomRightTopPanel); housingAddRoomRightPanel.add(housingAddRoomRightBottomPanel); housingAddRoomRightPanel.setLayout(new GridLayout(0, 1)); housingAddRoomRightPanel.setPreferredSize(new Dimension(600, 600)); housingAddRoomRightPanel.setBackground(LookAndFeel.CUSTOM_GREY); JPanel housingAddRoomPanel = new JPanel(); housingAddRoomPanel.setBackground(LookAndFeel.CUSTOM_GREY); BorderLayout mainLayout = new BorderLayout(); housingAddRoomPanel.setLayout(mainLayout); housingAddRoomPanel.add(returnHousingMenuPanel(3), BorderLayout.WEST); housingAddRoomPanel.add(housingAddRoomLeftPanel, BorderLayout.CENTER); housingAddRoomPanel.add(housingAddRoomRightPanel, BorderLayout.EAST); mainLayout.setVgap(100); mainLayout.setHgap(100); housingAddRoomPanel.setVisible(true); capacidad.addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { char caracter = e.getKeyChar(); if (!Character.isDigit(caracter)) { e.consume(); } } }); // si entro a editar una habitacion if (currentRoom != null) { nameRoom.setText(currentRoom.getName()); descripcion.setText(currentRoom.getDescription()); if (currentRoom.isAvailable()) { setDisponible.setSelectedIndex(1); } else { if (!currentRoom.isAvailable()) { setDisponible.setSelectedIndex(2); } } if (currentRoom.getHostServiceType().equals("Simple")) { tipoRoom.setSelectedIndex(1); } else { if (currentRoom.getHostServiceType().equals("Doble")) { tipoRoom.setSelectedIndex(2); } else { if (currentRoom.getHostServiceType().equals("Triple")) { tipoRoom.setSelectedIndex(3); } else { if (currentRoom.getHostServiceType().equals("Cuadruple")) { tipoRoom.setSelectedIndex(4); } } } capacidad.setText(String.valueOf(currentRoom.getCapacity())); if (currentRoom.getCommodities().contains("Jacuzzi")) { roomCommodity1.setSelected(true); } if (currentRoom.getCommodities().contains("TV")) { roomCommodity2.setSelected(true); } } } else deleteRoomButton.setVisible(false); deleteRoomButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { int selection = JOptionPane.showConfirmDialog(scatView, Message.DELETE_ROOM_MESSAGE, "Advertencia", JOptionPane.WARNING_MESSAGE); // si presiona aceptar if (selection == 0) { hUser.getHousing().deleteRoom(currentRoom); new HousingServices().persistHousing(hUser.getHousing()); JOptionPane.showMessageDialog(scatView, Message.SUCCESS_MESSAGE_5); scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnRoomsView(hUser.getHousing().getRooms())); scatView.validate(); scatView.repaint(); } } }); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { int selection = JOptionPane.showConfirmDialog(scatView, Message.CANCELBUTTON_MESSAGE_5, "Advertencia", JOptionPane.WARNING_MESSAGE); // si presiona aceptar if (selection == 0) { scatView.getContentPane().removeAll(); scatView.getContentPane().add(returnRoomsView(hUser.getHousing().getRooms())); scatView.validate(); scatView.repaint(); } } }); saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { // comprueba que no haya ningun campo vacio boolean empty = (nameRoom.getText().equals("") || descripcion.getText().equals("") || setDisponible.getSelectedIndex() == 0 || tipoRoom.getSelectedIndex() == 0 || capacidad.getText().equals("")); if (empty) { JOptionPane.showMessageDialog(scatView, Message.CREARBUTTON_MESSAGE_1); } boolean disp = false; if (setDisponible.getSelectedIndex() == 1) { disp = true; } if (currentRoom == null) { Room r = new Room(disp, nameRoom.getText(), descripcion.getText(), Integer.parseInt(capacidad.getText()), String.valueOf(tipoRoom.getSelectedItem()), hUser.getHousing()); if (roomCommodity1.isSelected()) { r.addCommodity(roomCommodity1.getText()); } if (roomCommodity2.isSelected()) { r.addCommodity(roomCommodity2.getText()); } hUser.getHousing().addRoom(r); } else { // si la habitacion se esta modificando... currentRoom.setAvailable(disp); currentRoom.setName(nameRoom.getText()); currentRoom.setDescription(descripcion.getText()); currentRoom.setCapacity(Integer.parseInt(capacidad.getText())); currentRoom.setHostServiceType(String.valueOf(tipoRoom.getSelectedItem())); currentRoom.getCommodities().clear(); if (roomCommodity1.isSelected()) { currentRoom.addCommodity(roomCommodity1.getText()); } if (roomCommodity2.isSelected()) { currentRoom.addCommodity(roomCommodity2.getText()); } } if (!empty) { new HousingServices().persistHousing(hUser.getHousing()); JOptionPane.showMessageDialog(scatView, Message.SUCCESS_MESSAGE_4); } nameRoom.setText(""); descripcion.setText(""); setDisponible.setSelectedIndex(0); tipoRoom.setSelectedIndex(0); capacidad.setText(""); roomCommodity1.setSelected(false); roomCommodity2.setSelected(false); } }); return housingAddRoomPanel; } }
[ "r.beltracchi@globant.com" ]
r.beltracchi@globant.com
eec16256e361b272b323fe5c156250daef1ee067
b749104b254342faa5ef7634303326d645490f1d
/src/main/java/edu/cmu/cs/graphics/hopper/eval/EvalCache.java
911e0f177b05deecb149e5fa77fe87b0fed30f35
[]
no_license
bhumbers/hoppercontrol
7bc7ab67e4e78e26ebf5fc1b3af94b05a1bf5b3d
3fc565497221686b07eb163b559abf7ba212daf6
refs/heads/master
2021-01-25T10:15:42.012401
2014-03-06T15:41:58
2014-03-06T15:41:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
911
java
package edu.cmu.cs.graphics.hopper.eval; import edu.cmu.cs.graphics.hopper.control.ControlProviderDefinition; import edu.cmu.cs.graphics.hopper.problems.ProblemDefinition; import java.util.HashMap; /** * Provides cached evaluation results without having to run the evaluation again. * A bit hacky at the moment, but useful for quickly running tests */ public class EvalCache { HashMap<EvalCacheKey, EvalCacheValue> cachedEvals; public EvalCache() { cachedEvals = new HashMap<EvalCacheKey, EvalCacheValue>(); } public void insert(EvalCacheKey key, EvalCacheValue val) { cachedEvals.put(key, val); } public EvalCacheValue getCachedEvaluation(ProblemDefinition problemDef, ControlProviderDefinition controlDef) { EvalCacheKey key = new EvalCacheKey(problemDef, controlDef); EvalCacheValue value = cachedEvals.get(key); return value; } }
[ "raichuman@gmail.com" ]
raichuman@gmail.com
ab0feaaf09e6535f3f638eee278c636c7a4605d9
7f995d884f3361bb7f9778c84fb44d702a0c9d7c
/ftpreader/src/main/java/com/github/rodbate/datax/plugin/reader/ftpreader/Constant.java
f7719769cefd5f6d5426201e50f09732ef976198
[ "Apache-2.0" ]
permissive
yourant/datax-ex
9f9e413755edf9201b63964b58d1c84c65cc7d56
716725ada1dcea67c3cf7d32239cb0ac74e4dc61
refs/heads/master
2022-01-05T22:10:59.209095
2019-03-22T03:34:01
2019-03-22T03:34:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
423
java
package com.github.rodbate.datax.plugin.reader.ftpreader; public class Constant { public static final String SOURCE_FILES = "sourceFiles"; public static final int DEFAULT_FTP_PORT = 21; public static final int DEFAULT_SFTP_PORT = 22; public static final int DEFAULT_TIMEOUT = 60000; public static final int DEFAULT_MAX_TRAVERSAL_LEVEL = 100; public static final String DEFAULT_FTP_CONNECT_PATTERN = "PASV"; }
[ "rodbatejss@gmail.com" ]
rodbatejss@gmail.com
48ce2c7832c1244a83ad7d1dfb0437f44ab18655
09facc14448b32b874827bd702cbb13dc7cc8c66
/OrganizationTraining/src/com/augmentum/ot/util/ValidationUtil.java
d5da4c98c5d5962808df0a95e526b86edd299c97
[]
no_license
CarlKong/DemoSSH
41eb5ea91b021def4421968e45c2c8b87d533d41
0aa0f376c8ea080508b3c92b39e2e720f7c5346e
refs/heads/master
2021-01-10T18:13:32.413901
2016-01-08T14:21:46
2016-01-08T14:21:46
49,274,642
1
0
null
null
null
null
UTF-8
Java
false
false
6,929
java
package com.augmentum.ot.util; import java.util.Date; import java.util.List; import java.util.Set; import com.augmentum.ot.dataObject.constant.FlagConstants; import com.augmentum.ot.model.ActualCourse; import com.augmentum.ot.model.Plan; import com.augmentum.ot.model.PlanEmployeeMap; public class ValidationUtil { public static boolean isNotNull (String str) { String string = str.trim(); if (null == string || "".equals(string)) { return false; } return true; } /** * Return the flag of whether the plan is published. * * @param plan The instance. * @return The flag. */ public static Integer isPlanPublished(Plan plan) { Integer flag = FlagConstants.PLAN_VALIDATEION_RESULT_FALSE; if (plan == null) { flag = FlagConstants.PLAN_IS_NULL; } else if (plan.getPlanIsPublish().equals(FlagConstants.IS_PUBLISHED) ){ flag = FlagConstants.PLAN_VALIDATEION_RESULT_TRUE; } return flag; } /** * Return the flag of whether the plan is canceled. * * @param plan The instance. * @return The flag. */ public static Integer isPlanCanceled(Plan plan) { Integer flag = FlagConstants.PLAN_VALIDATEION_RESULT_FALSE; if (plan == null || plan.getPlanIsCanceled() == null) { flag = FlagConstants.PLAN_IS_NULL; } else if (plan.getPlanIsCanceled().equals(FlagConstants.IS_CANCELED) ){ flag = FlagConstants.PLAN_VALIDATEION_RESULT_TRUE; } return flag; } /** * Return the flag of whether the plan is deleted. * * @param plan The instance. * @return The flag. */ public static Integer isPlanDeleted(Plan plan) { Integer flag = FlagConstants.PLAN_VALIDATEION_RESULT_FALSE; if (plan == null || plan.getPlanIsDeleted() == null) { flag = FlagConstants.PLAN_IS_NULL; } else if (plan.getPlanIsDeleted().equals(FlagConstants.IS_DELETED) ){ flag = FlagConstants.PLAN_VALIDATEION_RESULT_TRUE; } return flag; } /** * According to the end time about the plan course and plan session, judge * whether the plan is completed. * * @param plan The instance. * @return The flag. */ public static Integer isPlanCompleted(Plan plan) { Integer flag = FlagConstants.PLAN_VALIDATEION_RESULT_TRUE; if (plan == null) { flag = FlagConstants.PLAN_IS_NULL; } else if (plan != null) { // If flag is true, iterate the plan course. if (flag.equals(FlagConstants.PLAN_VALIDATEION_RESULT_TRUE)) { List<ActualCourse> actualCourseList = plan.getActualCourses(); Date nowTime = new Date(); Date actualCourseEndTime = null; if (actualCourseList != null && !actualCourseList.isEmpty()) { for (ActualCourse actualCourse: actualCourseList) { actualCourseEndTime = actualCourse.getCourseEndTime(); /* * If the planCourseEndTime is behind now time or is null, * this plan is not completed. */ if (actualCourseEndTime == null || nowTime.compareTo(actualCourseEndTime) < 0) { flag = FlagConstants.PLAN_VALIDATEION_RESULT_FALSE; break; } } } } } return flag; } /** * Judge whether the plan has no plan course. * * @param plan * @return */ public static Integer isPlanNoCourseAdded(Plan plan) { Integer flag = FlagConstants.PLAN_VALIDATEION_RESULT_FALSE; if (plan == null) { flag = FlagConstants.PLAN_IS_NULL; } else { if (plan.getActualCourses() == null || plan.getActualCourses().isEmpty()) { flag = FlagConstants.PLAN_VALIDATEION_RESULT_TRUE; } } return flag; } /** * * Judge whether the plan has trainees * 1. invited plan -- invited trainees * 2. public plan -- specific trainees * * @param plan * @return */ public static Integer isPlanNoTraineesAdded(Plan plan) { Integer flag = FlagConstants.PLAN_VALIDATEION_RESULT_FALSE; if (plan == null) { flag = FlagConstants.PLAN_IS_NULL; } else { Set<PlanEmployeeMap> pemList = plan.getPlanEmployeeMapList(); if(plan.getPlanType().getPlanTypeName().equals(FlagConstants.INVITED_PLAN)) { flag = getNoTraineesFlag(pemList, FlagConstants.ATTEND_TYPE_INVITED); } else { if(plan.getIsAllEmployee().equals(FlagConstants.UN_ALL_EMPLOYEES)) { flag = getNoTraineesFlag(pemList, FlagConstants.ATTEND_TYPE_SPECIFIC); } } } return flag; } private static Integer getNoTraineesFlag(Set<PlanEmployeeMap> pemList, int attendType) { Integer flag = FlagConstants.PLAN_VALIDATEION_RESULT_TRUE; if(pemList == null | pemList.size() == 0) { flag = FlagConstants.PLAN_VALIDATEION_RESULT_TRUE; } else { for(PlanEmployeeMap pem:pemList) { if (pem.getPlanEmployeeIsDeleted() == FlagConstants.UN_DELETED && pem.getPlanTraineeAttendType() == attendType) { flag = FlagConstants.PLAN_VALIDATEION_RESULT_FALSE; break; } } } return flag; } /** * Judge whether has one or more plan courses started. * * @param plan The instance. * @return The flag. */ public static Integer isPlanOneOrMoreCourseStarted(Plan plan) { Integer flag = FlagConstants.PLAN_VALIDATEION_RESULT_FALSE; if (plan == null) { flag = FlagConstants.PLAN_IS_NULL; } else { List<ActualCourse> actualCourseList = plan.getActualCourses(); if (actualCourseList != null && !actualCourseList.isEmpty()) { Date nowTime = new Date(); Date actualCourseStartTime = null; for (ActualCourse actualCourse: actualCourseList) { if (actualCourse != null) { /* * If planCourseStartTime is null or is before nowTime, * the plan has one or more plan courses started. */ actualCourseStartTime = actualCourse.getCourseStartTime(); if (actualCourseStartTime != null && actualCourseStartTime.compareTo(nowTime) < 0) { flag = FlagConstants.PLAN_VALIDATEION_RESULT_TRUE; } } } } } return flag; } }
[ "ahdkkyxq@163.com" ]
ahdkkyxq@163.com
a8315385da65f97305db237a7946d36c8f03c608
379b719c7ff0e7db11ffcd063982905192453124
/src/main/java/structural/bridge/abstraction/Abstraction.java
8699b1c45b01db760e5574c5d28400ef66f31c3a
[]
no_license
yechanpark/Design-Pattern
dcd82791770235f8cc9b92625cdb6ebb5f396b80
c7c9e8d3e336c9aed770dc78300c87086a0735a2
refs/heads/master
2021-01-01T04:02:42.197105
2019-07-13T10:15:56
2019-07-13T10:15:56
97,108,420
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package structural.bridge.abstraction; import structural.bridge.implementor.Implementor; public abstract class Abstraction { protected Implementor implementor; public void setImplementor(Implementor implementor) { this.implementor = implementor; } public abstract void doAbstraction(); }
[ "qkrdpcks0419@naver.com" ]
qkrdpcks0419@naver.com
eb198db19eac96e0e9d113e3e0bed1fe96de8c3d
d7291511468c1405d26fd55eae4adbb815a4ab1f
/MetaCodingFrameWork/src/com/crazyt/gmod/libs/LibSurface.java
b706a7248b0371565b5eece9c5e70d1980dabda3
[]
no_license
TheCrazyT/MCF
7cb58e8241e8e43c4789e0c2d3a16cb913141a6f
479550d4d63bde97a08147194422568e3a0ba1a9
refs/heads/master
2021-01-13T14:19:53.815160
2012-11-18T08:45:00
2012-11-18T08:45:00
6,518,437
0
1
null
null
null
null
UTF-8
Java
false
false
8,153
java
package com.crazyt.gmod.libs; import com.crazyt.gmod.IMetaVarAny; import com.crazyt.gmod.types.*; import com.crazyt.gmod.*; import com.crazyt.mcf.MetaVar; import com.crazyt.mcf.MetaVarImpl; import com.crazyt.mcf.MetaCommand; import com.crazyt.mcf.External; import com.crazyt.mcf.SimpleName; import com.crazyt.mcf.Library; @External @Library("surface") public class LibSurface{ /** Creates a new font. */ @External @ClientFunc public MetaVar CreateFont(MetaVarString fontNameVar,MetaVarFontData fontDataVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Draws a hollow circle, made of dots. */ @External @ClientFunc public MetaVar DrawCircle(MetaVarNumber originXVar,MetaVarNumber originYVar,MetaVarNumber radiusVar,MetaVarColor colorVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Draws a line from one point to another. */ @External @ClientFunc public MetaVar DrawLine(MetaVarNumber startXVar,MetaVarNumber startYVar,MetaVarNumber endXVar,MetaVarNumber endYVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Draws a hollow box with a border width of 1 px. */ @External @ClientFunc public MetaVar DrawOutlinedRect(MetaVarNumber xVar,MetaVarNumber yVar,MetaVarNumber wVar,MetaVarNumber hVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Draws a polygon with a maximum of 256 vertices. */ @External @ClientFunc public MetaVar DrawPoly(MetaVarTable vertexesVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Draws a solid rectangle on the screen. */ @External @ClientFunc public MetaVar DrawRect(MetaVarNumber xVar,MetaVarNumber yVar,MetaVarNumber widthVar,MetaVarNumber heightVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Draw the specified text on the screen, using the previously set position. */ @External @ClientFunc public MetaVar DrawText(MetaVarString textVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Draw a textured rectangle with the given position and dimensions on the screen, using the current active texture. */ @External @ClientFunc public MetaVar DrawTexturedRect(MetaVarNumber xVar,MetaVarNumber yVar,MetaVarNumber widthVar,MetaVarNumber heightVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Draw a textured rotated rectangle with the given position and dimensions and angle on the screen, using the current active texture. */ @External @ClientFunc public MetaVar DrawTexturedRectRotated(MetaVarNumber xVar,MetaVarNumber yVar,MetaVarNumber widthVar,MetaVarNumber heightVar,MetaVarNumber rotationVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Draws a textured rectangle with a repeated or partial texture. */ //public MetaVar DrawTexturedRectUV(MetaVarNumber xVar,MetaVarNumber yVar,MetaVarNumber widthVar,MetaVarNumber heightVar,MetaVarNumber startUVar,MetaVarNumber startVVar,MetaVarNumber endUVar,MetaVarNumber endUVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Gets the HUD texture with the specified name. */ @External @ClientFunc public MetaVarITexture GetHUDTexture(MetaVarString nameVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Returns the width and height (in pixels) of the given text, but only if the font has been set with <a href="http://wiki.garrysmod.com/page/Libraries/surface/SetFont" title="Libraries/surface/SetFont">surface/SetFont</a>. */ @External @ClientFunc public MetaVarNumber GetTextSize(MetaVarString textVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Returns the texture id of the texture with the given name/path. */ //public MetaVarNumber GetTextureID(MetaVarString name/pathVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Returns the size of the texture with the associated texture id. */ @External @ClientFunc public MetaVarNumber GetTextureSize(MetaVarNumber textureIDVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Play a sound file directly on the client (such as UI sounds, etc). */ @External @ClientFunc public MetaVar PlaySound(MetaVarString soundfileVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Returns the height of the current client's screen. */ @External @ClientFunc public MetaVarNumber ScreenHeight(){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Returns the width of the current client's screen. */ @External @ClientFunc public MetaVarNumber ScreenWidth(){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Sets a multiplier that will influence all upcoming drawing operations. */ @External @ClientFunc public MetaVar SetAlphaMultiplier(MetaVarNumber multiplierVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Set the colour of any future shapes to be drawn, can be set by either using r, g, b, a as seperate values or by a <a href="http://wiki.garrysmod.com/page/Classes/Color" title="Classes/Color" class="mw-redirect">Color</a> object, using a color object is not recommended to be created prodecural. */ @External @ClientFunc public MetaVar SetDrawColor(MetaVarColor gVar,MetaVarColor bVar,MetaVarColor aVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Set the current font to be used for text operations later. */ @External @ClientFunc public MetaVar SetFont(MetaVarString fontNameVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Sets the material to be used in all upcoming surface draw operations. */ @External @ClientFunc public MetaVar SetMaterial(MetaVarIMaterial materialVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Set the colour of any future text to be drawn, can be set by either using r, g, b, a as seperate values or by a <a href="http://wiki.garrysmod.com/page/Classes/Color" title="Classes/Color" class="mw-redirect">Color</a> object, using a color object is not recommended to be created prodecural. */ @External @ClientFunc public MetaVar SetTextColor(MetaVarColor gVar,MetaVarColor bVar,MetaVarColor aVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Set the position to draw any future text. */ @External @ClientFunc public MetaVar SetTextPos(MetaVarNumber xVar,MetaVarNumber yVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; /** Sets the texture to be used in all upcoming surface draw operations. */ @External @ClientFunc public MetaVar SetTexture(MetaVarNumber textureIDVar){throw new RuntimeException("Should never be executed directly, there is probably an error in the Aspect-coding.");}; }
[ "tobias15556@gmx.de" ]
tobias15556@gmx.de
d91fb86bfd1be614e8e9c804820d0f419d4a9841
247c30bddb2c7975c38a75b950c3a96a659dc3da
/app/src/main/java/com/eja/realmcrud/model/ModelSiswa.java
d03ba62873e3dba5d9fc42bcb92eb12e47f78fb4
[]
no_license
rezarizky69/realm-crud
3942d33810946736a3243dd7505906155295c229
e064eb8d64f157de91d0fd82060a83f41f042415
refs/heads/master
2023-07-29T19:30:32.424347
2021-09-09T16:03:50
2021-09-09T16:03:50
404,404,649
0
0
null
null
null
null
UTF-8
Java
false
false
1,154
java
package com.eja.realmcrud.model; import io.realm.RealmObject; public class ModelSiswa extends RealmObject { private int id; private String nama; private String alamat; private String email; private String motto; public ModelSiswa(int id, String nama, String alamat, String email, String motto){ this.id = id; this.nama = nama; this.alamat = alamat; this.email = email; this.motto = motto; } public ModelSiswa(){ } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNama() { return nama; } public void setNama(String nama) { this.nama = nama; } public String getAlamat() { return alamat; } public void setAlamat(String alamat) { this.alamat = alamat; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMotto() { return motto; } public void setMotto(String motto) { this.motto = motto; } }
[ "ezaworkspace@gmail.com" ]
ezaworkspace@gmail.com
c7f58557d686e93c57bfd7b69684975efe160af4
9354caa74c13b7c8febc230401a3c30385740cd9
/Bullet.java
897a8e950029c8cb8e57aa04b52a8fbb9dd645a3
[]
no_license
SimplyATable/DroneAssault
be6fbe6c150e4e8f50c5fe145126d06c250bf880
d6fd831578199c0045791719adb82feda3a90521
refs/heads/master
2020-04-29T20:09:38.290640
2019-03-18T23:01:06
2019-03-18T23:01:06
100,145,509
0
0
null
null
null
null
UTF-8
Java
false
false
1,203
java
import edu.digipen.gameobject.GameObject; import edu.digipen.math.Vec2; public class Bullet extends GameObject { public Vec2 direction; public float bulletSpeed = 8.0f; // custom constructor for the bullet public Bullet(Vec2 direction_, Vec2 position_) { super("Bullet", 15, 15, "Bullet.png"); setCircleCollider(7); direction = new Vec2(direction_); setPosition(position_); } public void update(float dt) { setPositionX(getPositionX() + direction.getX()*bulletSpeed); setPositionY(getPositionY() + direction.getY()*bulletSpeed); if(!isInViewport()) { kill(); } } public void collisionReaction(GameObject collidedWith) { if(collidedWith.getName().equals("Enemy") || (collidedWith.getName().equals("Boss") || (collidedWith.getName().equals("EnemyBullet") || (collidedWith.getName().equals("FastRobot") || (collidedWith.getName().equals("Shooter") || (collidedWith.getName().equals("Gunner"))))))) { kill(); } if (collidedWith.getName().equals("Wall")) { kill(); } } }
[ "noreply@github.com" ]
SimplyATable.noreply@github.com
a06b5de73e9b5757626691f27b86c276c0e12dba
b17eeed105b8f75b74078f11cf792f167564062b
/AdapterPattern/src/adapter/example/IEncryption.java
39332520a0ee2e1fdb6033103d185c1d13014771
[]
no_license
smcoder/Design-Patterns
3753227a997a0ca038c86b862de86be793d62e97
2a5f1a172ad41c49380937bbddc3d3a86ec2dd81
refs/heads/master
2020-12-02T16:24:48.677043
2017-07-09T09:11:47
2017-07-09T09:11:47
96,548,127
0
0
null
null
null
null
UTF-8
Java
false
false
137
java
package adapter.example; /** * Created by mac on 09/07/2017. */ public interface IEncryption { void encryption(String content); }
[ "mac@192.168.0.100" ]
mac@192.168.0.100
c1d977bf5b25befce2ed7209bec5c31bc4817c11
54f643075f3e14fde2cd553ea1e21ab53eb86977
/exercises1/src/net/bohush/exercises/chapter41/Exercise07.java
a6b13636503406aed6cc264974eeddc542104097
[]
no_license
Toxa2202/JavaExercises
949db9f08b54a6e4f44407c4834fdb0b140c7030
ee099613da9a657c31d5aa592136d667ce5207fc
refs/heads/master
2020-06-09T17:22:54.800430
2014-08-20T20:52:01
2014-08-20T20:52:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,095
java
package net.bohush.exercises.chapter41; import java.sql.*; import java.io.*; import javax.swing.*; import com.sun.rowset.JdbcRowSetImpl; import java.awt.*; import java.awt.event.*; public class Exercise07 extends JApplet { private static final long serialVersionUID = 1L; // Prepared statement private DescriptionPanel descriptionPanel1 = new DescriptionPanel(); private JdbcRowSetImpl rowSet = new JdbcRowSetImpl(); private JComboBox<String> jcboCountry = new JComboBox<String>(); /** Creates new form StoreAndRetrieveImage */ public Exercise07() { try { connectDB(); // Connect to DB storeDataToTable(); // Store data to the table (including image) fillDataInComboBox(); // Fill in combo box retrieveFlagInfo((String) (jcboCountry.getSelectedItem())); } catch (Exception ex) { ex.printStackTrace(); } jcboCountry.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent evt) { retrieveFlagInfo((String) (evt.getItem())); } }); add(jcboCountry, BorderLayout.NORTH); add(descriptionPanel1, BorderLayout.CENTER); } private void connectDB() throws Exception { // Load the driver Class.forName("com.mysql.jdbc.Driver"); System.out.println("Driver loaded"); rowSet.setUrl("jdbc:mysql://localhost/javabook"); rowSet.setUsername("scott"); rowSet.setPassword("tiger"); rowSet.setCommand("select * from Country"); rowSet.execute(); System.out.println("Database connected"); } private void storeDataToTable() { String[] countries = { "Canada", "UK", "USA", "Germany", "Indian", "China" }; String[] imageFilenames = { "image/ca.gif", "image/uk.gif", "image/us.gif", "image/germany.gif", "image/india.gif", "image/china.gif" }; String[] descriptions = { "A text to describe Canadian " + "flag is omitted", "British flag ...", "American flag ...", "German flag ...", "Indian flag ...", "Chinese flag ..." }; try { for (int i = 0; i < countries.length; i++) { rowSet.moveToInsertRow(); rowSet.updateString(1, countries[i]); java.net.URL url = this.getClass().getResource(imageFilenames[i]); InputStream inputImage = url.openStream(); rowSet.updateBinaryStream(2, inputImage, (int)(inputImage.available())); rowSet.updateString(3, descriptions[i]); rowSet.insertRow(); } System.out.println("Table Country populated"); } catch (Exception ex) { ex.printStackTrace(); } } private void fillDataInComboBox() throws Exception { rowSet.setCommand("select name from Country"); rowSet.execute(); rowSet.beforeFirst(); while (rowSet.next()) { jcboCountry.addItem(rowSet.getString(1)); } } private void retrieveFlagInfo(String name) { try { rowSet.setCommand("select flag, description from Country where name = \'" + name + "\'"); rowSet.execute(); rowSet.beforeFirst(); if (rowSet.next()) { Blob blob = rowSet.getBlob(1); ImageIcon imageIcon = new ImageIcon(blob.getBytes(1, (int) blob.length())); descriptionPanel1.setImageIcon(imageIcon); descriptionPanel1.setName(name); String description = rowSet.getString(2); descriptionPanel1.setDescription(description); } } catch (Exception ex) { System.err.println(ex); } } public static void main(String[] args) { Exercise07 applet = new Exercise07(); JFrame frame = new JFrame(); frame.getContentPane().add(applet); frame.setDefaultCloseOperation(3); frame.setTitle("Exercise07"); frame.setSize(400, 320); frame.setVisible(true); } public class DescriptionPanel extends JPanel { private static final long serialVersionUID = 1L; /** Label for displaying an image icon and a title */ private JLabel jlblImageTitle = new JLabel(); /** Text area for displaying text */ private JTextArea jtaDescription = new JTextArea(); public DescriptionPanel() { // Center the icon and text and place the text under the icon jlblImageTitle.setHorizontalAlignment(JLabel.CENTER); jlblImageTitle.setHorizontalTextPosition(JLabel.CENTER); jlblImageTitle.setVerticalTextPosition(JLabel.BOTTOM); // Set the font in the label and the text field jlblImageTitle.setFont(new Font("SansSerif", Font.BOLD, 16)); jtaDescription.setFont(new Font("Serif", Font.PLAIN, 14)); // Set lineWrap and wrapStyleWord true for the text area jtaDescription.setLineWrap(true); jtaDescription.setWrapStyleWord(true); jtaDescription.setEditable(false); // Create a scroll pane to hold the text area JScrollPane scrollPane = new JScrollPane(jtaDescription); // Set BorderLayout for the panel, add label and scrollpane setLayout(new BorderLayout(5, 5)); add(scrollPane, BorderLayout.CENTER); add(jlblImageTitle, BorderLayout.WEST); } /** Set the title */ public void setTitle(String title) { jlblImageTitle.setText(title); } /** Set the image icon */ public void setImageIcon(ImageIcon icon) { jlblImageTitle.setIcon(icon); } /** Set the text description */ public void setDescription(String text) { jtaDescription.setText(text); } } }
[ "vbohush@users.noreply.github.com" ]
vbohush@users.noreply.github.com
793b3b8baa4d59fb0d74939335eef2a425aa5896
6c6d503f12e231468a236459ecb999f68d68b2dc
/osp/src/org/opensourcephysics/display2d/CellLattice.java
06142ebf3b7291d730014ec249d4c57cfa2bb8a5
[]
no_license
rjchacko/open-source-physics
683e5cfb21b2ada3368ae27882b2795e15d491ca
afe56811ff7a7bc0098dc3bd845c852f2a80e686
refs/heads/master
2021-01-15T17:42:07.711684
2015-07-30T22:05:16
2015-07-30T22:05:16
39,894,319
0
0
null
null
null
null
UTF-8
Java
false
false
6,355
java
/* * Open Source Physics software is free software as described near the bottom of this code file. * * For additional information and documentation on Open Source Physics please see: * <http://www.opensourcephysics.org/> */ package org.opensourcephysics.display2d; import org.opensourcephysics.display.DrawingPanel; import java.awt.Graphics; import java.awt.Color; import javax.swing.JFrame; /** * A CellLattice that displays an array where each array element can assume one of 256 * values. * * Values can be set between -128 and 127. Because byte values larger * than 127 overflow to negative, values can also be set between 0 and 255. The * lattice is drawn as an array of rectangles to distinguish between the two * possible values. * * @author Wolfgang Christian * @created July 3, 2005 * @version 1.0 */ public class CellLattice implements ByteLattice { ByteLattice lattice = null; static String osName; static { try { osName = System.getProperty("os.name", ""); } catch(Exception ex) { osName = ""; } } public CellLattice() { if(osName.indexOf("Mac")>-1) { lattice = new CellLatticeOSX(); } else { lattice = new CellLatticePC(); } } public CellLattice(int nx, int ny) { if(osName.indexOf("Mac")>-1) { lattice = new CellLatticeOSX(nx, ny); } else { lattice = new CellLatticePC(nx, ny); } } public double getXMin() { return lattice.getXMin(); } public double getXMax() { return lattice.getXMax(); } public double getYMin() { return lattice.getYMin(); } public double getYMax() { return lattice.getYMax(); } public boolean isMeasured() { return lattice.isMeasured(); } public void draw(DrawingPanel panel, Graphics g) { lattice.draw(panel, g); } public int getNx() { return lattice.getNx(); } public int getNy() { return lattice.getNy(); } public int indexFromPoint(double x, double y) { return lattice.indexFromPoint(x, y); } public int xToIndex(double x) { return lattice.xToIndex(x); } public int yToIndex(double y) { return lattice.yToIndex(y); } public byte getValue(int ix, int iy) { return lattice.getValue(ix, iy); } public void setValue(int ix, int iy, byte val) { lattice.setValue(ix, iy, val); } public void randomize() { lattice.randomize(); } public void resizeLattice(int nx, int ny) { lattice.resizeLattice(nx, ny); } /** * Sets the lattice values and scale. * * The lattice is resized to fit the new data if needed. * * @param val int[][] the new values * @param xmin double * @param xmax double * @param ymin double * @param ymax double */ public void setAll(byte val[][], double xmin, double xmax, double ymin, double ymax) { lattice.setAll(val, xmin, xmax, ymin, ymax); } public void setBlock(int ix_offset, int iy_offset, byte[][] val) { lattice.setBlock(ix_offset, iy_offset, val); } public void setBlock(byte[][] val) { lattice.setBlock(val); } public void setCol(int ix, int iy_offset, byte[] val) { lattice.setCol(ix, iy_offset, val); } public void setRow(int iy, int ix_offset, byte[] val) { lattice.setRow(iy, ix_offset, val); } public void setShowGridLines(boolean show) { lattice.setShowGridLines(show); } public void setGridLineColor(Color c) { lattice.setGridLineColor(c); } public JFrame showLegend() { return lattice.showLegend(); } public void setVisible(boolean isVisible) { lattice.setVisible(isVisible); } public void setColorPalette(Color[] colors) { lattice.setColorPalette(colors); } public void setIndexedColor(int i, Color color) { lattice.setIndexedColor(i, color); } public void setMinMax(double xmin, double xmax, double ymin, double ymax) { lattice.setMinMax(xmin, xmax, ymin, ymax); } /** * Creates a new SiteLattice containing the same data as this lattice. */ public SiteLattice createSiteLattice() { if(osName.indexOf("Mac")>-1) { return((CellLatticeOSX) lattice).createSiteLattice(); } else { return((CellLatticePC) lattice).createSiteLattice(); } } /** * Sets a block of cells using integer values. * * @param ix_offset int * @param iy_offset int * @param val int[][] */ public void setBlock(int ix_offset, int iy_offset, int val[][]) { if(osName.indexOf("Mac")>-1) { ((CellLatticeOSX) lattice).setBlock(ix_offset, iy_offset, val); } else { ((CellLatticePC) lattice).setBlock(ix_offset, iy_offset, val); } } public void setXMin(double xmin) { lattice.setXMin(xmin); } public void setXMax(double xmax) { lattice.setXMax(xmax); } public void setYMin(double ymin) { lattice.setYMin(ymin); } public void setYMax(double ymax) { lattice.setYMax(ymax); } public void createDefaultColors() { lattice.createDefaultColors(); } } /* * Open Source Physics software is free software; you can redistribute * it and/or modify it under the terms of the GNU General Public License (GPL) as * published by the Free Software Foundation; either version 2 of the License, * or(at your option) any later version. * Code that uses any portion of the code in the org.opensourcephysics package * or any subpackage (subdirectory) of this package must must also be be released * under the GNU GPL license. * * This software 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; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA * or view the license online at http://www.gnu.org/copyleft/gpl.html * * Copyright (c) 2007 The Open Source Physics project * http://www.opensourcephysics.org */
[ "rjchacko@6a2400d0-0b49-0410-9cf7-e3d17bb89f17" ]
rjchacko@6a2400d0-0b49-0410-9cf7-e3d17bb89f17
d79cfc557488c535bd159ffb6933da6708e980b4
128eb90ce7b21a7ce621524dfad2402e5e32a1e8
/laravel-converted/src/main/java/com/project/convertedCode/globalNamespace/namespaces/Monolog/namespaces/Processor/classes/IntrospectionProcessor.java
c8c2bc797273104f2111c7863921e24ae6789567
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
RuntimeConverter/RuntimeConverterLaravelJava
657b4c73085b4e34fe4404a53277e056cf9094ba
7ae848744fbcd993122347ffac853925ea4ea3b9
refs/heads/master
2020-04-12T17:22:30.345589
2018-12-22T10:32:34
2018-12-22T10:32:34
162,642,356
0
0
null
null
null
null
UTF-8
Java
false
false
14,124
java
package com.project.convertedCode.globalNamespace.namespaces.Monolog.namespaces.Processor.classes; import com.runtimeconverter.runtime.references.ReferenceContainer; import com.runtimeconverter.runtime.passByReference.PassByReferenceArgs; import com.runtimeconverter.runtime.references.BasicReferenceContainer; import com.runtimeconverter.runtime.ZAssignment; import com.runtimeconverter.runtime.classes.StaticBaseClass; import com.runtimeconverter.runtime.nativeFunctions.array.function_array_shift; import com.runtimeconverter.runtime.classes.RuntimeClassBase; import com.runtimeconverter.runtime.RuntimeEnv; import com.project.convertedCode.globalNamespace.namespaces.Monolog.classes.Logger; import com.runtimeconverter.runtime.ZVal; import com.runtimeconverter.runtime.reflection.ReflectionClassData; import com.runtimeconverter.runtime.annotations.ConvertedParameter; import com.runtimeconverter.runtime.arrays.ZPair; import com.runtimeconverter.runtime.nativeFunctions.array.function_array_merge; import java.lang.invoke.MethodHandles; import com.runtimeconverter.runtime.nativeFunctions.string.function_strpos; import com.runtimeconverter.runtime.nativeFunctions.array.function_in_array; import com.runtimeconverter.runtime.classes.NoConstructor; import com.runtimeconverter.runtime.arrays.ArrayAction; import com.project.convertedCode.globalNamespace.NamespaceGlobal; import com.runtimeconverter.runtime.annotations.ConvertedMethod; import static com.runtimeconverter.runtime.ZVal.arrayActionR; import static com.runtimeconverter.runtime.ZVal.assignParameter; /* Converted with The Runtime Converter (runtimeconverter.com) vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php */ public class IntrospectionProcessor extends RuntimeClassBase { public Object level = null; public Object skipClassesPartials = null; public Object skipStackFramesCount = null; public Object skipFunctions = ZVal.arrayFromList("call_user_func", "call_user_func_array"); public IntrospectionProcessor(RuntimeEnv env, Object... args) { super(env); if (this.getClass() == IntrospectionProcessor.class) { this.__construct(env, args); } } public IntrospectionProcessor(NoConstructor n) { super(n); } @ConvertedMethod @ConvertedParameter(index = 0, name = "level") @ConvertedParameter( index = 1, name = "skipClassesPartials", typeHint = "array", defaultValue = "", defaultValueType = "array" ) @ConvertedParameter( index = 2, name = "skipStackFramesCount", defaultValue = "0", defaultValueType = "number" ) public Object __construct(RuntimeEnv env, Object... args) { Object level = assignParameter(args, 0, true); if (null == level) { level = Logger.CONST_DEBUG; } Object skipClassesPartials = assignParameter(args, 1, true); if (null == skipClassesPartials) { skipClassesPartials = ZVal.newArray(); } Object skipStackFramesCount = assignParameter(args, 2, true); if (null == skipStackFramesCount) { skipStackFramesCount = 0; } this.level = Logger.runtimeStaticObject.toMonologLevel(env, level); this.skipClassesPartials = function_array_merge .f .env(env) .call(ZVal.arrayFromList("Monolog\\"), skipClassesPartials) .value(); this.skipStackFramesCount = skipStackFramesCount; return null; } @ConvertedMethod @ConvertedParameter(index = 0, name = "record", typeHint = "array") public Object __invoke(RuntimeEnv env, Object... args) { int runtimeConverterBreakCount; int runtimeConverterContinueCount; ReferenceContainer record = new BasicReferenceContainer(assignParameter(args, 0, false)); ReferenceContainer trace = new BasicReferenceContainer(null); Object part = null; ReferenceContainer i = new BasicReferenceContainer(null); if (ZVal.isLessThan(record.arrayGet(env, "level"), '<', this.level)) { return ZVal.assign(record.getObject()); } trace.setObject( NamespaceGlobal.debug_backtrace .env(env) .call(ZVal.isLessThan(70211, '<', 50306) ? 2 : 2) .value()); function_array_shift.f.env(env).call(trace.getObject()); function_array_shift.f.env(env).call(trace.getObject()); i.setObject(0); runtimeConverterBreakCount = 0; runtimeConverterContinueCount = 0; while (ZVal.isTrue( this.isTraceClassOrSkippedFunction(env, trace.getObject(), i.getObject()))) { if (arrayActionR(ArrayAction.ISSET, trace, env, i.getObject(), "class")) { runtimeConverterBreakCount = 0; runtimeConverterContinueCount = 0; for (ZPair zpairResult816 : ZVal.getIterable(this.skipClassesPartials, env, true)) { part = ZVal.assign(zpairResult816.getValue()); if (ZVal.strictNotEqualityCheck( function_strpos .f .env(env) .call(trace.arrayGet(env, i.getObject(), "class"), part) .value(), "!==", false)) { i.setObject(ZVal.increment(i.getObject())); runtimeConverterContinueCount = 2; runtimeConverterContinueCount--; continue; } } } else if (function_in_array .f .env(env) .call(trace.arrayGet(env, i.getObject(), "function"), this.skipFunctions) .getBool()) { i.setObject(ZVal.increment(i.getObject())); continue; } break; } i.setObject(ZAssignment.add("+=", i.getObject(), this.skipStackFramesCount)); record.arrayAccess(env, "extra") .set( function_array_merge .f .env(env) .call( record.arrayGet(env, "extra"), ZVal.newArray( new ZPair( "file", arrayActionR( ArrayAction.ISSET, trace, env, ZVal.subtract( i.getObject(), 1), "file") ? trace.arrayGet( env, ZVal.subtract( i.getObject(), 1), "file") : ZVal.getNull()), new ZPair( "line", arrayActionR( ArrayAction.ISSET, trace, env, ZVal.subtract( i.getObject(), 1), "line") ? trace.arrayGet( env, ZVal.subtract( i.getObject(), 1), "line") : ZVal.getNull()), new ZPair( "class", arrayActionR( ArrayAction.ISSET, trace, env, i.getObject(), "class") ? trace.arrayGet( env, i.getObject(), "class") : ZVal.getNull()), new ZPair( "function", arrayActionR( ArrayAction.ISSET, trace, env, i.getObject(), "function") ? trace.arrayGet( env, i.getObject(), "function") : ZVal.getNull()))) .value()); return ZVal.assign(record.getObject()); } @ConvertedMethod @ConvertedParameter(index = 0, name = "trace", typeHint = "array") @ConvertedParameter(index = 1, name = "index") private Object isTraceClassOrSkippedFunction(RuntimeEnv env, Object... args) { ReferenceContainer trace = new BasicReferenceContainer(assignParameter(args, 0, false)); Object index = assignParameter(args, 1, false); if (!arrayActionR(ArrayAction.ISSET, trace, env, index)) { return ZVal.assign(false); } return ZVal.assign( ZVal.toBool(arrayActionR(ArrayAction.ISSET, trace, env, index, "class")) || ZVal.toBool( function_in_array .f .env(env) .call( trace.arrayGet(env, index, "function"), this.skipFunctions) .value())); } public static final Object CONST_class = "Monolog\\Processor\\IntrospectionProcessor"; // Runtime Converter Internals // RuntimeStaticCompanion contains static methods // RequestStaticProperties contains static (per-request) properties // ReflectionClassData contains php reflection data used by the runtime library public static class RuntimeStaticCompanion extends StaticBaseClass { private static final MethodHandles.Lookup staticCompanionLookup = MethodHandles.lookup(); } public static final RuntimeStaticCompanion runtimeStaticObject = new RuntimeStaticCompanion(); private static final ReflectionClassData runtimeConverterReflectionData = ReflectionClassData.builder() .setName("Monolog\\Processor\\IntrospectionProcessor") .setLookup( IntrospectionProcessor.class, MethodHandles.lookup(), RuntimeStaticCompanion.staticCompanionLookup) .setLocalProperties( "level", "skipClassesPartials", "skipFunctions", "skipStackFramesCount") .setFilename( "vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php") .get(); @Override public ReflectionClassData getRuntimeConverterReflectionData() { return runtimeConverterReflectionData; } @Override public Object converterRuntimeCallExtended( RuntimeEnv env, String method, Class<?> caller, PassByReferenceArgs passByReferenceArgs, Object... args) { return RuntimeClassBase.converterRuntimeCallExtendedWithDataStatic( this, runtimeConverterReflectionData, env, method, caller, passByReferenceArgs, args); } }
[ "git@runtimeconverter.com" ]
git@runtimeconverter.com
2e49e2694b74c307be34f3b699be368a59685e6d
25001e7956e614652225b514ff07412324ce2d79
/src/net/houselease/dao/PaidMapper.java
8542b6a99fce07af38da90dc7c18efbaf5c58747
[]
no_license
pmsmall/houseLeaseManagement
2dde39f6fcfd3853c0db7aea4baa69d14e3911bd
44b1ee738f2742dfc5a21a4c2ab7e28d6547830b
refs/heads/master
2020-03-07T14:52:59.369272
2018-04-08T18:06:38
2018-04-08T18:06:38
127,538,544
0
0
null
null
null
null
UTF-8
Java
false
false
327
java
package net.houselease.dao; import java.util.List; import net.houselease.pojo.Paid; import net.houselease.pojo.QueryVo; public interface PaidMapper { public List<Paid> selectall(QueryVo vo); public Double selectsum(QueryVo vo); public void deletepaid(Integer id); public void insertpaid(Paid paid); }
[ "frankkang@foxmail.com" ]
frankkang@foxmail.com
c0a9589d26ae510d4a40477b5d5a5b85c6e027e5
f33516ffd4ac82b741f936ae2f7ef974b5f7e2f9
/changedPlugins/org.emftext.language.java/src-gen/org/emftext/language/java/generics/impl/TypeParameterImpl.java
46ca155d35205c3b7628f2cd900176a48e03cb92
[]
no_license
ichupakhin/sdq
e8328d5fdc30482c2f356da6abdb154e948eba77
32cc990e32b761aa37420f9a6d0eede330af50e2
refs/heads/master
2023-01-06T13:33:20.184959
2020-11-01T13:29:04
2020-11-01T13:29:04
246,244,334
0
0
null
null
null
null
UTF-8
Java
false
false
5,892
java
/** * Copyright (c) 2006-2014 * Software Technology Group, Dresden University of Technology * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026 * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Software Technology Group - TU Dresden, Germany; * DevBoost GmbH - Berlin, Germany * - initial API and implementation * */ package org.emftext.language.java.generics.impl; import java.util.Collection; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.emftext.language.java.classifiers.ConcreteClassifier; import org.emftext.language.java.classifiers.impl.ClassifierImpl; import org.emftext.language.java.commons.Commentable; import org.emftext.language.java.generics.GenericsPackage; import org.emftext.language.java.generics.TypeParameter; import org.emftext.language.java.members.Member; import org.emftext.language.java.references.Reference; import org.emftext.language.java.types.Type; import org.emftext.language.java.types.TypeReference; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Type Parameter</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.emftext.language.java.generics.impl.TypeParameterImpl#getExtendTypes <em>Extend Types</em>}</li> * </ul> * </p> * * @generated */ public class TypeParameterImpl extends ClassifierImpl implements TypeParameter { /** * The cached value of the '{@link #getExtendTypes() <em>Extend Types</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getExtendTypes() * @generated * @ordered */ protected EList<TypeReference> extendTypes; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TypeParameterImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return GenericsPackage.Literals.TYPE_PARAMETER; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<TypeReference> getExtendTypes() { if (extendTypes == null) { extendTypes = new EObjectContainmentEList.Resolving<TypeReference>(TypeReference.class, this, GenericsPackage.TYPE_PARAMETER__EXTEND_TYPES); } return extendTypes; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<ConcreteClassifier> getAllSuperClassifiers() { return org.emftext.language.java.extensions.generics.TypeParameterExtension.getAllSuperClassifiers((org.emftext.language.java.generics.TypeParameter) this); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Member> getAllMembers(final Commentable context) { return org.emftext.language.java.extensions.generics.TypeParameterExtension.getAllMembers((org.emftext.language.java.generics.TypeParameter) this, (org.emftext.language.java.commons.Commentable) context); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Type getBoundType(final TypeReference typeReference, final Reference reference) { return org.emftext.language.java.extensions.generics.TypeParameterExtension.getBoundType((org.emftext.language.java.generics.TypeParameter) this, (org.emftext.language.java.types.TypeReference) typeReference, (org.emftext.language.java.references.Reference) reference); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case GenericsPackage.TYPE_PARAMETER__EXTEND_TYPES: return ((InternalEList<?>)getExtendTypes()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case GenericsPackage.TYPE_PARAMETER__EXTEND_TYPES: return getExtendTypes(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case GenericsPackage.TYPE_PARAMETER__EXTEND_TYPES: getExtendTypes().clear(); getExtendTypes().addAll((Collection<? extends TypeReference>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case GenericsPackage.TYPE_PARAMETER__EXTEND_TYPES: getExtendTypes().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case GenericsPackage.TYPE_PARAMETER__EXTEND_TYPES: return extendTypes != null && !extendTypes.isEmpty(); } return super.eIsSet(featureID); } } //TypeParameterImpl
[ "bla@mail.com" ]
bla@mail.com
e9f9d97d904a16892f4c2e4a60a54922b404c270
6db9460b992cd43f62fc835c23f31d3a5f20b39a
/JSF Application & Grid/assignment3a/src/controllers/FormController.java
16125a208ff0a615ed332b34338fdff6ff3e3295
[]
no_license
MickeyNavarro/CST-235
133644de965154396c26d65a0b2194340babf746
fc4391eed1556a223b0deab4004646d43f6a3ca8
refs/heads/main
2023-04-03T08:04:39.918720
2021-04-14T03:47:08
2021-04-14T03:47:08
332,600,575
0
0
null
null
null
null
UTF-8
Java
false
false
689
java
package controllers; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.faces.context.FacesContext; import beans.User; @ManagedBean @ViewScoped public class FormController { public String onSubmit(User user) { // send the User managed bean to the TestResponse view FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("user", user); return "TestResponse.xhtml"; } public String onFlash(User user) { // send the User managed bean to the TestResponse view FacesContext.getCurrentInstance().getExternalContext().getFlash().put("user", user); return "TestResponse2.xhtml?faces-redirect=true"; } }
[ "noreply@github.com" ]
MickeyNavarro.noreply@github.com
f613ccb82f3fe2923edc15145b1a812e84d47a45
800f6dfdd6adc9e59d80714ad2ddeb6fe5b731e0
/javasource/test_crm/tests/TestAuditBase.java
c3c7ad9e70b5163e0e81828268e81c104c46599c
[ "Apache-2.0" ]
permissive
passalaqua/AuditTrailModule
1c7155cba2262bb0f594174d9d48853184a90735
e6a71d6b35a4f95550b1f2babd0c6dda03c23ef3
refs/heads/master
2021-08-03T18:14:13.934640
2021-07-21T09:00:50
2021-07-21T09:00:50
212,061,808
0
0
null
2019-10-01T09:49:59
2019-10-01T09:49:59
null
UTF-8
Java
false
false
1,487
java
package test_crm.tests; import java.util.Date; import com.mendix.core.Core; import com.mendix.core.CoreException; import com.mendix.systemwideinterfaces.core.IContext; import com.mendix.systemwideinterfaces.core.IMendixObject; import org.junit.Before; import system.proxies.User; import test_crm.proxies.Group; public abstract class TestAuditBase { protected IContext context; protected User admin; protected Group group, group2; protected IMendixObject groupObject, group2Object; protected Date initialDate; @Before public void beforeTesting() throws CoreException { this.context = Core.createSystemContext(); this.initialDate = new Date(); this.admin = User.load(this.context, String.format("[%1s = '%2s']", User.MemberNames.Name, Core.getConfiguration().getAdminUserName())) .get(0); this.group = createNewGroup(GROUP_NAME, GROUP_CODE); this.groupObject = this.group.getMendixObject(); this.group2 = createNewGroup(GROUP_NAME2, GROUP_CODE2); this.group2Object = this.group2.getMendixObject(); } private Group createNewGroup(final String name, final String code) throws CoreException { final Group newGroup = new Group(context); newGroup.setCode(code); newGroup.setName(name); newGroup.commit(); return newGroup; } private static final String GROUP_NAME = "GROUP_NAME"; private static final String GROUP_CODE = "CDE"; private static final String GROUP_NAME2 = "GROUP_NAME2"; private static final String GROUP_CODE2 = "CDF"; }
[ "Augusto.Passalaqua@mendix.com" ]
Augusto.Passalaqua@mendix.com
6a21e6b377c6b96bdb9250eac2292a3a19176f83
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_823b8cbc9c26ffe4f3395228445d7991f2b68f68/RunDistanceTab/2_823b8cbc9c26ffe4f3395228445d7991f2b68f68_RunDistanceTab_t.java
c5f231cc6c5827953a4113625e88cf6e8df3e984
[]
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
14,224
java
/* * Created on Aug 17, 2004 * */ package is.idega.idegaweb.marathon.presentation; import is.idega.idegaweb.marathon.business.ConverterUtility; import is.idega.idegaweb.marathon.data.Distance; import is.idega.idegaweb.marathon.util.IWMarathonConstants; import java.util.List; import java.util.Locale; import com.idega.idegaweb.IWResourceBundle; import com.idega.presentation.IWContext; import com.idega.presentation.Table; import com.idega.presentation.text.Text; import com.idega.presentation.ui.CheckBox; import com.idega.presentation.ui.DropdownMenu; import com.idega.presentation.ui.TextInput; import com.idega.user.presentation.UserGroupTab; import com.idega.util.ListUtil; import com.idega.util.LocaleUtil; import com.idega.util.MiscUtil; /** * @author birna * */ public class RunDistanceTab extends UserGroupTab{ private static final String PARAMETER_USE_CHIP = "use_chip"; private static final String PARAMETER_FAMILY_DISCOUNT = "family_discount"; private static final String PARAMETER_ALLOWS_GROUPS = "allows_groups"; private static final String PARAMETER_PRICE_ISK = "price_isk"; private static final String PARAMETER_PRICE_EUR = "price_eur"; private static final String PARAMETER_CHILDREN_PRICE_ISK = "children_price_isk"; private static final String PARAMETER_CHILDREN_PRICE_EUR = "children_price_eur"; private static final String PARAMETER_NUMBER_OF_SPLITS = "number_of_splits"; private static final String PARAMETER_SHIRT_SIZES_PER_RUN = "shirt_sizes_per_run"; private TextInput priceISK; private TextInput priceEUR; private TextInput childrenPriceISK; private TextInput childrenPriceEUR; private CheckBox useChip; private CheckBox familyDiscount; private CheckBox allowsGroups; private DropdownMenu numberOfSplits; private ShirtSizeSelectionBox shirtSizeSelectionBox; private Text priceISKText; private Text priceEURText; private Text childrenPriceISKText; private Text childrenPriceEURText; private Text useChipText; private Text familyDiscountText; private Text allowsGroupsText; private Text numberOfSplitsText; private Text shirtSizeSelectionBoxText; public RunDistanceTab() { super(); IWContext iwc = IWContext.getInstance(); IWResourceBundle iwrb = getResourceBundle(iwc); setName(iwrb.getLocalizedString("run_tab.distance_name", "Distance info")); } /* (non-Javadoc) * @see com.idega.util.datastructures.Collectable#collect(com.idega.presentation.IWContext) */ public boolean collect(IWContext iwc) { if (iwc != null) { Boolean useChip = new Boolean(iwc.isParameterSet(PARAMETER_USE_CHIP)); Boolean familyDiscount = new Boolean(iwc.isParameterSet(PARAMETER_FAMILY_DISCOUNT)); Boolean allowsGroups = new Boolean(iwc.isParameterSet(PARAMETER_ALLOWS_GROUPS)); String priceISK = iwc.getParameter(PARAMETER_PRICE_ISK); String priceEUR = iwc.getParameter(PARAMETER_PRICE_EUR); String childPriceISK = iwc.getParameter(PARAMETER_CHILDREN_PRICE_ISK); String childPriceEUR = iwc.getParameter(PARAMETER_CHILDREN_PRICE_EUR); String numberOfSplits = iwc.getParameter(PARAMETER_NUMBER_OF_SPLITS); String[] shirtSizesPerRun = iwc.getParameterValues(PARAMETER_SHIRT_SIZES_PER_RUN); this.fieldValues.put(PARAMETER_USE_CHIP, useChip); this.fieldValues.put(PARAMETER_FAMILY_DISCOUNT, familyDiscount); this.fieldValues.put(PARAMETER_ALLOWS_GROUPS, allowsGroups); if (priceISK != null) { this.fieldValues.put(PARAMETER_PRICE_ISK, new Float(priceISK)); } if (priceEUR != null) { this.fieldValues.put(PARAMETER_PRICE_EUR, new Float(priceEUR)); } if (childPriceISK != null) { this.fieldValues.put(PARAMETER_CHILDREN_PRICE_ISK, new Float(childPriceISK)); } if(childPriceEUR != null){ this.fieldValues.put(PARAMETER_CHILDREN_PRICE_EUR, new Float(childPriceEUR)); } if(numberOfSplits != null){ this.fieldValues.put(PARAMETER_NUMBER_OF_SPLITS, new Integer(numberOfSplits)); } if(shirtSizesPerRun != null){ this.fieldValues.put(PARAMETER_SHIRT_SIZES_PER_RUN, shirtSizesPerRun); } updateFieldsDisplayStatus(); return true; } return false; } /* (non-Javadoc) * @see com.idega.user.presentation.UserTab#initFieldContents() */ public void initFieldContents() { try { Distance distance = ConverterUtility.getInstance().convertGroupToDistance(new Integer(getGroupId())); this.fieldValues.put(PARAMETER_USE_CHIP, new Boolean(distance.isUseChip())); this.fieldValues.put(PARAMETER_FAMILY_DISCOUNT, new Boolean(distance.isFamilyDiscount())); this.fieldValues.put(PARAMETER_ALLOWS_GROUPS, new Boolean(distance.isAllowsGroups())); this.fieldValues.put(PARAMETER_PRICE_ISK, new Float(distance.getPrice(LocaleUtil.getIcelandicLocale()))); this.fieldValues.put(PARAMETER_PRICE_EUR, new Float(distance.getPrice(Locale.ENGLISH))); this.fieldValues.put(PARAMETER_CHILDREN_PRICE_ISK, new Float(distance.getChildrenPrice(LocaleUtil.getIcelandicLocale()))); this.fieldValues.put(PARAMETER_CHILDREN_PRICE_EUR, new Float(distance.getChildrenPrice(Locale.ENGLISH))); this.fieldValues.put(PARAMETER_NUMBER_OF_SPLITS, new Integer(distance.getNumberOfSplits())); String shirtSizeMetadata = distance.getMetaData(PARAMETER_SHIRT_SIZES_PER_RUN); if (shirtSizeMetadata != null) { String[] shirtSizeMetadataArray = MiscUtil.str2array(shirtSizeMetadata,","); this.fieldValues.put(PARAMETER_SHIRT_SIZES_PER_RUN, shirtSizeMetadataArray); } updateFieldsDisplayStatus(); } catch (Exception e) { System.err.println("RunDistanceTab error initFieldContents, GroupId : " + getGroupId()); } } /* (non-Javadoc) * @see com.idega.user.presentation.UserTab#initializeFieldNames() */ public void initializeFieldNames() { } /* (non-Javadoc) * @see com.idega.user.presentation.UserTab#initializeFields() */ public void initializeFields() { this.priceISK = new TextInput(PARAMETER_PRICE_ISK); this.priceISK.setAsFloat("Not a valid price"); this.priceEUR = new TextInput(PARAMETER_PRICE_EUR); this.priceEUR.setAsFloat("Not a valid price"); this.childrenPriceISK = new TextInput(PARAMETER_CHILDREN_PRICE_ISK); this.childrenPriceISK.setAsFloat("Not a valid price"); this.childrenPriceEUR = new TextInput(PARAMETER_CHILDREN_PRICE_EUR); this.childrenPriceEUR.setAsFloat("Not a valid price"); this.useChip = new CheckBox(PARAMETER_USE_CHIP); this.familyDiscount = new CheckBox(PARAMETER_FAMILY_DISCOUNT); this.allowsGroups = new CheckBox(PARAMETER_ALLOWS_GROUPS); this.numberOfSplits = new DropdownMenu(PARAMETER_NUMBER_OF_SPLITS); this.numberOfSplits.addMenuElement(0, "0"); this.numberOfSplits.addMenuElement(1, "1"); this.numberOfSplits.addMenuElement(2, "2"); this.shirtSizeSelectionBox = new ShirtSizeSelectionBox(PARAMETER_SHIRT_SIZES_PER_RUN); this.shirtSizeSelectionBox.initialize(IWContext.getInstance()); } /* (non-Javadoc) * @see com.idega.user.presentation.UserTab#initializeFieldValues() */ public void initializeFieldValues() { this.fieldValues.put(PARAMETER_USE_CHIP, new Boolean(false)); this.fieldValues.put(PARAMETER_FAMILY_DISCOUNT, new Boolean(false)); this.fieldValues.put(PARAMETER_ALLOWS_GROUPS, new Boolean(false)); this.fieldValues.put(PARAMETER_PRICE_ISK, new Float(0)); this.fieldValues.put(PARAMETER_PRICE_EUR, new Float(0)); this.fieldValues.put(PARAMETER_CHILDREN_PRICE_ISK, new Float(0)); this.fieldValues.put(PARAMETER_CHILDREN_PRICE_EUR, new Float(0)); this.fieldValues.put(PARAMETER_NUMBER_OF_SPLITS, new Integer(0)); this.fieldValues.put(PARAMETER_SHIRT_SIZES_PER_RUN, new String[0]); } /* (non-Javadoc) * @see com.idega.user.presentation.UserTab#initializeTexts() */ public void initializeTexts() { IWContext iwc = IWContext.getInstance(); IWResourceBundle iwrb = getResourceBundle(iwc); this.priceISKText = new Text(iwrb.getLocalizedString("run_tab.price_ISK", "Price (ISK)")); this.priceISKText.setBold(); this.priceEURText = new Text(iwrb.getLocalizedString("run_tab.price_EUR", "Price (EUR)")); this.priceEURText.setBold(); this.childrenPriceISKText = new Text(iwrb.getLocalizedString("run_tab.children_price_ISK", "Children price (ISK)")); this.childrenPriceISKText.setBold(); this.childrenPriceEURText = new Text(iwrb.getLocalizedString("run_tab.children_price_EUR", "Children price (EUR)")); this.childrenPriceEURText.setBold(); this.useChipText = new Text(iwrb.getLocalizedString("run_tab.use_chip", "Uses chips")); this.useChipText.setBold(); this.familyDiscountText = new Text(iwrb.getLocalizedString("run_tab.family_discount", "Uses family discount")); this.familyDiscountText.setBold(); this.allowsGroupsText = new Text(iwrb.getLocalizedString("run_tab.allows_groups", "Allows groups")); this.allowsGroupsText.setBold(); this.numberOfSplitsText = new Text(iwrb.getLocalizedString("run_tab.number_of_splits", "Number of splits")); this.numberOfSplitsText.setBold(); this.shirtSizeSelectionBoxText = new Text(iwrb.getLocalizedString("run_tab.shirt_sizes", "Shirt sizes")); this.shirtSizeSelectionBoxText.setBold(); } /* (non-Javadoc) * @see com.idega.user.presentation.UserTab#lineUpFields() */ public void lineUpFields() { resize(1, 1); setCellpadding(0); setCellspacing(0); Table table = new Table(2, 4); table.setCellpadding(5); table.setCellspacing(0); table.setWidth(1, "50%"); table.setWidth(2, "50%"); table.setWidth(Table.HUNDRED_PERCENT); table.add(this.priceISKText, 1, 1); table.add(Text.getBreak(), 1, 1); table.add(this.priceISK, 1, 1); table.add(this.childrenPriceISKText, 2, 1); table.add(Text.getBreak(), 2, 1); table.add(this.childrenPriceISK, 2, 1); table.add(this.priceEURText, 1, 2); table.add(Text.getBreak(), 1, 2); table.add(this.priceEUR, 1, 2); table.add(this.childrenPriceEURText, 2, 2); table.add(Text.getBreak(), 2, 2); table.add(this.childrenPriceEUR, 2, 2); table.mergeCells(1, 3, 2, 3); table.add(this.numberOfSplitsText, 1, 3); table.add(Text.getNonBrakingSpace(), 1, 3); table.add(this.numberOfSplits, 1, 3); table.mergeCells(1, 4, 2, 4); table.add(this.useChip, 1, 4); table.add(Text.getNonBrakingSpace(), 1, 4); table.add(this.useChipText, 1, 4); table.add(Text.getBreak(), 1, 4); table.add(this.familyDiscount, 1, 4); table.add(Text.getNonBrakingSpace(), 1, 4); table.add(this.familyDiscountText, 1, 4); table.add(Text.getBreak(), 1, 4); table.add(this.allowsGroups, 1, 4); table.add(Text.getNonBrakingSpace(), 1, 4); table.add(this.allowsGroupsText, 1, 4); table.add(Text.getBreak(), 1, 4); table.add(Text.getBreak(), 1, 4); table.add(this.shirtSizeSelectionBoxText, 1, 4); table.add(Text.getBreak(), 1, 4); table.add(this.shirtSizeSelectionBox,1,4); add(table, 1, 1); } /* (non-Javadoc) * @see com.idega.util.datastructures.Collectable#store(com.idega.presentation.IWContext) */ public boolean store(IWContext iwc) { try { if (getGroupId() > -1) { Distance distance = ConverterUtility.getInstance().convertGroupToDistance(new Integer(getGroupId())); distance.setUseChip(((Boolean) this.fieldValues.get(PARAMETER_USE_CHIP)).booleanValue()); distance.setFamilyDiscount(((Boolean) this.fieldValues.get(PARAMETER_FAMILY_DISCOUNT)).booleanValue()); distance.setAllowsGroups(((Boolean) this.fieldValues.get(PARAMETER_ALLOWS_GROUPS)).booleanValue()); distance.setPriceInISK(((Float) this.fieldValues.get(PARAMETER_PRICE_ISK)).floatValue()); distance.setPriceInEUR(((Float) this.fieldValues.get(PARAMETER_PRICE_EUR)).floatValue()); distance.setChildrenPriceInISK(((Float) this.fieldValues.get(PARAMETER_CHILDREN_PRICE_ISK)).floatValue()); distance.setChildrenPriceInEUR(((Float) this.fieldValues.get(PARAMETER_CHILDREN_PRICE_EUR)).floatValue()); distance.setNumberOfSplits(((Integer) this.fieldValues.get(PARAMETER_NUMBER_OF_SPLITS)).intValue()); String[] shirtSizesPerRun = (String[]) this.fieldValues.get(PARAMETER_SHIRT_SIZES_PER_RUN); if(shirtSizesPerRun!=null && shirtSizesPerRun.length != 0){ List abbrList = ListUtil.convertStringArrayToList(shirtSizesPerRun); if(abbrList.isEmpty()){ distance.setMetaData(PARAMETER_SHIRT_SIZES_PER_RUN, ""); } else{ String commaSeparated = ListUtil.convertListOfStringsToCommaseparatedString(abbrList); distance.setMetaData(PARAMETER_SHIRT_SIZES_PER_RUN, commaSeparated); } } distance.store(); } } catch (Exception e) { //return false; e.printStackTrace(System.err); throw new RuntimeException("update group exception"); } return true; } /* (non-Javadoc) * @see com.idega.user.presentation.UserTab#updateFieldsDisplayStatus() */ public void updateFieldsDisplayStatus() { this.useChip.setChecked(((Boolean) this.fieldValues.get(PARAMETER_USE_CHIP)).booleanValue()); this.familyDiscount.setChecked(((Boolean) this.fieldValues.get(PARAMETER_FAMILY_DISCOUNT)).booleanValue()); this.allowsGroups.setChecked(((Boolean) this.fieldValues.get(PARAMETER_ALLOWS_GROUPS)).booleanValue()); this.priceISK.setContent(((Float) this.fieldValues.get(PARAMETER_PRICE_ISK)).toString()); this.priceEUR.setContent(((Float) this.fieldValues.get(PARAMETER_PRICE_EUR)).toString()); this.childrenPriceISK.setContent(((Float) this.fieldValues.get(PARAMETER_CHILDREN_PRICE_ISK)).toString()); this.childrenPriceEUR.setContent(((Float) this.fieldValues.get(PARAMETER_CHILDREN_PRICE_EUR)).toString()); this.numberOfSplits.setSelectedElement(((Integer) this.fieldValues.get(PARAMETER_NUMBER_OF_SPLITS)).intValue()); this.shirtSizeSelectionBox.setSelectedElements((String[]) this.fieldValues.get(PARAMETER_SHIRT_SIZES_PER_RUN)); } public String getBundleIdentifier() { return IWMarathonConstants.IW_BUNDLE_IDENTIFIER; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
904756cecad11faea979aa9704f39c9329578321
521bb1e142549cb9cefd9b1e68d820afed9bdb08
/src/controller/mgr/free/MgrFreeListController.java
e8f07c0a6275495a598b5a1ff529f2446a781973
[]
no_license
Kinuk97/PickMI
386a169cac88e110c9c02add5320e099caf07e6d
800f78da3ae7cfd58c8f30fe5d9a23f7c1e25914
refs/heads/master
2020-09-11T12:45:50.037919
2019-12-08T16:10:04
2019-12-08T16:10:04
222,067,458
2
0
null
null
null
null
UTF-8
Java
false
false
1,610
java
package controller.mgr.free; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import dto.FreeBoard; import serivce.face.FreeBoardService; import serivce.impl.FreeBoardServiceImpl; import util.Paging; /** * Servlet implementation class MgrFreeListController */ @WebServlet("/mgr/freelist") public class MgrFreeListController extends HttpServlet { private static final long serialVersionUID = 1L; FreeBoardService freeBoardService = FreeBoardServiceImpl.getInstance(); @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (req.getSession().getAttribute("mgrlogin") != null) { // 요청파라미터에서 curPage를 구하고 Paging 객체 반환 Paging paging = freeBoardService.getPaging(req); //Paging 객체를 MODEL값으로 지정 req.setAttribute("paging", paging); //mgr main navTab에서 사용할 번호 req.setAttribute("boardno", 5); // FreeBoard 게시글 목록 조회 List<FreeBoard>freelist = freeBoardService.getBoardList(paging); //freelist 객체를 MODEL값으로 전달 req.setAttribute("list", freelist); req.getRequestDispatcher("/WEB-INF/views/mgr/free/freelist.jsp").forward(req, resp); } else { // 에러페이지 req.getRequestDispatcher("/WEB-INF/views/mgr/layouts/mustlogin.jsp") .forward(req, resp); } } }
[ "wbhblb@gmail.com" ]
wbhblb@gmail.com
55b0a68359b21620bee501f045e62c705cbe2365
ffd9290319ea35763d6da538e43d808462852410
/src/main/java/cn/edu/hit/spat/system/entity/PointsRule.java
560d61e0425593ed8357133f6a387aeac8897b8b
[ "Apache-2.0" ]
permissive
HIT-SoftwareProcessAndTools/GWARBMS
423768fde7e6d2bf5f0dad3d65e1d4f585f4571d
317c781cae1a768b0f80c435bf0d1651202e8435
refs/heads/main
2023-02-13T00:50:20.880901
2021-01-14T05:37:16
2021-01-14T05:37:16
315,177,166
3
2
Apache-2.0
2020-12-03T06:27:30
2020-11-23T02:13:02
Java
UTF-8
Java
false
false
823
java
package cn.edu.hit.spat.system.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; /** * @author XuJian */ @Data @TableName("t_points_rule") public class PointsRule implements Serializable { /** * 规则 ID */ @TableId(value = "POINTS_RULE_ID", type = IdType.AUTO) private Long pointsRuleId; /** * 付账累计积分是的比例 */ @TableField("TO_POINTS") private Long toPoints; /** * 积分兑换余额的比例 */ @TableField("TO_BALANCE") private Long toBalance; public Long getId() { return pointsRuleId; } }
[ "941197279@qq.com" ]
941197279@qq.com
09862762e80a85a715d5ff0865525ced8c9739d4
653b61157c7c15ee37af767453f7811435123aa9
/src/main/java/com/eviware/soapui/plugins/auto/factories/AutoImportMethodFactory.java
c17aa25c5bbeae880e9dd920c0de99c1d44bc80a
[ "MIT" ]
permissive
stallewar/soapui-plugin-extender
8fef713b7fd7842367718d58f33217e7e3b6fd5f
46f07786937c50d68d141abfa0c058b7600e3a8c
refs/heads/master
2020-09-17T08:46:49.756255
2019-10-12T22:24:22
2019-10-13T05:09:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
617
java
package com.eviware.soapui.plugins.auto.factories; import com.eviware.soapui.SoapUI; import com.eviware.soapui.plugins.auto.PluginImportMethod; import com.eviware.soapui.plugins.oss.ImportMethodFactory; import com.eviware.soapui.support.action.SoapUIAction; public class AutoImportMethodFactory extends SimpleSoapUIFactory<SoapUIAction> { private final String pluginName; public AutoImportMethodFactory(PluginImportMethod method, Class<SoapUIAction> actionType) { super(ImportMethodFactory.class, actionType); this.pluginName = method.label(); SoapUI.log("No-op " + getClass().getName()); } }
[ "nbquinns@gmail.com" ]
nbquinns@gmail.com
00b3874bced7dc901956f121e2f8e891bb484d0f
dd80a584130ef1a0333429ba76c1cee0eb40df73
/frameworks/base/core/tests/coretests/src/android/widget/focus/ListOfButtonsTest.java
1968a32c8bcd9303e670d984c8cb862c33f5ed46
[ "MIT", "LicenseRef-scancode-unicode", "Apache-2.0" ]
permissive
karunmatharu/Android-4.4-Pay-by-Data
466f4e169ede13c5835424c78e8c30ce58f885c1
fcb778e92d4aad525ef7a995660580f948d40bc9
refs/heads/master
2021-03-24T13:33:01.721868
2017-02-18T17:48:49
2017-02-18T17:48:49
81,847,777
0
2
MIT
2020-03-09T00:02:12
2017-02-13T16:47:00
null
UTF-8
Java
false
false
5,381
java
/* * Copyright (C) 2007 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.widget.focus; import android.widget.focus.ListOfButtons; import com.android.frameworks.coretests.R; import android.test.ActivityInstrumentationTestCase2; import android.test.suitebuilder.annotation.MediumTest; import android.widget.ListAdapter; import android.widget.Button; import android.widget.ListView; import android.view.KeyEvent; import android.view.View; /** * Tests that focus works as expected when navigating into and out of * a {@link ListView} that has buttons in it. */ public class ListOfButtonsTest extends ActivityInstrumentationTestCase2<ListOfButtons> { private ListAdapter mListAdapter; private Button mButtonAtTop; private ListView mListView; public ListOfButtonsTest() { super(ListOfButtons.class); } @Override protected void setUp() throws Exception { super.setUp(); ListOfButtons a = getActivity(); getInstrumentation().waitForIdleSync(); mListAdapter = a.getListAdapter(); mButtonAtTop = (Button) a.findViewById(R.id.button); mListView = a.getListView(); } @MediumTest public void testPreconditions() { assertNotNull(mListAdapter); assertNotNull(mButtonAtTop); assertNotNull(mListView); assertFalse(mButtonAtTop.hasFocus()); assertTrue(mListView.hasFocus()); assertEquals("expecting 0 index to be selected", 0, mListView.getSelectedItemPosition()); } @MediumTest public void testNavigateToButtonAbove() { sendKeys(KeyEvent.KEYCODE_DPAD_UP); assertTrue(mButtonAtTop.hasFocus()); assertFalse(mListView.hasFocus()); } @MediumTest public void testNavigateToSecondItem() { sendKeys(KeyEvent.KEYCODE_DPAD_DOWN); assertTrue(mListView.hasFocus()); View childOne = mListView.getChildAt(1); assertNotNull(childOne); assertEquals(childOne, mListView.getFocusedChild()); assertTrue(childOne.hasFocus()); } @MediumTest public void testNavigateUpAboveAndBackOut() { sendKeys(KeyEvent.KEYCODE_DPAD_UP); sendKeys(KeyEvent.KEYCODE_DPAD_DOWN); assertFalse("button at top should have focus back", mButtonAtTop.hasFocus()); assertTrue(mListView.hasFocus()); } // TODO: this reproduces bug 981791 public void TODO_testNavigateThroughAllButtonsAndBack() { String[] labels = getActivity().getLabels(); for (int i = 0; i < labels.length; i++) { String label = labels[i]; sendKeys(KeyEvent.KEYCODE_DPAD_DOWN); getInstrumentation().waitForIdleSync(); String indexInfo = "index: " + i + ", label: " + label; assertTrue(indexInfo, mListView.hasFocus()); Button button = (Button) mListView.getSelectedView(); assertNotNull(indexInfo, button); assertEquals(indexInfo, label, button.getText().toString()); assertTrue(indexInfo, button.hasFocus()); } // pressing down again shouldn't matter; make sure last item keeps focus sendKeys(KeyEvent.KEYCODE_DPAD_DOWN); for (int i = labels.length - 1; i >= 0; i--) { String label = labels[i]; String indexInfo = "index: " + i + ", label: " + label; assertTrue(indexInfo, mListView.hasFocus()); Button button = (Button) mListView.getSelectedView(); assertNotNull(indexInfo, button); assertEquals(indexInfo, label, button.getText().toString()); assertTrue(indexInfo, button.hasFocus()); sendKeys(KeyEvent.KEYCODE_DPAD_UP); getInstrumentation().waitForIdleSync(); } assertTrue("button at top should have focus back", mButtonAtTop.hasFocus()); assertFalse(mListView.hasFocus()); } @MediumTest public void testGoInAndOutOfListWithItemsFocusable() { sendKeys(KeyEvent.KEYCODE_DPAD_UP); assertTrue(mButtonAtTop.hasFocus()); sendKeys(KeyEvent.KEYCODE_DPAD_DOWN); final String firstButtonLabel = getActivity().getLabels()[0]; final Button firstButton = (Button) mListView.getSelectedView(); assertTrue(firstButton.isFocused()); assertEquals(firstButtonLabel, firstButton.getText()); sendKeys(KeyEvent.KEYCODE_DPAD_UP); assertTrue(mButtonAtTop.isFocused()); sendKeys(KeyEvent.KEYCODE_DPAD_DOWN); assertTrue(firstButton.isFocused()); sendKeys(KeyEvent.KEYCODE_DPAD_UP); assertTrue(mButtonAtTop.isFocused()); sendKeys(KeyEvent.KEYCODE_DPAD_DOWN); assertTrue(firstButton.isFocused()); } }
[ "karun.matharu@gmail.com" ]
karun.matharu@gmail.com
c841934af68f5d7bb445c2263007a3450f6872e4
801599c446ac24b2877973363b28ef1cb930e206
/src/br/cin/ufpe/wsn2rbd/ConvertRouteToRBD.java
36a68ea6e1fbb291f32b558fa12c9fa69c533fe7
[]
no_license
anhnt2407/wsn2rbd
d1249db7bfa563330911fda4eb0909a7e78efdb7
182624faa82dbc948fb96c66f6740f8b593e8207
refs/heads/master
2021-05-28T08:27:37.260318
2014-05-26T02:32:37
2014-05-26T02:32:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,788
java
package br.cin.ufpe.wsn2rbd; import java.util.HashMap; import java.util.List; import java.util.Map; import org.modcs.tools.rbd.blocks.Block; import org.modcs.tools.rbd.blocks.BlockExponential; import org.modcs.tools.rbd.blocks.BlockParallel; import org.modcs.tools.rbd.blocks.BlockSeries; import org.modcs.tools.rbd.blocks.RBDModel; /** * * @author avld */ public class ConvertRouteToRBD { private Map<String,Integer> nodeMap; private int parallelCounter; private int seriesCounter; public ConvertRouteToRBD() { // do nothing } public RBDModel convert( List<Route> routeList ) { if( routeList.isEmpty() ) { return null; } else if( routeList.size() == 1 ) { return convert( routeList.get( 0 ) ); } // -------------------- nodeMap = new HashMap<>(); parallelCounter = 0; seriesCounter = 0; // -------------------- BlockParallel parallel = new BlockParallel( getParallelName() ); for( Route route : routeList ) { Block block = convertRouteToBlock( route ); parallel.addBlock( block ); } RBDModel model = new RBDModel( "WSN" ); model.setModel( parallel ); return model; } public RBDModel convert( Route route ) { nodeMap = new HashMap<>(); parallelCounter = 0; seriesCounter = 0; Block block = convertRouteToBlock( route ); if ( block == null ) { return null; } else { RBDModel model = new RBDModel( "WSN" ); model.setModel( block ); return model; } } private Block convertRouteToBlock( Route route ) { String name = getBlockName( route ); BlockExponential block = new BlockExponential( name , null , null ); block.setFailureRate( route.getAvailability() ); // ---------------------- if( route.getRouteList().isEmpty() ) // um block normal { return block; } else if( route.getRouteList().size() == 1 ) // um block seriado { Block block01 = convertRouteToBlock( route.getRouteList().get( 0 ) ); BlockSeries series = new BlockSeries( getSeriesName() ); series.addBlock( block ); series.addBlock( block01 ); return series; } else // um block paralelo { BlockParallel parallel = new BlockParallel( getParallelName() ); for( Route r : route.getRouteList() ) { Block b = convertRouteToBlock( r ); parallel.addBlock( b ); } BlockSeries series = new BlockSeries( getSeriesName() ); series.addBlock( block ); series.addBlock( parallel ); return series; } } private String getBlockName( Route route ) { String name = route.getName(); int counter = 1; if( nodeMap.containsKey( name ) ) { counter = nodeMap.get( name ) + 1; } nodeMap.put( name , counter ); return name + " (" + counter + ")"; } private String getSeriesName() { return "Series (" + (++seriesCounter) + ")"; } private String getParallelName() { return "Parallel (" + (++parallelCounter) + ")"; } }
[ "avld@avld" ]
avld@avld
78586030ec8398ea45693935c5867ebb428b7ffa
aa7eac80cba1146f33f4d747a75ad0fd31c15c30
/SupernaturalOutbreak/src/gameDeck_Master/CardView.java
367a34ecfd63867af31983087d1770f60e694c1f
[]
no_license
ilovebeef/Pandemic_Educational_AndroidSDK
9546190b2a506628e01b609cfcef7518985ff55d
94adcc9ccbfba7ed9cc8d712932d4baf6ed2d78a
refs/heads/master
2020-12-26T00:26:42.206411
2014-09-30T06:18:25
2014-09-30T06:18:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
362
java
// Written by Matt Roycroft package gameDeck_Master; public class CardView { // simple function to identify cards by the view, to whichever entity is interested in knowing public void printCardDetails(String cardName, String cardType) { System.out.println("Current card's name: " + cardName); System.out.println("Current card's type: " + cardType); } }
[ "csueb.css.hnguyen@gmail.com" ]
csueb.css.hnguyen@gmail.com
809b05c90b7bf46719ae6ae1db2413e9735ff74e
1277793b4942a447c1e86a4e80217a3829d728a8
/workspace/ECoreJavaProj/src/basic/str/StringEndsWithExample.java
b3248ca077fb6a5e2c1f6af03ab82617c54c9e9e
[]
no_license
amrutabds/School
7d178143530f8b9115f46bc200c9ea57bf7e8ec1
907bc164ac4ced5a4b940b22eb647c078bc25090
refs/heads/master
2021-01-16T19:31:03.617714
2012-12-12T01:38:46
2012-12-12T01:38:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
759
java
package basic.str; /* String endsWith Example This example shows how to check if a particular string is ending with a specified word. */ public class StringEndsWithExample { public static void main(String[] args) { //declare the original String String strOrig = "Hello World"; /* check whether String ends with World or not. Use endsWith method of the String class to check the same. endsWith() method returns true if a string is ending with a given word otherwise it returns false */ if(strOrig.endsWith("World")){ System.out.println("String ends with World"); }else{ System.out.println("String does not end with World"); } } } /* Output of the program would be : String ends with World */
[ "amrutabds@gmail.com" ]
amrutabds@gmail.com
f380b30be360eab8f4d39eb420689ba51ccd72c9
3dae6353a3aab4892c490a5d5928144fb5b487fa
/MinidumpLoader/src/main/java/net/jubjubnest/minidump/contrib/pe/cli/tables/CliTableFieldRVA.java
171a632392c7f18c2ae692232015c531d9bc22b4
[ "LGPL-2.1-only", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
dobo90/ghidra-minidump-loader
a3698958ac0d3062bf3f0641fd32c59ab3f9eed8
025da0a34eaeda71fca437c3dd555db5f4522fcc
refs/heads/main
2023-07-11T09:26:54.155987
2021-01-01T19:40:50
2021-01-01T19:40:50
395,076,588
0
0
Apache-2.0
2021-08-11T18:03:20
2021-08-11T18:03:19
null
UTF-8
Java
false
false
2,096
java
/* ### * IP: GHIDRA * * 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 net.jubjubnest.minidump.contrib.pe.cli.tables; import java.io.IOException; import ghidra.app.util.bin.BinaryReader; import net.jubjubnest.minidump.contrib.pe.cli.streams.CliStreamMetadata; import ghidra.program.model.data.CategoryPath; import ghidra.program.model.data.StructureDataType; /** * Describes the FieldRVA table. Each row gives the RVA location of an initial value for each Field. */ public class CliTableFieldRVA extends CliAbstractTable { public class CliFieldRVARow extends CliAbstractTableRow { public int rva; public int fieldIndex; public CliFieldRVARow(int rva, int fieldIndex) { super(); this.rva = rva; this.fieldIndex = fieldIndex; } @Override public String getRepresentation() { return String.format("Field %s RVA %x", getRowRepresentationSafe(CliTypeTable.Field, fieldIndex), rva); } } public CliTableFieldRVA(BinaryReader reader, CliStreamMetadata stream, CliTypeTable tableId) throws IOException { super(reader, stream, tableId); for (int i = 0; i < this.numRows; i++) { rows.add(new CliFieldRVARow(reader.readNextInt(), readTableIndex(reader, CliTypeTable.Field))); } reader.setPointerIndex(this.readerOffset); } @Override public StructureDataType getRowDataType() { StructureDataType rowDt = new StructureDataType(new CategoryPath(PATH), "FieldRVA Row", 0); rowDt.add(DWORD, "RVA", null); rowDt.add(metadataStream.getTableIndexDataType(CliTypeTable.Field), "Field", "index into Field table"); return rowDt; } }
[ "jubjub@jubjubnest.net" ]
jubjub@jubjubnest.net
0e26a0bbeac72529ae982ad32abbdb73bcebb3e3
709659a41bc532cea7d7ed03d4eb193f53b951eb
/Iterator/3/PancakeHouseMenu.java
145637f675e43929a824e049858b304e320df04f
[]
no_license
smatthewenglish/HeadFirstDesignPatterns
2ebd10a498ed65c2392e97fd52232cf63c2bc850
4e792a728ec3bd4635fdbed8ebe4c1911a2d7c56
refs/heads/master
2020-03-08T19:27:16.458013
2018-05-05T02:53:27
2018-05-05T02:53:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,083
java
import java.util.*; public class PancakeHouseMenu implements Menu { ArrayList<MenuItem> menuItems; public PancakeHouseMenu() { menuItems = new ArrayList<MenuItem>(); addItem("K&B's Pancake Breakfast", "Pancakes with scrambled eggs, and toast", true, 2.99); addItem("Regular Pancake Breakfast", "Pancakes with fried eggs, sausage", false, 2.99); addItem("BlueBerry Pancakes", "Pancakes made with fresh blueberries", true, 3.49); addItem("Waffles", "Waffles, with your choice of blueberries or strawberries", true, 3.59); } public void addItem(String name, String description, boolean vegatarian, double price) { MenuItem menuItem = new MenuItem(name, description, vegatarian, price); menuItems.add(menuItem); } // public Iterator createIterator() { // return new PancakeHouseIterator(menuItems); // } public Iterator<Menu> createIterator() { return menuItems.iterator(); } // other menu methods here }
[ "s.matthew.english@gmail.com" ]
s.matthew.english@gmail.com
507536aa0b80d30b41c6cd7e45db2ac1e4993b24
4ceaaf31438676923695d5a312f6e985b606acb2
/jgltf-impl/src/main/java/de/javagl/jgltf/impl/Asset.java
6bd36eeeafef12a82cd2d978b2d402defae91255
[ "MIT" ]
permissive
Arcnor/JglTF
fbbf3a161fb81a78107e902413be583dd43431a9
b1bd1030f5619c628c00fd32a6a9e419b7881a45
refs/heads/master
2020-07-12T20:34:42.263800
2017-01-25T17:35:05
2017-01-25T17:35:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,792
java
/* * glTF JSON model * * Do not modify this class. It is automatically generated * with JsonModelGen (https://github.com/javagl/JsonModelGen) * Copyright (c) 2016 Marco Hutter - http://www.javagl.de */ package de.javagl.jgltf.impl; /** * Metadata about the glTF asset. * * Auto-generated for asset.schema.json * */ public class Asset extends GlTFProperty { /** * A copyright message suitable for display to credit the content * creator. (optional) * */ private String copyright; /** * Tool that generated this glTF model. Useful for debugging. (optional) * */ private String generator; /** * Specifies if the shaders were generated with premultiplied alpha. * (optional)<br> * Default: false * */ private Boolean premultipliedAlpha; /** * The profile of this Asset (optional)<br> * Default: {} * */ private AssetProfile profile; /** * The glTF version. (required) * */ private String version; /** * A copyright message suitable for display to credit the content * creator. (optional) * * @param copyright The copyright to set * */ public void setCopyright(String copyright) { if (copyright == null) { this.copyright = copyright; return ; } this.copyright = copyright; } /** * A copyright message suitable for display to credit the content * creator. (optional) * * @return The copyright * */ public String getCopyright() { return this.copyright; } /** * Tool that generated this glTF model. Useful for debugging. (optional) * * @param generator The generator to set * */ public void setGenerator(String generator) { if (generator == null) { this.generator = generator; return ; } this.generator = generator; } /** * Tool that generated this glTF model. Useful for debugging. (optional) * * @return The generator * */ public String getGenerator() { return this.generator; } /** * Specifies if the shaders were generated with premultiplied alpha. * (optional)<br> * Default: false * * @param premultipliedAlpha The premultipliedAlpha to set * */ public void setPremultipliedAlpha(Boolean premultipliedAlpha) { if (premultipliedAlpha == null) { this.premultipliedAlpha = premultipliedAlpha; return ; } this.premultipliedAlpha = premultipliedAlpha; } /** * Specifies if the shaders were generated with premultiplied alpha. * (optional)<br> * Default: false * * @return The premultipliedAlpha * */ public Boolean isPremultipliedAlpha() { return this.premultipliedAlpha; } /** * Returns the default value of the premultipliedAlpha<br> * @see #isPremultipliedAlpha * * @return The default premultipliedAlpha * */ public Boolean defaultPremultipliedAlpha() { return false; } /** * The profile of this Asset (optional)<br> * Default: {} * * @param profile The profile to set * */ public void setProfile(AssetProfile profile) { if (profile == null) { this.profile = profile; return ; } this.profile = profile; } /** * The profile of this Asset (optional)<br> * Default: {} * * @return The profile * */ public AssetProfile getProfile() { return this.profile; } /** * Returns the default value of the profile<br> * @see #getProfile * * @return The default profile * */ public AssetProfile defaultProfile() { return new AssetProfile(); } /** * The glTF version. (required) * * @param version The version to set * @throws NullPointerException If the given value is <code>null</code> * */ public void setVersion(String version) { if (version == null) { throw new NullPointerException((("Invalid value for version: "+ version)+", may not be null")); } this.version = version; } /** * The glTF version. (required) * * @return The version * */ public String getVersion() { return this.version; } }
[ "javagl@javagl.de" ]
javagl@javagl.de
a7c025ddbe4ed43dd5e4817bf30dc16c0af5a00f
3f860861a067a9a42cdd9a6f1cd46f4ffb3ff8ef
/app/src/main/java/com/fatchao/gangedrecyclerview/ClassifyDetailAdapter.java
35ddcf146064092bdb9934bfb17f39029be95ab7
[]
no_license
AlienChao/GangedRecyclerview-master2
322847377691cac3079bc718eedda7adf4df36ca
2eb5dc4c8a2c784f28f18b3bfb447be5a321e45e
refs/heads/master
2022-12-24T19:32:56.130537
2020-10-13T08:36:00
2020-10-13T08:36:00
303,639,438
1
0
null
null
null
null
UTF-8
Java
false
false
1,921
java
package com.fatchao.gangedrecyclerview; import android.content.Context; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import java.util.List; public class ClassifyDetailAdapter extends RvAdapter<RightBean> { public ClassifyDetailAdapter(Context context, List<RightBean> list, RvListener listener) { super(context, list, listener); } @Override protected int getLayoutId(int viewType) { return viewType == 0 ? R.layout.item_title : R.layout.item_classify_detail; } @Override public int getItemViewType(int position) { return list.get(position).isTitle() ? 0 : 1; } @Override protected RvHolder getHolder(View view, int viewType) { return new ClassifyHolder(view, viewType, listener); } public class ClassifyHolder extends RvHolder<RightBean> { TextView tvCity; ImageView avatar; TextView tvTitle; public ClassifyHolder(View itemView, int type, RvListener listener) { super(itemView, type, listener); switch (type) { case 0: tvTitle = (TextView) itemView.findViewById(R.id.tv_title); break; case 1: tvCity = (TextView) itemView.findViewById(R.id.tvCity); avatar = (ImageView) itemView.findViewById(R.id.ivAvatar); break; } } @Override public void bindHolder(RightBean sortBean, int position) { int itemViewType = ClassifyDetailAdapter.this.getItemViewType(position); switch (itemViewType) { case 0: tvTitle.setText(sortBean.getName()); break; case 1: tvCity.setText(sortBean.getName()); break; } } } }
[ "alienchao@live.com" ]
alienchao@live.com
56136750bcab573eb44149f8a921d47851f9e444
45fb879161beb583e1a5afd9088a358e5d6308f1
/13_Collection/src/com/kh/chap01_list/part02_mvc/model/sort/TitleDesc.java
1e76eec28dc360dab9f0a8698ea669e957eb70c7
[]
no_license
pje00427/java_workspace
5049ae77f558cadccccc3efe2f0c2ee4651700a6
cc885bf294b6804c98656f01c2e87e21cce0b698
refs/heads/master
2022-11-09T03:13:06.598767
2020-07-05T10:48:44
2020-07-05T10:48:44
276,353,388
2
0
null
null
null
null
UHC
Java
false
false
440
java
package com.kh.chap01_list.part02_mvc.model.sort; import java.util.Comparator; import com.kh.chap01_list.part02_mvc.model.vo.Music; public class TitleDesc implements Comparator<Music> { @Override public int compare(Music o1, Music o2) { // 곡명 내림차순 정렬 // o2(뒤)의 곡명이 o1(앞)의 곡명보다 더 클경우 --> 순서변경 -> 양수반환 return o2.getTitle().compareTo(o1.getTitle()); } }
[ "59409769+pje00427@users.noreply.github.com" ]
59409769+pje00427@users.noreply.github.com
90b33d442ddaf23e7828f7f2366a605e601feded
895cfe0ecc1649015aebb9323cebfee740d137d0
/services-common/src/main/java/org/sola/services/common/repository/CommonMapper.java
9387cce70631972fe8925f5ccece92a262c9f40a
[]
no_license
OpenTenure/services
434812fe545c0f291d9c2b84fc4525bd130ae2cb
68d69e2ddf25c4096e45ca6522e104b830770c08
refs/heads/master
2023-04-15T03:23:16.890471
2023-04-08T15:24:26
2023-04-08T15:24:26
34,508,654
0
3
null
2022-06-30T14:45:28
2015-04-24T09:01:12
Java
UTF-8
Java
false
false
4,104
java
/** * ****************************************************************************************** * Copyright (C) 2014 - Food and Agriculture Organization of the United Nations (FAO). * 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 FAO 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 org.sola.services.common.repository; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import org.apache.ibatis.annotations.DeleteProvider; import org.apache.ibatis.annotations.InsertProvider; import org.apache.ibatis.annotations.SelectProvider; import org.apache.ibatis.annotations.UpdateProvider; import org.sola.services.common.repository.entities.AbstractEntity; /** * * @author soladev */ public interface CommonMapper { /** * Refer to {@linkplain CommonSqlProvider#buildInsertSql}. */ @InsertProvider(type = CommonSqlProvider.class, method = "buildInsertSql") <T extends AbstractEntity> int insert(T entity); /** * Refer to {@linkplain CommonSqlProvider#buildUpdateSql}. */ @UpdateProvider(type = CommonSqlProvider.class, method = "buildUpdateSql") <T extends AbstractEntity> int update(T entity); /** * Refer to {@linkplain CommonSqlProvider#buildDeleteSql}. */ @DeleteProvider(type = CommonSqlProvider.class, method = "buildDeleteSql") <T extends AbstractEntity> int delete(T entity); /** * Refer to {@linkplain CommonSqlProvider#buildGetEntitySql}. */ @SelectProvider(type = CommonSqlProvider.class, method = "buildGetEntitySql") HashMap getEntity(Map params); /** * Refer to {@linkplain CommonSqlProvider#buildGetEntitySql}. */ @SelectProvider(type = CommonSqlProvider.class, method = "buildGetEntityListSql") ArrayList<HashMap> getEntityList(Map params); /** * Refer to {@linkplain CommonSqlProvider#buildSelectSql}. */ @SelectProvider(type = CommonSqlProvider.class, method = "buildSelectSql") Object getScalar(Map params); /** * Refer to {@linkplain CommonSqlProvider#buildSelectSql}. */ @SelectProvider(type = CommonSqlProvider.class, method = "buildSelectSql") ArrayList<Object> getScalarList(Map params); /** * Refer to {@linkplain CommonSqlProvider#buildSql}. */ @SelectProvider(type = CommonSqlProvider.class, method = "buildSql") ArrayList<HashMap> executeSql(Map params); /** * Refer to {@linkplain CommonSqlProvider#buildSql}. */ @UpdateProvider(type = CommonSqlProvider.class, method = "buildSql") int bulkUpdate(Map params); }
[ "a_solovov@yahoo.com" ]
a_solovov@yahoo.com
29dd7f0f9fa055500d17eae819c0f28fac26055d
58eac8afa926b5646ca0dce62a9392dd48d4cf32
/dataset_with_mutant/checkstyle/src/test/java/testset/metrics/NPathComplexityCheckTest.java
10d0930059e83d86f608c1018dc8e665516fa052
[]
no_license
fischerJF/Community-wide-Dataset-of-Configurable-Systems
71f20635032bbfed959382e98e808e657c5f1ef4
eab5839ec7c6851934d255f3af3904b81a8dd13e
refs/heads/master
2023-07-04T23:04:56.061388
2021-08-17T18:32:53
2021-08-17T18:32:53
236,009,474
3
2
null
2021-08-17T18:33:29
2020-01-24T13:39:55
Java
UTF-8
Java
false
false
14,498
java
//////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code for adherence to a set of rules. // Copyright (C) 2001-2018 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //////////////////////////////////////////////////////////////////////////////// package testset.metrics; import static checks.metrics.NPathComplexityCheck.MSG_KEY; import java.io.File; import java.util.Collection; import java.util.Optional; import java.util.SortedSet; import org.junit.Assert; import org.junit.Test; import antlr.CommonHiddenStreamToken; //import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; //import com.puppycrawl.tools.checkstyle.DefaultConfiguration; //import com.puppycrawl.tools.checkstyle.JavaParser; import api.Context; import api.DetailAST; import api.LocalizedMessage; import api.TokenTypes; import checks.metrics.NPathComplexityCheck; import checkstyle.DefaultConfiguration; import testset.checkstyle.AbstractModuleTestSupport; //import com.puppycrawl.tools.checkstyle.internal.utils.TestUtil; //import com.puppycrawl.tools.checkstyle.utils.CommonUtil; //import testset.internal.utils.TestUtil; // -@cs[AbbreviationAsWordInName] Can't change check name public class NPathComplexityCheckTest extends AbstractModuleTestSupport { @Override protected String getPackageLocation() { return "com/puppycrawl/tools/checkstyle/checks/metrics/npathcomplexity"; } @Test public void testCalculation() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(NPathComplexityCheck.class); checkConfig.addAttribute("max", "0"); final String[] expected = { "5:5: " + getCheckMessage(MSG_KEY, 2, 0), "10:17: " + getCheckMessage(MSG_KEY, 2, 0), "22:5: " + getCheckMessage(MSG_KEY, 10, 0), "35:5: " + getCheckMessage(MSG_KEY, 3, 0), "45:5: " + getCheckMessage(MSG_KEY, 7, 0), "63:5: " + getCheckMessage(MSG_KEY, 3, 0), "76:5: " + getCheckMessage(MSG_KEY, 3, 0), "88:5: " + getCheckMessage(MSG_KEY, 3, 0), "104:13: " + getCheckMessage(MSG_KEY, 2, 0), "113:5: " + getCheckMessage(MSG_KEY, 48, 0), "123:5: " + getCheckMessage(MSG_KEY, 1, 0), "124:5: " + getCheckMessage(MSG_KEY, 1, 0), }; verify(checkConfig, getPath("InputNPathComplexityDefault.java"), expected); } @Test public void testCalculation2() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(NPathComplexityCheck.class); checkConfig.addAttribute("max", "0"); final String[] expected = { "5:5: " + getCheckMessage(MSG_KEY, 5, 0), "11:5: " + getCheckMessage(MSG_KEY, 5, 0), "18:5: " + getCheckMessage(MSG_KEY, 4, 0), "33:5: " + getCheckMessage(MSG_KEY, 4, 0), "49:5: " + getCheckMessage(MSG_KEY, 6, 0), "65:5: " + getCheckMessage(MSG_KEY, 15, 0), "90:5: " + getCheckMessage(MSG_KEY, 11, 0), "100:5: " + getCheckMessage(MSG_KEY, 8, 0), "113:5: " + getCheckMessage(MSG_KEY, 120, 0), "125:5: " + getCheckMessage(MSG_KEY, 6, 0), "135:5: " + getCheckMessage(MSG_KEY, 21, 0), "148:5: " + getCheckMessage(MSG_KEY, 35, 0), "156:5: " + getCheckMessage(MSG_KEY, 25, 0), "171:5: " + getCheckMessage(MSG_KEY, 2, 0), }; verify(checkConfig, getPath("InputNPathComplexity.java"), expected); } @Test public void testIntegerOverflow() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(NPathComplexityCheck.class); checkConfig.addAttribute("max", "0"); final long largerThanMaxInt = 3_486_784_401L; final String[] expected = { "13:5: " + getCheckMessage(MSG_KEY, largerThanMaxInt, 0), }; verify(checkConfig, getPath("InputNPathComplexityOverflow.java"), expected); } // @Test // @SuppressWarnings("unchecked") // public void testStatefulFieldsClearedOnBeginTree1() throws Exception { // final DetailAST ast = new DetailAST(); // ast.setType(TokenTypes.LITERAL_ELSE); // // final NPathComplexityCheck check = new NPathComplexityCheck(); // Assert.assertTrue("Stateful field is not cleared after beginTree", // TestUtil.isStatefulFieldClearedDuringBeginTree(check, ast, "rangeValues", // rangeValues -> ((Collection<Context>) rangeValues).isEmpty())); // Assert.assertTrue("Stateful field is not cleared after beginTree", // TestUtil.isStatefulFieldClearedDuringBeginTree(check, ast, "expressionValues", // expressionValues -> ((Collection<Context>) expressionValues).isEmpty())); // } // @Test // @SuppressWarnings("unchecked") // public void testStatefulFieldsClearedOnBeginTree2() throws Exception { // final DetailAST ast = new DetailAST(); // ast.setType(TokenTypes.LITERAL_RETURN); // ast.setLineNo(5); // final DetailAST child = new DetailAST(); // child.setType(TokenTypes.SEMI); // ast.addChild(child); // // final NPathComplexityCheck check = new NPathComplexityCheck(); // Assert.assertTrue("Stateful field is not cleared after beginTree", // TestUtil.isStatefulFieldClearedDuringBeginTree(check, ast, "isAfterValues", // isAfterValues -> ((Collection<Context>) isAfterValues).isEmpty())); // } // @Test // public void testStatefulFieldsClearedOnBeginTree3() throws Exception { // final NPathComplexityCheck check = new NPathComplexityCheck(); // final Optional<DetailAST> question = TestUtil.findTokenInAstByPredicate( // JavaParser.parseFile(new File(getPath("InputNPathComplexity.java")), // JavaParser.Options.WITHOUT_COMMENTS), // ast -> ast.getType() == TokenTypes.QUESTION); // // Assert.assertTrue("Ast should contain QUESTION", question.isPresent()); // // Assert.assertTrue("State is not cleared on beginTree", // TestUtil.isStatefulFieldClearedDuringBeginTree( // check, // question.get(), // "processingTokenEnd", // processingTokenEnd -> { // try { // return (Integer) TestUtil.getClassDeclaredField( // processingTokenEnd.getClass(), "endLineNo").get( // processingTokenEnd) == 0 // && (Integer) TestUtil.getClassDeclaredField( // processingTokenEnd.getClass(), "endColumnNo").get( // processingTokenEnd) == 0; // } // catch (IllegalAccessException | NoSuchFieldException ex) { // throw new IllegalStateException(ex); // } // })); // } // @Test // public void testDefaultConfiguration() throws Exception { // final DefaultConfiguration checkConfig = // createModuleConfig(NPathComplexityCheck.class); // // createChecker(checkConfig); // final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; // verify(checkConfig, getPath("InputNPathComplexityDefault.java"), expected); // } @Test public void testGetAcceptableTokens() { final NPathComplexityCheck npathComplexityCheckObj = new NPathComplexityCheck(); final int[] actual = npathComplexityCheckObj.getAcceptableTokens(); final int[] expected = { TokenTypes.CTOR_DEF, TokenTypes.METHOD_DEF, TokenTypes.STATIC_INIT, TokenTypes.INSTANCE_INIT, TokenTypes.LITERAL_WHILE, TokenTypes.LITERAL_DO, TokenTypes.LITERAL_FOR, TokenTypes.LITERAL_IF, TokenTypes.LITERAL_ELSE, TokenTypes.LITERAL_SWITCH, TokenTypes.LITERAL_CASE, TokenTypes.LITERAL_TRY, TokenTypes.LITERAL_CATCH, TokenTypes.QUESTION, }; Assert.assertNotNull("Acceptable tokens should not be null", actual); Assert.assertArrayEquals("Invalid acceptable tokens", expected, actual); } @Test public void testGetRequiredTokens() { final NPathComplexityCheck npathComplexityCheckObj = new NPathComplexityCheck(); final int[] actual = npathComplexityCheckObj.getRequiredTokens(); final int[] expected = { TokenTypes.CTOR_DEF, TokenTypes.METHOD_DEF, TokenTypes.INSTANCE_INIT, TokenTypes.STATIC_INIT, }; Assert.assertNotNull("Required tokens should not be null", actual); Assert.assertArrayEquals("Invalid required tokens", expected, actual); } // @Test // public void testDefaultHooks() { // final NPathComplexityCheck npathComplexityCheckObj = new NPathComplexityCheck(); // final DetailAST ast = new DetailAST(); // ast.initialize(new CommonHiddenStreamToken(TokenTypes.INTERFACE_DEF, "interface")); // // npathComplexityCheckObj.visitToken(ast); // final SortedSet<LocalizedMessage> messages1 = npathComplexityCheckObj.getMessages(); // // Assert.assertEquals("No exception messages expected", 0, messages1.size()); // // npathComplexityCheckObj.leaveToken(ast); // final SortedSet<LocalizedMessage> messages2 = npathComplexityCheckObj.getMessages(); // // Assert.assertEquals("No exception messages expected", 0, messages2.size()); // } /** * This must be a reflection test as it is too difficult to hit normally and * the responsible code can't be removed without failing tests. * TokenEnd is only used for processingTokenEnd and it is only set during visitConditional * and visitUnitaryOperator. For it to be the same line/column, it must be the exact same * token or a token who has the same line/column as it's child and we visit. We never * visit the same token twice and we are only visiting on very specific tokens. * The line can't be removed or reworked as other tests fail, and regression shows us no * use cases to create a UT for. * @throws Exception if there is an error. */ // @Test // public void testTokenEndIsAfterSameLineColumn() throws Exception { // final NPathComplexityCheck check = new NPathComplexityCheck(); // final Object tokenEnd = TestUtil.getClassDeclaredField(NPathComplexityCheck.class, // "processingTokenEnd").get(check); // final DetailAST token = new DetailAST(); // token.setLineNo(0); // token.setColumnNo(0); // // Assert.assertTrue("isAfter must be true for same line/column", // (Boolean) TestUtil.getClassDeclaredMethod(tokenEnd.getClass(), "isAfter") // .invoke(tokenEnd, token)); // } // @Test // public void testVisitTokenBeforeExpressionRange() { // // Create first ast // final DetailAST astIf = mockAST(TokenTypes.LITERAL_IF, "if", "mockfile", 2, 2); // final DetailAST astIfLeftParen = mockAST(TokenTypes.LPAREN, "(", "mockfile", 3, 3); // astIf.addChild(astIfLeftParen); // final DetailAST astIfTrue = // mockAST(TokenTypes.LITERAL_TRUE, "true", "mockfile", 3, 3); // astIf.addChild(astIfTrue); // final DetailAST astIfRightParen = mockAST(TokenTypes.RPAREN, ")", "mockfile", 4, 4); // astIf.addChild(astIfRightParen); // // Create ternary ast // final DetailAST astTernary = mockAST(TokenTypes.QUESTION, "?", "mockfile", 1, 1); // final DetailAST astTernaryTrue = // mockAST(TokenTypes.LITERAL_TRUE, "true", "mockfile", 1, 2); // astTernary.addChild(astTernaryTrue); // // final NPathComplexityCheck npathComplexityCheckObj = new NPathComplexityCheck(); // // // visiting first ast, set expressionSpatialRange to [2,2 - 4,4] // npathComplexityCheckObj.visitToken(astIf); // final SortedSet<LocalizedMessage> messages1 = npathComplexityCheckObj.getMessages(); // // Assert.assertEquals("No exception messages expected", 0, messages1.size()); // // //visiting ternary, it lies before expressionSpatialRange // npathComplexityCheckObj.visitToken(astTernary); // final SortedSet<LocalizedMessage> messages2 = npathComplexityCheckObj.getMessages(); // // Assert.assertEquals("No exception messages expected", 0, messages2.size()); // } /** * Creates MOCK lexical token and returns AST node for this token. * @param tokenType type of token * @param tokenText text of token * @param tokenFileName file name of token * @param tokenRow token position in a file (row) * @param tokenColumn token position in a file (column) * @return AST node for the token */ private static DetailAST mockAST(final int tokenType, final String tokenText, final String tokenFileName, final int tokenRow, final int tokenColumn) { final CommonHiddenStreamToken tokenImportSemi = new CommonHiddenStreamToken(); tokenImportSemi.setType(tokenType); tokenImportSemi.setText(tokenText); tokenImportSemi.setLine(tokenRow); tokenImportSemi.setColumn(tokenColumn); tokenImportSemi.setFilename(tokenFileName); final DetailAST astSemi = new DetailAST(); astSemi.initialize(tokenImportSemi); return astSemi; } }
[ "fischerbatera@hotmail.com" ]
fischerbatera@hotmail.com
426b8fd237f675999c3c60ebf70b906be2972072
630e8d327f0621a335d10e73a2e775cadd44b7a3
/src/main/java/com/load/configuration/profile/demo/DemoApplication.java
27211c4d633318e4a0390ba244d7cdea3c704f7e
[]
no_license
andeerlb/configurationfilesbyprofile
e37a421cbff6a2097054ea0136edec086585a802
da2d464cfbb1862419e911bea5d5f7c0bbc91512
refs/heads/master
2020-07-14T06:29:21.366919
2019-08-29T22:39:29
2019-08-29T22:39:29
205,261,878
0
0
null
null
null
null
UTF-8
Java
false
false
699
java
package com.load.configuration.profile.demo; import com.load.configuration.profile.demo.configuration.ConfigurationTeste; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ConfigurableApplicationContext; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { final ConfigurableApplicationContext context = SpringApplication.run(DemoApplication.class, args); ConfigurationTeste teste = (ConfigurationTeste) context.getBean("beanTest"); System.out.println(teste.getMessage()); } }
[ "anderson@nexti.com" ]
anderson@nexti.com
276412cec19fb0a2c1a1774c0defdd7ce8cbc3cc
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/31/31_db2c359892723715c00f915d1530b7fd013ba432/ConflictResolverImpl/31_db2c359892723715c00f915d1530b7fd013ba432_ConflictResolverImpl_s.java
dbe5ef34f801e409a70f49c413a3bb990f2cb166
[]
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
16,335
java
package cz.cuni.mff.odcleanstore.conflictresolution.impl; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import org.openrdf.model.Model; import org.openrdf.model.Resource; import org.openrdf.model.Statement; import org.openrdf.model.URI; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import cz.cuni.mff.odcleanstore.conflictresolution.CRContext; import cz.cuni.mff.odcleanstore.conflictresolution.ConflictClusterFilter; import cz.cuni.mff.odcleanstore.conflictresolution.ConflictResolutionPolicy; import cz.cuni.mff.odcleanstore.conflictresolution.ConflictResolver; import cz.cuni.mff.odcleanstore.conflictresolution.ConflictResolverFactory; import cz.cuni.mff.odcleanstore.conflictresolution.EnumAggregationErrorStrategy; import cz.cuni.mff.odcleanstore.conflictresolution.EnumCardinality; import cz.cuni.mff.odcleanstore.conflictresolution.ResolutionFunction; import cz.cuni.mff.odcleanstore.conflictresolution.ResolutionFunctionRegistry; import cz.cuni.mff.odcleanstore.conflictresolution.ResolutionStrategy; import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatement; import cz.cuni.mff.odcleanstore.conflictresolution.ResolvedStatementFactory; import cz.cuni.mff.odcleanstore.conflictresolution.URIMapping; import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ConflictResolutionException; import cz.cuni.mff.odcleanstore.conflictresolution.exceptions.ResolutionFunctionNotRegisteredException; import cz.cuni.mff.odcleanstore.conflictresolution.impl.util.CRUtils; import cz.cuni.mff.odcleanstore.conflictresolution.impl.util.EmptyMetadataModel; import cz.cuni.mff.odcleanstore.conflictresolution.impl.util.GrowingArray; import cz.cuni.mff.odcleanstore.conflictresolution.resolution.AllResolution; import cz.cuni.mff.odcleanstore.vocabulary.ODCS; /** * Implementation of the RDF conflict resolution algorithm. * URIs are translated according to given URI mappings and conflict resolved by * application of conflict resolution functions according to resolution settings. * @author Jan Michelfeit */ public class ConflictResolverImpl implements ConflictResolver { private static final Logger LOG = LoggerFactory.getLogger(ConflictResolverImpl.class); /** Default prefix of graph names where resolved quads are placed. */ public static final String DEFAULT_RESOLVED_GRAPHS_URI_PREFIX = ODCS.NAMESPACE + "CR/"; /** Default conflict resolution strategy. */ public static final ResolutionStrategy DEFAULT_RESOLUTION_STRATEGY = new ResolutionStrategyImpl( AllResolution.getName(), EnumCardinality.MANYVALUED, EnumAggregationErrorStrategy.RETURN_ALL); private static final int EXPECTED_REDUCTION_FACTOR = 3; private Model metadata = null; private URIMapping uriMapping = EmptyURIMapping.getInstance(); private ResolvedStatementFactory resolvedStatementFactory = new ResolvedStatementFactoryImpl(DEFAULT_RESOLVED_GRAPHS_URI_PREFIX); private ConflictResolutionPolicy conflictResolutionPolicy; private ResolutionFunctionRegistry resolutionFunctionRegistry; private ConflictClusterFilter conflictClusterFilter; private CRContextImpl context; // private StatementFilter statementFilter; /** * Creates a new instance with default resolution function registry and default settings for conflict * resolution. */ public ConflictResolverImpl() { this(ConflictResolverFactory.createInitializedResolutionFunctionRegistry()); } /** * Creates a new instance with the given resolution function registry and defaults for other conflict * resolution settings. * @param resolutionFunctionRegistry registry for obtaining conflict resolution function implementations */ public ConflictResolverImpl(ResolutionFunctionRegistry resolutionFunctionRegistry) { this.resolutionFunctionRegistry = resolutionFunctionRegistry; } /** * Creates a new instance with the given settings and no URI mappings. * @param resolutionFunctionRegistry registry for obtaining conflict resolution function implementations * @param conflictResolutionPolicy conflict resolution parameters */ public ConflictResolverImpl(ResolutionFunctionRegistry resolutionFunctionRegistry, ConflictResolutionPolicy conflictResolutionPolicy) { this(resolutionFunctionRegistry); this.conflictResolutionPolicy = conflictResolutionPolicy; } /** * Creates a new instance with the given settings. * @param resolutionFunctionRegistry registry for obtaining conflict resolution function implementations * @param conflictResolutionPolicy conflict resolution parameters * @param uriMapping mapping of URIs to their canonical URI (based on owl:sameAs links) */ public ConflictResolverImpl(ResolutionFunctionRegistry resolutionFunctionRegistry, ConflictResolutionPolicy conflictResolutionPolicy, URIMapping uriMapping) { this(resolutionFunctionRegistry, conflictResolutionPolicy); this.uriMapping = uriMapping; } /** * Creates a new instance with the given settings. * @param resolutionFunctionRegistry registry for obtaining conflict resolution function implementations * @param conflictResolutionPolicy conflict resolution parameters * @param uriMapping mapping of URIs to their canonical URI (based on owl:sameAs links) * @param metadata additional metadata for use by resolution functions (e.g. source quality etc.) */ public ConflictResolverImpl(ResolutionFunctionRegistry resolutionFunctionRegistry, ConflictResolutionPolicy conflictResolutionPolicy, URIMapping uriMapping, Model metadata) { this(resolutionFunctionRegistry, conflictResolutionPolicy, uriMapping); this.metadata = metadata; } /** * Creates a new instance with the given settings. * @param resolutionFunctionRegistry registry for obtaining conflict resolution function implementations * @param conflictResolutionPolicy conflict resolution parameters * @param uriMapping mapping of URIs to their canonical URI (based on owl:sameAs links) * @param metadata additional metadata for use by resolution functions (e.g. source quality etc.) * @param resolvedGraphsURIPrefix prefix of graph names where resolved quads are placed */ public ConflictResolverImpl(ResolutionFunctionRegistry resolutionFunctionRegistry, ConflictResolutionPolicy conflictResolutionPolicy, URIMapping uriMapping, Model metadata, String resolvedGraphsURIPrefix) { this(resolutionFunctionRegistry, conflictResolutionPolicy, uriMapping, metadata); if (resolvedGraphsURIPrefix != null) { resolvedStatementFactory = new ResolvedStatementFactoryImpl(resolvedGraphsURIPrefix); } } /** * Creates a new instance with the given settings. * @param resolutionFunctionRegistry registry for obtaining conflict resolution function implementations * @param conflictResolutionPolicy conflict resolution parameters * @param uriMapping mapping of URIs to their canonical URI (based on owl:sameAs links) * @param metadata additional metadata for use by resolution functions (e.g. source quality etc.) * @param resolvedGraphsURIPrefix prefix of graph names where resolved quads are placed * @param conflictClusterFilter additional filter for quads in a conflict cluster */ public ConflictResolverImpl(ResolutionFunctionRegistry resolutionFunctionRegistry, ConflictResolutionPolicy conflictResolutionPolicy, URIMapping uriMapping, Model metadata, String resolvedGraphsURIPrefix, ConflictClusterFilter conflictClusterFilter) { this(resolutionFunctionRegistry, conflictResolutionPolicy, uriMapping, metadata, resolvedGraphsURIPrefix); this.conflictClusterFilter = conflictClusterFilter; } /** * Sets conflict resolution settings. * @param conflictResolutionPolicy conflict resolution settings */ public void setConflictResolutionPolicy(ConflictResolutionPolicy conflictResolutionPolicy) { this.conflictResolutionPolicy = conflictResolutionPolicy; } /** * Sets URI mapping to use. * @param uriMapping canonical URI mapping */ public void setURIMapping(URIMapping uriMapping) { this.uriMapping = uriMapping; } /** * Sets additional metadata available for resolution. * @param metadata metadata as RDF model */ public void setMetadata(Model metadata) { this.metadata = metadata; } /** * Sets factory for resolved statements produced as output of conflict resolution. * @param factory resolved statement factory */ public void setResolvedStatementFactory(ResolvedStatementFactory factory) { this.resolvedStatementFactory = factory; } /** * Sets registry with resolution function implementations. * @param resolutionFunctionRegistry registry for obtaining conflict resolution function implementations */ public void setResolutionFunctionRegistry(ResolutionFunctionRegistry resolutionFunctionRegistry) { this.resolutionFunctionRegistry = resolutionFunctionRegistry; } /** * Sets additional filter for quads in a conflict cluster. * @param conflictClusterFilter additional filter for quads in a conflict cluster. */ public void setConflictClusterFilter(ConflictClusterFilter conflictClusterFilter) { this.conflictClusterFilter = conflictClusterFilter; } @Override public Collection<ResolvedStatement> resolveConflicts(Iterator<Statement> statements) throws ConflictResolutionException { GrowingArray<Statement> growingArray = new GrowingArray<Statement>(); while (statements.hasNext()) { growingArray.add(statements.next()); } return resolveConflictsInternal(growingArray.getArray()); } @Override public Collection<ResolvedStatement> resolveConflicts(Collection<Statement> statements) throws ConflictResolutionException { return resolveConflictsInternal(statements.toArray(new Statement[0])); } /** * The internal implementation of the conflict resolution algorithm. * @param statements RDF quads to be resolved; NOTE that this array will by modified by the function * @return resolved quads (see {@link #resolveConflicts(Collection)}) * @throws ConflictResolutionException conflict resolution error */ protected Collection<ResolvedStatement> resolveConflictsInternal(Statement[] statements) throws ConflictResolutionException { long startTime = 0; if (LOG.isDebugEnabled()) { LOG.debug("Resolving conflicts among {} quads.", statements.length); startTime = System.currentTimeMillis(); } // Prepare effective resolution strategy based on per-predicate strategies, default strategy & uri mappings ConflictResolutionPolicy effectiveResolutionPolicy = getEffectiveResolutionPolicy(); // Apply owl:sameAs mappings, remove duplicities, sort into clusters of conflicting quads ConflictClustersCollection conflictClusters = new ConflictClustersCollection(statements, uriMapping, resolvedStatementFactory.getValueFactory()); initContext(conflictClusters.asModel()); // Resolve conflicts: Collection<ResolvedStatement> result = createResultCollection(conflictClusters.size()); for (List<Statement> conflictCluster : conflictClusters) { if (conflictCluster.isEmpty()) { continue; } // Get resolution strategy URI predicate = getPredicate(conflictCluster); ResolutionStrategy resolutionStrategy = effectiveResolutionPolicy.getPropertyResolutionStrategies().get(predicate); if (resolutionStrategy == null) { resolutionStrategy = effectiveResolutionPolicy.getDefaultResolutionStrategy(); } // Prepare resolution functions & context ResolutionFunction resolutionFunction = getResolutionFunction(resolutionStrategy); CRContext context = getContext(conflictCluster, resolutionStrategy); // Apply additional filtering if (conflictClusterFilter != null) { conflictCluster = conflictClusterFilter.filter(conflictCluster, context); if (conflictCluster.isEmpty()) { continue; } } // Resolve conflicts & append to result Model conflictClusterModel = new SortedListModel(conflictCluster); Collection<ResolvedStatement> resolvedStatements = resolutionFunction.resolve(conflictClusterModel, context); result.addAll(resolvedStatements); } if (LOG.isDebugEnabled()) { LOG.debug("Conflict resolution executed in {} ms, resolved to {} quads", System.currentTimeMillis() - startTime, result.size()); } return result; } private void initContext(Model statementsModel) { Model metadataModel = metadata != null ? metadata : new EmptyMetadataModel(); context = new CRContextImpl(statementsModel, metadataModel, resolvedStatementFactory); } private CRContext getContext(List<Statement> conflictCluster, ResolutionStrategy resolutionStrategy) { context.setSubject(getSubject(conflictCluster)); context.setResolutionStrategy(resolutionStrategy); return context; } private ConflictResolutionPolicy getEffectiveResolutionPolicy() { ConflictResolutionPolicyImpl result = new ConflictResolutionPolicyImpl(); ResolutionStrategy effectiveDefaultStrategy = conflictResolutionPolicy.getDefaultResolutionStrategy() != null ? CRUtils.fillResolutionStrategyDefaults(conflictResolutionPolicy.getDefaultResolutionStrategy(), DEFAULT_RESOLUTION_STRATEGY) : DEFAULT_RESOLUTION_STRATEGY; result.setDefaultResolutionStrategy(effectiveDefaultStrategy); Map<URI, ResolutionStrategy> effectivePropertyStrategies = new HashMap<URI, ResolutionStrategy>(); for (Entry<URI, ResolutionStrategy> entry : conflictResolutionPolicy.getPropertyResolutionStrategies().entrySet()) { URI mappedURI = uriMapping.mapURI(entry.getKey()); ResolutionStrategy strategy = CRUtils.fillResolutionStrategyDefaults(entry.getValue(), effectiveDefaultStrategy); effectivePropertyStrategies.put(mappedURI, strategy); } result.setPropertyResolutionStrategy(effectivePropertyStrategies); return result; } /** * Creates an empty instance of collection that is returned as the output * of conflict resolution. * @return an empty collection */ private Collection<ResolvedStatement> createResultCollection(int inputSize) { return new ArrayList<ResolvedStatement>(inputSize / EXPECTED_REDUCTION_FACTOR); } private ResolutionFunction getResolutionFunction(ResolutionStrategy resolutionStrategy) throws ResolutionFunctionNotRegisteredException { return resolutionFunctionRegistry.get(resolutionStrategy.getResolutionFunctionName()); } private Resource getSubject(List<Statement> conflictCluster) { assert !conflictCluster.isEmpty(); return conflictCluster.get(0).getSubject(); } private URI getPredicate(List<Statement> conflictCluster) { assert !conflictCluster.isEmpty(); return conflictCluster.get(0).getPredicate(); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
b21cc9d56daed7824be10eec9256ce0cd24d0aed
31f186b6cfe982adac8191102655caec709f9358
/src/main/java/com/snapshot/person/dispatch/client/core/source/task/BootScheduleTask.java
94ae2fcadc6bcc9e5a59eed8867762dc2c594c60
[]
no_license
yaogenum/dispatch-server
69169aa411044454ee606f5a20fb1a73c49d8e5a
0ed06f4eae9621a98cb80eeec6e29fb1b2c51b3f
refs/heads/master
2020-03-29T16:03:01.638051
2018-12-15T08:48:54
2018-12-15T08:48:54
150,094,384
0
0
null
null
null
null
UTF-8
Java
false
false
595
java
package com.snapshot.person.dispatch.client.core.source.task; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; /** * description: 定时任务扫描 * * @author jiubao@wcai.com - 九宝 every day good lucky * @version 1.0.0 * @Date 2018/6/2 下午3:29 * @since 1.0.0 */ @Component public class BootScheduleTask { /** * 7~17点 之间 每间隔30分钟开始重试 */ @Scheduled(cron = "0 */30 7-17 * * ?") public void sendDisptachTask() { System.out.print("cycle output , healthy check"); } }
[ "yaogemail@gmail.com" ]
yaogemail@gmail.com
549c95061e8e7ac10c082cdc4ed80358f89d9c28
f1a6f6dfefb5f855b7d8fc20abed98e7bba2074e
/src/test/java/io/eventmanager/cucumber/stepdefs/UserStepDefs.java
cb8990f34a046ff3bfc1b7f0ab02108f5fa614c7
[]
no_license
savanevamara/eventmanager
cba3431b80a788168b082c2ab1775b8f06da87b6
3e9f6b4ffe2d8bfce35ce6ae2c36969a637c7eb4
refs/heads/master
2022-12-15T05:45:12.200545
2017-12-04T01:22:45
2017-12-04T01:22:45
112,975,473
0
1
null
2020-09-18T12:14:45
2017-12-04T00:19:57
TypeScript
UTF-8
Java
false
false
1,519
java
package io.eventmanager.cucumber.stepdefs; import cucumber.api.java.Before; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import io.eventmanager.web.rest.UserResource; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; public class UserStepDefs extends StepDefs { @Autowired private UserResource userResource; private MockMvc restUserMockMvc; @Before public void setup() { this.restUserMockMvc = MockMvcBuilders.standaloneSetup(userResource).build(); } @When("^I search user '(.*)'$") public void i_search_user_admin(String userId) throws Throwable { actions = restUserMockMvc.perform(get("/api/users/" + userId) .accept(MediaType.APPLICATION_JSON)); } @Then("^the user is found$") public void the_user_is_found() throws Throwable { actions .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)); } @Then("^his last name is '(.*)'$") public void his_last_name_is(String lastName) throws Throwable { actions.andExpect(jsonPath("$.lastName").value(lastName)); } }
[ "admin@MacBook-Pro-de-macbook.local" ]
admin@MacBook-Pro-de-macbook.local
08b2efaf440754851f6cb86782b042b8f099e7fb
0c43009c62935de88af4fcf56eeaeceee60e3370
/src/Questions/RemoveJunk.java
9fa6d71efa6acd3f7d9762a7c7677b2de33a3e0d
[]
no_license
TechieVidushi/New_Practice
e05f30a555d8bebb56ab37815c6be3cc432d1eee
8297efb9337c2ebfc4c4b447cd502c9d26aa2618
refs/heads/master
2020-06-01T01:18:51.439817
2019-06-06T12:11:13
2019-06-06T12:11:13
190,574,688
0
0
null
null
null
null
UTF-8
Java
false
false
216
java
package Questions; public class RemoveJunk { public static void main(String[] args) { String s = "@#$%@@@@ ffjknlnWujvd,m097653 rt467@$*"; s = s.replaceAll("[^a-zA-Z0-9]", ""); System.out.println(s); } }
[ "vidushi.dubey2107@gmail.com" ]
vidushi.dubey2107@gmail.com
ba93c4f724e011e54887079f2bfc67174e10198f
305eb1d7ebfa86c2124a2bd023b2d0e51bc4934a
/Task01/src/main/java/by/epam/library/controller/Controller.java
c9f729a684fadee80b4004e0cb1e57c901a560f4
[]
no_license
GitTooth/JD2_Projects
47d297cff6715c81d8a1c2c88a963b5a43f57671
7eabe6a274c58fbdfa83e429b0388f827109d005
refs/heads/master
2021-01-18T16:57:40.765133
2017-09-27T06:45:14
2017-09-27T06:45:14
100,479,576
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
package by.epam.library.controller; import by.epam.library.Statics; import by.epam.library.controller.command.CommandProvider; import by.epam.library.controller.command.Command; import static by.epam.library.Statics.context; public final class Controller { public String executeAction(String request){ String commandName; Command command; commandName = request.substring(0, request.indexOf(Statics.REGEX)); CommandProvider provider = context.getBean("commandProvider", CommandProvider.class); command = provider.getCommand(commandName); String response = command.executeCommand(request); return response; } }
[ "stelth47@gmail.com" ]
stelth47@gmail.com
60522aa64591162639549ff7b0661de8a675f817
20eb62855cb3962c2d36fda4377dfd47d82eb777
/IntroClassJava/dataset/smallest/346b1d3c1cdc3032d07222a8a5e0027a2abf95bb1697b9d367d7cca7db1af769d8298e232c56471a122f05e87e79f4bd965855c9c0f8b173ebc0ef5d0abebc7b/003/mutations/317/smallest_346b1d3c_003.java
c40a2e9686a5ef5ec475beacba54562684b1acb2
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,484
java
package introclassJava; class IntObj { public int value; public IntObj () { } public IntObj (int i) { value = i; } } class FloatObj { public float value; public FloatObj () { } public FloatObj (float i) { value = i; } } class LongObj { public long value; public LongObj () { } public LongObj (long i) { value = i; } } class DoubleObj { public double value; public DoubleObj () { } public DoubleObj (double i) { value = i; } } class CharObj { public char value; public CharObj () { } public CharObj (char i) { value = i; } } public class smallest_346b1d3c_003 { public java.util.Scanner scanner; public String output = ""; public static void main (String[]args) throws Exception { smallest_346b1d3c_003 mainClass = new smallest_346b1d3c_003 (); String output; if (args.length > 0) { mainClass.scanner = new java.util.Scanner (args[0]); } else { mainClass.scanner = new java.util.Scanner (System.in); } mainClass.exec (); System.out.println (mainClass.output); } public void exec () throws Exception { IntObj a = new IntObj (), b = new IntObj (), c = new IntObj (), d = new IntObj (), num_1 = new IntObj (), num_2 = new IntObj (), num_3 = new IntObj (), num_4 = new IntObj (); output += (String.format ("Please enter 4 numbers separated by spaces > ")); num_1.value = scanner.nextInt (); num_2.value = scanner.nextInt (); num_3.value = scanner.nextInt (); num_4.value = scanner.nextInt (); a.value = (num_1.value); b.value = (num_2.value); c.value = (num_3.value); d.value = (num_4.value); if ((a.value) < (c.value) && a.value < d.value) { output += (String.format ("%d is the smallest\n", a.value)); } else if (b.value < a.value && b.value < c.value && b.value < d.value) { output += (String.format ("%d is the smalles\n", b.value)); } else if (c.value < a.value && c.value < b.value && c.value < d.value) { output += (String.format ("%d is the smallest\n", c.value)); } else if (d.value < a.value && d.value < b.value && d.value < c.value) { output += (String.format ("%d is the smallest\n", d.value)); } if (true) return;; } }
[ "justinwm@163.com" ]
justinwm@163.com
ad418dbfd583509c454644bb85c0c22bb72fc070
4c94dfb1d8cf5e34a1d243e8755380e42ad965de
/Project/FBMS/src/fasttrackse/ffse1704/fbms/controller/security/ChucNangPhongBanController.java
7bbd7cb9c7f0fb6d2f2b25690cc4c25b93a08980
[]
no_license
FASTTRACKSE/FFSE1704.JavaWeb
9595d24353dd49ca80ab7136d929bd7ef23e2999
bc4c6eb957c117c056249bfce1166aa707579aa0
refs/heads/master
2022-12-22T05:12:30.633806
2019-08-05T07:19:53
2019-08-05T07:19:53
152,555,801
1
0
null
2022-12-16T04:23:47
2018-10-11T08:16:06
Java
UTF-8
Java
false
false
4,434
java
package fasttrackse.ffse1704.fbms.controller.security; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import fasttrackse.ffse1704.fbms.entity.security.ChucNangPhongBan; import fasttrackse.ffse1704.fbms.service.security.ChucDanhService; import fasttrackse.ffse1704.fbms.service.security.ChucNangPhongBanService; import fasttrackse.ffse1704.fbms.service.security.ChucNangService; import fasttrackse.ffse1704.fbms.service.security.PhongBanService; @Controller @RequestMapping("/ChucNangPhongBan") public class ChucNangPhongBanController { @Autowired private ChucNangPhongBanService chucNangPhongBanService; @Autowired private ChucNangService chucNangService; @Autowired private ChucDanhService chucDanhService; @Autowired private PhongBanService phongBanService; @RequestMapping(value = "/", method = RequestMethod.GET) public String listChucNangPhongBan(Model model, @RequestParam(name = "page", required = false, defaultValue = "1") int currentPage) { int totalRecords = chucNangPhongBanService.findAll().size(); int recordsPerPage = 10; int totalPages = 0; if ((totalRecords / recordsPerPage) % 2 == 0) { totalPages = totalRecords / recordsPerPage; } else { totalPages = totalRecords / recordsPerPage + 1; } int startPosition = recordsPerPage * (currentPage - 1); model.addAttribute("listChucNangPhongBan", chucNangPhongBanService.findAllForPaging(startPosition, recordsPerPage)); model.addAttribute("lastPage", totalPages); model.addAttribute("currentPage", currentPage); return "quantrihethong/chucnangphongban/list"; } @RequestMapping(value = "/them-moi", method = RequestMethod.GET) public String addForm(Model model, final RedirectAttributes redirectAttributes) { model.addAttribute("chucNangPhongBan", new ChucNangPhongBan()); model.addAttribute("listPhongBan", phongBanService.findAll()); model.addAttribute("listChucNang", chucNangService.findAll()); model.addAttribute("listChucDanh", chucDanhService.findAll()); return "quantrihethong/chucnangphongban/add_form"; } @RequestMapping(value = "/them-moi", method = RequestMethod.POST) public String doAdd(Model model, @ModelAttribute("chucNangPhongBan") ChucNangPhongBan pb, final RedirectAttributes redirectAttributes) { try { chucNangPhongBanService.addNew(pb); redirectAttributes.addFlashAttribute("messageSuccess", "Thêm mới thành công.."); } catch (Exception e) { redirectAttributes.addFlashAttribute("messageError", "Lỗi. Xin thử lại!"); } return "redirect:/ChucNangPhongBan/"; } @RequestMapping(value = "/sua/{id}", method = RequestMethod.GET) public String editForm(@PathVariable("id") int id, Model model) { model.addAttribute("chucNangPhongBan", chucNangPhongBanService.findById(id)); model.addAttribute("listPhongBan", phongBanService.findAll()); model.addAttribute("listChucNang", chucNangService.findAll()); model.addAttribute("listChucDanh", chucDanhService.findAll()); return "quantrihethong/chucnangphongban/edit_form"; } @RequestMapping(value = "/sua/luu", method = RequestMethod.POST) public String doEdit(Model model, @ModelAttribute("chucNangPhongBan") ChucNangPhongBan pb, final RedirectAttributes redirectAttributes) { try { chucNangPhongBanService.update(pb); redirectAttributes.addFlashAttribute("messageSuccess", "Thành công.."); } catch (Exception e) { redirectAttributes.addFlashAttribute("messageError", "Lỗi. Xin thử lại!"); } return "redirect:/ChucNangPhongBan/"; } @RequestMapping(value = "/xoa/{id}", method = RequestMethod.GET) public String delete(@PathVariable("id") int id, final RedirectAttributes redirectAttributes) { try { chucNangPhongBanService.delete(id); redirectAttributes.addFlashAttribute("messageSuccess", "Xóa thành công.."); } catch (Exception e) { redirectAttributes.addFlashAttribute("messageError", "Lỗi. Xin thử lại!"); } return "redirect:/function-role/"; } }
[ "thanhcl@gmail.com" ]
thanhcl@gmail.com
3024d42692c55b470ed6e281057102c52b1e0a28
35a65eb425f917f984bc3af56408a148e1b81614
/src/Admin/TeacherData.java
bb4d081c9d7c65077493afa74e711d45c23a6897
[]
no_license
SparkXV/S-Assistant
80eb1d7f0123609a47ea9c8edaf407127a4dd4e3
12ec523f5bb047abe4fab846096f39f03971f97d
refs/heads/master
2020-05-20T15:30:21.117992
2019-11-19T22:19:09
2019-11-19T22:19:09
185,645,623
0
0
null
null
null
null
UTF-8
Java
false
false
1,824
java
package Admin; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; public class TeacherData { private final StringProperty ID; private final StringProperty firstName; private final StringProperty lastName; private final StringProperty email; private final StringProperty DOB; public TeacherData(String id, String firstname, String lastname, String email, String dob) { this.ID = new SimpleStringProperty(id); this.firstName = new SimpleStringProperty(firstname); this.lastName = new SimpleStringProperty(lastname); this.email = new SimpleStringProperty(email); this.DOB = new SimpleStringProperty(dob); } public String getID() { return (String)this.ID.get(); } public String getFirstName() { return (String)this.firstName.get(); } public String getLastName() { return (String)this.lastName.get(); } public String getEmail() { return (String)this.email.get(); } public String getDOB() { return (String)this.DOB.get(); } public void setID(String value) { this.ID.set(value); } public void setFirstName(String value) { this.firstName.set(value); } public void setLastName(String value) { this.lastName.set(value); } public void setEmail(String value) { this.email.set(value); } public void setDOB(String value) { this.DOB.set(value); } public StringProperty idProperty() { return this.ID; } public StringProperty firstNameProperty() { return this.firstName; } public StringProperty lastNameProperty() { return this.lastName; } public StringProperty emailProperty() { return this.email; } public StringProperty dobProperty() { return this.DOB; } }
[ "deepanshuvijay123@gmail.com" ]
deepanshuvijay123@gmail.com
bab8a9bcc02c28e1de913d0eb1b06703f143fbd2
4e5bd37594cdf274884eca2577e83db0d58694d4
/src/com/twu/biblioteca/presentation/View.java
90f3a89b3cfdd1f37815494eb127787b0e6c070b
[ "Apache-2.0" ]
permissive
alvaroHernandez/twu-biblioteca-alvaroHernandez
e2a5cddf41a1a920fe4d444f1cd0fee47d829a86
857ad3fd829af3db08b05f0d46eb51b115ebfeb4
refs/heads/master
2021-01-22T08:38:09.872883
2017-06-15T15:04:26
2017-06-15T15:04:26
92,625,350
0
0
null
null
null
null
UTF-8
Java
false
false
7,393
java
package com.twu.biblioteca.presentation; import com.twu.biblioteca.entities.Book; import com.twu.biblioteca.entities.LibraryElement; import com.twu.biblioteca.entities.Movie; import com.twu.biblioteca.entities.User; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.TreeMap; /** * Created by alvarohernandez on 5/25/17. */ public class View { public static LinkedHashMap<String,Integer> getBookFieldsHeadersLength(){ LinkedHashMap<String,Integer> lengths = new LinkedHashMap<String, Integer>(); lengths.put(Book.TITLE_FIELD, Book.TITLE_FIELD.length()); lengths.put(Book.AUTHOR_FIELD, Book.AUTHOR_FIELD.length()); lengths.put(Book.YEAR_PUBLISHED_FIELD, Book.YEAR_PUBLISHED_FIELD.length()); return lengths; } public static LinkedHashMap<String,Integer> getMovieFieldsHeadersLength() { LinkedHashMap<String,Integer> lengths = new LinkedHashMap<String, Integer>(); lengths.put(Movie.NAME_FIELD, Movie.NAME_FIELD.length()); lengths.put(Movie.YEAR_FIELD, Movie.YEAR_FIELD.length()); lengths.put(Movie.DIRECTOR_FIELD, Movie.DIRECTOR_FIELD.length()); lengths.put(Movie.RATING_FIELD, Movie.RATING_FIELD.length()); return lengths; } public void printWelcomeMessage(String welcomeMessage){ System.out.println(welcomeMessage); } public void printAvailableBooks(TreeMap<Integer, ? extends LibraryElement> database) { System.out.println("Listing available books:\n"); printLibraryElementListAsRows(database); System.out.println("There are no more books to show."); } public void printLibraryElementListAsRows(TreeMap<Integer, ? extends LibraryElement> database) { System.out.println(getLibraryElementListAsRows(database)); } public String getLibraryElementListAsRows(TreeMap<Integer, ? extends LibraryElement> database){ StringBuilder listString = new StringBuilder(); //builds list (rows) with each book: its id + title for (LibraryElement availableLibraryElement : database.values()) { listString.append(availableLibraryElement.getAsSimpleListElement()); } return listString.toString(); } public void printDetailedMovieDataAsColumnsString(TreeMap<Integer,Movie> availableMovies) { //get the longest text for each field in order to calculate spacing LinkedHashMap<String,Integer> maxLengths = calculateMaxLengthForEachFieldInMovies(availableMovies); printDetailedLibraryElementDataAsColumnsString(availableMovies, maxLengths); } public void printDetailedBookDataAsColumnsString(TreeMap<Integer, Book> availableBooks) { //get the longest text for each field in order to calculate spacing LinkedHashMap<String,Integer> maxLengths = calculateMaxLengthForEachFieldInBooks(availableBooks); printDetailedLibraryElementDataAsColumnsString(availableBooks, maxLengths); } public void printDetailedLibraryElementDataAsColumnsString(TreeMap<Integer, ? extends LibraryElement> availableLibraryElements, LinkedHashMap<String, Integer> maxLengths) { StringBuilder dataAsColumns = new StringBuilder(); //append formatted data and separator to result string appendHeaders(dataAsColumns,availableLibraryElements,maxLengths); appendDashes(dataAsColumns,availableLibraryElements); appendLibraryElementData(dataAsColumns,availableLibraryElements,maxLengths); System.out.println(dataAsColumns.toString()); } public String getDetailHeadersAsColumns() { return String.format("%s\t\t" + "%s\t\t" + "%s",Book.TITLE_FIELD,Book.AUTHOR_FIELD,Book.YEAR_PUBLISHED_FIELD); } public LinkedHashMap<String,Integer> calculateMaxLengthForEachFieldInBooks(TreeMap<Integer,Book> availableBooks) { return calculateMaxLengthForEachField(availableBooks,View.getBookFieldsHeadersLength()); } public LinkedHashMap<String,Integer> calculateMaxLengthForEachFieldInMovies(TreeMap<Integer,Movie> availableMovies) { return calculateMaxLengthForEachField(availableMovies,View.getMovieFieldsHeadersLength()); } public LinkedHashMap<String,Integer> calculateMaxLengthForEachField(TreeMap<Integer,? extends LibraryElement> availableLibraryElements,LinkedHashMap<String,Integer> maxLengths ){ for (LibraryElement libraryElement : availableLibraryElements.values()) { HashMap<String,String> details = libraryElement.getDetails(); //updates the max length register for each field, with the longest value for each book for (String field : maxLengths.keySet()) { if ( details.get(field).length() > maxLengths.get(field)){ maxLengths.put(field,details.get(field).length()); } } } return maxLengths; } private void appendLibraryElementData(StringBuilder dataAsColumns,TreeMap<Integer,? extends LibraryElement> availableLibraryElements, LinkedHashMap<String, Integer> maxLengths) { for (LibraryElement libraryElement : availableLibraryElements.values()) { HashMap<String,String> details = libraryElement.getDetails(); appendDataWithWhitespaces(dataAsColumns, availableLibraryElements,maxLengths, details); } } private void appendHeaders(StringBuilder dataAsColumns,TreeMap<Integer,? extends LibraryElement> availableLibraryElement, LinkedHashMap<String, Integer> maxLengths) { appendDataWithWhitespaces(dataAsColumns,availableLibraryElement,maxLengths,null); } private void appendDashes(StringBuilder currentString,TreeMap<Integer,? extends LibraryElement> availableLibraryElements) { int currentLength = currentString.length(); for (int i = 0; i < currentLength-1; i++) { currentString.append("-"); } currentString.append("\n"); } private void appendDataWithWhitespaces(StringBuilder dataAsColumns,TreeMap<Integer,? extends LibraryElement> availableLibraryElements, LinkedHashMap<String, Integer> maxLengths, HashMap<String, String> details) { for (String field : maxLengths.keySet()) { int fieldLength; if(details==null){ //append field name to the current string dataAsColumns.append(field); fieldLength = field.length(); }else{ //append field value to the current string dataAsColumns.append(details.get(field)); fieldLength = details.get(field).length(); } //fill with withespaces the remaining spaces between current field length and the max field length while(fieldLength < (maxLengths.get(field)+4) ){ dataAsColumns.append(" "); fieldLength++; } } dataAsColumns.append("\n"); } public void printMessage(String message) { System.out.println(message); } public void printUserData(User loggedUser) { String userData = "- Name: " + loggedUser.getName()+ "\n"+ "- Email: " + loggedUser.getEmail()+ "\n"+ "- Address: " + loggedUser.getAddress() + "\n"+ "- Phone: " + loggedUser.getPhone(); System.out.println(userData); } }
[ "alvaro.hernandezi@alumnos.usm.cl" ]
alvaro.hernandezi@alumnos.usm.cl
acbebf982e79ab1c0c08f058b27665f8b4fdb37f
2d5c6766fb7ebbb6fd9b3f81e015b8c56eda2733
/pact/pact-tests/src/test/java/eu/stratosphere/pact/test/pactPrograms/TeraSortITCase.java
d8301ee36ff48b752f9cdd3611c5954186c04332
[]
no_license
bel90/nephele
e134197edeb86d5b2bfde138445f2f624f934bae
674876a9714a6b48fd7467cadbc48f9eacfd5c84
refs/heads/master
2021-08-24T00:43:16.161984
2017-12-07T09:22:36
2017-12-07T09:22:36
112,023,086
0
0
null
null
null
null
UTF-8
Java
false
false
3,965
java
/*********************************************************************************************************************** * * Copyright (C) 2010-2013 by the Stratosphere project (http://stratosphere.eu) * * 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 eu.stratosphere.pact.test.pactPrograms; import java.io.File; import java.io.FileInputStream; import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.List; import junit.framework.Assert; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import eu.stratosphere.nephele.configuration.Configuration; import eu.stratosphere.nephele.jobgraph.JobGraph; import eu.stratosphere.pact.common.plan.Plan; import eu.stratosphere.pact.compiler.PactCompiler; import eu.stratosphere.pact.compiler.jobgen.JobGraphGenerator; import eu.stratosphere.pact.compiler.plan.OptimizedPlan; import eu.stratosphere.pact.example.sort.TeraSort; import eu.stratosphere.pact.test.util.TestBase; @RunWith(Parameterized.class) public class TeraSortITCase extends TestBase { private static final String INPUT_DATA_FILE = "/testdata/terainput.txt"; private String resultPath; public TeraSortITCase(Configuration config) { super(config); } @Override protected void preSubmit() throws Exception { resultPath = getFilesystemProvider().getTempDirPath() + "/result"; } @Override protected JobGraph getJobGraph() throws Exception { URL fileURL = getClass().getResource(INPUT_DATA_FILE); String inPath = "file://" + fileURL.getPath(); TeraSort ts = new TeraSort(); Plan plan = ts.getPlan(this.config.getString("TeraSortITCase#NoSubtasks", "1"), inPath, getFilesystemProvider().getURIPrefix() + resultPath); PactCompiler pc = new PactCompiler(); OptimizedPlan op = pc.compile(plan); JobGraphGenerator jgg = new JobGraphGenerator(); return jgg.compileJobGraph(op); } @Override protected void postSubmit() throws Exception { final byte[] line = new byte[100]; final byte[] previous = new byte[10]; for (int i = 0; i < previous.length; i++) { previous[i] = -128; } File parent = new File(this.resultPath); int num = 1; while (true) { File next = new File(parent, String.valueOf(num)); if (!next.exists()) { break; } FileInputStream inStream = new FileInputStream(next); int read; while ((read = inStream.read(line)) == 100) { // check against the previous for (int i = 0; i < previous.length; i++) { if (line[i] > previous[i]) { break; } else if (line[i] < previous[i]) { Assert.fail("Next record is smaller than previous record."); } } System.arraycopy(line, 0, previous, 0, 10); } if (read != -1) { Assert.fail("Inclomplete last record in result file."); } inStream.close(); num++; } if (num == 1) { Assert.fail("Empty result, nothing checked for Job!"); } getFilesystemProvider().delete(resultPath, true); } @Parameters public static Collection<Object[]> getConfigurations() { final List<Configuration> tConfigs = new ArrayList<Configuration>(); Configuration config = new Configuration(); config.setInteger("TeraSortITCase#NoSubtasks", 4); tConfigs.add(config); return toParameterList(tConfigs); } }
[ "belinda.diesslin@campus.tu-berlin.de" ]
belinda.diesslin@campus.tu-berlin.de
b3afce1edb562cde5a03df20adf7705857c1367b
9665e7f3de03d1dfea64b1c432bcedae2a148a4d
/src/main/java/com/tegnercodes/flexio/pluginsystem/PluginStateListener.java
6c5fb3d0895862d162c2f286303c92f55804012e
[ "MIT" ]
permissive
TegnerCodes/flex-io
238e12067419e16ce4afec39c57227902032309e
46f93b289417dfb050460dfd2589fb18ccc7c01a
refs/heads/master
2021-01-19T02:30:38.024600
2016-07-04T14:25:49
2016-07-04T14:25:49
62,521,959
0
0
null
null
null
null
UTF-8
Java
false
false
399
java
package com.tegnercodes.flexio.pluginsystem; import java.util.EventListener; /** * PluginStateListener defines the interface for an object that listens to plugin state changes. */ public interface PluginStateListener extends EventListener { /** * Invoked when a plugin's state (for example DISABLED, STARTED) is changed. */ void pluginStateChanged(PluginStateEvent event); }
[ "Nicklas@TegnerCodes.com" ]
Nicklas@TegnerCodes.com
1cdf81a980e8ec738aef7c9b468c4d90307ba3fe
61775207ff9af52ef7050d1a1d5afc9f132ab9d5
/Client/src/dialog/HelpDialog.java
1c65b573437263a4aabf78dea2a5b9e7580b6145
[]
no_license
shulga-oleg/Thousand
c6590ad53d89c3ae18424f43cb7435a2f36b51d0
bfb3bc59acb8af1e2b7bf9af8362819b6d823ef2
refs/heads/master
2020-08-05T01:08:14.657776
2015-02-09T16:05:13
2015-02-09T16:05:13
30,522,300
0
0
null
null
null
null
UTF-8
Java
false
false
3,659
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 dialog; /** * * @author Олег */ public class HelpDialog extends javax.swing.JDialog { /** * Creates new form HelpDialog */ public HelpDialog(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(HelpDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(HelpDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(HelpDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(HelpDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the dialog */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { HelpDialog dialog = new HelpDialog(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables }
[ "shulga.work@ya.ru" ]
shulga.work@ya.ru
88a444998d8a382cea12a3fd0cd5691ee96aa1a3
27b77cd4041f15133227e3e8836ebcb9956668a6
/latte-ec/src/main/java/com/flj/latte/ec/main/personal/list/ListItemType.java
65faf0175aaa310285cc58b6391cbd1eb4cde9d0
[]
no_license
chenguoyu313270/CgyFastEc
1945cda176acffcf7206acc247f00038bd7ae580
2c53b74eb67d3b9dec050a6a9551a20c761ba831
refs/heads/master
2020-03-18T18:43:05.411089
2018-07-17T01:22:53
2018-07-17T01:22:53
135,110,495
0
0
null
null
null
null
UTF-8
Java
false
false
251
java
package com.flj.latte.ec.main.personal.list; /** * Created by cgy */ public class ListItemType { public static final int ITEM_NORMAL = 20;//常规 public static final int ITEM_AVATAR = 21; public static final int ITEM_SWITCH = 22; }
[ "2584132419@qq.com" ]
2584132419@qq.com
198424b8f641a1edfdc4ed7fdc47e18306f28fa9
1593a1a56c20fd73392d918595dc0076a5a24113
/ng-portfolio-core/src/main/java/com/bindstone/portfolio/mapper/AccountMapper.java
b8904d311ab6b03915c906fd556481be4feed5e4
[ "MIT" ]
permissive
bindstone/ng-portfolio
8e505fdb5b422e45037e060b5a3d26f7bf3ec4b2
cff94d88cbded5e4af9a64dab889d63ae9b93e23
refs/heads/master
2022-01-16T18:49:48.047525
2019-08-03T15:18:53
2019-08-03T15:18:53
149,020,404
0
0
null
null
null
null
UTF-8
Java
false
false
1,764
java
package com.bindstone.portfolio.mapper; import com.bindstone.portfolio.mapper.dto.AccountDto; import com.bindstone.portfolio.security.Account; import org.apache.commons.lang3.Validate; import org.springframework.stereotype.Component; /** * JPA/DTO Mapper for ACCOUNT */ @Component public class AccountMapper implements DtoMapper<Account, AccountDto> { /** * JPA to DTO Mapper * * @param object JPA Object * @return DTO Object */ @Override public AccountDto toDto(Account object) { Validate.notNull(object); return AccountDto.builder() .id(object.getId()) .username(object.getUsername()) .password(object.getPassword()) .accountNonExpired(object.isAccountNonExpired()) .accountNonLocked(object.isAccountNonLocked()) .credentialsNonExpired(object.isCredentialsNonExpired()) .enabled(object.isEnabled()) .role(object.getRole()) .build(); } /** * JPA to DTO Mapper * * @param objectDto DTO Object * @return JPA Object */ @Override public Account fromDto(AccountDto objectDto) { Validate.notNull(objectDto); return Account.builder() .id(objectDto.getId()) .username(objectDto.getUsername()) .password(objectDto.getPassword()) .accountNonExpired(objectDto.isAccountNonExpired()) .accountNonLocked(objectDto.isAccountNonLocked()) .credentialsNonExpired(objectDto.isCredentialsNonExpired()) .enabled(objectDto.isEnabled()) .role(objectDto.getRole()) .build(); } }
[ "msbindstone@gmail.com" ]
msbindstone@gmail.com
335d116c56791ca8098752db9a29075c735465bf
90784147b54f55c2e3821e568c001a19078c0a49
/Labolatorium 5/gRPC-2020/gen/sr/grpc/gen/AdvancedCalculatorGrpc.java
bdb79db9b577ebc16db00a1409f91c9713f636f0
[]
no_license
ankolodz/Systemy-Rozproszone
f879f1188f8aea908832a19058d6be194bf13470
c7f61f2aef3ffedab8ca3562271f0cc16b0deb5a
refs/heads/master
2022-09-16T16:25:37.947049
2020-06-01T19:11:30
2020-06-01T19:11:30
242,928,800
1
2
null
2020-03-07T18:12:50
2020-02-25T06:38:07
Java
UTF-8
Java
false
false
11,824
java
package sr.grpc.gen; import static io.grpc.MethodDescriptor.generateFullMethodName; import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; import static io.grpc.stub.ClientCalls.asyncUnaryCall; import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; import static io.grpc.stub.ClientCalls.blockingUnaryCall; import static io.grpc.stub.ClientCalls.futureUnaryCall; import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; import static io.grpc.stub.ServerCalls.asyncUnaryCall; import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; /** */ @javax.annotation.Generated( value = "by gRPC proto compiler (version 1.27.0)", comments = "Source: calculator.proto") public final class AdvancedCalculatorGrpc { private AdvancedCalculatorGrpc() {} public static final String SERVICE_NAME = "calculator.AdvancedCalculator"; // Static method descriptors that strictly reflect the proto. private static volatile io.grpc.MethodDescriptor<sr.grpc.gen.ComplexArithmeticOpArguments, sr.grpc.gen.ComplexArithmeticOpResult> getComplexOperationMethod; @io.grpc.stub.annotations.RpcMethod( fullMethodName = SERVICE_NAME + '/' + "ComplexOperation", requestType = sr.grpc.gen.ComplexArithmeticOpArguments.class, responseType = sr.grpc.gen.ComplexArithmeticOpResult.class, methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor<sr.grpc.gen.ComplexArithmeticOpArguments, sr.grpc.gen.ComplexArithmeticOpResult> getComplexOperationMethod() { io.grpc.MethodDescriptor<sr.grpc.gen.ComplexArithmeticOpArguments, sr.grpc.gen.ComplexArithmeticOpResult> getComplexOperationMethod; if ((getComplexOperationMethod = AdvancedCalculatorGrpc.getComplexOperationMethod) == null) { synchronized (AdvancedCalculatorGrpc.class) { if ((getComplexOperationMethod = AdvancedCalculatorGrpc.getComplexOperationMethod) == null) { AdvancedCalculatorGrpc.getComplexOperationMethod = getComplexOperationMethod = io.grpc.MethodDescriptor.<sr.grpc.gen.ComplexArithmeticOpArguments, sr.grpc.gen.ComplexArithmeticOpResult>newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ComplexOperation")) .setSampledToLocalTracing(true) .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( sr.grpc.gen.ComplexArithmeticOpArguments.getDefaultInstance())) .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( sr.grpc.gen.ComplexArithmeticOpResult.getDefaultInstance())) .setSchemaDescriptor(new AdvancedCalculatorMethodDescriptorSupplier("ComplexOperation")) .build(); } } } return getComplexOperationMethod; } /** * Creates a new async stub that supports all call types for the service */ public static AdvancedCalculatorStub newStub(io.grpc.Channel channel) { io.grpc.stub.AbstractStub.StubFactory<AdvancedCalculatorStub> factory = new io.grpc.stub.AbstractStub.StubFactory<AdvancedCalculatorStub>() { @java.lang.Override public AdvancedCalculatorStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new AdvancedCalculatorStub(channel, callOptions); } }; return AdvancedCalculatorStub.newStub(factory, channel); } /** * Creates a new blocking-style stub that supports unary and streaming output calls on the service */ public static AdvancedCalculatorBlockingStub newBlockingStub( io.grpc.Channel channel) { io.grpc.stub.AbstractStub.StubFactory<AdvancedCalculatorBlockingStub> factory = new io.grpc.stub.AbstractStub.StubFactory<AdvancedCalculatorBlockingStub>() { @java.lang.Override public AdvancedCalculatorBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new AdvancedCalculatorBlockingStub(channel, callOptions); } }; return AdvancedCalculatorBlockingStub.newStub(factory, channel); } /** * Creates a new ListenableFuture-style stub that supports unary calls on the service */ public static AdvancedCalculatorFutureStub newFutureStub( io.grpc.Channel channel) { io.grpc.stub.AbstractStub.StubFactory<AdvancedCalculatorFutureStub> factory = new io.grpc.stub.AbstractStub.StubFactory<AdvancedCalculatorFutureStub>() { @java.lang.Override public AdvancedCalculatorFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new AdvancedCalculatorFutureStub(channel, callOptions); } }; return AdvancedCalculatorFutureStub.newStub(factory, channel); } /** */ public static abstract class AdvancedCalculatorImplBase implements io.grpc.BindableService { /** */ public void complexOperation(sr.grpc.gen.ComplexArithmeticOpArguments request, io.grpc.stub.StreamObserver<sr.grpc.gen.ComplexArithmeticOpResult> responseObserver) { asyncUnimplementedUnaryCall(getComplexOperationMethod(), responseObserver); } @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) .addMethod( getComplexOperationMethod(), asyncUnaryCall( new MethodHandlers< sr.grpc.gen.ComplexArithmeticOpArguments, sr.grpc.gen.ComplexArithmeticOpResult>( this, METHODID_COMPLEX_OPERATION))) .build(); } } /** */ public static final class AdvancedCalculatorStub extends io.grpc.stub.AbstractAsyncStub<AdvancedCalculatorStub> { private AdvancedCalculatorStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); } @java.lang.Override protected AdvancedCalculatorStub build( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new AdvancedCalculatorStub(channel, callOptions); } /** */ public void complexOperation(sr.grpc.gen.ComplexArithmeticOpArguments request, io.grpc.stub.StreamObserver<sr.grpc.gen.ComplexArithmeticOpResult> responseObserver) { asyncUnaryCall( getChannel().newCall(getComplexOperationMethod(), getCallOptions()), request, responseObserver); } } /** */ public static final class AdvancedCalculatorBlockingStub extends io.grpc.stub.AbstractBlockingStub<AdvancedCalculatorBlockingStub> { private AdvancedCalculatorBlockingStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); } @java.lang.Override protected AdvancedCalculatorBlockingStub build( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new AdvancedCalculatorBlockingStub(channel, callOptions); } /** */ public sr.grpc.gen.ComplexArithmeticOpResult complexOperation(sr.grpc.gen.ComplexArithmeticOpArguments request) { return blockingUnaryCall( getChannel(), getComplexOperationMethod(), getCallOptions(), request); } } /** */ public static final class AdvancedCalculatorFutureStub extends io.grpc.stub.AbstractFutureStub<AdvancedCalculatorFutureStub> { private AdvancedCalculatorFutureStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); } @java.lang.Override protected AdvancedCalculatorFutureStub build( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { return new AdvancedCalculatorFutureStub(channel, callOptions); } /** */ public com.google.common.util.concurrent.ListenableFuture<sr.grpc.gen.ComplexArithmeticOpResult> complexOperation( sr.grpc.gen.ComplexArithmeticOpArguments request) { return futureUnaryCall( getChannel().newCall(getComplexOperationMethod(), getCallOptions()), request); } } private static final int METHODID_COMPLEX_OPERATION = 0; private static final class MethodHandlers<Req, Resp> implements io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>, io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>, io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>, io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> { private final AdvancedCalculatorImplBase serviceImpl; private final int methodId; MethodHandlers(AdvancedCalculatorImplBase serviceImpl, int methodId) { this.serviceImpl = serviceImpl; this.methodId = methodId; } @java.lang.Override @java.lang.SuppressWarnings("unchecked") public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) { switch (methodId) { case METHODID_COMPLEX_OPERATION: serviceImpl.complexOperation((sr.grpc.gen.ComplexArithmeticOpArguments) request, (io.grpc.stub.StreamObserver<sr.grpc.gen.ComplexArithmeticOpResult>) responseObserver); break; default: throw new AssertionError(); } } @java.lang.Override @java.lang.SuppressWarnings("unchecked") public io.grpc.stub.StreamObserver<Req> invoke( io.grpc.stub.StreamObserver<Resp> responseObserver) { switch (methodId) { default: throw new AssertionError(); } } } private static abstract class AdvancedCalculatorBaseDescriptorSupplier implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { AdvancedCalculatorBaseDescriptorSupplier() {} @java.lang.Override public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { return sr.grpc.gen.CalculatorProto.getDescriptor(); } @java.lang.Override public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { return getFileDescriptor().findServiceByName("AdvancedCalculator"); } } private static final class AdvancedCalculatorFileDescriptorSupplier extends AdvancedCalculatorBaseDescriptorSupplier { AdvancedCalculatorFileDescriptorSupplier() {} } private static final class AdvancedCalculatorMethodDescriptorSupplier extends AdvancedCalculatorBaseDescriptorSupplier implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { private final String methodName; AdvancedCalculatorMethodDescriptorSupplier(String methodName) { this.methodName = methodName; } @java.lang.Override public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { return getServiceDescriptor().findMethodByName(methodName); } } private static volatile io.grpc.ServiceDescriptor serviceDescriptor; public static io.grpc.ServiceDescriptor getServiceDescriptor() { io.grpc.ServiceDescriptor result = serviceDescriptor; if (result == null) { synchronized (AdvancedCalculatorGrpc.class) { result = serviceDescriptor; if (result == null) { serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) .setSchemaDescriptor(new AdvancedCalculatorFileDescriptorSupplier()) .addMethod(getComplexOperationMethod()) .build(); } } } return result; } }
[ "49743845+ankolodz@users.noreply.github.com" ]
49743845+ankolodz@users.noreply.github.com
9907c5f617bda30ec3537763fbdf4215425ca6a9
4bb97997c40774553a07f258280ce1617f47ad16
/api/src/main/java/com/orange/tbk/api/bean/Course.java
4901aed44723e46422fcf17d23710493bc77770d
[]
no_license
MAXIAODONGS/tyh
c94582436636bc586a82d3f3a2cceae54409c1e9
d22eee3e39ec5e84352446c65df7baa2ae8c0012
refs/heads/master
2022-01-15T16:14:45.407769
2019-05-01T08:37:20
2019-05-01T08:37:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,473
java
package com.orange.tbk.api.bean; import com.baomidou.mybatisplus.annotation.*; import java.io.Serializable; /** * 新手教程模块 * t_course * @author Orange * @date 2019/03/14 */ @TableName("t_course") @KeySequence("SEQ_TEST") public class Course implements Serializable { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.ID_WORKER_STR) private String id; @TableField(value = "create_date",fill = FieldFill.INSERT) private Long createDate; @TableLogic private Integer delFlag; private String remarks; @TableField(value = "update_date",fill = FieldFill.UPDATE) private Long updateDate; /** * 新手教程标题 * title */ private String title; /** * 作者 * author */ private String author; /** * 教程内容 * content */ private String content; /** * 主图地址 * image */ private String image; public String getId() { return id; } public void setId(String id) { this.id = id == null ? null : id.trim(); } public Long getCreateDate() { return createDate; } public void setCreateDate(Long createDate) { this.createDate = createDate; } public Integer getDelFlag() { return delFlag; } public void setDelFlag(Integer delFlag) { this.delFlag = delFlag; } public String getRemarks() { return remarks; } public void setRemarks(String remarks) { this.remarks = remarks == null ? null : remarks.trim(); } public Long getUpdateDate() { return updateDate; } public void setUpdateDate(Long updateDate) { this.updateDate = updateDate; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title == null ? null : title.trim(); } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author == null ? null : author.trim(); } public String getContent() { return content; } public void setContent(String content) { this.content = content == null ? null : content.trim(); } public String getImage() { return image; } public void setImage(String image) { this.image = image == null ? null : image.trim(); } }
[ "1067357662@qq.com" ]
1067357662@qq.com
848e71ce7ba5b3cfb8532dd3a78365ce5620ad61
adb0e161cf83195e349401e86b607c5beb70835d
/src/main/java/in/kirthika/exception/InvalidPlaceException.java
a5f7984cf379958e46aab33e5ee5bc6049ee69b0
[]
no_license
csys-fresher-batch-2021/bloodbankapp-spring-kirthika
de76d76244573013e92f72cad8902120530c47e3
0c674ffb13d5c2d63efd17028ee60992857d6fa5
refs/heads/main
2023-05-30T22:48:13.737812
2021-06-20T14:54:30
2021-06-20T14:54:30
378,051,395
0
0
null
null
null
null
UTF-8
Java
false
false
227
java
package in.kirthika.exception; public class InvalidPlaceException extends Exception { /** * */ private static final long serialVersionUID = 1L; public InvalidPlaceException(String message) { super(message); } }
[ "kirthy2411@gmail.com" ]
kirthy2411@gmail.com
a1a9e873afa0ee3be9f8f474405b9d9b4566aa36
250ac72e79d6480cdac10282e757b4c1dac83d46
/DLP/src/ast/expression/Expression.java
ae2af97cdab250681182beb17f9d0872402933d0
[]
no_license
tehAnswer/PLD
1fa652e52a0f009d1d6db6b2e77e4b7b10f9eb44
8774c41f9056aed289109575cec1dc8611e4a2c5
refs/heads/master
2020-07-02T00:01:22.635097
2014-02-24T22:52:08
2014-02-24T22:52:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
147
java
package ast.expression; import ast.NodeAST; /** Represent expressions. * @author Sergio * */ public interface Expression extends NodeAST { }
[ "sergiorodriguezgijon@gmail.com" ]
sergiorodriguezgijon@gmail.com
32791c9453d63b3cc220ff8fb66700046ff2762f
fb303dec7e839451222eeab8859e5812f1169c75
/bookstore_backend/src/main/java/com/reins/bookstore/service/UserService.java
9b69ed9b09af7ad75df60b8605392c8605223d49
[]
no_license
SJTUzhh/bookstore
79d577f4dadd75cb81189b2e8c4b011977ea7b18
9e54c2f772354f1d25e084d02a36d26a1b3a4346
refs/heads/master
2023-06-18T22:22:16.484158
2021-07-18T10:21:02
2021-07-18T10:21:02
375,734,367
0
0
null
null
null
null
UTF-8
Java
false
false
572
java
package com.reins.bookstore.service; import com.reins.bookstore.entity.UserAuth; import com.reins.bookstore.utils.msgutils.Msg; import java.util.List; public interface UserService { //检查登录时输入的用户名和密码是否正确 UserAuth checkUser(String username, String password); List<UserAuth> getUserAuths(); Msg changeUserAuthEnabled(Integer userId, Integer enabled); UserAuth checkUsernameExist(String username); Msg addNewUser(String name, String password, String email); UserAuth getUserAuthById(Integer userId); }
[ "321984375@qq.com" ]
321984375@qq.com
6350a2a1ac7a0ea315568547bccbe285247d05bb
3f9e23896279907a0fe2c6f95e552bb39b210660
/src/swsv-ris/src/main/java/hu/bme/mit/swsv/ris/common/logging/LogEntry.java
51d1b28ec88f052e56935549a58a8c7a9e54ac1c
[]
no_license
tamasbence/Javatar-ris-2016_2
ed5da9beef2ebbe7eb3ae90d8dc91b12ad5bb215
4095cc38285a03fa8909ab7092d1a497dc74ff2f
refs/heads/master
2021-01-23T03:21:02.958370
2016-12-01T14:56:56
2016-12-01T14:56:56
86,069,067
0
1
null
null
null
null
UTF-8
Java
false
false
1,951
java
package hu.bme.mit.swsv.ris.common.logging; import org.slf4j.event.Level; /** * Defines the possible log entries. A log entry consists of a code, a level and * a description. The description can have placeholders for additional message. */ public enum LogEntry { // @formatter:off METHOD_ENTER(701, Level.TRACE, "Entering method: {}."), STARTED(300, Level.INFO, "Component started."), STOPPED(301, Level.INFO, "Component stopped."), IT_STEP(302, Level.INFO, "Integration test scenario step: {}."), IT_MSG_PUB(303, Level.INFO, "Message published: {}."), IT_MSG_REC(304, Level.INFO, "Message received: {}."), WRONG_SIGNAL(400, Level.WARN, "Wrong signal: {}."), CANNOT_PUBLISH(401, Level.WARN, "Could not publish message, details: {}."), CANNOT_SERIALIZE(402, Level.WARN, "Could not serialize message, details: {}."), UNKNOWN_SIGNAL(403, Level.WARN, "Unknown signal: {}."), UNKNOWN_MESSAGE(404, Level.WARN, "A message arrived that is not a signal: {}."), CANNOT_CONNECT(500, Level.ERROR, "Cannot connect to the server."), CONNECTION_LOST(501, Level.ERROR, "Connection to the server lost."), DISCONNECT_ERROR(502, Level.ERROR, "Error while disconnecting component, details: {}."), JSON_PARSE_ERROR(503, Level.ERROR, "Error while parsing JSON file, details: {}."); // @formatter:on private final int code; private final Level level; private final String description; private LogEntry(final int code, final Level level, final String description) { this.code = code; this.level = level; this.description = description; } /** * Gets the code. * * @return Code */ public int getCode() { return code; } /** * Gets the level. * * @return Level */ public Level getLevel() { return level; } /** * Gets the description. * * @return Description */ public String getDescription() { return description; } @Override public String toString() { return code + " - " + description; } }
[ "tambbb@gmail.com" ]
tambbb@gmail.com
8eb67812ef95e2671c1b0fb431f643ff33da4c3a
f0bf48872cf09cbf5bf2fbab16c64f993318c4d1
/src/Recursion1/State.java
669fc9673cb89254e604de5b6bff4d53cca5978f
[]
no_license
sunandapatra/Sunanda_Java
5a0fc7efe0a04475280b4888554317bc269b49ba
c684baecf03a218108b7f9b58805045eb08edb16
refs/heads/master
2021-01-19T23:47:46.365374
2017-05-01T19:36:23
2017-05-01T19:36:23
89,030,395
0
0
null
null
null
null
UTF-8
Java
false
false
255
java
package Recursion1; public class State { private String name; private String speciality; private Language language; public State(String name){ this.name = name; } } class Language { private String name; private String script; }
[ "noreply@github.com" ]
sunandapatra.noreply@github.com
4ae221935aa75f113f65b7435a1740617f4ef6b5
75e6218db8dd4435915c7f2309f555b71d7ae51a
/src/firstgame/input/Keyboard.java
8edcad21f98ca08d39ed806f92435c61abdc3778
[]
no_license
CloneTrooper567/MyFirstGame
2b338798c9a259416c48cec411b43892996026d8
28458695eab920beb5e933f4992351570021c3aa
refs/heads/master
2018-12-31T11:26:22.684303
2014-08-10T16:58:15
2014-08-10T16:58:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,418
java
/** * */ package firstgame.input; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; /** * @author Markus * */ public class Keyboard implements KeyListener { // =========================================== // ==============Instance-Variables=========== // =========================================== private final boolean[] keys = new boolean[120]; public boolean up, down, left, right; // =========================================== // ==============Constructor(s)=============== // =========================================== public Keyboard() { } // =========================================== // ==============Methods====================== // =========================================== public void update() { up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W]; down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S]; left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A]; right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D]; } @Override public void keyTyped(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { keys[e.getKeyCode()] = true; } @Override public void keyReleased(KeyEvent e) { keys[e.getKeyCode()] = false; } // =========================================== // ==============Getter/Setter================ // =========================================== }
[ "markus271@gmx.de" ]
markus271@gmx.de
e0b7c83ecc141ea48475757323428e8768fa1ca6
939c05442baf790867d4e8c6393fbdb1e8a0be30
/gy/or_gy_17181_bekefi/10/gyakorlat10/Client.java
54e685a7e8eca81ca5a1f397c652124aa59bd62f
[]
no_license
8emi95/elte-ik-or
560748d3dbc99605d833e6ca44e0c77d4274254f
f5eed356e83c688fbbfa4bb58cfe3bb5d49889bd
refs/heads/master
2020-04-23T18:29:40.843849
2019-02-18T23:04:09
2019-02-18T23:04:09
171,369,082
0
0
null
null
null
null
UTF-8
Java
false
false
995
java
package gyakorlat10; import java.io.IOException; import java.io.PrintWriter; import java.net.Socket; import java.util.Scanner; public class Client { public static void main(String[] args) throws IOException { Socket s = new Socket("localhost", 12345); Scanner sc = new Scanner(s.getInputStream()); PrintWriter pw = new PrintWriter(s.getOutputStream(), true); System.out.println("A nevem: "+args[0]); pw.println(args[0]); boolean end = false; while(!end) { String message = sc.nextLine(); if (message.equals("Nyertel")) { System.out.println(args[0]+": nyertem"); end = true; } else { int number = Integer.parseInt(message); number--; pw.println(number); if (number < 0) { System.out.println(args[0]+" kiestem."); } } } } }
[ "8emi95@inf.elte.hu" ]
8emi95@inf.elte.hu
ef335d6904258b3abd9b86ced458f2028c4df57b
7e43011c818cd95460e02930bec0981b65d032c7
/src/main/java/com/github/badoualy/telegram/tl/api/request/TLRequestChannelsGetParticipants.java
ad35ab0cbe1c3a0b4aae72958d526e5b1b8b9089
[ "MIT" ]
permissive
shahrivari/kotlogram
48faef9ff5cf1695c18cf02fb4fb3ed8edcc571e
2281523c2a99692087bdcf6b2034bca6b2dc645c
refs/heads/master
2020-09-07T11:37:15.597377
2019-11-10T12:18:56
2019-11-10T12:18:56
220,767,354
0
2
MIT
2019-11-10T09:20:24
2019-11-10T09:20:23
null
UTF-8
Java
false
false
4,229
java
package com.github.badoualy.telegram.tl.api.request; import com.github.badoualy.telegram.tl.TLContext; import com.github.badoualy.telegram.tl.api.TLAbsChannelParticipantsFilter; import com.github.badoualy.telegram.tl.api.TLAbsInputChannel; import com.github.badoualy.telegram.tl.api.channels.TLChannelParticipants; import com.github.badoualy.telegram.tl.core.TLMethod; import com.github.badoualy.telegram.tl.core.TLObject; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import static com.github.badoualy.telegram.tl.StreamUtils.readInt; import static com.github.badoualy.telegram.tl.StreamUtils.readTLObject; import static com.github.badoualy.telegram.tl.StreamUtils.writeInt; import static com.github.badoualy.telegram.tl.StreamUtils.writeTLObject; import static com.github.badoualy.telegram.tl.TLObjectUtils.SIZE_CONSTRUCTOR_ID; import static com.github.badoualy.telegram.tl.TLObjectUtils.SIZE_INT32; /** * @author Yannick Badoual yann.badoual@gmail.com * @see <a href="http://github.com/badoualy/kotlogram">http://github.com/badoualy/kotlogram</a> */ public class TLRequestChannelsGetParticipants extends TLMethod<TLChannelParticipants> { public static final int CONSTRUCTOR_ID = 0x24d98f92; protected TLAbsInputChannel channel; protected TLAbsChannelParticipantsFilter filter; protected int offset; protected int limit; private final String _constructor = "channels.getParticipants#24d98f92"; public TLRequestChannelsGetParticipants() { } public TLRequestChannelsGetParticipants(TLAbsInputChannel channel, TLAbsChannelParticipantsFilter filter, int offset, int limit) { this.channel = channel; this.filter = filter; this.offset = offset; this.limit = limit; } @Override @SuppressWarnings({"unchecked", "SimplifiableConditionalExpression"}) public TLChannelParticipants deserializeResponse(InputStream stream, TLContext context) throws IOException { final TLObject response = readTLObject(stream, context); if (response == null) { throw new IOException("Unable to parse response"); } if (!(response instanceof TLChannelParticipants)) { throw new IOException( "Incorrect response type, expected " + getClass().getCanonicalName() + ", found " + response .getClass().getCanonicalName()); } return (TLChannelParticipants) response; } @Override public void serializeBody(OutputStream stream) throws IOException { writeTLObject(channel, stream); writeTLObject(filter, stream); writeInt(offset, stream); writeInt(limit, stream); } @Override @SuppressWarnings({"unchecked", "SimplifiableConditionalExpression"}) public void deserializeBody(InputStream stream, TLContext context) throws IOException { channel = readTLObject(stream, context, TLAbsInputChannel.class, -1); filter = readTLObject(stream, context, TLAbsChannelParticipantsFilter.class, -1); offset = readInt(stream); limit = readInt(stream); } @Override public int computeSerializedSize() { int size = SIZE_CONSTRUCTOR_ID; size += channel.computeSerializedSize(); size += filter.computeSerializedSize(); size += SIZE_INT32; size += SIZE_INT32; return size; } @Override public String toString() { return _constructor; } @Override public int getConstructorId() { return CONSTRUCTOR_ID; } public TLAbsInputChannel getChannel() { return channel; } public void setChannel(TLAbsInputChannel channel) { this.channel = channel; } public TLAbsChannelParticipantsFilter getFilter() { return filter; } public void setFilter(TLAbsChannelParticipantsFilter filter) { this.filter = filter; } public int getOffset() { return offset; } public void setOffset(int offset) { this.offset = offset; } public int getLimit() { return limit; } public void setLimit(int limit) { this.limit = limit; } }
[ "yann.badoual@gmail.com" ]
yann.badoual@gmail.com
21e449c0e24cf3fbea3b2e781dea769de6782ebf
ea2e8acdddfed0d00803f1c07735d1e3ecdfcbea
/app_tts/src/androidTest/java/com/example/app_tts/ExampleInstrumentedTest.java
7b5baa869021fdc378af5b66f4b207b12fadd11e
[]
no_license
h86656519/MyApplication3
5360f359826bd4be4e3cc059b667555f342e01d2
0e86eb3a7034b12de8b972fc92d45cc4ff5f26cb
refs/heads/master
2020-05-25T03:39:47.030059
2019-05-20T09:25:58
2019-05-20T09:25:58
187,609,319
0
0
null
null
null
null
UTF-8
Java
false
false
742
java
package com.example.app_tts; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.app_tts", appContext.getPackageName()); } }
[ "h86656519@gmail.com" ]
h86656519@gmail.com
4eff173b2260a9be22a56e583610a61d3d472f10
c5cb1d4de80f81f784065f9e6ccb24a8a7150983
/substance/src/main/java/org/pushingpixels/substance/api/painter/decoration/MatteDecorationPainter.java
d04a860ff05bcc4ce2c8ee83ea6474917a727d1a
[ "BSD-3-Clause" ]
permissive
mtbadi39/swing-effects
9cd609968f7c2045caf7e6ab07b9f14b3004ebd3
a29f7a31c73e13027a7228324b5612768452c155
refs/heads/master
2021-09-16T12:23:54.090032
2018-06-20T13:52:27
2018-06-20T13:52:27
115,825,692
7
0
null
null
null
null
UTF-8
Java
false
false
5,990
java
/* * Copyright (c) 2005-2018 Substance Kirill Grouchnikov. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * o Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * o 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. * * o Neither the name of Substance Kirill Grouchnikov 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 OWNER 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 org.pushingpixels.substance.api.painter.decoration; import java.awt.Color; import java.awt.Component; import java.awt.GradientPaint; import java.awt.Graphics2D; import java.awt.Point; import org.pushingpixels.substance.api.SubstanceCortex.ComponentScope; import org.pushingpixels.substance.api.SubstanceSkin; import org.pushingpixels.substance.api.SubstanceSlices.DecorationAreaType; import org.pushingpixels.substance.api.colorscheme.SubstanceColorScheme; import org.pushingpixels.substance.internal.utils.SubstanceColorUtilities; /** * Implementation of {@link SubstanceDecorationPainter} that uses matte painting * on decoration areas. * * @author Kirill Grouchnikov * @since version 4.3 */ public class MatteDecorationPainter implements SubstanceDecorationPainter { /** * The display name for the decoration painters of this class. */ public static final String DISPLAY_NAME = "Matte"; @Override public String getDisplayName() { return DISPLAY_NAME; } @Override public void paintDecorationArea(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) { if ((decorationAreaType == DecorationAreaType.PRIMARY_TITLE_PANE) || (decorationAreaType == DecorationAreaType.SECONDARY_TITLE_PANE)) { this.paintTitleBackground(graphics, comp, width, height, skin.getBackgroundColorScheme(decorationAreaType)); } else { this.paintExtraBackground(graphics, comp, width, height, skin.getBackgroundColorScheme(decorationAreaType)); } } /** * Paints the title background. * * @param graphics * Graphics context. * @param comp * Component. * @param width * Width. * @param height * Height. * @param scheme * Color scheme for painting the title background. */ private void paintTitleBackground(Graphics2D graphics, Component comp, int width, int height, SubstanceColorScheme scheme) { Graphics2D g2d = (Graphics2D) graphics.create(); this.fill(g2d, comp, scheme, 0, 0, 0, width, height); g2d.dispose(); } /** * Paints the background of non-title decoration areas. * * @param graphics * Graphics context. * @param parent * Component ancestor for computing the correct offset of the * background painting. * @param comp * Component. * @param width * Width. * @param height * Height. * @param scheme * Color scheme for painting the title background. */ private void paintExtraBackground(Graphics2D graphics, Component comp, int width, int height, SubstanceColorScheme scheme) { Point offset = ComponentScope.getOffsetInRootPaneCoords(comp); Graphics2D g2d = (Graphics2D) graphics.create(); this.fill(g2d, comp, scheme, offset.y, 0, 0, width, height); g2d.dispose(); } /** * Fills the relevant part with the gradient fill. * * @param graphics * Graphics. * @param comp * Component. * @param scheme * Color scheme to use. * @param offsetY * Vertical offset. * @param x * X coordinate of the fill area. * @param y * Y coordinate of the fill area. * @param width * Fill area width. * @param height * Fill area height. */ protected void fill(Graphics2D graphics, Component comp, SubstanceColorScheme scheme, int offsetY, int x, int y, int width, int height) { // System.out.println(comp.getClass().getName() + ":" // + scheme.getDisplayName()); // 0 - 50 : light -> medium // 50 - : medium fill int flexPoint = 50; int startY = y + offsetY; if (startY < 0) startY = 0; int endY = startY + height; Color startColor = scheme.getLightColor(); Color endColor = SubstanceColorUtilities.getInterpolatedColor(startColor, scheme.getMidColor(), 0.4f); int currStart = 0; if (flexPoint >= startY) { graphics.setPaint(new GradientPaint(x, currStart - offsetY, startColor, x, flexPoint - offsetY, endColor)); graphics.fillRect(x, currStart - offsetY, width, flexPoint); } currStart += flexPoint; if (currStart > endY) return; graphics.setColor(endColor); graphics.fillRect(x, currStart - offsetY, width, endY - currStart + offsetY); } }
[ "" ]
8c6054109a351103319aeb932b935e3f5f7fcbc3
3ed996f31e256d86b9a7e1bf663613470b8566f3
/android/app/src/main/java/com/mynewappredux/MainActivity.java
fe4ff6bb21b1fbe643e62e1dff2b5f41cbfdf4d8
[]
no_license
alexlondon07/MyNewAppRedux
f5d4b2316a026f01c4ffa870ea61c9e61dee7563
8de6105c70a89d89e31a4431071cd86467077f12
refs/heads/master
2020-04-04T08:54:26.019359
2018-12-05T22:43:05
2018-12-05T22:43:05
155,799,300
1
0
null
null
null
null
UTF-8
Java
false
false
371
java
package com.mynewappredux; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. */ @Override protected String getMainComponentName() { return "MyNewAppRedux"; } }
[ "alexlondon07@gmail.com" ]
alexlondon07@gmail.com
747513ab55bc65f54dbd2fe121a8750b5a9892b4
7aac5d29bee9e749b9731ccd61c26cf9beeb5084
/src/test/java/com/kazale/pontointeligente/PontoInteligenteApiApplicationTests.java
0d106a9ca095150579d9372833f36128b88890bd
[ "MIT" ]
permissive
m4rciosouza/api-restful-spring
45eb9dc0123125bd8d14f1f1c20f85df8fb07c9d
1e45f745632f717ad1c2e72202ac952c19bbe05c
refs/heads/master
2021-01-01T15:22:38.683718
2017-07-18T14:44:13
2017-07-18T14:44:13
97,536,216
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
package com.kazale.pontointeligente; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class PontoInteligenteApiApplicationTests { @Test public void contextLoads() { } }
[ "marcio@kazale.com" ]
marcio@kazale.com
fc3a90d7550bb4f42b1502f6e2f55c4c24740cfc
36dfe6ec17131001d0e7e07741df490cd127ca97
/app/src/main/java/com/sjtuopennetwork/shareit/share/HomeActivity.java
6f7b00b18195443a93b7e6bae3ab0dba55195c00
[]
no_license
SJTU-OpenNetwork/ShareIt2
163a9231af264d0054d2b568fd6db652733be379
7078980c9b635ff44caa8a3c23e7a6ea6c896622
refs/heads/main
2023-01-23T15:13:56.614093
2020-12-03T05:25:12
2020-12-03T05:25:12
314,106,553
0
0
null
null
null
null
UTF-8
Java
false
false
6,800
java
package com.sjtuopennetwork.shareit.share; import android.app.ActivityManager; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.PersistableBundle; import android.support.annotation.NonNull; import android.support.design.bottomnavigation.LabelVisibilityMode; import android.support.design.widget.BottomNavigationView; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.MenuItem; import com.sjtuopennetwork.shareit.R; import com.sjtuopennetwork.shareit.album.AlbumFragment; import com.sjtuopennetwork.shareit.contact.ContactFragment; import com.sjtuopennetwork.shareit.setting.SettingFragment; import com.sjtuopennetwork.shareit.util.ShareService; import com.syd.oden.circleprogressdialog.core.CircleProgressDialog; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import java.util.ArrayList; import sjtu.opennet.hon.Textile; public class HomeActivity extends AppCompatActivity { private static final String TAG = "===================="; //UI控件 private ShareFragment shareFragment; private SettingFragment settingFragment; private AlbumFragment albumFragment; private ContactFragment contactFragment; CircleProgressDialog circleProgressDialog; FragmentManager fragmentManager; FragmentTransaction transaction; //内存数据 boolean nodeOnline = false; // int login; boolean textileOn=false; //持久化存储 private SharedPreferences pref; //导航栏监听器,每次点击都进行fragment的切换 private BottomNavigationView.OnNavigationItemSelectedListener navSeLis = new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.share: replaceFragment(shareFragment); return true; case R.id.contacts: replaceFragment(contactFragment); return true; case R.id.album: replaceFragment(albumFragment); return true; case R.id.setting: replaceFragment(settingFragment); return true; } return false; } }; @Override public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) { // super.onSaveInstanceState(outState, outPersistentState); } @Override protected void onStart() { Log.d(TAG, "onStart: home activity"); super.onStart(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); Intent theIntent = getIntent(); pref = getSharedPreferences("txtl", Context.MODE_PRIVATE); textileOn = pref.getBoolean("textileon",false); int login = theIntent.getIntExtra("login", 5); if (login == 0 || login == 1 || login == 2 || login == 3) { //如果等于5,就不是登录页面跳转过来的 initUI(); if (!EventBus.getDefault().isRegistered(this)) { EventBus.getDefault().register(this); } boolean serviceRunning = isServiceRunning("com.sjtuopennetwork.shareit.util.ShareService"); if (serviceRunning) { replaceFragment(shareFragment); } else { circleProgressDialog = new CircleProgressDialog(this); circleProgressDialog.setText("节点启动中"); circleProgressDialog.setCancelable(false); circleProgressDialog.showDialog(); Intent intent = new Intent(this, ShareService.class); intent.putExtra("login", login); startForegroundService(intent); } } } public boolean isServiceRunning(String ServiceName) { ActivityManager myManager = (ActivityManager) getApplicationContext() .getSystemService(Context.ACTIVITY_SERVICE); ArrayList<ActivityManager.RunningServiceInfo> runningService = (ArrayList<ActivityManager.RunningServiceInfo>) myManager .getRunningServices(30); for (int i = 0; i < runningService.size(); i++) { Log.d(TAG, "isServiceRunning: " + runningService.get(i).service.getClassName()); if (runningService.get(i).service.getClassName() .equals(ServiceName)) { return true; } } return false; } private void initUI() { shareFragment = new ShareFragment(); contactFragment = new ContactFragment(); albumFragment = new AlbumFragment(); settingFragment = new SettingFragment(); BottomNavigationView nav = findViewById(R.id.nav_view); nav.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_LABELED); nav.setOnNavigationItemSelectedListener(navSeLis); } @Subscribe(threadMode = ThreadMode.MAIN) public void knowOnline(Integer integer) { if (integer.intValue() == 0) { if (!nodeOnline) { circleProgressDialog.dismiss(); nodeOnline = true; replaceFragment(shareFragment); } } } //切换Fragment private void replaceFragment(Fragment fragment) { fragmentManager = getSupportFragmentManager(); transaction = fragmentManager.beginTransaction(); transaction.replace(R.id.rep_layout, fragment); transaction.commitAllowingStateLoss(); } @Override public void onStop() { super.onStop(); if (EventBus.getDefault().isRegistered(this)) { EventBus.getDefault().unregister(this); } } @Subscribe(threadMode = ThreadMode.MAIN) public void textileOn(Integer ton){ if(ton==2562){ nodeOnline = false; circleProgressDialog = new CircleProgressDialog(this); circleProgressDialog.setText("节点启动中"); circleProgressDialog.setCancelable(false); circleProgressDialog.showDialog(); } } }
[ "a2471277747@qq.com" ]
a2471277747@qq.com
b68a1e63ede4505fd24b4cb274629685df0d75f0
ad16cb824c9efef183bd6d5bdd44b4a1cf2130c7
/src/main/java/com/practicaldime/flags/repo/CountriesRepo.java
8ba06891c0ae204cb9f6aac514b1d2cc4e1f8bbe
[]
no_license
m41na/zesty-flags
ded3b37814b6d125146826da7d1c870e32b1877b
0de778ee795eb87fa05b160b43520d679b3f403f
refs/heads/master
2020-04-30T09:06:24.501085
2019-04-24T23:54:39
2019-04-24T23:54:39
176,737,291
0
0
null
null
null
null
UTF-8
Java
false
false
1,276
java
package com.practicaldime.flags.repo; import java.io.IOException; import java.net.URL; import java.util.List; import java.util.function.Supplier; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.io.Resources; import com.practicaldime.flags.entity.Country; @Repository public class CountriesRepo { private ObjectMapper mapper; private List<Country> countries = null; private final URL url; @Autowired public CountriesRepo(ObjectMapper mapper, Supplier<String> source) { super(); this.mapper = mapper; String input = source.get(); this.url = Resources.getResource(input != null && input.trim().length() > 0? input : "data/all-countries.json"); } public List<Country> getCountries() { if (this.countries == null) { try { this.countries = mapper.readValue(url, new TypeReference<List<Country>>() {}); } catch (IOException e) { throw new RuntimeException(e); } } return this.countries; } public Country getCountry(String name) { return getCountries().stream().filter(item -> item.name.equalsIgnoreCase(name)).findFirst().get(); } }
[ "m41na@yahoo.com" ]
m41na@yahoo.com
771c3a391c6b85c688a60ce4e7fd23d4ba4e2a74
9a4acfc0259f5ca157453397eda068f18990e8d9
/src/geometria/Circulo.java
d31347f99be56647f1716cb88ce42e95429ddea5
[]
no_license
jorgePrograUnlam/FigurasGeometricas
4b88bf61551b203dd8eea50b907966a28caa2843
f55073427ddbd3dc914177afd7d2f0cd37a31f7b
refs/heads/master
2021-06-27T00:50:24.661230
2017-09-17T03:06:35
2017-09-17T03:06:35
103,736,752
0
0
null
null
null
null
UTF-8
Java
false
false
608
java
package geometria; public class Circulo implements IColisionable { private double radio; private Punto centro; public Circulo(Punto centro, double radio) { this.radio = radio; this.centro = centro; } public double getRadio() { return radio; } public Punto getCentro() { return centro; } @Override public boolean colisionaCon(IColisionable figura) { CirculoVisitor cvisitor = new CirculoVisitor(this); return figura.accept(cvisitor); } @Override public boolean accept(FiguraVisitor visitor) { return visitor.visitarCirculo(this); } }
[ "jamc4626@gmail.com" ]
jamc4626@gmail.com
b676d76b32dd6cbeee45441e4b5d41b3e89aecc4
d0c478750a826679cb2b783997cc99b2ff75b992
/Test/src/com/test/test/GGameSecond.java
2ddfb1951a79ca363b37ecd328da5a372968eadb
[]
no_license
limyjyj/helloworld_java
ecef747161432abc2f91ffffd37a8a64eeac8955
cc74da1d0be97ec283dd564dbba2f3eff745d4ed
refs/heads/master
2021-01-11T21:34:51.564269
2017-02-13T09:18:15
2017-02-13T09:18:15
78,812,014
0
0
null
null
null
null
UTF-8
Java
false
false
1,270
java
package com.test.test; public class GGameSecond extends GGame implements initailReverse, reverse, checkVictory, checkCard, victoryGame{ public GGameSecond(int score){ super(); this.setScore(score); System.out.println(getScore()); } @Override public void reverse(GGame player){ this.setCardReverse(getInput(),false); player.setCardReverse(player.getInput(),false); } @Override public void initailReverse(int a){ for(int i=a;i<TOTAL_CARD;i++){ this.setCardReverse(i,false); } } @Override public boolean checkCard(int cardnum){ if(this.isCardReverse(cardnum)) return false; return true; } @Override public boolean checkVictory(GGame player){ if(this.getScore()<1) return false; if(this.getInput()>player.getInput() ){ this.setScore(this.getScore()-1); reverse(player); return true; } return false; } @Override boolean drawCard(int input){ this.setInput(input); if(this.checkCard(input)) return true; return false; } @Override public boolean victoryGame(GGame player){ if(this.getScore()>player.getScore()) return true; return false; } boolean victoryGame(){ if(this.getScore()<1) return true; return false; } }
[ "lyjyj0131@gmail.com" ]
lyjyj0131@gmail.com
59cfdb7934918f248942f63b6fc37d6f6b7ac2a8
13aadf00480f6d112f7d608c917a6a61ca25539d
/ch04-param/src/main/java/org/example/dao/StudentDao.java
6f1d58790b7b67608746b14551dfdadeb3f185ea
[]
no_license
xianqirui/mybatis-cours
760367ef8c7c026b3465574fedc13443c919084f
46e7e50fdaa9a18529a2a17eb29ffa2e3a896541
refs/heads/master
2023-09-06T04:56:40.855451
2021-11-21T01:27:25
2021-11-21T01:27:25
430,247,515
0
0
null
null
null
null
UTF-8
Java
false
false
464
java
package org.example.dao; import org.apache.ibatis.annotations.Param; import org.example.domain.Student; import org.example.vo.Querparam; import java.util.List; public interface StudentDao { public Student selectStudentById(Integer id); public List<Student> paramselect(@Param("myname") String name,@Param("myage") Integer age); List<Student> selectMuty(Querparam param); public List<Student> selectUserorder(@Param("colName") String name); }
[ "xqr@xqr.com" ]
xqr@xqr.com
de879cf242c7fa28e13e009c22385d93f9cc863f
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project401/src/main/java/org/gradle/test/performance/largejavamultiproject/project401/p2007/Production40147.java
f878318219f2d7fe68cc1e1f959c79a48f70e4fe
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
1,971
java
package org.gradle.test.performance.largejavamultiproject.project401.p2007; public class Production40147 { private Production40144 property0; public Production40144 getProperty0() { return property0; } public void setProperty0(Production40144 value) { property0 = value; } private Production40145 property1; public Production40145 getProperty1() { return property1; } public void setProperty1(Production40145 value) { property1 = value; } private Production40146 property2; public Production40146 getProperty2() { return property2; } public void setProperty2(Production40146 value) { property2 = value; } private String property3; public String getProperty3() { return property3; } public void setProperty3(String value) { property3 = value; } private String property4; public String getProperty4() { return property4; } public void setProperty4(String value) { property4 = value; } private String property5; public String getProperty5() { return property5; } public void setProperty5(String value) { property5 = value; } private String property6; public String getProperty6() { return property6; } public void setProperty6(String value) { property6 = value; } private String property7; public String getProperty7() { return property7; } public void setProperty7(String value) { property7 = value; } private String property8; public String getProperty8() { return property8; } public void setProperty8(String value) { property8 = value; } private String property9; public String getProperty9() { return property9; } public void setProperty9(String value) { property9 = value; } }
[ "sterling.greene@gmail.com" ]
sterling.greene@gmail.com
d9ef6375e69776767042bccea44fc2b3997de59d
742b86b23ce20650e44d105b93558ca0e89536fb
/src/main/java/dev/johnwatts/openweather/Hourly.java
c2823e032018f2c6aa6346bab358e6d7f051790c
[]
no_license
BudgieWatts/openweather-pojos
116e7a85f2e444ea80967fa0a1a84f7253f414d4
4ba5a3e45e7ab5218ddd54c8a651f47de70b79cf
refs/heads/master
2022-12-24T14:24:11.942255
2020-10-04T13:27:13
2020-10-04T13:27:13
299,922,983
0
0
null
null
null
null
UTF-8
Java
false
false
469
java
package dev.johnwatts.openweather; import com.fasterxml.jackson.annotation.JsonProperty; public class Hourly { private double hourly; @JsonProperty("1h") public double getHourly() { return hourly; } @JsonProperty("1h") public void setHourly(double hourly) { this.hourly = hourly; } @Override public String toString() { return "Hourly{" + "hourly=" + hourly + '}'; } }
[ "drwatts.jw@googlemail.com" ]
drwatts.jw@googlemail.com