blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
be763721f03376d35dadd11ce061613009e713c7
d4e758b7b9bd6104fd2ea0b95be5cd5dd439d649
/src/main/java/com/example/demo/SecurityConfig.java
501e3716b9df7de7862c95f14fef2d7e7ead68ca
[]
no_license
yusuke-emoto/BookSummary
790b8eb7b6346ea6a89782d3b200ac604d5f4c25
117cd9056417535abbe65ced703fcfc53d8abc1d
refs/heads/master
2022-11-30T18:33:30.076095
2020-08-08T15:06:47
2020-08-08T15:06:47
274,056,351
0
0
null
2020-08-08T15:06:48
2020-06-22T06:22:35
Java
UTF-8
Java
false
false
3,867
java
package com.example.demo; import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; @EnableWebSecurity //デフォルトのwebセキュリティ設定をオフにしますよ @Configuration //設定用のクラスですよ public class SecurityConfig extends WebSecurityConfigurerAdapter{ @Bean //パスワードエンコーダーのBean定義 public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } //データソース、@Autowiredを付けることで@Componentのついたクラスから該当を探して、newしてインスタンスを突っ込んでくれる @Autowired private DataSource dataSource; //ユーザーIDとパスワードを検索するSQL文 private static final String USER_SQL= " SELECT" + " user_id," + " password," + " true" + " FROM" + " m_user" + " WHERE" + " user_id = ?"; //ユーザーのロールをする検索SQL文 private static final String ROLE_SQL=" SELECT" + " user_id," + " role" + " FROM" + " m_user" + " WHERE" + " user_id=?"; @Override public void configure(WebSecurity web) throws Exception{ //静的リソースへのアクセスには、セキュリティを適用しない web.ignoring().antMatchers("/webjars/**","/css/**"); } @Override protected void configure(HttpSecurity http) throws Exception{ //ログイン不要ページの設定 http.authorizeRequests() .antMatchers("/webjars/**").permitAll()//webjarsへアクセス許可 .antMatchers("/css/**").permitAll()//cssへアクセス許可 .antMatchers("/images/**").permitAll() .antMatchers("/login").permitAll() //ログインページは直リンクOK .antMatchers("/signup").permitAll() //ユーザー登録画面は直リンクOK .antMatchers("/home").permitAll()//ホーム画面は直リンクOK .antMatchers("/post").permitAll() .anyRequest().authenticated(); //それ以外は直リンク禁止 //ログイン処理 http.formLogin().loginProcessingUrl("/login")//ログイン処理のパス .loginPage("/login") //ログインページの指定、これがないとデフォルトのセキュリティページになってしまう .failureUrl("/login") //ログイン失敗時の遷移先 .usernameParameter("userId") //ログインページのユーザーID .passwordParameter("password") //ログインページのユーザーID .defaultSuccessUrl("/home",true); //ログイン成功後の遷移先 //ログアウト処理 http.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")) .logoutUrl("/logout") .logoutSuccessUrl("/login"); //CSRF対策を無効に設定(一時的) http.csrf().disable(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception{ //ログイン処理時のユーザー情報を、DBから取得する auth.jdbcAuthentication() .dataSource(dataSource) .usersByUsernameQuery(USER_SQL) .authoritiesByUsernameQuery(ROLE_SQL) .passwordEncoder(passwordEncoder()); } }
57e73872a5c70db18edd24f37c519e35aaec66e5
1004e02b95b296bec009e36cb44e5fc64aa1c251
/Pixels/DeadPixel.java
a7fc88f5a0fb4adcdbc41120c00f9f492fa00f54
[]
no_license
zurnov/pu-oop-java-hw-5
9d36b8ed9659ad3f2c21d6eaee35f0bf6f695597
7927db1d407e8e314b5c6d4567aa5e766bcc1079
refs/heads/main
2023-03-10T02:22:38.923178
2021-02-25T21:49:49
2021-02-25T21:49:49
342,365,409
0
0
null
null
null
null
UTF-8
Java
false
false
48
java
package Pixels; public class DeadPixel { }
41a888a3bca02f2e0ee7c6cb2f16f591cb8ff842
c46f99dbb1ea967302d4ba6f974928c43e0b7eb1
/src/pptx4j/java/org/pptx4j/pml/CTTLSetBehavior.java
7e12298af9a782b0280d32cdd3e14918b91b57f0
[ "Apache-2.0" ]
permissive
manivannans/docx4j
688320ebde87c6f6d7cd43f32d475eb635d5e9c1
777c78a844b98e15c3d472fedd3b3e01e6017327
refs/heads/master
2020-12-25T00:50:18.304299
2012-05-29T03:59:59
2012-05-29T03:59:59
4,479,085
3
0
null
null
null
null
UTF-8
Java
false
false
2,825
java
/* * Copyright 2010, Plutext Pty Ltd. * * This file is part of docx4j. docx4j is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.pptx4j.pml; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for CT_TLSetBehavior complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="CT_TLSetBehavior"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="cBhvr" type="{http://schemas.openxmlformats.org/presentationml/2006/main}CT_TLCommonBehaviorData"/> * &lt;element name="to" type="{http://schemas.openxmlformats.org/presentationml/2006/main}CT_TLAnimVariant" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CT_TLSetBehavior", propOrder = { "cBhvr", "to" }) public class CTTLSetBehavior { @XmlElement(required = true) protected CTTLCommonBehaviorData cBhvr; protected CTTLAnimVariant to; /** * Gets the value of the cBhvr property. * * @return * possible object is * {@link CTTLCommonBehaviorData } * */ public CTTLCommonBehaviorData getCBhvr() { return cBhvr; } /** * Sets the value of the cBhvr property. * * @param value * allowed object is * {@link CTTLCommonBehaviorData } * */ public void setCBhvr(CTTLCommonBehaviorData value) { this.cBhvr = value; } /** * Gets the value of the to property. * * @return * possible object is * {@link CTTLAnimVariant } * */ public CTTLAnimVariant getTo() { return to; } /** * Sets the value of the to property. * * @param value * allowed object is * {@link CTTLAnimVariant } * */ public void setTo(CTTLAnimVariant value) { this.to = value; } }
14de8ff25f31507fe78133882e7c405b197935f9
8381f7acfb91f9a432af92b43055b284744f73db
/src/test/java/runnerPackage/TestRunner.java
9feed54f57489eb670f1856996d6b0179b95f2ca
[]
no_license
okanalkan98/CucumberDemo
f9698bcec215633a52b47aef2a99ceb5b59cc79e
a00b6142b754f6d09489732eca22beb5573b595e
refs/heads/master
2021-01-24T02:47:36.352205
2018-02-25T21:03:15
2018-02-25T21:03:15
122,862,376
0
0
null
null
null
null
UTF-8
Java
false
false
807
java
package runnerPackage; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.BeforeTest; import org.testng.annotations.AfterTest; import cucumber.api.CucumberOptions; import cucumber.api.testng.AbstractTestNGCucumberTests; import io.github.bonigarcia.wdm.WebDriverManager; @CucumberOptions(features= {"features"},glue= {"stepDefinitionPackage"}) public class TestRunner extends AbstractTestNGCucumberTests{ public static WebDriver driver; @BeforeTest public void setUp() { WebDriverManager.chromedriver().setup(); driver=new ChromeDriver(); System.out.println("Set up script is running"); System.out.println("My first cucumber test"); } @AfterTest public void tearDown() { driver.close(); } }
4e362032711edbf3c10d4aed3d60a73ba54689e5
8aea95c114e07d043d217f51a30807b4642d49a7
/testbench/modules/testDataFlow/languages/testCustomAnalyzer/source_gen/testCustomAnalyzer/dataFlow/Child_IntraProcedural_BuilderMode_DataFlow.java
ab90c69832c6bb0c060a7a128374a6616fd60752
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
JetBrains/MPS
ec03a005e0eda3055c4e4856a28234b563af92c6
0d2aeaf642e57a86b23268fc87740214daa28a67
refs/heads/master
2023-09-03T15:14:10.508189
2023-09-01T13:25:35
2023-09-01T13:30:22
2,209,077
1,242
309
Apache-2.0
2023-07-25T18:10:10
2011-08-15T09:48:06
JetBrains MPS
UTF-8
Java
false
false
837
java
package testCustomAnalyzer.dataFlow; /*Generated by MPS */ import jetbrains.mps.lang.dataFlow.DataFlowBuilder; import jetbrains.mps.lang.dataFlow.DataFlowBuilderContext; import java.util.Collection; import jetbrains.mps.lang.dataFlow.framework.IDataFlowModeId; import java.util.Arrays; import jetbrains.mps.lang.dataFlow.framework.ConceptDataFlowModeId; public class Child_IntraProcedural_BuilderMode_DataFlow extends DataFlowBuilder { public void build(final DataFlowBuilderContext _context) { _context.getBuilder().emitNop("r:11be8b48-b45e-48e5-98ad-b77dc1b202b1(testCustomAnalyzer.dataFlow)/2955426575105812292"); } @Override public Collection<IDataFlowModeId> getModes() { return Arrays.<IDataFlowModeId>asList(new ConceptDataFlowModeId("jetbrains.mps.lang.dataFlow.structure.IntraProcedural_BuilderMode")); } }
a60cecec09ff323c3b59080ededc8768ca8b04cd
ead5a617b23c541865a6b57cf8cffcc1137352f2
/decompiled/sources/com/google/api/client/extensions/android/http/packageinfo.java
de9ae72769f7cd3c4a78e9ea883879411dec45ce
[]
no_license
erred/uva-ssn
73a6392a096b38c092482113e322fdbf9c3c4c0e
4fb8ea447766a735289b96e2510f5a8d93345a8c
refs/heads/master
2022-02-26T20:52:50.515540
2019-10-14T12:30:33
2019-10-14T12:30:33
210,376,140
1
0
null
null
null
null
UTF-8
Java
false
false
235
java
package com.google.api.client.extensions.android.http; import com.google.api.client.util.Beta; @Beta /* renamed from: com.google.api.client.extensions.android.http.package-info reason: invalid class name */ interface packageinfo { }
3487dccf2210eb50c0b8c0690eaa37e39e3f9fb0
fc16b0bf8f1f5ab72bceffcb7e4165ceb9aebf44
/SammyUnit12/src/RentalDemo.java
9c65bdd06a5b5640fd58278e07ea9f83d714bf1d
[]
no_license
SharkTaleLover/My-School-Java-Projects
36a076c59179abdb8a5d494122c69d16cff038ff
416dca91f631d8722f4b681eb63aff300ea7aa6a
refs/heads/main
2023-05-02T20:14:23.884841
2021-05-21T15:54:26
2021-05-21T15:54:26
351,823,130
0
0
null
null
null
null
UTF-8
Java
false
false
2,669
java
import java.util.InputMismatchException; import java.util.Scanner; public class RentalDemo { public static void main(String[] args) { Scanner input = new Scanner(System.in); int minutesRented, hoursRented, rentalCost, minutesExtra; Rental[] rentals = new Rental[8]; for(int i = 0; i < rentals.length; i++) { while(true) { try { rentals[i] = new Rental(i + 1, SammysRentalPriceWithMethods.askRental(), SammysRentalPriceWithMethods.askEquipment()); break; } catch (InputMismatchException e) { System.out.println("Please enter in the correct format."); } } } SammysRentalPriceWithMethods.displayMotto(); System.out.println(); /* for(int i = 0; i < person3.getHoursRented(); i++) { System.out.println("Coupon good for 10% off next rental"); } */ System.out.println(); for (Rental rental : rentals) { SammysRentalPriceWithMethods.displayRental(rental); } while(true) { System.out.print("Would you like to sort ascending order by (C)ontract price, (#)Contract Number, or (E)quipment Type, or (Q)uit >"); char userChoice = input.next().charAt(0); if (userChoice == 'Q') System.exit(0); while (userChoice != 'C' && userChoice != '#' && userChoice != 'E') { System.out.print("Please enter again >"); userChoice = input.next().charAt(0); } SammysRentalPriceWithMethods.sortRentals(rentals, userChoice); for (Rental rental : rentals) { SammysRentalPriceWithMethods.displayRental(rental); } } /* SammysRentalPriceWithMethods.displayRental(compareRentals(person1, person2)); System.out.println(); SammysRentalPriceWithMethods.displayRental(compareRentals(person1, person3)); System.out.println(); SammysRentalPriceWithMethods.displayRental(compareRentals(person2, person3)); */ } /* public static Rental compareRentals(Rental r1, Rental r2) { SammysRentalPriceWithMethods.displayRental(r1); SammysRentalPriceWithMethods.displayRental(r2); if(r1.getHoursRented() * 60 + r1.getMinutesExtra() > r2.getHoursRented() * 60 + r2.getMinutesExtra()) return r1; else if(r1.getHoursRented() * 60 + r1.getMinutesExtra() < r2.getHoursRented() * 60 + r2.getMinutesExtra()) return r2; else return r1; } */ }
e0511c99e527a96187ef95b2196646a3b0fd9747
5ec06dab1409d790496ce082dacb321392b32fe9
/clients/spring/generated/src/main/java/org/openapitools/model/ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo.java
afa1d30a137d187c9120d02fd0bea20f549d53d5
[ "Apache-2.0" ]
permissive
shinesolutions/swagger-aem-osgi
e9d2385f44bee70e5bbdc0d577e99a9f2525266f
c2f6e076971d2592c1cbd3f70695c679e807396b
refs/heads/master
2022-10-29T13:07:40.422092
2021-04-09T07:46:03
2021-04-09T07:46:03
190,217,155
3
3
Apache-2.0
2022-10-05T03:26:20
2019-06-04T14:23:28
null
UTF-8
Java
false
false
4,526
java
package org.openapitools.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenProperties; import javax.validation.Valid; import javax.validation.constraints.*; /** * ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2019-08-05T01:13:37.880Z[GMT]") public class ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo { @JsonProperty("pid") private String pid = null; @JsonProperty("title") private String title = null; @JsonProperty("description") private String description = null; @JsonProperty("properties") private ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenProperties properties = null; public ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo pid(String pid) { this.pid = pid; return this; } /** * Get pid * @return pid **/ @ApiModelProperty(value = "") public String getPid() { return pid; } public void setPid(String pid) { this.pid = pid; } public ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo title(String title) { this.title = title; return this; } /** * Get title * @return title **/ @ApiModelProperty(value = "") public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo description(String description) { this.description = description; return this; } /** * Get description * @return description **/ @ApiModelProperty(value = "") public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo properties(ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenProperties properties) { this.properties = properties; return this; } /** * Get properties * @return properties **/ @ApiModelProperty(value = "") @Valid public ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenProperties getProperties() { return properties; } public void setProperties(ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenProperties properties) { this.properties = properties; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo comAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo = (ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo) o; return Objects.equals(this.pid, comAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo.pid) && Objects.equals(this.title, comAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo.title) && Objects.equals(this.description, comAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo.description) && Objects.equals(this.properties, comAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo.properties); } @Override public int hashCode() { return Objects.hash(pid, title, description, properties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ComAdobeCqSocialContentFragmentsServicesImplCommunitiesFragmenInfo {\n"); sb.append(" pid: ").append(toIndentedString(pid)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
5d4054b56ebb19d76269cb38f53687a7979bb2b9
ea8568898a20e3a8a3c91c72d41ddaf29dcebd75
/ITC515_assignment2/src/datamanagement/Student.java
ee828e9b613cb7f689cef9151336f69bb38b7e9c
[]
no_license
aamerk2/Code-Debuggers
66390627c60ecf805452c534086492dd160f29a1
2aa57e08ad9737372a1f6db83b43f282aa69d7df
refs/heads/master
2020-05-21T17:54:36.363975
2016-09-19T08:56:48
2016-09-19T08:56:48
64,348,514
1
2
null
2016-09-19T10:45:00
2016-07-27T23:30:47
Java
UTF-8
Java
false
false
1,131
java
package datamanagement; public class Student implements IStudent { private Integer id; // id of integer type private String fn;// fn of String type private String ln; // lnof String type private StudentUnitRecordList su;//su of type StudentUnitrecordList property public Student(Integer id, String fn, String ln, StudentUnitRecordList su) { this.id = id; this.fn = fn; this.ln = ln; this.su = su == null ? new StudentUnitRecordList() : su; } public Integer getID() { // Property getID return this.id; } public String getFirstName() { // Property getFirstName return fn; } public void setFirstName(String firstName) { // Property setFirstName this.fn = firstName; } public String getLastName() { return ln; } public void setLastName(String lastName) { this.ln = lastName; } public void addUnitRecord(IStudentUnitRecord record) { su.add(record); } public IStudentUnitRecord getUnitRecord(String unitCode) { for (IStudentUnitRecord r : su) if (r.getUnitCode().equals(unitCode)) return r; return null; } public StudentUnitRecordList getUnitRecords() { return su; } }
7fb8c76ad0ee8b16948c26b9aa347d482e983949
3eab9aafe4eb373cb4b0051d92afe145e46e6073
/src/main/java/com/example/habrreactive/HabrreactiveApplication.java
18ef30b41ab287f14e662a385d2223cec76300f5
[]
no_license
dkul108/habrreactive
96752d24ff8dd38661373a21c267b527b3848020
f0d8e0f527c07a36cf6a32e6abda6c0dcee09c45
refs/heads/master
2021-08-14T11:41:04.898977
2017-11-15T15:07:02
2017-11-15T15:07:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
328
java
package com.example.habrreactive; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class HabrreactiveApplication { public static void main(String[] args) { SpringApplication.run(HabrreactiveApplication.class, args); } }
d78ea6f80267ade5a2cfb8b457389ec02403c992
2ead3493f04e7bd8be4916ea2af34e0366fedb51
/JavaStreams/src/Problem_06/Main.java
968c1972a5f29ad649014d3a5a9e4c0da22a8c4b
[]
no_license
Ivanov-Stiliqn/Java-Fundamentals-Homeworks
c4a3970e8063b8831c54c1a12c96d73e93119ccd
2c908cf29d62e8e704707a870e0f907a8a127fc6
refs/heads/master
2021-01-10T16:26:56.127547
2015-11-24T12:54:25
2015-11-24T12:54:25
46,791,190
0
0
null
null
null
null
UTF-8
Java
false
false
1,900
java
package Problem_06; import java.io.*; /* Problem 6. *Save a Custom Object in a file Write a program that saves and loads the information from a custom Object that you have created to a file using ObjectInputStream, ObjectOutputStream. Create a class Course that has a String field containing the name and an integer field containing the number of students attending the course. Set the name of the new file as course.save. */ public class Main { private static Course[] courses; public static void main(String[] args) { courses=new Course[3]; courses[0]=new Course("Java Fundamentals",300); courses[1]=new Course("C# Fundamentals",400); courses[2]=new Course("C# Basics",1200); //Save(); Load(); } public static void Save(){ try ( ObjectOutputStream oos= new ObjectOutputStream( new BufferedOutputStream( new FileOutputStream("resources/problem_06/course.save")))){ for(Course c: courses){ oos.writeObject(c); } } catch (IOException e) { e.printStackTrace(); } } public static void Load(){ try ( ObjectInputStream ois= new ObjectInputStream( new BufferedInputStream( new FileInputStream("resources/problem_06/course.save")))){ Object obj; while((obj=ois.readObject())!=null){ System.out.println("Course: "+obj); } }catch (EOFException eof){ System.out.println("End of File"); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } }
b694b2f9f0b65d35ea1a8079c103111f865f33a3
a1bca7e14c44d3288d8e1f66c41270d09d76e916
/src/main/java/io/sj/exception/MessageResourceHandler.java
5cc2aca763dc94173e45c0733a7a3f85fd1ea61c
[]
no_license
Shubhamjain2908/Boot
aa26e6628a9eec8a4823befe6b8d8b1ec948c6ae
614ab70cbd6a11fa2ea746df84fe755aa8ccd50a
refs/heads/master
2020-04-13T23:12:53.808620
2018-12-29T10:06:39
2018-12-29T10:06:39
163,500,494
0
0
null
null
null
null
UTF-8
Java
false
false
1,254
java
package io.sj.exception; import java.util.Locale; import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; import org.springframework.context.NoSuchMessageException; import org.springframework.context.support.MessageSourceAccessor; import org.springframework.stereotype.Component; /** * Helper to simplify accessing i18n messages in code. * This finds messages automatically found from * src/main/resources (files named messages_*.properties) * * * @author Surabhi Bhawsar * @since 2017-11-04 */ @Component public class MessageResourceHandler { @Autowired private MessageSource messageSource; private MessageSourceAccessor accessor; /** * TODO */ @PostConstruct private void init() { accessor = new MessageSourceAccessor(messageSource, Locale.ENGLISH); } /** * TODO * @param code * @return */ public String get(String code) { try { return accessor.getMessage(code); } catch (NoSuchMessageException ex ) { return code; //When message is not found for given key, then return key as message instead of breaking. } } }
cdc32efdb4b14d181294d5e403f04c16ce416f26
ec728f5b2668a5698b37167e259f7713a76925a8
/PartitionUIMindset/app/src/main/java/com/android/kpe/partitionuimindset/TitlesFragment.java
ceddee865f8a7969e439a95a013f8c28526b97ef
[]
no_license
kurt-patrick/android
84d8b6c1ae125e332a571bc6abe3e49cc962fe29
c659a872e63591fe9810a108bee36c4bb54ab9e3
refs/heads/master
2021-09-03T04:06:42.660746
2018-01-05T12:59:05
2018-01-05T12:59:05
104,538,335
1
0
null
2017-11-25T12:08:06
2017-09-23T03:25:25
Java
UTF-8
Java
false
false
926
java
package com.android.kpe.partitionuimindset; import android.app.ListFragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; /** * Created by LocalUser on 20/09/2017. */ public class TitlesFragment extends ListFragment { @Override public void onListItemClick(ListView l, View v, int position, long id) { ((OnCourseChangedListener) getActivity() ).onCourseChanged(position); } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); String[] titles = getResources().getStringArray(R.array.course_titles); ArrayAdapter<String> adapter = new ArrayAdapter<String>( getActivity(), android.R.layout.simple_list_item_1, titles); setListAdapter(adapter); } }
52b0b1dff56d2db4e287b9cf885cfd18cb9a1b41
5765c87fd41493dff2fde2a68f9dccc04c1ad2bd
/Variant Programs/1-4/33/production/GrowerTerminate.java
53e24403c65ca348be452ee7bf48581b91d28494
[ "MIT" ]
permissive
hjc851/Dataset2-HowToDetectAdvancedSourceCodePlagiarism
42e4c2061c3f8da0dfce760e168bb9715063645f
a42ced1d5a92963207e3565860cac0946312e1b3
refs/heads/master
2020-08-09T08:10:08.888384
2019-11-25T01:14:23
2019-11-25T01:14:23
214,041,532
0
0
null
null
null
null
UTF-8
Java
false
false
844
java
package production; import manufacturedBelongings.MinableOppose; import warehouses.*; public class GrowerTerminate extends Presenter { public RinglikeAssociatedLeaning<MinableOppose> basket = null; public GrowerTerminate(double spiteful, double drift, Repository ago) { parallelize(spiteful, drift, null, ago); this.central = EmitterTerritory.overpopulated; this.basket = new RinglikeAssociatedLeaning<MinableOppose>(); } protected synchronized void eligibleSoonBody() throws DepositoryEliminateDeparture { try { this.presentPreclude = this.firstStowage.afterParagraph(); } catch (DepositoryEliminateDeparture samad) { throw samad; } } protected synchronized void propelOngoingAimCoughMemory() { this.basket.injectedSurvive(this.presentPreclude); this.presentPreclude = null; } }
94b1b9adfbea8d17bd41ffb6b961ea2cfbae0caf
60efbd957bfc8f98121f0dc6d2ea8cfafc1865ea
/app/src/main/java/com/example/intership2019/Fragment/DPDependencyInjectionExample/Person.java
f64fc737cce9fb0064d2082a9034c2050f6d59a1
[]
no_license
annv1990/PTIT-Internship-2019-CW
6f4040dd878cb7a5327b9eba7aa539e6de60129d
ad6481fd419247f72363a1c53616e4bc896cc324
refs/heads/master
2020-06-22T14:21:19.220632
2020-06-19T02:36:48
2020-06-19T02:36:48
197,728,954
1
0
null
null
null
null
UTF-8
Java
false
false
215
java
package com.example.intership2019.Fragment.DPDependencyInjectionExample; import javax.inject.Inject; public class Person{ Body body; @Inject public Person(Body body){ this.body = body; } }
85db836cf637431436cf7a250d7c4b42ff58f964
a69843c67fd8a5b227837bd253fde3f672739e87
/api-executor-v1/src/main/java/com/linkedpipes/etl/executor/api/v1/service/DefaultExceptionFactory.java
f9c9195618830059667456c950e831cde252fb1e
[ "MIT" ]
permissive
eghuro/etl
28713014be4db6bb010bd8c6a4e9a8249857ed2f
5d74f9156397a4b48ad0eb3d833721dc67ba74a2
refs/heads/master
2020-04-02T02:41:15.816327
2018-09-20T11:44:31
2018-09-20T11:44:31
153,922,127
0
0
NOASSERTION
2018-10-20T15:53:20
2018-10-20T15:53:20
null
UTF-8
Java
false
false
363
java
package com.linkedpipes.etl.executor.api.v1.service; import com.linkedpipes.etl.executor.api.v1.LpException; /** * Default implementation of exception factory. */ class DefaultExceptionFactory implements ExceptionFactory { @Override public LpException failure(String message, Object... args) { return new LpException(message, args); } }
e4549135ba1ca96d494b24fb38cd1aee369a7870
d05e815086d14ecd748707ef578c6404c7c1dd35
/processor/src/main/java/org/mobilitydata/gtfsvalidator/processor/TableLoaderGenerator.java
1ba61e616e5017df5e408df55d5e2de91212bae4
[ "Apache-2.0" ]
permissive
ReseauTransportLongueuil-RTL/gtfs-validator
99c154077bb098fbab8a14ec7e10301cca158190
b9e90ce25f698cbe55189434645aba6b2e3f0067
refs/heads/master
2023-01-24T11:10:32.321989
2020-12-04T16:47:40
2020-12-04T16:47:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,539
java
/* * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mobilitydata.gtfsvalidator.processor; import com.google.common.base.CaseFormat; import com.google.common.collect.ImmutableSet; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import org.mobilitydata.gtfsvalidator.annotation.FieldTypeEnum; import org.mobilitydata.gtfsvalidator.annotation.Generated; import org.mobilitydata.gtfsvalidator.annotation.GtfsLoader; import org.mobilitydata.gtfsvalidator.input.GtfsFeedName; import org.mobilitydata.gtfsvalidator.notice.EmptyFileNotice; import org.mobilitydata.gtfsvalidator.notice.MissingRequiredFileError; import org.mobilitydata.gtfsvalidator.notice.NoticeContainer; import org.mobilitydata.gtfsvalidator.parsing.CsvFile; import org.mobilitydata.gtfsvalidator.parsing.CsvRow; import org.mobilitydata.gtfsvalidator.parsing.RowParser; import org.mobilitydata.gtfsvalidator.table.GtfsTableContainer; import org.mobilitydata.gtfsvalidator.table.GtfsTableLoader; import org.mobilitydata.gtfsvalidator.validator.TableHeaderValidator; import org.mobilitydata.gtfsvalidator.validator.ValidatorLoader; import javax.lang.model.element.Modifier; import java.io.Reader; import java.util.ArrayList; import java.util.List; import java.util.Set; import static org.mobilitydata.gtfsvalidator.processor.FieldNameConverter.fieldNameField; import static org.mobilitydata.gtfsvalidator.processor.FieldNameConverter.gtfsColumnName; import static org.mobilitydata.gtfsvalidator.processor.GtfsEntityClasses.TABLE_PACKAGE_NAME; /** * Generates code for a loader for a GTFS table. The loader creates an instance of a corresponding GTFS container class. * <p> * E.g., GtfsStopTableLoader class is generated for "stops.txt". */ public class TableLoaderGenerator { private static final int LOG_EVERY_N_ROWS = 200000; private final GtfsFileDescriptor fileDescriptor; private final GtfsEntityClasses classNames; public TableLoaderGenerator(GtfsFileDescriptor fileDescriptor) { this.fileDescriptor = fileDescriptor; this.classNames = new GtfsEntityClasses(fileDescriptor); } private static String gtfsTypeToParserMethod(FieldTypeEnum typeEnum) { return "as" + CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, typeEnum.toString()); } public JavaFile generateGtfsTableLoaderJavaFile() { return JavaFile.builder( TABLE_PACKAGE_NAME, generateGtfsTableLoaderClass()).build(); } public TypeSpec generateGtfsTableLoaderClass() { TypeSpec.Builder typeSpec = TypeSpec.classBuilder(classNames.tableLoaderSimpleName()) .superclass(ParameterizedTypeName.get(ClassName.get(GtfsTableLoader.class), classNames.entityImplementationTypeName())) .addAnnotation(GtfsLoader.class) .addAnnotation(Generated.class) .addModifiers(Modifier.PUBLIC); typeSpec.addField( FieldSpec.builder(String.class, "FILENAME", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL) .initializer("$S", fileDescriptor.filename()).build()); for (GtfsFieldDescriptor field : fileDescriptor.fields()) { typeSpec.addField( FieldSpec.builder(String.class, fieldNameField(field.name()), Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL) .initializer("$S", gtfsColumnName(field.name())).build()); } typeSpec.addMethod(MethodSpec.constructorBuilder().addModifiers(Modifier.PUBLIC).build()); typeSpec.addMethod(generateGtfsFilenameMethod()); typeSpec.addMethod(generateIsRequiredMethod()); typeSpec.addMethod(generateLoadMethod()); typeSpec.addMethod(generateLoadMissingFileMethod()); typeSpec.addMethod(generateGetColumnNamesMethod()); typeSpec.addMethod(generateGetRequiredColumnNamesMethod()); return typeSpec.build(); } private MethodSpec generateGetColumnNamesMethod() { ArrayList<String> fieldNames = new ArrayList<>(); fieldNames.ensureCapacity(fileDescriptor.fields().size()); for (GtfsFieldDescriptor field : fileDescriptor.fields()) { fieldNames.add(fieldNameField(field.name())); } MethodSpec.Builder method = MethodSpec.methodBuilder("getColumnNames") .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .returns(ParameterizedTypeName.get(Set.class, String.class)) .addStatement("return $T.of($L)", ImmutableSet.class, String.join(", ", fieldNames)); return method.build(); } private MethodSpec generateGetRequiredColumnNamesMethod() { ArrayList<String> fieldNames = new ArrayList<>(); fieldNames.ensureCapacity(fileDescriptor.fields().size()); for (GtfsFieldDescriptor field : fileDescriptor.fields()) { if (field.required()) { fieldNames.add(fieldNameField(field.name())); } } MethodSpec.Builder method = MethodSpec.methodBuilder("getRequiredColumnNames") .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .returns(ParameterizedTypeName.get(Set.class, String.class)) .addStatement("return $T.of($L)", ImmutableSet.class, String.join(", ", fieldNames)); return method.build(); } private MethodSpec generateLoadMethod() { TypeName gtfsEntityType = classNames.entityImplementationTypeName(); TypeName tableContainerTypeName = classNames.tableContainerTypeName(); MethodSpec.Builder method = MethodSpec.methodBuilder("load") .addModifiers(Modifier.PUBLIC) .addParameter(Reader.class, "reader") .addParameter(GtfsFeedName.class, "feedName") .addParameter(ValidatorLoader.class, "validatorLoader") .addParameter(NoticeContainer.class, "noticeContainer") .returns(ParameterizedTypeName.get(ClassName.get(GtfsTableContainer.class), gtfsEntityType)) .addStatement("$T csvFile = new $T(reader, FILENAME)", CsvFile.class, CsvFile.class) .beginControlFlow("if (csvFile.isEmpty())") .addStatement( "noticeContainer.addNotice(new $T(FILENAME))", EmptyFileNotice.class) .addStatement( "$T table = $T.forEmptyFile()", tableContainerTypeName, tableContainerTypeName) .addStatement( "validatorLoader.invokeSingleFileValidators(table, noticeContainer)") .addStatement("return table") .endControlFlow() .beginControlFlow("if (!new $T().validate(FILENAME, csvFile.getColumnNames(), " + "getColumnNames(), getRequiredColumnNames(), noticeContainer))", TableHeaderValidator.class) .addStatement("return $T.forInvalidHeaders()", tableContainerTypeName) .endControlFlow(); for (GtfsFieldDescriptor field : fileDescriptor.fields()) { method.addStatement( "final int $LColumnIndex = csvFile.getColumnIndex($L)", field.name(), fieldNameField(field.name())); } method.addStatement("$T.Builder builder = new $T.Builder()", gtfsEntityType, gtfsEntityType) .addStatement( "$T rowParser = new $T(feedName, noticeContainer)", RowParser.class, RowParser.class) .addStatement("$T entities = new $T<>()", ParameterizedTypeName.get(ClassName.get(List.class), gtfsEntityType), ArrayList.class); method.beginControlFlow( "for ($T row : csvFile)", CsvRow.class); method.beginControlFlow("if (row.getRowNumber() % $L == 0)", LOG_EVERY_N_ROWS) .addStatement("System.out.println($S + FILENAME + $S + row.getRowNumber())", "Reading ", ", row ") .endControlFlow(); method .addStatement("rowParser.setRow(row)") .addStatement("rowParser.checkRowColumnCount(csvFile)") .addStatement("builder.clear()") .addStatement("builder.$L(row.getRowNumber())", FieldNameConverter.setterMethodName("csvRowNumber")); for (GtfsFieldDescriptor field : fileDescriptor.fields()) { method.addStatement( "builder.$L(rowParser.$L($LColumnIndex, $T.$L$L))", FieldNameConverter.setterMethodName(field.name()), gtfsTypeToParserMethod(field.type()), field.name(), RowParser.class, field.required() ? "REQUIRED" : "OPTIONAL", field.numberBounds().isPresent() ? ", RowParser.NumberBounds." + field.numberBounds().get() : field.type() == FieldTypeEnum.ENUM ? ", " + field.javaType().toString() + "::forNumber" : ""); } method.beginControlFlow("if (!rowParser.hasParseErrorsInRow())") .addStatement("$T entity = builder.build()", gtfsEntityType) .addStatement("validatorLoader.invokeSingleEntityValidators(entity, noticeContainer)") .addStatement("entities.add(entity)") .endControlFlow(); method.endControlFlow(); // end for (row) method.addStatement("$T table = $T.forEntities(entities, noticeContainer)", tableContainerTypeName, tableContainerTypeName) .addStatement( "validatorLoader.invokeSingleFileValidators(table, noticeContainer)") .addStatement("return table"); return method.build(); } private MethodSpec generateGtfsFilenameMethod() { return MethodSpec.methodBuilder("gtfsFilename") .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .returns(String.class) .addStatement("return FILENAME") .build(); } private MethodSpec generateIsRequiredMethod() { return MethodSpec.methodBuilder("isRequired") .addModifiers(Modifier.PUBLIC) .returns(boolean.class) .addAnnotation(Override.class) .addStatement("return $L", fileDescriptor.required()) .build(); } private MethodSpec generateLoadMissingFileMethod() { TypeName gtfsEntityType = classNames.entityImplementationTypeName(); MethodSpec.Builder method = MethodSpec.methodBuilder("loadMissingFile") .addModifiers(Modifier.PUBLIC) .addParameter(ValidatorLoader.class, "validatorLoader") .addParameter(NoticeContainer.class, "noticeContainer") .returns(ParameterizedTypeName.get(ClassName.get(GtfsTableContainer.class), gtfsEntityType)) .addAnnotation(Override.class) .addStatement("$T table = $T.forMissingFile()", classNames.tableContainerTypeName(), classNames.tableContainerTypeName()) .beginControlFlow("if (isRequired())") .addStatement("noticeContainer.addNotice(new $T(gtfsFilename()))", MissingRequiredFileError.class) .endControlFlow() .addStatement("validatorLoader.invokeSingleFileValidators(table, noticeContainer)") .addStatement("return table"); return method.build(); } }
8258d875354f5f2da26c140d01eb45abb83f1073
9c21e86c9772b932e85d0200bb0645115e693d3e
/interfaces/music5/Music5.java
dac2c42cf63d04204c8f96eb64440d9ccbb69223
[]
no_license
duranchen/OnJava8
64c9ccff272df15c5060a077de247989b191064a
ba20b128a7d3d7f98beac4bb26d0ee034a1c69b2
refs/heads/master
2022-09-09T09:25:05.103693
2020-05-31T09:23:15
2020-05-31T09:23:15
262,552,627
0
0
null
null
null
null
UTF-8
Java
false
false
1,307
java
package interfaces.music5; import polymorphism.music.Note; interface Instrument { int VALUE =5; default void play(Note n) { System.out.println(this + ".play() " + n); } default void adjust() { System.out.println("Adjusting " + this); } } class Wind implements Instrument { @Override public String toString() { return "Wind"; } } class Percussion implements Instrument { @Override public String toString() { return "Percussion"; } } class Stringed implements Instrument { @Override public String toString() { return "Stringed"; } } class Brass extends Wind { @Override public String toString() { return "Brass"; } } class Woodwind extends Wind { @Override public String toString() { return "Woodwind"; } } public class Music5 { static void tune(Instrument i) { i.play(Note.MIDDLE_C); } static void tuneAll(Instrument[] e) { for (Instrument i: e) { tune(i); } } public static void main(String[] args) { Instrument[] orchestra = { new Wind(), new Percussion(), new Stringed(), new Brass(), new Woodwind() }; tuneAll(orchestra); } }
12faa86278ba7ec7a0b4fc3a5b1ea4880d19e999
74b2cb9e8e5d5042ff3a00278d78e39f037a9e4b
/src/main/java/com/hackathon/mred/config/apidoc/SwaggerConfiguration.java
fbba16cf5df55d54024089c2bd105545a62c7c68
[]
no_license
BulkSecurityGeneratorProject/hackathon
ad4ce4530357940775c4bb772788e95d55070b64
5d84632b66d839ac37c8a81f0a574ab56b879d27
refs/heads/master
2022-12-28T17:54:46.799835
2016-12-16T10:50:45
2016-12-16T10:50:45
296,586,464
0
0
null
2020-09-18T10:15:16
2020-09-18T10:15:15
null
UTF-8
Java
false
false
2,760
java
package com.hackathon.mred.config.apidoc; import com.hackathon.mred.config.Constants; import com.hackathon.mred.config.JHipsterProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.*; import org.springframework.http.ResponseEntity; import org.springframework.util.StopWatch; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; import static springfox.documentation.builders.PathSelectors.regex; /** * Springfox Swagger configuration. * * Warning! When having a lot of REST endpoints, Springfox can become a performance issue. In that * case, you can use a specific Spring profile for this class, so that only front-end developers * have access to the Swagger view. */ @Configuration @EnableSwagger2 @Import(springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration.class) @Profile(Constants.SPRING_PROFILE_SWAGGER) public class SwaggerConfiguration { private final Logger log = LoggerFactory.getLogger(SwaggerConfiguration.class); public static final String DEFAULT_INCLUDE_PATTERN = "/api/.*"; /** * Swagger Springfox configuration. * * @param jHipsterProperties the properties of the application * @return the Swagger Springfox configuration */ @Bean public Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start(); Contact contact = new Contact( jHipsterProperties.getSwagger().getContactName(), jHipsterProperties.getSwagger().getContactUrl(), jHipsterProperties.getSwagger().getContactEmail()); ApiInfo apiInfo = new ApiInfo( jHipsterProperties.getSwagger().getTitle(), jHipsterProperties.getSwagger().getDescription(), jHipsterProperties.getSwagger().getVersion(), jHipsterProperties.getSwagger().getTermsOfServiceUrl(), contact, jHipsterProperties.getSwagger().getLicense(), jHipsterProperties.getSwagger().getLicenseUrl()); Docket docket = new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo) .forCodeGeneration(true) .genericModelSubstitutes(ResponseEntity.class) .select() .paths(regex(DEFAULT_INCLUDE_PATTERN)) .build(); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return docket; } }
f8b0a7d56b2c079392a526a2fd28837ba3fda7e4
bb60768a6eb5435a4b315f4af861b25addfd3b44
/dingtalk/java/src/main/java/com/aliyun/dingtalkdrive_1_0/models/AddFileRequest.java
d6910f8d6d67960296976cc3929250d6d9db5391
[ "Apache-2.0" ]
permissive
yndu13/dingtalk-sdk
f023e758d78efe3e20afa1456f916238890e65dd
700fb7bb49c4d3167f84afc5fcb5e7aa5a09735f
refs/heads/master
2023-06-30T04:49:11.263304
2021-08-12T09:54:35
2021-08-12T09:54:35
395,271,690
0
0
null
null
null
null
UTF-8
Java
false
false
2,007
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.dingtalkdrive_1_0.models; import com.aliyun.tea.*; public class AddFileRequest extends TeaModel { // 父目录id @NameInMap("parentId") public String parentId; // 文件类型 @NameInMap("fileType") public String fileType; // 文件名 @NameInMap("fileName") public String fileName; // mediaId @NameInMap("mediaId") public String mediaId; // 文件名冲突策略 @NameInMap("addConflictPolicy") public String addConflictPolicy; // 用户id @NameInMap("unionId") public String unionId; public static AddFileRequest build(java.util.Map<String, ?> map) throws Exception { AddFileRequest self = new AddFileRequest(); return TeaModel.build(map, self); } public AddFileRequest setParentId(String parentId) { this.parentId = parentId; return this; } public String getParentId() { return this.parentId; } public AddFileRequest setFileType(String fileType) { this.fileType = fileType; return this; } public String getFileType() { return this.fileType; } public AddFileRequest setFileName(String fileName) { this.fileName = fileName; return this; } public String getFileName() { return this.fileName; } public AddFileRequest setMediaId(String mediaId) { this.mediaId = mediaId; return this; } public String getMediaId() { return this.mediaId; } public AddFileRequest setAddConflictPolicy(String addConflictPolicy) { this.addConflictPolicy = addConflictPolicy; return this; } public String getAddConflictPolicy() { return this.addConflictPolicy; } public AddFileRequest setUnionId(String unionId) { this.unionId = unionId; return this; } public String getUnionId() { return this.unionId; } }
50de0989e5e9f7d9347cf864861b5a857cb3135f
fba58f501701ebe25a48590f34f076082217026e
/src/main/java/wang/mh/base/collection/CollectionsDemo.java
6bdfc24e7267d84e7c0217637031cd361f61a47c
[]
no_license
HelloWangmh/java-learning
c773f773527dee63e72d1d9f6287aeea567bcc09
90a7828d49b1dc65df51f89cddb8c73824c2d23f
refs/heads/master
2022-11-25T17:25:53.039118
2021-04-22T01:34:49
2021-04-22T01:34:49
90,616,908
2
0
null
2022-11-16T09:28:01
2017-05-08T10:43:01
Java
UTF-8
Java
false
false
2,707
java
package wang.mh.base.collection; import com.google.common.collect.Lists; import java.util.*; public class CollectionsDemo { public static void main(String[] args) { listToArr(); } /** * 集合转数组 */ private static void listToArr(){ ArrayList<Integer> list = Lists.newArrayList(); list.add(1); list.add(2); list.add(3); //返回一个新数组 Integer[] arr = list.toArray(new Integer[0]); System.out.println("arr:"+arr[1]); //如果arr.length >= size 那么返回的就是这个数组 Integer[] existArr = new Integer[list.size()+1]; Integer[] newArr = list.toArray(existArr); System.out.println(newArr == existArr); //true System.out.println("existArr:"+existArr[1]); System.out.println("existArr:"+existArr[3]); //null System.out.println("newArr:"+newArr[1]); } /** * 返回一个空集合 * 不可修改 */ private static void testEmpty(){ Set<String> set = Collections.emptySet(); set.add("hello"); //error UnsupportedOperationException } /** * 返回给定范围的集合 包前不包后 * subList的改变也会影响原始List */ private static void testSubList(){ ArrayList<Integer> list = Lists.newArrayList(); list.add(1); list.add(2); list.add(3); list.add(4); List<Integer> subList = list.subList(0, 2); subList.remove(new Integer(1)); System.out.println(subList); //2 System.out.println(list); // 2 3 4 } /** * 返回一个数组元素的列表视图,可以修改,但是不能改变大小 */ private static void testAsList(){ List<Integer> list = Arrays.asList(1, 2, 3); list.set(0,11); list.add(5);//error } /** * 不可修改 */ private static void testSingleton(){ Set<Integer> singleton = Collections.singleton(1); singleton.add(2); //error } /** * 不可改变 返回一个包含n个相同元素的列表,集合 */ private static void testNCopies(){ List<Integer> integers = Collections.nCopies(100, 88); integers.add(1); System.out.println("size:"+integers.size());//100 } /** * 受查视图 * 添加的时候会进行类型检查,避免在get()时候发现 * */ private static void testCheckedList(){ List<String> list = Collections.checkedList(new ArrayList<>(),String.class); list.add("test"); List listObj = list; //error ClassCastException listObj.add(1); } }
95ff849b3c858829a7bb881affb7bc274d4c5b27
b92e887aaaa55e5875727892381e2f0eb117f629
/app/src/test/java/com/huburt/app/ExampleUnitTest.java
d8cd4783c7d3d13fbf8798b4a0104102b882fbd5
[]
no_license
huburt-Hu/AndroidArchitecture
e9cc51ee50475d54f013336dce70692cbc59cbb7
caac91c03b3685777dca542554928bb772814210
refs/heads/master
2021-08-24T05:31:49.358539
2017-12-08T07:21:40
2017-12-08T07:21:40
112,594,544
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
package com.huburt.app; 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() throws Exception { assertEquals(4, 2 + 2); } }
9fa180e8815db410d99f46c30e17c379b47cddf5
26c38e9bb35e79c899cff9c5e3ccef7b949832ff
/apps-test/taglib-it/src/test/java/org/apache/struts/taglib/SimpleBeanForTesting.java
5a3d0969b6f8783fbf3a71e9276a40728ae5740f
[]
no_license
apache/struts-sandbox
58292b54dccdce5de68e6a186ff6b64e1fb33d96
e9b8ac4c8b53387bd96da9bcc0dd01bbc2725e3b
refs/heads/trunk
2023-08-05T16:10:39.408041
2022-04-23T08:38:11
2022-04-23T08:38:11
206,401
3
16
null
2022-04-22T21:32:02
2009-05-21T01:42:37
Java
UTF-8
Java
false
false
7,215
java
/* * $Id$ * * Copyright 1999-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.struts.taglib; import org.apache.struts.action.ActionForm; import java.util.Collection; import java.util.Enumeration; import java.util.List; import java.util.Map; /** * Simple bean for unit tests. */ public class SimpleBeanForTesting extends ActionForm { public SimpleBeanForTesting() { super(); } public SimpleBeanForTesting(List lst) { this.lst = lst; } public SimpleBeanForTesting(boolean checked) { this.checked = checked; } public SimpleBeanForTesting(Boolean checkedWrapper) { this.checkedWrapper = checkedWrapper; } public SimpleBeanForTesting(Map map) { this.map = map; } public SimpleBeanForTesting(String string) { this.string = string; } public SimpleBeanForTesting(String[] stringArray) { this.stringArray = stringArray; } public SimpleBeanForTesting(Integer integerValue) { this.integerValue = integerValue; } private String string; private String[] stringArray; private Integer integerValue; private Double doubleValue; private List lst; private Map map; private String x; private String y; private Object nestedObject; private Object[] array; private Enumeration enumeration; private Collection collection; private boolean checked; private Boolean checkedWrapper; //Copied right from the FAQ private String strAry[] = { "String 0", "String 1", "String 2", "String 3", "String 4" }; public String getStringIndexed(int index) { return (strAry[index]); } public void setStringIndexed(int index, String value) { strAry[index] = value; } /** * Returns the lst. * * @return List */ public List getList() { return lst; } /** * Returns the map. * * @return Map */ public Map getMap() { return map; } /** * Sets the lst. * * @param lst The lst to set */ public void setList(List lst) { this.lst = lst; } /** * Sets the map. * * @param map The map to set */ public void setMap(Map map) { this.map = map; } /** * Returns the string. * * @return String */ public String getString() { return string; } /** * Sets the string. * * @param string The string to set */ public void setString(String string) { this.string = string; } /** * Returns an array of type String. * * @return String[] */ public String[] getStringArray() { return stringArray; } /** * Sets the string array. * * @param string The string array to set */ public void setStringArray(String[] stringArray) { this.stringArray = stringArray; } /** * Returns the lst. * * @return List */ public List getLst() { return lst; } /** * Sets the lst. * * @param lst The lst to set */ public void setLst(List lst) { this.lst = lst; } /** * Returns the Object Array. * * @return Object[] */ public Object[] getArray() { return array; } /** * Sets the Object Array . * * @param array The Object array to set */ public void setArray(Object[] array) { this.array = array; } /** * Returns the enumeration. * * @return Enumeration */ public Enumeration getEnumeration() { return enumeration; } /** * Sets the enumeration. * * @param enumeration The enumeration to set */ public void setEnumeration(Enumeration enumeration) { this.enumeration = enumeration; } /** * Returns the nestedObject. * * @return Object */ public Object getNestedObject() { return nestedObject; } /** * Sets the nestedObject. * * @param nestedObject The nestedObject to set */ public void setNestedObject(Object nestedObject) { this.nestedObject = nestedObject; } /** * Returns the collection. * * @return Collection */ public Collection getCollection() { return collection; } /** * Sets the collection. * * @param collection The collection to set */ public void setCollection(Collection collection) { this.collection = collection; } /** * Returns the doubleValue. * * @return Double */ public Double getDoubleValue() { return doubleValue; } /** * Returns the integerValue. * * @return Integer */ public Integer getIntegerValue() { return integerValue; } /** * Sets the doubleValue. * * @param doubleValue The doubleValue to set */ public void setDoubleValue(Double doubleValue) { this.doubleValue = doubleValue; } /** * Sets the integerValue. * * @param integerValue The integerValue to set */ public void setIntegerValue(Integer integerValue) { this.integerValue = integerValue; } /** * Returns the checked. * * @return boolean */ public boolean isChecked() { return checked; } /** * Sets the checked. * * @param checked The checked to set */ public void setChecked(boolean checked) { this.checked = checked; } /** * Returns the checkedWrapper. * * @return Boolean */ public Boolean getCheckedWrapper() { return checkedWrapper; } /** * Sets the checkedWrapper. * * @param checkedWrapper The checkedWrapper to set */ public void setCheckedWrapper(Boolean checkedWrapper) { this.checkedWrapper = checkedWrapper; } /** * Returns the x. * * @return String */ public String getX() { return x; } /** * Returns the y. * * @return String */ public String getY() { return y; } /** * Sets the x. * * @param x The x to set */ public void setX(String x) { this.x = x; } /** * Sets the y. * * @param y The y to set */ public void setY(String y) { this.y = y; } public String getJustThrowAnException() throws Exception { throw new Exception(); } }
bcb000aa32225342c3007f475d9be1871b2ec0d8
6ae77f59faecb1f7c1879c98bf5c730ed463ec9b
/src/java/servlets_form_data/CheckBox_request.java
ba604e08145f32fdf149bccd88add837eedc904b
[]
no_license
mohammed-a-wadod/Servlets_TutorialsPoint
9e69d2e0afc63a9ddf976205e891d5c644864b39
4166673b2fbbf81ba3110a51010e8dbac0b6bb70
refs/heads/master
2021-01-16T21:21:16.104953
2014-11-18T12:08:24
2014-11-18T12:08:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,174
java
package servlets_form_data; import java.io.IOException; import java.io.PrintWriter; import java.util.Enumeration; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class CheckBox_request extends HttpServlet { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { /* * as we do by using getParameter method in the GET_Method class we can use the same way * but here we want to use other way to read all parameters coming for CHECKBOX form */ PrintWriter out = resp.getWriter(); read_CheckBox_Single_Value(req, resp); // here we are using the old Way which in the GET_method Class out.println("<hr/>"); out.println("<h1> Using Enumeration"+ "</h1>"); read_CheckBox_All_Values(req, resp); // here we are reading all the values } private void read_CheckBox_Single_Value(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); out.println("Me : " + req.getParameter("Me") + "<br>"); out.println("Here : " + req.getParameter("Here") + "<br>"); out.println("There : " + req.getParameter("There") + "<br>"); } private void read_CheckBox_All_Values(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); //creating Enumeration which takes all paramter names from request Enumeration paramNames = req.getParameterNames(); //use hasMoreELements to move arround this enum while (paramNames.hasMoreElements()) { //get the first emum element which represent the name pass through the request String paramName = (String) paramNames.nextElement(); //here i don't know if this paramter carry one value or more //so i will use getPrameterValues which return array of values String[] paramValues = req.getParameterValues(paramName); //check if hte paramValues has one element or not if (paramValues.length == 1) { String paramValue = paramValues[0]; //here check if this value.length==0 then we don't have value if (paramValue.length() == 0) { out.println("No Value <br>"); } else { out.println(paramName + " : " + paramValue + "<br>"); } } else { // here we have more than one element in the paramValues //so i need to loop on in it for (int i = 1; i < paramValues.length; i++) { out.println(paramName + " : " + paramValues[i] + "<br>"); } } } } }
[ "Muhammed@Muhammed-wadod" ]
Muhammed@Muhammed-wadod
10e3a1943ff1f6ca90d2ea5efdbef4a8601e1777
23d0987433973217344b570039f53f70b48261de
/src/main/java/dev/map/anticheat/events/CompassCPS.java
d8fd09d23698a305ec273bfde24b9c273a41532f
[]
no_license
gabrielvicenteYT/MapAntiCheat
47c78a6bb417651af218f53d8d5a1161f14d9886
c1635f62128008c2ff2a121d3404c5602997ca8b
refs/heads/master
2023-04-05T02:40:09.783063
2021-03-30T20:42:06
2021-03-30T20:42:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,157
java
package dev.map.anticheat.events; import com.sun.tools.javac.util.Convert; import dev.map.anticheat.autoclicker.CPSDetection; import dev.map.anticheat.main.Main; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerInteractEntityEvent; import java.util.HashMap; import java.util.UUID; public class CompassCPS implements Listener { private int taskID; private int clicks = 0; private int playerclicks; private HashMap<UUID, Boolean> playerIDisRunningMap = new HashMap<UUID, Boolean>(); @EventHandler public void onClick(PlayerInteractEntityEvent event) { Entity target = event.getRightClicked(); String targetname = target.getName(); Player player = event.getPlayer(); if (target instanceof Player) { if (player.getItemInHand().getType().equals(Material.COMPASS)) { if (!playerIDisRunningMap.containsKey(player.getUniqueId())) { playerIDisRunningMap.put(player.getUniqueId(), false); } else { if (playerIDisRunningMap.get(player.getUniqueId()) == true) { player.sendMessage(ChatColor.RED + "Thread is already running."); } else { taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getPlugin(Main.class), new Runnable() { int index = 11; double averageclicks = 0; public void run() { if (index == 11) { playerIDisRunningMap.put(player.getUniqueId(), false); CPSDetection.clicks.put(target.getUniqueId(), 0); index--; playerIDisRunningMap.put(player.getUniqueId(), true); } else if (index > 0 && index < 11) { clicks = CPSDetection.clicks.get(target.getUniqueId()); player.sendMessage(ChatColor.GRAY + "Clicks: " + ChatColor.DARK_AQUA + clicks); averageclicks = averageclicks + clicks; CPSDetection.clicks.put(target.getUniqueId(), 0); index--; } if (index == 0) { player.sendMessage(target.getName() + ChatColor.GRAY + ": Had an average of " + ChatColor.DARK_AQUA + averageclicks / 10 + " CPS"); Bukkit.getScheduler().cancelTask(taskID); playerIDisRunningMap.put(player.getUniqueId(), false); } } }, 0, 20); } } } } } }
2466001e9b5d3f933a2d1b82feddf0cfc2b2b380
53e540321e8453827d115bd4847073f75c05394e
/library/app/src/androidTest/java/com/longzhiye/android/libdemo/ApplicationTest.java
3076c92e3b39e58c25169e6cfb033e7c1e603565
[]
no_license
longzhiye/LibLongzhiye
c5794323fa0610da2b19cc47719f1c69b3778082
cc6c1206f34cdc25c61c890e4bee372081e88d98
refs/heads/master
2021-01-13T05:23:45.043822
2017-03-08T09:17:52
2017-03-08T09:17:52
81,399,567
1
0
null
null
null
null
UTF-8
Java
false
false
360
java
package com.longzhiye.android.libdemo; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
ff61492cdac499c392a31ba5b08258a9abd7ba89
09389d27cb0559859c1d78714367d785123277b2
/src/main/java/org/uma/mbd/mdRectas/rectas/Segmento.java
06dbce0048cb99396ca5f99bd355aa0bc4e3c0ca
[]
no_license
Proteus1989/BigData-UMA-Master-Java
3d0854238f56ce88620a20ad374b3d8012565b09
30992e4d34ed1b56a129c24f0349914a3d5fa512
refs/heads/master
2022-04-03T15:11:53.330176
2020-02-03T21:48:35
2020-02-03T21:48:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
677
java
package org.uma.mbd.mdRectas.rectas; public class Segmento { private Punto origen; private Punto extremo; public Segmento(double x1, double y1, double x2, double y2) { origen = new Punto(x1, y1); extremo = new Punto(x2, y2); } public Segmento(Punto p1, Punto p2) { origen = p1; extremo = p2; } public void trasladar(double a, double b) { origen.trasladar(a, b); extremo.trasladar(a, b); } public double longitud() { return origen.distancia(extremo); } @Override public String toString() { return "S(" + origen + ", " + extremo + ")"; } }
4ac4effd43f682958e6e073ba27d31ec2db8267d
571fc48d53e6377d2fe266f84c35181aacc80202
/Fgcm/app/src/main/java/com/fanwang/fgcm/MainActivity.java
5d10255700ca45b250d13b1516f859314e5cc761
[]
no_license
edcedc/Fg
618a381d4399664d3fac9e04dd7a11b62b752f7e
19fd32837347fd17f9b43e816e3cc9fd0c207eb4
refs/heads/master
2020-04-04T10:08:23.469555
2019-06-29T06:09:21
2019-06-29T06:09:21
155,843,816
0
0
null
null
null
null
UTF-8
Java
false
false
11,372
java
package com.fanwang.fgcm; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import com.baidu.location.BDLocation; import com.baidu.location.BDLocationListener; import com.baidu.location.LocationClient; import com.baidu.location.LocationClientOption; import com.baidu.mapapi.SDKInitializer; import com.blankj.utilcode.util.LogUtils; import com.fanwang.fgcm.bean.User; import com.fanwang.fgcm.controller.CloudApi; import com.fanwang.fgcm.event.BundleDataInEvent; import com.fanwang.fgcm.gt.MyGTIntentService; import com.fanwang.fgcm.gt.MyGTService; import com.fanwang.fgcm.view.ui.MainFrg; import com.fanwang.fgcm.weight.ShareLoginOK; import com.igexin.sdk.PushManager; import com.umeng.socialize.UMShareAPI; import org.json.JSONObject; import io.reactivex.Observer; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.Disposable; import io.reactivex.functions.Consumer; import me.yokeyword.eventbusactivityscope.EventBusActivityScope; import me.yokeyword.fragmentation.SwipeBackLayout; import me.yokeyword.fragmentation.anim.FragmentAnimator; import me.yokeyword.fragmentation_swipeback.SwipeBackActivity; public class MainActivity extends SwipeBackActivity { // 定位相关 private LocationClient mLocClient; private MyLocationListenner myListener = new MyLocationListenner(); @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); // getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); setContentView(R.layout.activity_main); if (findFragment(MainFrg.class) == null) { loadRootFragment(R.id.fl_container, MainFrg.newInstance()); } getSwipeBackLayout().setEdgeOrientation(SwipeBackLayout.EDGE_ALL); setSwipeBackEnable(false); // 注册 SDK 广播监听者 IntentFilter iFilter = new IntentFilter(); iFilter.addAction(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_OK); iFilter.addAction(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR); iFilter.addAction(SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR); mReceiver = new BaiduReceiver(); registerReceiver(mReceiver, iFilter); //定位 // 定位初始化 mLocClient = new LocationClient(this); mLocClient.registerLocationListener(myListener); LocationClientOption option = new LocationClientOption(); option.setOpenGps(true); // 打开gps option.setCoorType("bd09ll"); // 设置坐标类型 option.setScanSpan(1000); option.setIsNeedAddress(true); //加上这个配置后才可以取到详细地址信息 mLocClient.setLocOption(option); mLocClient.start(); ShareLoginOK.getInstance(this).save(true); initGT(); } protected void initGT() { // 为第三方自定义推送服务 PushManager.getInstance().initialize(this, MyGTService.class); // 为第三方自定义的推送服务事件接收类 PushManager.getInstance().registerPushIntentService(this, MyGTIntentService.class); PushManager.getInstance().turnOnPush(this); } /** * 限制SwipeBack的条件,默认栈内Fragment数 <= 1时 , 优先滑动退出Activity , 而不是Fragment * * @return true: Activity优先滑动退出; false: Fragment优先滑动退出 */ @Override public boolean swipeBackPriority() { return super.swipeBackPriority(); } public FragmentAnimator onCreateFragmentAnimator() { return super.onCreateFragmentAnimator(); } @Override public void onBackPressedSupport() { // 对于 4个类别的主Fragment内的回退back逻辑,已经在其onBackPressedSupport里各自处理了 super.onBackPressedSupport(); } /** * Android 点击EditText文本框之外任何地方隐藏键盘 */ @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { View v = getCurrentFocus(); if (isShouldHideInput(v, ev)) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.hideSoftInputFromWindow(v.getWindowToken(), 0); } } return super.dispatchTouchEvent(ev); } // 必不可少,否则所有的组件都不会有TouchEvent了 if (getWindow().superDispatchTouchEvent(ev)) { return true; } return onTouchEvent(ev); } private boolean isShouldHideInput(View v, MotionEvent event) { if (v != null && (v instanceof EditText)) { int[] leftTop = {0, 0}; //获取输入框当前的location位置 v.getLocationInWindow(leftTop); int left = leftTop[0]; int top = leftTop[1]; int bottom = top + v.getHeight(); int right = left + v.getWidth(); if (event.getX() > left && event.getX() < right && event.getY() > top && event.getY() < bottom) { // 点击的是输入框区域,保留点击EditText的事件 return false; } else { return true; } } return false; } /** * 构造广播监听类,监听 SDK key 验证以及网络异常广播 */ private class BaiduReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { String s = intent.getAction(); if (s.equals(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR)) { LogUtils.e("key 验证出错! 错误码 :" + intent.getIntExtra (SDKInitializer.SDK_BROADTCAST_INTENT_EXTRA_INFO_KEY_ERROR_CODE, 0) + " ; 请在 AndroidManifest.xml 文件中检查 key 设置"); } else if (s.equals(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_OK)) { LogUtils.e("key 验证成功! 功能可以正常使用"); } else if (s.equals(SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR)) { LogUtils.e("网络出错"); } } } private BaiduReceiver mReceiver; @Override protected void onDestroy() { super.onDestroy(); // 取消监听 SDK 广播 unregisterReceiver(mReceiver); } private static final int REQUEST_CODE_SETTING = 300; @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { switch (requestCode) { case BundleDataInEvent.select_video: EventBusActivityScope.getDefault(this).post(new BundleDataInEvent(BundleDataInEvent.select_video, data)); break; case BundleDataInEvent.select_img: EventBusActivityScope.getDefault(this).post(new BundleDataInEvent(BundleDataInEvent.select_img, data)); break; case REQUEST_CODE_SETTING: break; } } UMShareAPI.get(this).onActivityResult(requestCode, resultCode, data); } /** * 定位SDK监听函数 */ public class MyLocationListenner implements BDLocationListener { @Override public void onReceiveLocation(BDLocation location) { // map view 销毁后不在处理新接收的位置 if (location == null) { return; } // mCurrentLat = location.getLatitude(); // mCurrentLon = location.getLongitude(); LogUtils.e(location.getLatitude(), location.getLongitude(), location.getProvince(), location.getCity(), location.getDistrict()); /* mCurrentAccracy = location.getRadius(); locData = new MyLocationData.Builder() .accuracy(location.getRadius()) // 此处设置开发者获取到的方向信息,顺时针0-360 .direction(mCurrentDirection).latitude(location.getLatitude()) .longitude(location.getLongitude()).build(); if (isFirstLoc) { isFirstLoc = false; LatLng ll = new LatLng(location.getLatitude(), location.getLongitude()); MapStatus.Builder builder = new MapStatus.Builder(); builder.target(ll).zoom(18.0f); }*/ mLocClient.stop(); double latitude = location.getLatitude(); double longitude = location.getLongitude(); String province = location.getProvince(); String city = location.getCity(); String district = location.getDistrict(); String street = location.getStreet(); String streetNumber = location.getStreetNumber(); Bundle bundle = new Bundle(); bundle.putDouble("latitude", latitude); bundle.putDouble("longitude", longitude); bundle.putString("province", province == null ? "广东省" : province); bundle.putString("city", city == null ? "广州市" : city); bundle.putString("district", district == null ? "番禺区" : district); bundle.putString("street", street); bundle.putString("streetNumber", streetNumber); User.getInstance().setAddressBundle(bundle); // EventBusActivityScope.getDefault(MainActivity.this).post(new BundleDataInEvent(BundleDataInEvent.mLookMap)); userupdate(longitude, latitude); } } @Override protected void onStop() { super.onStop(); mLocClient.stop(); } private void userupdate(double location, double latitude){ CloudApi.userupdate(location, latitude) .doOnSubscribe(new Consumer<Disposable>() { @Override public void accept(Disposable disposable) throws Exception { } }) .subscribeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<JSONObject>() { @Override public void onSubscribe(Disposable d) { } @Override public void onNext(JSONObject jsonObject) { } @Override public void onError(Throwable e) { } @Override public void onComplete() { } }); } }
ca33df55655dfef9454315c3cdd71ba39504e5f8
27c60f5f4a933713fce384264d3f8eb05442feb6
/A09/src/FilterFactory.java
2d2848b6f63a2d79be15471b82787bd31648da1d
[]
no_license
rieder91/Programmierpraxis
fe95f512d44c2cae38b5600bc906c6d8c5a0507b
2b7e3439dfac561684d56e424d82e3d45555942b
refs/heads/master
2021-01-01T08:56:51.325156
2012-01-21T14:25:12
2012-01-21T14:25:12
2,852,666
0
1
null
null
null
null
ISO-8859-1
Java
false
false
1,812
java
import java.util.Scanner; /** * @author Thomas Rieder * @matrikelnummer 1125403 * @date 2011-12-16 * @description 9. Übungsbeispiel * */ public class FilterFactory implements Factory { /** * Standardkonstruktor */ public FilterFactory() { } /** * liest die Parameter für die Filteroperationen ein und gibt die jeweilige * Operation zurück * * @return jeweilige Filteroperation (derzeit nur median) */ public Operation create(Scanner scanner) throws FactoryException { // nur 1 Zeile auslesen scanner = new Scanner(scanner.nextLine()); String filter = null; String genType = null; Operation ret = null; BlockGenerator gen = new XBlockGenerator(); int size = 3; if (scanner.hasNext()) { filter = scanner.next(); // Zusätzlicher size-Parameter der Bonusaufgabe if (scanner.hasNextInt()) { size = scanner.nextInt(); if ((size % 2) == 0 || size <= 1) { throw new FactoryException("invalid size"); } } // Zusätzlicher Typ-Parameter der Bonusaufgabe if (scanner.hasNext()) { genType = scanner.next(); if (genType.equals("x")) { gen = new XBlockGenerator(size); } else if (genType.equals("circular")) { gen = new CircularBlockGenerator(size); } else if (genType.equals("replicate")) { gen = new ReplicateBlockGenerator(size); } else if (genType.equals("symmetric")) { gen = new SymmetricBlockGenerator(size); } else { throw new FactoryException("wrong parameters"); } } if (filter.equals("median")) { ret = new MedianOperation(gen); } else if (filter.equals("average")) { ret = new AverageOperation(gen); } else { throw new FactoryException("wrong parameters"); } } else { throw new FactoryException("wrong parameters"); } return ret; } }
066513cfb04728aa7d033d65853e83e292f97ed5
ea2bdf5ab8d469e95168024e66ca7dbb69f102b1
/src/main/java/view/Console.java
33ea28dd2d3a14fc7a755ef18ee6f0c1bb626ab9
[]
no_license
NikolayNN/StringFilter
9b29453ea128d2c6433e4c3f6dcb54b478fa7ccc
a0167f7147af3752762c8634a50d8b940b0b8f5a
refs/heads/master
2021-05-02T13:58:27.683596
2018-02-08T17:47:54
2018-02-08T17:47:54
120,709,090
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
package view; import java.util.Scanner; public class Console implements View { @Override public String read() { Scanner sc = new Scanner(System.in); return sc.nextLine(); } @Override public void write(String message) { System.out.println(message); } }
2a724d8f4c312dd8d44d1bf3f5deec8ef94b9895
c2fb6846d5b932928854cfd194d95c79c723f04c
/java_backup/my java/series/SUM.java
117c208d6f93d9aafaa0b53cede720ec7e83e68e
[ "MIT" ]
permissive
Jimut123/code-backup
ef90ccec9fb6483bb6dae0aa6a1f1cc2b8802d59
8d4c16b9e960d352a7775786ea60290b29b30143
refs/heads/master
2022-12-07T04:10:59.604922
2021-04-28T10:22:19
2021-04-28T10:22:19
156,666,404
9
5
MIT
2022-12-02T20:27:22
2018-11-08T07:22:48
Jupyter Notebook
UTF-8
Java
false
false
372
java
import java.io.*; public class SUM { public static void main(int n)throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader (System.in)); int s,p,i,j;p=1;s=0; for(i=1;i<=n;i++) {p=1; for(j=1;j<=i+1;j++) { p=p*j; } s=s+p; } System.out.println("THE SERIES:"+s); } }
7267ed5b0a0f97d123244022ad9c86d3137421c3
03e7edccca6f36675ac60a0a1b1076ba8fce3648
/app/src/main/java/appzlogic/architecturalexample/LocalDatabase/NoteViewModel.java
6bead4841a72ae4fc85f8c03cc3d8108c1462611
[]
no_license
satyendrababu/mvvm_room_retrofit_databinding
e7a447087e615026ae0c48673c49ca275d88fee5
ad6879d5dd7c17e637e1dc8b9699d9277f15da47
refs/heads/master
2022-09-05T23:21:57.319061
2020-05-27T17:49:35
2020-05-27T17:49:35
267,386,853
0
0
null
null
null
null
UTF-8
Java
false
false
1,019
java
package appzlogic.architecturalexample.LocalDatabase; import android.app.Application; import androidx.annotation.NonNull; import androidx.lifecycle.AndroidViewModel; import androidx.lifecycle.LiveData; import java.util.List; public class NoteViewModel extends AndroidViewModel { private NoteRepository repository; private LiveData<List<Note>> allNotes; public NoteViewModel(@NonNull Application application) { super(application); repository = new NoteRepository(application); allNotes = repository.getAllNotes(); } public void insert(Note note){ repository.insert(note); } public void update(Note note){ repository.update(note); } public void delete(Note note){ repository.delete(note); } public void deleteAllNotes(){ repository.deleteAllNotes(); } public LiveData<List<Note>> getAllNotes(){ return allNotes; } public void initData(){ allNotes = repository.getAllNotes(); } }
fe57a4df57ff13c6ad0d6c9141c05f579f601b35
04eb88e2eb3fd7004930170919eff41a0a9e0d6b
/src/main/java/com/anbang/qipai/xiuxianchang/msg/service/DianpaoGameRoomMsgService.java
9f924ef4a5909bfe92808f2737c35ced8bd6e4bd
[]
no_license
flyarong/qipai_xiuxianchang
65240715b01c51a1b82278fca83544c3a4b60e12
93d8ac49b3d7116fd607f45635edece27b57547d
refs/heads/master
2023-03-15T16:23:59.061112
2019-05-15T07:32:24
2019-05-15T07:32:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,184
java
package com.anbang.qipai.xiuxianchang.msg.service; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.stream.annotation.EnableBinding; import org.springframework.messaging.support.MessageBuilder; import com.anbang.qipai.xiuxianchang.msg.channel.source.DianpaoGameRoomSource; import com.anbang.qipai.xiuxianchang.msg.msjobs.CommonMO; @EnableBinding(DianpaoGameRoomSource.class) public class DianpaoGameRoomMsgService { @Autowired private DianpaoGameRoomSource dianpaoGameRoomSource; public void removeGameRoom(List<String> gameIds) { CommonMO mo = new CommonMO(); mo.setMsg("gameIds"); mo.setData(gameIds); dianpaoGameRoomSource.dianpaoGameRoom().send(MessageBuilder.withPayload(mo).build()); } public void createGameRoom(String gameId, String game) { CommonMO mo = new CommonMO(); mo.setMsg("create gameroom"); Map data = new HashMap<>(); mo.setData(data); data.put("gameId", gameId); data.put("game", game); dianpaoGameRoomSource.dianpaoGameRoom().send(MessageBuilder.withPayload(mo).build()); } }
[ "林少聪 @PC-20180515PRDG" ]
林少聪 @PC-20180515PRDG
2b4474ad16cce87664bef172af8695b4bb5113ea
39b87f687c9b9674506c61c294100dd6a0052b95
/T24.java
e337b3f6d6044da12c6c4d1427b2f84e25f8b35f
[]
no_license
heatsink/NinjaFighter
e396afdf292956face107c7b5053ce50644852d7
a096689a0f1387d8c54c89db2aa3bcf070c9a61f
refs/heads/master
2021-01-21T16:26:40.411421
2015-12-06T04:43:37
2015-12-06T04:43:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,858
java
import greenfoot.*; import java.util.*; /** * Write a description of class K1 here. * * @author (your name) * @version (a version number or a date) */ public class T24 extends Trap//bill { static boolean played = false; GreenfootSound billin = new GreenfootSound("billin.mp3"); Counter shurikenCounter = new ShurikenCounter(getThisWorld(),"Shurikens: "); Counter powerCounter = new PowerCounter("Power: "); Counter levelCounter = new Counter("Stage: "); Counter healthCounter = new HealthCounter(getThisWorld(), "Health: "); private List<NPCS> npcs; private int counterDelay = 0; Ninja ninja; int delay = 11; public T24(Ninja ninja)//bill { super(); billin.setVolume(40); this.ninja = ninja; prepare(); } private void prepare()//bill { doorT21 doort21 = new doorT21(); addObject(doort21, 625, 125); for(int i = 0; i<15; i++) for(int j = 0; j<2; j++) { Stump fence = new Stump(); addObject(fence, 25+j*700, 50*i+25); } for(int i = 1;i<15; i++) for(int j = 0; j<2; j++) { Stump fence = new Stump(); addObject(fence, 50*i+25, 25+j*(700-50)); } for(int i = 1; i<8; i++) { ForestBat bluemm = new ForestBat(2,2); addObject(bluemm, 25+i*50, 425); } for(int i = 1; i<5; i++) { ForestBat bluemm = new ForestBat(2, 2); addObject(bluemm, 375, 675-50*i); } for(int i = 4; i<10; i++) { ForestBat bluemm = new ForestBat(2, 2); addObject(bluemm, 225+50*i, 225); } Teleport teleport1 = new Teleport(); addObject(teleport1, 375, 275); Teleport teleport2 = new Teleport(); addObject(teleport2, 375, 325); Teleport teleport3 = new Teleport(); instaPower instaPower1 = new instaPower(); addObject(instaPower1, 125, 675-50); instaPower instaPower2 = new instaPower(); addObject(instaPower2, 175, 675-50); addObject(teleport3, 375, 375); addObject(healthCounter, 866, 120); healthCounter.setValue(ninja.getNINJAHP()); addObject(shurikenCounter, 866, 201); shurikenCounter.setValue(ninja.getSHURIKENNUMBER()); addObject(powerCounter, 866, 161); powerCounter.setValue(ninja.getPOWERBAR()); makeAllIcons(); addObject(levelCounter, 950, 15); levelCounter.setValue(24); addObject(ninja, 75, 675-50); npcs = getObjects(NPCS.class); for(int i = 0; i<npcs.size(); i++) { TempText9 text = new TempText9(npcs.get(i)); addObject(text, npcs.get(i).getX(), npcs.get(i).getY()-20); } } public void act()//bill { counterDelay++; if(!played) { billin.playLoop(); played = !played; } checkTeleport(); if (Greenfoot.isKeyDown("h")&&delay>10) { clickSound.play(); Menu menu = new Menu(getThisWorld()); Greenfoot.setWorld(menu); delay = 0; } if(getObjects(Ninja.class).size() != 0&& counterDelay >= 10) { checkDoorT21(); healthCounter.setValue(ninja.getNINJAHP()); shurikenCounter.setValue(ninja.getSHURIKENNUMBER()); powerCounter.setValue(ninja.getPOWERBAR()); counterDelay-= 10; /**/ // TEMPORAY FUNCTIONS FOR HAYDEN TO CHANGE LEVELS TO MAKE THEM /**/ /**/ // TEMPORAY FUNCTIONS FOR HAYDEN TO CHANGE LEVELS TO MAKE THEM /**/ } delay++; } public void makeAllIcons()//sean { SwordIcon swordicon = new SwordIcon(); addObject(swordicon, 889, 360); ShurikenIcon shurikenicon = new ShurikenIcon(); addObject(shurikenicon, 838, 360); DashIcon dashicon = new DashIcon(); addObject(dashicon, 819, 308); } public void checkTeleport(){//bill if(ninja.checkTeleport()) { ninja.setLocation(75, 625); } } public void checkDoorT21()//bill { if(ninja.checkDoorT21()==true) { billin.stop(); Greenfoot.setWorld(new T25(ninja)); } } public Ninja getNinja()//bill { return ninja; } public Trap getThisWorld()//bill { return this; } public void gameover(){//Hayden ninja.setHP(ninja.getArmor()); Greenfoot.setWorld(new T24(ninja)); } }
bfb18322d129834c53f579b11dea8b3113e92290
48841e20165ebc37e196f4f1747cfb13ea3de25b
/dmbase/src/main/java/com/dm/search/service/EntityService.java
de847f3b453955bc38be1c5c153669b3bfdcf2e4
[]
no_license
zmdevelop/topiesearch
c09f9240addf0c052307a08c6ff3755239ad7530
40b54d33913f81f8699b57b248e2496089487471
refs/heads/master
2020-12-21T17:28:20.152632
2016-08-11T07:52:21
2016-08-11T07:52:21
59,458,124
0
0
null
null
null
null
UTF-8
Java
false
false
489
java
package com.dm.search.service; import java.util.List; import java.util.Map; import com.dm.search.model.SearchEntity; import com.github.pagehelper.PageInfo; public interface EntityService { int add(SearchEntity record); int update(SearchEntity record); int delete(Integer id); SearchEntity load(Integer id); PageInfo<SearchEntity> list(Integer pageSize,Integer PageNum,Map searchMap); public List<SearchEntity> list(Map searchMap); boolean updateStatus(Integer id); }
1d017077aff09606f7da425c066eb4beb03f987a
a00326c0e2fc8944112589cd2ad638b278f058b9
/src/main/java/000/123/872/CWE113_HTTP_Response_Splitting__database_setHeaderServlet_54c.java
e35b6ea8f5f16ef9cf7bb02dc93359133e6a2a0c
[]
no_license
Lanhbao/Static-Testing-for-Juliet-Test-Suite
6fd3f62713be7a084260eafa9ab221b1b9833be6
b095b11c7cb6d4a5bb2b76181e35d6ee00e96e68
refs/heads/master
2020-08-24T13:34:04.004149
2019-10-25T09:26:00
2019-10-25T09:26:00
216,822,684
0
1
null
2019-11-08T09:51:54
2019-10-22T13:37:13
Java
UTF-8
Java
false
false
1,586
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE113_HTTP_Response_Splitting__database_setHeaderServlet_54c.java Label Definition File: CWE113_HTTP_Response_Splitting.label.xml Template File: sources-sinks-54c.tmpl.java */ /* * @description * CWE: 113 HTTP Response Splitting * BadSource: database Read data from a database * GoodSource: A hardcoded string * Sinks: setHeaderServlet * GoodSink: URLEncode input * BadSink : querystring to setHeader() * Flow Variant: 54 Data flow: data passed as an argument from one method through three others to a fifth; all five functions are in different classes in the same package * * */ import javax.servlet.http.*; public class CWE113_HTTP_Response_Splitting__database_setHeaderServlet_54c { public void badSink(String data , HttpServletRequest request, HttpServletResponse response) throws Throwable { (new CWE113_HTTP_Response_Splitting__database_setHeaderServlet_54d()).badSink(data , request, response); } /* goodG2B() - use goodsource and badsink */ public void goodG2BSink(String data , HttpServletRequest request, HttpServletResponse response) throws Throwable { (new CWE113_HTTP_Response_Splitting__database_setHeaderServlet_54d()).goodG2BSink(data , request, response); } /* goodB2G() - use badsource and goodsink */ public void goodB2GSink(String data , HttpServletRequest request, HttpServletResponse response) throws Throwable { (new CWE113_HTTP_Response_Splitting__database_setHeaderServlet_54d()).goodB2GSink(data , request, response); } }
4bb06c4a37faca59558060ea7924851faab5a133
59384f38a43b76b24a782c6e13f371a03dfa7d4c
/springBoot/src/main/java/org/gaverdov/springBoot/security/SecurityConfig.java
d77c01f7074a4c4b4d127a83ccee6a7c09088ab6
[]
no_license
22Matvey22/springBoot
0c0bbc9157d127fb30e070b86df8a84b54fbb1ff
d219cee98b44c0883a154d9a87d7f2bee08a0a53
refs/heads/master
2023-06-06T10:41:09.429821
2021-06-17T06:19:35
2021-06-17T06:19:35
377,725,751
0
0
null
null
null
null
UTF-8
Java
false
false
2,286
java
package org.gaverdov.springBoot.security; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.password.NoOpPasswordEncoder; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { private final UserDetailsService userDetailsService; private final SuccessUserHandler successUserHandler; public SecurityConfig(@Qualifier("userDetailsServiceImpl") UserDetailsService userDetailsService, SuccessUserHandler successUserHandler) { this.userDetailsService = userDetailsService; this.successUserHandler = successUserHandler; } @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.authorizeRequests() .antMatchers("/").permitAll() .antMatchers("/admin/**").hasRole("ADMIN") .antMatchers("/user/**").authenticated() .and().formLogin() .successHandler(successUserHandler); http.logout() .permitAll() .logoutRequestMatcher(new AntPathRequestMatcher("/logout")) .logoutSuccessUrl("/"); } @Bean public static NoOpPasswordEncoder passwordEncoder() { return (NoOpPasswordEncoder) NoOpPasswordEncoder.getInstance(); } @Autowired public void configureGlobalSecurity(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()); } }
f821fc0c804f82fa1e88c68f8d1232c69cb1b4f5
97e3b3bdbd73abe9ba01b5abe211d8b694301f34
/源码分析/spring/spring-framework-5.1.5.RELEASE/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMethodMappingNamingStrategyTests.java
53b57b60a20833d549b4c824dc694d00da736155
[ "Apache-2.0", "MIT" ]
permissive
yuaotian/java-technology-stack
dfbbef72aeeca0aeab91bc309fcce1fb93fdabf0
f060fea0f2968c2a527e8dd12b1ccf1d684c5d83
refs/heads/master
2020-08-26T12:37:30.573398
2019-05-27T14:10:07
2019-05-27T14:10:07
217,011,246
1
0
MIT
2019-10-23T08:49:43
2019-10-23T08:49:42
null
UTF-8
Java
false
false
2,333
java
/* * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.web.servlet.mvc.method; import java.lang.reflect.Method; import org.junit.Test; import org.springframework.util.ClassUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.handler.HandlerMethodMappingNamingStrategy; import static org.junit.Assert.*; /** * Unit tests for * {@link org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMethodMappingNamingStrategy}. * * @author Rossen Stoyanchev */ public class RequestMappingInfoHandlerMethodMappingNamingStrategyTests { @Test public void getNameExplicit() { Method method = ClassUtils.getMethod(TestController.class, "handle"); HandlerMethod handlerMethod = new HandlerMethod(new TestController(), method); RequestMappingInfo rmi = new RequestMappingInfo("foo", null, null, null, null, null, null, null); HandlerMethodMappingNamingStrategy<RequestMappingInfo> strategy = new RequestMappingInfoHandlerMethodMappingNamingStrategy(); assertEquals("foo", strategy.getName(handlerMethod, rmi)); } @Test public void getNameConvention() { Method method = ClassUtils.getMethod(TestController.class, "handle"); HandlerMethod handlerMethod = new HandlerMethod(new TestController(), method); RequestMappingInfo rmi = new RequestMappingInfo(null, null, null, null, null, null, null, null); HandlerMethodMappingNamingStrategy<RequestMappingInfo> strategy = new RequestMappingInfoHandlerMethodMappingNamingStrategy(); assertEquals("TC#handle", strategy.getName(handlerMethod, rmi)); } private static class TestController { @RequestMapping public void handle() { } } }
87f6cb8dc0e7ceddca840ba7a29a3ff269e73255
00ee4995af2c0de95480dd39034c36436843fcd3
/pcm/src/main/java/gov/samhsa/c2s/pcm/service/exception/NoDataFoundException.java
0f8af77b17efff89e2d345e96d7b2bf5d5e19c65
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
tlinqu/pcm
07348d2980f9692c2a13bfc0b313ed768085b654
e751cfefcc8d0c5c3e2aa2c08571255dae8f0a53
refs/heads/master
2021-08-11T11:19:13.482293
2017-10-20T18:11:37
2017-10-20T18:11:37
263,652,819
1
0
Apache-2.0
2020-05-13T14:25:26
2020-05-13T14:25:25
null
UTF-8
Java
false
false
763
java
package gov.samhsa.c2s.pcm.service.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.NOT_FOUND) public class NoDataFoundException extends RuntimeException { public NoDataFoundException() { } public NoDataFoundException(String message) { super(message); } public NoDataFoundException(String message, Throwable cause) { super(message, cause); } public NoDataFoundException(Throwable cause) { super(cause); } public NoDataFoundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } }
b77321f0c408f94127b6df14a78f2aa4f730fe88
562112f15c396095bf6a54a197980449def5848b
/src/main/java/com/agile/modules/database/SYS_USER_GROUP.java
ffc30b735e9f03baa106ee2964e828c6264d8277
[ "Apache-2.0" ]
permissive
xuanspace/SpringAgile
52507c7610554a47eeba0e83d8a2b70b94eeb28e
f4adacd93a305498d4b9102280c87c36bd5be8dc
refs/heads/master
2021-09-13T13:21:12.487488
2018-04-30T15:01:22
2018-04-30T15:01:22
115,268,268
0
0
null
null
null
null
UTF-8
Java
false
false
1,617
java
/* * Copyright (C) 2016-2017 Spring Agile. All rights reserved. * Licensed under the Apache License, Version 2.0 */ package com.agile.modules.database; import java.util.Date; import com.agile.framework.query.SQLField; import com.agile.framework.query.SQLTable; public class SYS_USER_GROUP extends SQLTable { public final static SQLField<Integer> ID = new SQLField<Integer>("sys_user_group", "id"); public final static SQLField<String> PARENT_ID = new SQLField<String>("sys_user_group", "parent_id"); public final static SQLField<Integer> USER_ID = new SQLField<Integer>("sys_user_group", "user_id"); public final static SQLField<String> GROUP_ID = new SQLField<String>("sys_user_group", "group_id"); public final static SQLField<String> CREATE_BY = new SQLField<String>("sys_user_group", "create_by"); public final static SQLField<Date> CREATE_TIME = new SQLField<Date>("sys_user_group", "create_time"); public final static SQLField<String> UPDATE_BY = new SQLField<String>("sys_user_group", "update_by"); public final static SQLField<Date> UPDATE_TIME = new SQLField<Date>("sys_user_group", "update_time"); public final static SQLField<String> DELETED = new SQLField<String>("sys_user_group", "deleted"); @Override public String getName() { return "sys_user_group"; } @Override public String getComment() { return null; } @Override public String toString() { return "sys_user_group"; } public SQLField<?>[] getFileds() { SQLField<?>[] fields = { ID,PARENT_ID,USER_ID,GROUP_ID,CREATE_BY,CREATE_TIME,UPDATE_BY,UPDATE_TIME,DELETED, }; return fields; } }
38d41e3cf417dc12097ade1ceb0169b6a63b3b42
21f2918feebee4afa31534f4714ef497911c8c79
/java-basic/app/src/main/java/com/eomcs/oop/ex12/Exam0210.java
8600048c7920e8fd76f2ae52ded06398ea593977
[]
no_license
eomjinyoung/bitcamp-20210607
276aab07d6ab067e998328d7946f592816e28baa
2f07da3993e3b6582d9f50a60079ce93ed3c261f
refs/heads/main
2023-06-14T23:47:21.139807
2021-06-25T09:48:48
2021-06-25T09:48:48
374,601,444
1
1
null
null
null
null
UTF-8
Java
false
false
480
java
// Lambda 문법 - functional interface의 자격 package com.eomcs.oop.ex12; public class Exam0210 { // 추상 메서드가 한 개짜리 인터페이스여야 한다. interface Player { void play(); } public static void main(String[] args) { // 추상 메서드를 한 개만 갖고 있는 인터페이스에 대해 // 람다 문법으로 익명 클래스를 만들 수 있다. Player p = () -> System.out.println("Player..."); p.play(); } }
063f45f2df50998797492b1ac0cb5cd4abeca632
a347db85a68f8c3965d1909535c5aeda0c48679c
/src/test/GameTest.java
c24f318eeb5b9f5c9510648e2c88d861cec125ac
[]
no_license
elaktomte/Battleships-Backup
5b77271e0f72f59d045c5e3cb784500f1828ffa9
ad52d6a0be743ed0d0db740644169158a3d4837b
refs/heads/master
2022-04-13T12:17:57.546237
2020-03-14T14:02:22
2020-03-14T14:02:22
246,643,896
0
0
null
null
null
null
UTF-8
Java
false
false
2,274
java
package test; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import controller.BattleshipsController; import model.Gameboard; import model.Player; /* * Main testing class for the game. Since this game is so small, its easier to contain the important unit tests into * a single file. */ class GameTest { int[][] MockBoard = new int[10][10]; Player testPlayer = new Player("Tester", false); BattleshipsController cont = new BattleshipsController(); @BeforeEach void setUp() throws Exception { int[][] MockBoard = new int[10][10]; Player testPlayer = new Player("Tester", false); BattleshipsController cont = new BattleshipsController(); } @Test void testShootingHit() { MockBoard[8][0] =3; testPlayer.getGb().setBoard(MockBoard); int result = testPlayer.getGb().shoot(0, 8); assertEquals(result, 3); } @Test void testShootingMiss() { //Testing missing MockBoard[8][0] =0; testPlayer.getGb().setBoard(MockBoard); int result = testPlayer.getGb().shoot(0, 8); assertEquals(result, 0); } @Test void testShootingMarkingMissOnTheBoard() { //Making sure we are marking misses correctly. MockBoard[8][0] =0; testPlayer.getGb().setBoard(MockBoard); int result = testPlayer.getGb().shoot(0, 8); int change = testPlayer.getGb().getBoard()[8][0]; assertEquals(change, 1); } @Test void testGameOver() { //Making sure the game over function works as intended MockBoard[8][0] =3; testPlayer.getGb().setBoard(MockBoard); int result = testPlayer.getGb().shoot(0, 8); boolean over = testPlayer.getGb().isGameOver(); assertTrue(over); } @Test void testGameisNotOver() { MockBoard[8][0] =3; testPlayer.getGb().setBoard(MockBoard); boolean over = testPlayer.getGb().isGameOver(); assertFalse(over); } @Test void testGameboardCreation() { //Making sure we are setting up the right amount of boats. Should be 30 "hull" pieces of boats. Gameboard gb = new Gameboard(); int counter = 0; for(int y = 0; y <10; y++) { for (int x = 0; x < 10; x++) { if(gb.getBoard()[y][x] == 3) { counter++; } } } assertEquals(counter, 30); } }
0b1fbc511194077b64a8fb18ee6eddd37b01f457
a6c96de7cbc18ff078296cf460e77924065ccbf6
/jdbc-practice-master/src/test/java/apitests/HRApiTestWithParameters.java
ea73571b54bc02ae148ce5ba525556a54ee02500
[]
no_license
AtasevenC/JDBC
ffdd15e2484452dd4f3ea699dd99f7550b1fd9f4
ea45bbc1a36f9e074915c45e7121ffd4ae208733
refs/heads/main
2023-01-23T15:27:09.101367
2020-11-29T19:35:38
2020-11-29T19:35:38
317,027,201
0
0
null
null
null
null
UTF-8
Java
false
false
1,696
java
package apitests; import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.response.Response; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import utilities.ConfigurationReader; import static io.restassured.RestAssured.*; import static org.testng.Assert.*; public class HRApiTestWithParameters { @BeforeClass public void setUpClass(){ RestAssured.baseURI = ConfigurationReader.get("hrapi.uri"); } /* Given accept type is Json And parameters: q = {“region_id”:2} When users sends a GET request to “/countries” Then status code is 200 And Content type is application/json And Payload should contain “United States of America” */ @Test public void countriesWithQueryParam(){ Response response = given().accept(ContentType.JSON).and() .queryParam("q", "{\"region_id\":2}") .when().get("/countries"); assertEquals(response.statusCode(),200); assertEquals(response.contentType(),"application/json"); assertTrue(response.body().asString().contains("United States of America")); } //get me the api request returns employees who is IT_PROG @Test public void countriesWithQueryParam2(){ Response response = given().accept(ContentType.JSON).and() .queryParam("q","{\"job_id\":\"IT_PROG\"}") .when().get("/employees"); assertEquals(response.statusCode(),200); assertEquals(response.contentType(),"application/json"); assertTrue(response.body().asString().contains("IT_PROG")); } }
487795eeb5bcb0c7b1e51c0102b2bbdc6298454d
76e0e6e5991f82290bf3cf0d66e2eb0f650e8e00
/03EnumerationsAndAnnotations/src/_002WarningLevels/Main.java
7ff6930923736b4b4824341e4d29ea3a040c3c7f
[ "MIT" ]
permissive
lapd87/SoftUniJavaOOPAdvanced
47ba0efba41b4b2619d4b363996e23fe070290cc
e06cf284fffc7259210a94f327d078d228edf76f
refs/heads/master
2020-03-27T21:40:22.120084
2018-09-03T07:26:02
2018-09-03T07:26:02
147,166,690
0
0
null
null
null
null
UTF-8
Java
false
false
1,003
java
package _002WarningLevels; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * Created by IntelliJ IDEA. * User: LAPD * Date: 18.7.2018 г. * Time: 09:48 ч. */ public class Main { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(System.in)); String loggerImportanceLevel = bufferedReader.readLine(); Logger logger = new Logger(loggerImportanceLevel); String input; while (true) { if ("END".equals(input = bufferedReader.readLine())) { break; } String[] messageArgs = input.split(": "); Message message = new Message(messageArgs[0], messageArgs[1]); logger.addMessage(message); } for (Message message : logger.getMessages()) { System.out.println(message); } } }
b094166f20ec32505b42e122ad8fc4a351b38de5
2981c30657d462b16d827aa6b4629b7a7baf3651
/app/src/test/java/com/example/abel/milagecalculator/ExampleUnitTest.java
848025b5cee7f4fe1eeb79f0fe04b38c7cd469d9
[ "MIT" ]
permissive
agonza16/MPG_Calculator
de066a42b809bd6766cc51c18e4146fcbcb92ff5
b138a3a3bbdb1ceb3a3b2988b8bd3b42111e8d5a
refs/heads/master
2021-09-09T00:21:40.634567
2018-03-12T22:05:09
2018-03-12T22:05:09
124,949,962
0
0
null
null
null
null
UTF-8
Java
false
false
427
java
package com.example.abel.milagecalculator; 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() throws Exception { assertEquals(4, 2 + 2); } }
bc2cde1b832f97796cf5aeca40bf82014a818a87
587021c8bee5f17d7e66bf75ebe6d854d4802e66
/eap.comps.orm.mybatis/src/main/java/eap/comps/orm/mybatis/config/NamespaceHandler.java
04d10bc5a1c385550cf1c4be736853ed0af735f3
[ "Apache-2.0" ]
permissive
rocky-zh/eap
1f8fa4ac1e9d1452982b40d9e037e9932106a7f6
f2293803506a25caf461080baecfb5919e5a4dbd
refs/heads/master
2021-01-16T22:45:21.183953
2014-08-13T15:13:57
2014-08-13T15:13:57
22,976,288
1
0
null
null
null
null
UTF-8
Java
false
false
602
java
package eap.comps.orm.mybatis.config; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; /** * <p> Title: </p> * <p> Description: </p> * @作者 [email protected] * @创建时间 * @版本 1.00 * @修改记录 * <pre> * 版本 修改人 修改时间 修改内容描述 * ---------------------------------------- * * ---------------------------------------- * </pre> */ public class NamespaceHandler extends NamespaceHandlerSupport { @Override public void init() { registerBeanDefinitionParser("init", new InitBeanDefinitionParser()); } }
a32682652745f8041bb71552837a9ffb09030a5d
7cb4d77ac492bb4dfcdf19f0ca15ca02c3fc1c7c
/genericUygulama/src/genericUygulama/student.java
7f13487fc2a3e1dabb27ee465b88849de7f3d6e5
[]
no_license
sametcavur/Java-SE
1759294d49afb07a9f8b147c8986aa0fa0a00467
e645f00bd1bf240c935b30468c2bd8ae72defb19
refs/heads/main
2023-04-12T07:22:06.937907
2021-05-15T16:44:19
2021-05-15T16:44:19
367,648,188
3
0
null
null
null
null
UTF-8
Java
false
false
559
java
package genericUygulama; public class student extends person { private String scNumber; public student() {} public student(String name, String surname, int age, String scNumber) { super(name, surname, age); this.scNumber = scNumber; } public String getScNumber() { return scNumber; } public void setScNumber(String scNumber) { this.scNumber = scNumber; } @Override public String toString() { return "student [scNumber=" + scNumber + ", Name=" + getName() + ", Surname=" + getSurname() + ", Age=" + getAge() + "]"; } }
6411e694fa3a78684bb27b183e76b8568a7eeda6
12f0d18fe38d16ecd0a7f6e5f5ec5b3c90e78881
/DGT/radar/src/main/java/edu/uclm/es/radar/App.java
9748e5183ea3be71991d740ded1f0bbd2b2d7e68
[]
no_license
ExposoftIso2/Exposoft
0e5a3519499757abf86cc591d4f42b52c53b4c98
c178b3bdd0143b0ed69dc08da427b4a9f1181636
refs/heads/master
2021-05-03T18:03:48.910339
2016-12-21T11:19:44
2016-12-21T11:19:44
71,891,396
0
0
null
null
null
null
UTF-8
Java
false
false
193
java
package edu.uclm.es.radar; /** * Hello world! * */ public class App { public static void main( String[] args ) { System.out.println( "Hello World!" ); } }
edc5ab1115e80ad8cff264148714f45137e125c9
fa8880ead2d16178475191e659991d46f251a92c
/Java Core/task12/task1209/Solution.java
2e5254840e676a668ed4f071ad9d270e6b57847c
[]
no_license
Haumidzaki/JavaRush-HW
5386e3c519f1f65175abaeefa3160b3552857eb6
61f4ca6f1eee0bebfc321786f8fb8b56ee4f1332
refs/heads/master
2021-01-08T02:30:22.334082
2020-07-28T13:11:07
2020-07-28T13:11:07
241,863,583
0
0
null
null
null
null
UTF-8
Java
false
false
1,659
java
package com.javarush.task.task12.task1209; /* Три метода и минимум Написать public static методы: int min(int, int), long min(long, long), double min(double, double). Каждый метод должен возвращать минимальное из двух переданных в него чисел. Требования: • Программа не должна выводить текст на экран. • Класс Solution должен содержать четыре метода. • Класс Solution должен содержать статический метод int min(int, int). • Метод int min(int, int) должен возвращать минимальное из двух чисел типа int. • Класс Solution должен содержать статический метод long min(long, long). • Метод long min(long, long) должен возвращать минимальное из двух чисел типа long. • Класс Solution должен содержать статический метод double min(double, double). • Метод double min(double, double) должен возвращать минимальное из двух чисел типа double. */ public class Solution { public static void main(String[] args) { } static int min(int a, int b){ int min = Integer.min(a,b); return min; } static long min(long a, long b){ long min = Long.min(a,b); return min; } static double min(double a, double b){ double min = Double.min(a,b); return min; } }
de9b73bc41afc532d60786819ecd25082cd4e5e4
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/32/32_26b9a527cdfd8a37dc7f453eb5399431f069bc87/DCBlockListener/32_26b9a527cdfd8a37dc7f453eb5399431f069bc87_DCBlockListener_t.java
25adb5d02fb8e35042659d9e23f3ebce63cdfe1c
[]
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
7,920
java
package com.smartaleq.bukkit.dwarfcraft.events; import java.util.HashMap; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockListener; import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.inventory.ItemStack; import com.smartaleq.bukkit.dwarfcraft.DCPlayer; import com.smartaleq.bukkit.dwarfcraft.DwarfCraft; import com.smartaleq.bukkit.dwarfcraft.Effect; import com.smartaleq.bukkit.dwarfcraft.EffectType; import com.smartaleq.bukkit.dwarfcraft.Skill; import com.smartaleq.bukkit.dwarfcraft.Util; /** * This watches for broken blocks and reacts * */ public class DCBlockListener extends BlockListener { private final DwarfCraft plugin; public DCBlockListener(final DwarfCraft plugin) { this.plugin = plugin; } /** * Called when a block is destroyed by a player. * * @param event * Relevant event details */ @Override public void onBlockBreak(BlockBreakEvent event) { if (event.isCancelled()) return; Player player = event.getPlayer(); DCPlayer dCPlayer = plugin.getDataManager().find(player); HashMap<Integer, Skill> skills = dCPlayer.getSkills(); ItemStack tool = player.getItemInHand(); int toolId = -1; short durability = 0; if (tool != null) { toolId = tool.getTypeId(); durability = tool.getDurability(); } Location loc = event.getBlock().getLocation(); int materialId = event.getBlock().getTypeId(); byte meta = event.getBlock().getData(); boolean blockDropChange = false; for (Skill s : skills.values()) { for (Effect effect : s.getEffects()) { if (effect.getEffectType() == EffectType.BLOCKDROP && effect.checkInitiator(materialId, meta)) { // Crops special line: if (effect.getInitiatorId() == 59){ if (meta != 7) continue; } if (DwarfCraft.debugMessagesThreshold < 4) System.out.println("DC4: Effect: " + effect.getId() + " tool: " + toolId + " and toolRequired: " + effect.getToolRequired()); if (effect.checkTool(toolId)) { ItemStack item = effect.getOutput(dCPlayer, meta); if (DwarfCraft.debugMessagesThreshold < 6) System.out.println("Debug: dropped " + item.toString()); if (item.getAmount() > 0) loc.getWorld().dropItemNaturally(loc, item); blockDropChange = true; } } if (effect.getEffectType() == EffectType.TOOLDURABILITY && durability != -1) { if (effect.checkTool(toolId)) { double effectAmount = effect.getEffectAmount(dCPlayer); if (DwarfCraft.debugMessagesThreshold < 3) System.out.println("DC2: affected durability of a tool - old:" + durability); tool.setDurability((short)(durability + Util.randomAmount(effectAmount))); // if you use the tool on a non-dropping block it // doesn't take special durability damage if (DwarfCraft.debugMessagesThreshold < 3) System.out.println("DC3: affected durability of a tool - new:" + tool.getDurability()); if (tool.getDurability() >= tool.getType().getMaxDurability()){ if (tool.getTypeId() == 267 && tool.getDurability() < 250) continue; player.setItemInHand(null); } } } if (tool != null){ if (effect.getEffectType() == EffectType.SWORDDURABILITY && effect.checkTool(toolId)) { if (DwarfCraft.debugMessagesThreshold < 2) System.out.println("DC2: affected durability of a sword - old:" + durability + " effect called: " + effect.getId()); tool.setDurability((short)(durability + (Util.randomAmount(effect.getEffectAmount(dCPlayer) * 2)))); if (DwarfCraft.debugMessagesThreshold < 3) System.out.println("DC3: affected durability of a sword - new:" + tool.getDurability()); if (tool.getDurability() >= tool.getType().getMaxDurability()){ if (tool.getTypeId() == 267 && tool.getDurability() < 250) continue; player.setItemInHand(null); } } } } } if (blockDropChange) { event.getBlock().setTypeId(0); event.setCancelled(true); } } /** * onBlockDamage used to accelerate how quickly blocks are destroyed. * setDamage() not implemented yet */ @Override public void onBlockDamage(BlockDamageEvent event) { if (event.isCancelled()) return; Player player = event.getPlayer(); DCPlayer dCPlayer = plugin.getDataManager().find(player); HashMap<Integer, Skill> skills = dCPlayer.getSkills(); // Effect Specific information ItemStack tool = player.getItemInHand(); int toolId = -1; if (tool != null) toolId = tool.getTypeId(); int materialId = event.getBlock().getTypeId(); byte data = event.getBlock().getData(); //if (event.getDamageLevel() != BlockDamageLevel.STARTED) // return; for (Skill s : skills.values()) { for (Effect e : s.getEffects()) { if (e.getEffectType() == EffectType.DIGTIME && e.checkInitiator(materialId, data)) { if (DwarfCraft.debugMessagesThreshold < 2) System.out.println("DC2: started instamine check"); if (e.checkTool(toolId)) { if (Util.randomAmount(e.getEffectAmount(dCPlayer)) == 0) return; if (DwarfCraft.debugMessagesThreshold < 3) System.out.println("DC3: Insta-mine occured. Block: " + materialId); event.setInstaBreak(true); } } } } } @Override public void onBlockPhysics(BlockPhysicsEvent event){ if (event.getBlock().getType() == Material.CACTUS && plugin.getConfigManager().disableCacti){ World world = event.getBlock().getWorld(); Location loc = event.getBlock().getLocation(); //this is a re-implementation of BlockCactus's doPhysics event, minus the spawning of a droped item. if (!(checkCacti(world, loc))){ event.getBlock().setTypeId(0, true); event.setCancelled(true); Material base = world.getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ()).getType(); if ((base != Material.CACTUS) && (base != Material.SAND)) world.dropItemNaturally(loc, new ItemStack(Material.CACTUS, 1)); } } } private boolean checkCacti(World world, Location loc){ int x = loc.getBlockX(); int y = loc.getBlockY(); int z = loc.getBlockZ(); if (isBuildable(world.getBlockAt(x - 1, y, z ).getType())) return false; if (isBuildable(world.getBlockAt(x + 1, y, z ).getType())) return false; if (isBuildable(world.getBlockAt(x, y, z - 1).getType())) return false; if (isBuildable(world.getBlockAt(x, y, z + 1).getType())) return false; Material base = world.getBlockAt(x, y - 1, z).getType(); return (base == Material.CACTUS) || (base == Material.SAND); } //Bukkit really needs to implement access to Material.isBuildable() private boolean isBuildable(Material block){ switch(block){ case AIR: case WATER: case STATIONARY_WATER: case LAVA: case STATIONARY_LAVA: case YELLOW_FLOWER: case RED_ROSE: case BROWN_MUSHROOM: case RED_MUSHROOM: case SAPLING: case SUGAR_CANE: case FIRE: case STONE_BUTTON: case DIODE_BLOCK_OFF: case DIODE_BLOCK_ON: case LADDER: case LEVER: case RAILS: case REDSTONE_WIRE: case TORCH: case REDSTONE_TORCH_ON: case REDSTONE_TORCH_OFF: case SNOW: case POWERED_RAIL: case DETECTOR_RAIL: return false; default: return true; } } }
328392c9fd88d3db2fd56e02a59b3fba44d0c62c
047b413521874dd6e887c9ea057b504df9c9e029
/app/src/main/java/com/android/materialdesign/ui/fragments/FragmentA.java
4e8124a466b3d6957ac57e929f888d0da5c491c6
[]
no_license
nataraj06/MaterialDesign
b31880c8bd21f4b40c769dec8619ae32707f6d1b
bd6ed47c2f792431d1cec16494a7aea3416faf2c
refs/heads/master
2021-01-13T05:14:05.087179
2017-03-28T15:16:28
2017-03-28T15:16:28
81,275,960
0
0
null
2017-03-28T15:16:28
2017-02-08T01:59:14
Java
UTF-8
Java
false
false
732
java
package com.android.materialdesign.ui.fragments; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.android.materialdesign.R; public class FragmentA extends Fragment { public FragmentA() { //Mandatory empty constructor for the fragment manager to instantiate the fragment (e.g. upon screen orientation changes). } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_a, container, false); } }
90186710c2eda8531d28c99f303448f556d30717
217d0fa1e2bf4c845dffea5d0e0581181973dff5
/series_9.java
3b5bce53ba8369a53aee2920a818fab893c86ae3
[]
no_license
aryamancomp/Aryaman-program
b1bd6f2984f32323b23a4f2c012e8ba59275de3c
54edfffcce237e0f87ace79577973cd56d8edbe2
refs/heads/master
2022-12-11T19:35:13.799674
2020-09-03T19:01:10
2020-09-03T19:01:10
291,467,137
0
0
null
null
null
null
UTF-8
Java
false
false
461
java
import java.util.*; class series_9 { int n; int s=0; void accept() { Scanner sc=new Scanner(System.in); System.out.println("Enter the value"); n=sc.nextInt(); } void calc() { for(int i=1;i<=n;i++) { s=s+i/1; } System.out.println(s); } public static void main() { series_9 obj=new series_9(); obj.accept(); obj.calc(); } }
[ "Aryaman Singh@DESKTOP-DR5G5E9" ]
Aryaman Singh@DESKTOP-DR5G5E9
ab5a5bca12381175f670aba32bb957ab8a92f5c5
ebdbeb7841912f7038d40c7c96a7f60b4609b64d
/src/com/riccio/abstraction/Parrot.java
aea5d6bb6689096513a85b9fb212e0a78433d7cc
[]
no_license
niosoulmusic/myJava
d7fdebbfd0d69218670835e26839e615dda78513
132eb5801fea56fa7cb5e1ce15cc7a47dae4a333
refs/heads/master
2020-03-20T05:43:07.912434
2018-06-13T14:04:56
2018-06-13T14:04:56
137,223,967
0
0
null
null
null
null
UTF-8
Java
false
false
133
java
package com.riccio.abstraction; public class Parrot extends Bird { public Parrot(String name) { super(name); } }
faa842a48378217659142b5a2adcef63668de725
db3fc771c22842b1a0bbb321c436e9bfb7225635
/app/src/androidTest/java/com/goldenfuturecommunication/androidnetworking/ExampleInstrumentedTest.java
97ce233bbd610eb55ff5b1d73129e058ae10526f
[]
no_license
SMalik97/Android_Networking_Universal_imageload
d5d12827da8f749c1ea09a217b4c1e94c756fa40
a302128547964a8d04451c65f7a585d89b1e1630
refs/heads/master
2020-08-03T23:06:12.155396
2019-10-11T15:48:34
2019-10-11T15:48:34
211,914,680
0
0
null
null
null
null
UTF-8
Java
false
false
810
java
package com.goldenfuturecommunication.androidnetworking; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented 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() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.goldenfuturecommunication.androidnetworking", appContext.getPackageName()); } }
ed669ff2ce18de0cccabb8455bb773904ac3da0d
a1bf37cdb1368507c62246e0c9357c530d374a79
/src/main/java/com/zzsharing/basic/utils/PageableUtil.java
8d5a7bbc89ec30b1f21f78010e7f180ebdb38aa1
[]
no_license
zsl131/zzsharing
094d25e92ddfc247d3adbef30225ba76e3038add
c544e234304b12ba07bfe3a67bad0651241c3930
refs/heads/master
2020-06-17T20:10:10.871363
2016-12-05T09:15:26
2016-12-05T09:15:26
74,972,952
0
0
null
null
null
null
UTF-8
Java
false
false
2,041
java
package com.zzsharing.basic.utils; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; /** * Created by 钟述林 [email protected] on 2016/10/21 15:45. */ public class PageableUtil { /** * 获取基础分页对象 * @param page 获取第几页 * @param size 每页条数 * @param dtos 排序对象数组 * @return */ public static Pageable basicPage(Integer page, Integer size, SortDto... dtos) { Sort sort = SortUtil.basicSort(dtos); page = (page==null || page<0)?0:page; size = (size==null || size<=0)?15:size; Pageable pageable = new PageRequest(page, size, sort); return pageable; } /** * 获取基础分页对象,每页条数默认15条 * - 默认以id降序排序 * @param page 获取第几页 * @return */ public static Pageable basicPage(Integer page) { return basicPage(page, 0, new SortDto("desc", "id")); } /** * 获取基础分页对象,每页条数默认15条 * @param page 获取第几页 * @param dtos 排序对象数组 * @return */ public static Pageable basicPage(Integer page, SortDto... dtos) { return basicPage(page, 0, dtos); } /** * 获取基础分页对象,排序方式默认降序 * @param page 获取第几页 * @param size 每页条数 * @param orderField 排序字段 * @return */ public static Pageable basicPage(Integer page, Integer size, String orderField) { return basicPage(page, size, new SortDto("desc", orderField)); } /** * 获取基础分页对象 * - 每页条数默认15条 * - 排序方式默认降序 * @param page 获取第几页 * @param orderField 排序字段 * @return */ public static Pageable basicPage(Integer page, String orderField) { return basicPage(page, 0, new SortDto("desc", orderField)); } }
5b5fbdc17d88b6f45444c620c5436df279ceae77
17e8438486cb3e3073966ca2c14956d3ba9209ea
/dso/tags/2.6.4/code/base/simulator/tests.base/com/tc/objectserver/control/NullServerControl.java
34e93ad81875050a670e35e05c1a0639f6113207
[]
no_license
sirinath/Terracotta
fedfc2c4f0f06c990f94b8b6c3b9c93293334345
00a7662b9cf530dfdb43f2dd821fa559e998c892
refs/heads/master
2021-01-23T05:41:52.414211
2015-07-02T15:21:54
2015-07-02T15:21:54
38,613,711
1
0
null
null
null
null
UTF-8
Java
false
false
982
java
/* * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright * notice. All rights reserved. */ package com.tc.objectserver.control; public class NullServerControl implements ServerControl { private boolean isRunning; public synchronized void attemptShutdown() throws Exception { isRunning = false; } public synchronized void shutdown() throws Exception { isRunning = false; } public synchronized void crash() throws Exception { isRunning = false; } public synchronized void start() throws Exception { this.isRunning = true; } public synchronized boolean isRunning() { return isRunning; } public void clean() { return; } public void mergeSTDOUT() { return; } public void mergeSTDERR() { return; } public void waitUntilShutdown() { return; } public int getDsoPort() { return 0; } public int getAdminPort() { return 0; } }
[ "foshea@7fc7bbf3-cf45-46d4-be06-341739edd864" ]
foshea@7fc7bbf3-cf45-46d4-be06-341739edd864
d9ec786326ed2854e83b51f7d19d50689a533fa3
593cc52a23b55583b5045651557d879095aca93b
/src/main/java/lavaplayer/TrackScheduler.java
dd182e11f7c5b846b5c9f908d3c4a1d5f0f2fd04
[]
no_license
pablosg003/MachoAlfaTotal_DiscordBot
cf6b340506d825c0e7732bf53fc627e2360f4102
ad05a9d503f192e81496b38661dba3a34e009c35
refs/heads/master
2023-06-07T13:11:40.591378
2021-07-14T19:18:21
2021-07-14T19:18:21
385,956,960
0
0
null
null
null
null
UTF-8
Java
false
false
990
java
package lavaplayer; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import com.sedmelluq.discord.lavaplayer.player.AudioPlayer; import com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter; import com.sedmelluq.discord.lavaplayer.track.AudioTrack; import com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason; public class TrackScheduler extends AudioEventAdapter{ private final AudioPlayer player; private final BlockingQueue<AudioTrack> queue; public TrackScheduler(AudioPlayer player) { this.player = player; this.queue = new LinkedBlockingQueue<>(); } public void queue(AudioTrack track) { if (!this.player.startTrack(track, true)) { this.queue.offer(track); } } public void onTrackEnd(AudioPlayer player, AudioTrack track, AudioTrackEndReason endReason){ if (endReason.mayStartNext) { nextTrack(); } } public void nextTrack() { this.player.startTrack(this.queue.poll(), false); } }
1eb32b993f9feb89117c2cdbd2516399342c2593
cbc979a8b8aabe1aa4a7030e2b34696a0220babb
/src/main/java/sk/fiit/aks/fail2ban/servlet/RouterServlet.java
6da55c5309258897b006fe2c131e0c8d89e09778
[]
no_license
andrejmlyncar/onepk-fail2ban
7d27fed4677506b1a4a53c0ec7d7f9622c8c64d6
f6548b136b1a41b3ba25b1eca434f05d92243f80
refs/heads/master
2020-06-29T21:06:28.896268
2017-03-20T14:22:12
2017-03-20T14:22:12
74,409,491
0
0
null
null
null
null
UTF-8
Java
false
false
2,586
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 sk.fiit.aks.fail2ban.servlet; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.json.Json; import javax.json.JsonArrayBuilder; import javax.json.JsonObject; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import sk.fiit.aks.fail2ban.controller.ElementRegistry; import sk.fiit.aks.fail2ban.enitiy.Router; import sk.fiit.aks.fail2ban.exception.Fail2BanServletException; import sk.fiit.aks.fail2ban.exception.Fail2banConnectionException; import sk.fiit.aks.fail2ban.servlet.util.ServletDataReader; /** * * @author Andrej Mlyncar <[email protected]> */ public class RouterServlet extends HttpServlet { @Override public void init() throws ServletException { } @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { JsonArrayBuilder arrayBuilder = Json.createArrayBuilder(); for (Router router : ElementRegistry.getInstance().getAllRouters()) { arrayBuilder.add(Json.createObjectBuilder().add("router_id", router.getId()).add("router_name", router.getName()).add("ip_address", router.getAddress()).build()); } response.setContentType("application/json"); response.setStatus(200); response.getWriter().write(arrayBuilder.build().toString()); } @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { JsonObject object = ServletDataReader.getJsonData(request); ElementRegistry.getInstance().registerRouter(object.getString("ip_address"), object.getString("username"), object.getString("password"), object.getString("name")); response.setStatus(200); response.getWriter().write(Json.createObjectBuilder().add("status", "rotuer registered").build().toString()); } catch (Fail2BanServletException | Fail2banConnectionException ex) { response.sendError(500); Logger.getLogger(RouterServlet.class.getName()).log(Level.SEVERE, "Error registering router", ex); } } @Override public void destroy() { } }
4d64d6c87b045f9c1fa6bba4d7eb157b4a0170cb
c8d753c500a90a476ef5439ebbc7bcc9b702ae96
/src/main/java/decorator/pattern/starbuzz/code/Soy.java
12deebbb40c4fd69899516cd7e85d194e4253be7
[]
no_license
asniii/design-patterns
1e12e49fca9b015eb64521ae3ca74faf6f23ba3d
55077e6157c2c753fe32ad7c966cd2d7086b2182
refs/heads/master
2020-03-22T18:33:39.161306
2019-05-23T08:41:24
2019-05-23T08:41:24
140,467,439
0
1
null
null
null
null
UTF-8
Java
false
false
358
java
package decorator.pattern.starbuzz.code; public class Soy extends CondimentDecorator { Beverage beverage; public Soy(Beverage beverage) { this.beverage = beverage; } public String getDescription() { return beverage.getDescription() + ", Soy"; } public double cost() { return .15 + beverage.cost(); } }
099b791ad71f069d489d1c8b1b88678b2f0f9dca
610f12c7d416408f114814a0c335929788645250
/Assignment 5/PageRank/src/edu/stevens/cs549/hadoop/pagerank/InitMapper.java
23fb3e0a98003cac4e838798c27e908837c466ca
[]
no_license
nvaldes/nvaldes_549
ba25978d5cd09d5a308dae1b7ffcad48c374de67
dc1bd827ed5e3da57f09a09a0e2a9caabfd23754
refs/heads/master
2020-06-19T08:37:16.131038
2017-12-02T02:15:35
2017-12-02T02:15:35
68,145,075
0
0
null
null
null
null
UTF-8
Java
false
false
711
java
package edu.stevens.cs549.hadoop.pagerank; import java.io.IOException; import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.io.*; public class InitMapper extends Mapper<LongWritable, Text, Text, Text> { public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException, IllegalArgumentException { String[] line = value.toString().split(": "); // Converts Line to a String /* * DONE Just echo the input, since it is already in adjacency list format. */ if (line.length == 1) { line = new String[] {line[0], ""}; } Text outKey = new Text(line[0]); Text outVal = new Text(line[1]); context.write(outKey, outVal); // return; } }
44f0a398f9d05287344728ddb9421ff416fa9b9d
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-13372-12-2-FEMO-WeightedSum:TestLen:CallDiversity/org/xwiki/extension/xar/internal/handler/XarExtensionHandler_ESTest_scaffolding.java
0e64226891a97e39897a5829d92383217b37b154
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
464
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Sat Apr 04 04:47:39 UTC 2020 */ package org.xwiki.extension.xar.internal.handler; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class XarExtensionHandler_ESTest_scaffolding { // Empty scaffolding for empty test suite }
5409a24f26c0d57f4ee81191cebd15c96f715d26
6acaa770d60f19c702c4a393fefc08ea72e48a48
/src/com/joyl/iotserver/Session.java
43780b66c07448ae79e7476c41f06b7f04502f24
[]
no_license
KateLim/IoTServer
fb55ef19202ad5861356ca27bccc677cd4180e32
abbe581cefb7fc13b2cbc8339570572e04ce9b8a
refs/heads/master
2021-01-13T02:18:40.096041
2013-06-28T05:15:47
2013-06-28T05:15:47
10,538,849
0
0
null
null
null
null
UTF-8
Java
false
false
639
java
package com.joyl.iotserver; public class Session { protected String sessionID; protected long lastHeartbeat; public Session() { super(); } public boolean isAlive(long sessionTimeout) { if (sessionID == null || lastHeartbeat == 0) return false; if ( (System.currentTimeMillis() - lastHeartbeat) > sessionTimeout) return false; return true; } public void updateSession() { lastHeartbeat = System.currentTimeMillis(); } public String getSessionID() { return sessionID; } public boolean isValidSession(String sessionID) { if (sessionID.equals(this.sessionID)) return true; return false; } }
8054c5d6a3d0f9b0585a527bc00bd3cabecbfa02
f09223d4fe1457428b8f3b5a138f3b8dd51d864a
/src/main/java/com/redhat/errai/math/client/shared/Manufacturer.java
afa8fdf2499526676ddccad597eec46f3b606c7f
[]
no_license
sabre1041/errai-math
dc0e62ce4b5f8505577362c5fc7c8b132e2a219b
8381cec50cd792e5f68e3341878c2dcef004bea3
refs/heads/master
2021-01-17T17:17:45.288007
2013-06-13T13:29:43
2013-06-13T13:29:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
142
java
package com.redhat.errai.math.client.shared; public enum Manufacturer { MICROSOFT,APPLE,MOZILLA,GOOGLE,OPERA,BLACKBERRY, LINUX; }
91f5792acc1a33b8f0a2b82f3d52f1ad8f74ab3b
703d7b0e617616d77c6461503e869bd78ac5e071
/Model/SpotifyData.java
143901234b90f8605eba2e95e852c2817bf19ee2
[]
no_license
FedyaSavchuk/MusicAdvisor
162a9766ac23a6a745dc83ca64f4ec17f47b3a58
bd2d78113724a5f4c34d0e6c410ec1a45f4fcfd8
refs/heads/master
2022-08-30T13:52:42.889655
2020-05-25T18:27:35
2020-05-25T18:27:35
266,840,808
0
0
null
null
null
null
UTF-8
Java
false
false
899
java
package advisor.Model; public class SpotifyData { String album = null; String artists = null; String category = null; String link = null; public void setAlbum(String album) { this.album = album; } public void setArtists(String authors) { this.artists = authors; } public void setCategory(String category) { this.category = category; } public void setLink(String link) { this.link = link; } @Override public String toString() { StringBuilder info = new StringBuilder(); if (album != null) { info.append(album).append("\n"); } if (artists != null) { info.append(artists).append("\n");; } if (link != null) { info.append(link).append("\n");; } if (category != null) { info.append(category).append("\n");; } return info.toString().replaceAll("\"", ""); } }
35d593cd39dc1ac8a725076c85cc09704d1b1b93
ed5159d056e98d6715357d0d14a9b3f20b764f89
/test/irvine/oeis/a150/A150605Test.java
4d045ce3eff0281bb2ab2cb74627de6d542aa7dd
[]
no_license
flywind2/joeis
c5753169cf562939b04dd246f8a2958e97f74558
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
refs/heads/master
2020-09-13T18:34:35.080552
2019-11-19T05:40:55
2019-11-19T05:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
256
java
package irvine.oeis.a150; import irvine.oeis.AbstractSequenceTest; /** * Tests the corresponding class. * @author Sean A. Irvine */ public class A150605Test extends AbstractSequenceTest { @Override protected int maxTerms() { return 10; } }
2acf233807f85310512826baf9d68ac97124350d
e42569d6e75efb0e7ed5238bc8c31943f67cf203
/Paradigms-2019/Java/SimpleExpression/expression/Variable.java
66bc8afdcf28b490897bdc02768f6c7efbb7ce25
[]
no_license
alexanderlvarfolomeev/ITMO
3894cc0b342442f1e49fc144e84968d727e58113
af23fd25f1b18786debc61f436cd813f0a72796a
refs/heads/master
2022-05-28T08:06:22.736193
2021-03-21T20:28:32
2021-03-21T20:28:32
181,557,213
1
0
null
2022-05-20T21:19:01
2019-04-15T20:02:43
Java
UTF-8
Java
false
false
317
java
package expression; public class Variable extends AbstractExpression { private String name; public Variable(String name) { this.name = name; } public double evaluate(double valueOfX) { return valueOfX; } public int evaluate(int valueOfX) { return valueOfX; } }
2f960a6bcab17dbdd03874e188b4927a42d96590
d5b39e9e1e8b24a23313ab13bc3c185ae4612d5e
/fastdfs.client/src/main/java/com/m/fastdfs/sources/ClientGlobal.java
beccd1270b9fe933ec47601dae8fafe34afc9cd9
[]
no_license
yangge007/taotao
52656438bb7dc50e38b48e042073c4f4a42e71af
3a44b777fbea86e46036428bac98015800eb35eb
refs/heads/master
2021-01-24T17:01:14.068283
2018-10-12T08:53:53
2018-10-12T08:53:53
123,103,646
0
0
null
null
null
null
UTF-8
Java
false
false
5,613
java
/** * Copyright (C) 2008 Happy Fish / YuQing * * FastDFS Java Client may be copied only under the terms of the GNU Lesser * General Public License (LGPL). * Please visit the FastDFS Home Page http://www.csource.org/ for more detail. **/ package com.m.fastdfs.sources; import java.io.FileNotFoundException; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; import com.m.fastdfs.common.IniFileReader; import com.m.fastdfs.common.MyException; /** * Global variables * @author Happy Fish / YuQing * @version Version 1.11 */ public class ClientGlobal { public static int g_connect_timeout; //millisecond public static int g_network_timeout; //millisecond public static String g_charset; public static int g_tracker_http_port; public static boolean g_anti_steal_token; //if anti-steal token public static String g_secret_key; //generage token secret key public static TrackerGroup g_tracker_group; public static final int DEFAULT_CONNECT_TIMEOUT = 5; //second public static final int DEFAULT_NETWORK_TIMEOUT = 30; //second public static String DEFAULT_GROUP_NAME;//if groupname is null ,return deault groupname private ClientGlobal() { } /** * load global variables * @param conf_filename config filename */ public static void init(String conf_filename) throws FileNotFoundException, IOException, MyException { IniFileReader iniReader; String[] szTrackerServers; String[] parts; iniReader = new IniFileReader(conf_filename); g_connect_timeout = iniReader.getIntValue("connect_timeout", DEFAULT_CONNECT_TIMEOUT); if (g_connect_timeout < 0) { g_connect_timeout = DEFAULT_CONNECT_TIMEOUT; } g_connect_timeout *= 1000; //millisecond g_network_timeout = iniReader.getIntValue("network_timeout", DEFAULT_NETWORK_TIMEOUT); if (g_network_timeout < 0) { g_network_timeout = DEFAULT_NETWORK_TIMEOUT; } g_network_timeout *= 1000; //millisecond g_charset = iniReader.getStrValue("charset"); if (g_charset == null || g_charset.length() == 0) { g_charset = "ISO8859-1"; } szTrackerServers = iniReader.getValues("tracker_server"); if (szTrackerServers == null) { throw new MyException("item \"tracker_server\" in " + conf_filename + " not found"); } InetSocketAddress[] tracker_servers = new InetSocketAddress[szTrackerServers.length]; for (int i=0; i<szTrackerServers.length; i++) { parts = szTrackerServers[i].split("\\:", 2); if (parts.length != 2) { throw new MyException("the value of item \"tracker_server\" is invalid, the correct format is host:port"); } tracker_servers[i] = new InetSocketAddress(parts[0].trim(), Integer.parseInt(parts[1].trim())); } g_tracker_group = new TrackerGroup(tracker_servers); g_tracker_http_port = iniReader.getIntValue("http.tracker_http_port", 80); g_anti_steal_token = iniReader.getBoolValue("http.anti_steal_token", false); if (g_anti_steal_token) { g_secret_key = iniReader.getStrValue("http.secret_key"); } DEFAULT_GROUP_NAME = iniReader.getStrValue("default_group_name"); } /** * construct Socket object * @param ip_addr ip address or hostname * @param port port number * @return connected Socket object */ public static Socket getSocket(String ip_addr, int port) throws IOException { Socket sock = new Socket(); sock.setSoTimeout(ClientGlobal.g_network_timeout); sock.connect(new InetSocketAddress(ip_addr, port), ClientGlobal.g_connect_timeout); return sock; } /** * construct Socket object * @param addr InetSocketAddress object, including ip address and port * @return connected Socket object */ public static Socket getSocket(InetSocketAddress addr) throws IOException { Socket sock = new Socket(); sock.setSoTimeout(ClientGlobal.g_network_timeout); sock.connect(addr, ClientGlobal.g_connect_timeout); return sock; } public static int getG_connect_timeout() { return g_connect_timeout; } public static void setG_connect_timeout(int connect_timeout) { ClientGlobal.g_connect_timeout = connect_timeout; } public static int getG_network_timeout() { return g_network_timeout; } public static void setG_network_timeout(int network_timeout) { ClientGlobal.g_network_timeout = network_timeout; } public static String getG_charset() { return g_charset; } public static void setG_charset(String charset) { ClientGlobal.g_charset = charset; } public static int getG_tracker_http_port() { return g_tracker_http_port; } public static void setG_tracker_http_port(int tracker_http_port) { ClientGlobal.g_tracker_http_port = tracker_http_port; } public static boolean getG_anti_steal_token() { return g_anti_steal_token; } public static boolean isG_anti_steal_token() { return g_anti_steal_token; } public static void setG_anti_steal_token(boolean anti_steal_token) { ClientGlobal.g_anti_steal_token = anti_steal_token; } public static String getG_secret_key() { return g_secret_key; } public static void setG_secret_key(String secret_key) { ClientGlobal.g_secret_key = secret_key; } public static TrackerGroup getG_tracker_group() { return g_tracker_group; } public static void setG_tracker_group(TrackerGroup tracker_group) { ClientGlobal.g_tracker_group = tracker_group; } public static String getDEFAULT_GROUP_NAME() { return DEFAULT_GROUP_NAME; } public static void setDEFAULT_GROUP_NAME(String dEFAULT_GROUP_NAME) { DEFAULT_GROUP_NAME = dEFAULT_GROUP_NAME; } }
eadc321e8380c1ada2aeedf0f994f3c9c8c6e31a
2c3e2e227eee24b3409be4edd206a1f8b3ea258b
/src/main/java/com/trapp/cursomc/domain/Categoria.java
e859cf75e7173281ceaf371bed47b9e08c638f86
[]
no_license
etrapp/cursomc
ab86fae6de0a8c0c5b8290f73c082ead83e715cf
2ca43dba8bf4b5a86ca0b8b75484145812c829dc
refs/heads/master
2022-11-19T21:16:39.142101
2020-07-24T09:36:50
2020-07-24T09:36:50
279,030,243
0
0
null
null
null
null
UTF-8
Java
false
false
1,662
java
package com.trapp.cursomc.domain; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToMany; import com.fasterxml.jackson.annotation.JsonManagedReference; @Entity public class Categoria implements Serializable { private static final long serialVersionUID = 1; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String nome; @JsonManagedReference @ManyToMany(mappedBy = "categorias") private List<Produto> produtos = new ArrayList<>(); public List<Produto> getProdutos() { return produtos; } public void setProdutos(List<Produto> produtos) { this.produtos = produtos; } public Categoria() { } public Categoria(Integer id, String nome) { super(); this.id = id; this.nome = nome; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Categoria other = (Categoria) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
a09fa0c9a8a4d4190645e75442497b3bba3d7d30
3274d151ad1db18ee513551864bdc944866d3a18
/CNS_analysis/MyCNSanalysis/src/me/songbx/mains/Maize282PopulationGenePresentAbsent.java
e1ebe7c5b12d1fea39781a885c51cf3281f3bda0
[ "MIT" ]
permissive
baoxingsong/CNSpublication
4e91f6f6c94583e11cee23f3b2cd1ff4e2fdab6f
00540e13be60631e2ea6f337944101e78c45119c
refs/heads/master
2023-03-20T05:37:14.825450
2021-02-27T20:19:44
2021-02-27T20:19:44
292,394,564
0
0
null
null
null
null
UTF-8
Java
false
false
9,397
java
package me.songbx.mains; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.regex.Matcher; import java.util.regex.Pattern; import me.songbx.impl.ChromoSomeReadImpl; import me.songbx.impl.ReadGffForSimpleGene; import me.songbx.model.BedRecord; import me.songbx.model.GeneSimple; import me.songbx.service.IfIntron; import htsjdk.tribble.readers.TabixReader; import edu.unc.genomics.Contig; import edu.unc.genomics.io.WigFileReader; import java.nio.file.Path; import java.nio.file.Paths; public class Maize282PopulationGenePresentAbsent { public static void main1(String[] args) { HashMap<String, String> maizeGenome = new ChromoSomeReadImpl("./Zea_mays.AGPv4.dna.toplevel.fa").getChromoSomeHashMap(); HashMap<String, GeneSimple> maizeGenes = new ReadGffForSimpleGene("./Zea_mays.AGPv4.34.gff3").getGenes(); PrintWriter outPut = null; try { outPut = new PrintWriter("./gene_sequence.fa"); for( String geneid : maizeGenes.keySet() ) { String seq_name = maizeGenes.get(geneid).getChromeSomeName()+":"+maizeGenes.get(geneid).getStart()+"-"+maizeGenes.get(geneid).getEnd(); outPut.println(">"+geneid+"\t"+seq_name); outPut.println(maizeGenome.get(maizeGenes.get(geneid).getChromeSomeName()).substring(maizeGenes.get(geneid).getStart()-1, maizeGenes.get(geneid).getEnd())); } outPut.close(); }catch (IOException e) { e.printStackTrace(); } } public static void main(String[] args) { PrintWriter outPut = null; try { outPut = new PrintWriter(args[0] + "_genotype"); //HashMap<String, String> maizeGenome = new ChromoSomeReadImpl("/media/bs674/1_8t/AndCns/maskGenomeForGenomeAlignment/masked_B73_v4_k20_46.fa").getChromoSomeHashMap(); HashMap<String, String> maizeGenome = new ChromoSomeReadImpl("masked_B73_v4_k20_46.fa").getChromoSomeHashMap(); HashMap<String, TabixReader> tabixReaders = new HashMap<String, TabixReader>(); HashMap<String, WigFileReader> wigFileReaders = new HashMap<String, WigFileReader>(); HashMap<String, WigFileReader> wigFileReaders2 = new HashMap<String, WigFileReader>(); IfIntron ifIntron = new IfIntron("./Zea_mays.AGPv4.34.gff3"); HashMap<String, GeneSimple> maizeGenes = new ReadGffForSimpleGene("./Zea_mays.AGPv4.34.gff3").getGenes(); outPut.print("geneName\tGeneRange\tlength"); HashMap<String, String> seqNameToId = new HashMap<String, String>(); try { //reading gene sequence begin File fastaFile = new File("gene_sequence.fa"); BufferedReader fastaReader = new BufferedReader(new FileReader(fastaFile)); String tempString = null; Pattern pattern = Pattern.compile("^>(\\S+)\\s+(\\S+)"); while ((tempString = fastaReader.readLine()) != null) { Matcher match = pattern.matcher(tempString); if( match.find() ) { seqNameToId.put(match.group(2), match.group(1)); } } fastaReader.close(); //reading gene sequence done //reading reads coverage begin File file = new File(args[0]); BufferedReader reader = new BufferedReader(new FileReader(file)); tempString = null; while ((tempString = reader.readLine()) != null) { tempString = tempString.trim(); String baseName = tempString; baseName = baseName.replaceAll(".*\\/", ""); baseName = baseName.replaceAll(".bam.bed.gz", ""); outPut.print("\t" + baseName); //String bwFilePosition0 = "/media/bs674/panAndAssemblyfi/maize282Genotyping/coverageBwFiles/" + baseName + ".bw"; //String bwFilePosition0 = "./coverageBwFiles/" + baseName + ".bw"; String bwFilePosition0 = "/public/home/xpsun/521bwabam/bamtoWig/bigwig/" + baseName + ".bam.wig.bw"; Path bwFile0 = Paths.get(bwFilePosition0); WigFileReader wig0 = WigFileReader.autodetect(bwFile0); wigFileReaders.put(baseName, wig0); //String bwFilePosition = "/media/bs674/1_8t/AndCns/mapCnsToReads/sorghum/mapreadsToCns/" + baseName + ".bw"; //String bwFilePosition = "./mapreadsToGene/" + baseName + ".bw"; String bwFilePosition = "/public/home/xpsun/521bwabam/geneSeqWig/bigwig/" + baseName + ".bw"; Path bwFile = Paths.get(bwFilePosition); WigFileReader wig = WigFileReader.autodetect(bwFile); wigFileReaders2.put(baseName, wig); TabixReader tr = new TabixReader(tempString); tabixReaders.put(baseName, tr); } reader.close(); //reading reads coverage done } catch (IOException e) { e.printStackTrace(); } outPut.println(); //SamReader reader0 = SamReaderFactory.makeDefault().validationStringency(ValidationStringency.SILENT).open(new File("/media/bs674/1_8t/AndCns/sorghum/and_cns_sorghum_maize_V2_smaller_kmer_frequency/5.bam")); for( String geneid: maizeGenes.keySet() ) { int start = maizeGenes.get(geneid).getStart(); int end = maizeGenes.get(geneid).getEnd(); String chr = maizeGenes.get(geneid).getChromeSomeName(); HashSet<Integer> nonMaskingPositions = new HashSet<Integer>(); int totalLength = 0; for( int i=start-1; i<end; ++i ) { if (ifIntron.getElement ( chr, i+1 ) == 2 ) { totalLength = totalLength + 1; nonMaskingPositions.add(i); } } if(totalLength > 30) { outPut.print(geneid+"\t"+chr+":"+start+"-"+end+"\t" + totalLength); String seq_name = chr+":"+start+"-"+end; //System.out.println(seq_name); //read bed files begin File file = new File(args[0]); try { BufferedReader reader = new BufferedReader(new FileReader(file)); String tempString = null; while ((tempString = reader.readLine()) != null) { tempString = tempString.trim(); try { ArrayList<BedRecord> bedRecords = new ArrayList<BedRecord>(); String baseName = tempString; baseName = baseName.replaceAll(".*\\/", ""); baseName = baseName.replaceAll(".bam.bed.gz", ""); WigFileReader wig = wigFileReaders.get(baseName); WigFileReader wig2 = wigFileReaders2.get(baseName); TabixReader tr = tabixReaders.get(baseName); String s; int st = start-1; TabixReader.Iterator iter = tr.query(chr+":"+st+"-"+end); // get the iterator while ((s = iter.next()) != null) { String[] arrOfStr = s.split("\\s+"); if( arrOfStr[3].compareTo("CALLABLE")==0 ) { BedRecord bedRecord = new BedRecord(Integer.parseInt(arrOfStr[1])+1, Integer.parseInt(arrOfStr[2])); //bed has special coordinate bedRecords.add(bedRecord); } } int totalGoodLength = 0; for( int i : nonMaskingPositions ) { if( maizeGenome.get(chr).charAt(i) == 'n' && ifCallAble(i+1, bedRecords, wig, chr, i+2-start, wig2, seqNameToId.get(seq_name)) ) { //if( maizeGenome.get(chr).charAt(i) != 'n' && ifCallAble(i+1, bedRecords, wig, chr) ) { totalGoodLength = totalGoodLength + 1; } } outPut.print("\t" + totalGoodLength); } catch (IOException e) { e.printStackTrace(); } } reader.close(); outPut.println(); } catch (IOException e) { e.printStackTrace(); }//read bed files end } } outPut.close(); for( String baseName : tabixReaders.keySet() ) { tabixReaders.get(baseName).close(); wigFileReaders.get(baseName).close(); wigFileReaders2.get(baseName).close(); } }catch (IOException e) { e.printStackTrace(); }// catch (WigFileException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } } static boolean ifCallAble( int position, ArrayList<BedRecord> bedRecords, WigFileReader wig, String chr, int position2, WigFileReader wig2, String seq_name ) { for( BedRecord bedRecord : bedRecords ) { if( position >= bedRecord.getStart() && position <= bedRecord.getEnd() ) { return true; } if( bedRecord.getStart() > position ) { break; } } Contig result; double thisMean; try { result = wig.query(chr, position, position); thisMean = result.mean(); if (thisMean > 0){ return true; } result = wig2.query(seq_name, position2, position2); thisMean = result.mean(); if (thisMean > 0){ return true; } } catch (Exception e) { e.printStackTrace(); return false; } return false; } }
[ "yifeiren07" ]
yifeiren07
90c1dde8a74c69a116626dfdf03fc1a94aaea282
26310ffd080286e8ba21c67ab6f51ab9c89aaee4
/app/src/main/java/com/wzy/helptravel/ui/Fragment/MeFragment.java
1374b58e25bcdb671d275f843db85c022c300b9c
[]
no_license
oldwu/HelpTravel
57ce3dd1b857c0ad65464570783b1fccfc1f5f42
edfa1baf2bb5a5be3b909605837d796216112ae5
refs/heads/master
2021-01-15T15:33:24.218664
2016-08-23T05:27:50
2016-08-23T05:27:50
62,987,062
0
0
null
null
null
null
UTF-8
Java
false
false
2,549
java
package com.wzy.helptravel.ui.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.wzy.helptravel.R; import com.wzy.helptravel.base.BaseToolBarFragment; import com.wzy.helptravel.base.UniversalImageLoader; import com.wzy.helptravel.bean.User; import com.wzy.helptravel.dao.UserModel; import com.wzy.helptravel.ui.LoginActivity; import com.wzy.helptravel.ui.MainActivity; import com.wzy.helptravel.ui.MeActivity; import com.wzy.helptravel.ui.MyInfoActivity; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; import cn.bmob.v3.Bmob; /** * Created by wzy on 2016/7/8. */ public class MeFragment extends BaseToolBarFragment { @Bind(R.id.avatar_bg) LinearLayout avatarBg; @Bind(R.id.avatar_me_img) ImageView avatar; @Bind(R.id.username_me_tv) TextView username; @Bind(R.id.meInfo) View meInfo; @Bind(R.id.helpInfo) View helpInfo; @Bind(R.id.logout_me_view) View logout; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_me, container, false); ButterKnife.bind(this, rootView); return rootView; } @Override public void onResume() { super.onResume(); initUserInfo(); } @Override protected String title() { return ""; } @OnClick(R.id.meInfo) void onMeInfo() { Bundle bundle = new Bundle(); bundle.putSerializable("user", MainActivity.user); bundle.putBoolean("canChanged", true); startActivity(MeActivity.class, bundle); } @OnClick(R.id.helpInfo) void onHelpInfo() { startActivity(MyInfoActivity.class, null); } @OnClick(R.id.logout_me_view) void onLogout(){ UserModel.getInstance().logout(); startActivity(LoginActivity.class, null); getActivity().finish(); } private void initUserInfo() { User user = UserModel.getInstance().getCurrentUser(); new UniversalImageLoader().load(avatar, user.getAvatar(), R.mipmap.default_avator, null); username.setText(user.getNickName() != null ? user.getNickName() : user.getUsername()); } }
[ "zhenyu Wu" ]
zhenyu Wu
19bcc755b0537930214c539c0164aa712604fda1
e2b1b702ac35aaf390b11248ea11e0d9b037ac82
/organizationsvc/src/test/java/com/springland365/organization/respository/OrganizationRespsitoryTest.java
54184e9686da6fa5c0340c9299681bfe7adbdb08
[]
no_license
springland/SpringMicroService
5dc3c6910aa773e678cb2159bcdf16d6a626e42e
b7b78fe48c1aaa6ba70d27da9f46e6b5a648726b
refs/heads/master
2023-02-11T04:56:53.316676
2021-01-10T20:38:48
2021-01-10T20:38:48
325,688,216
0
0
null
null
null
null
UTF-8
Java
false
false
1,153
java
package com.springland365.organization.respository; import com.springland365.organization.model.Organization; import com.springland365.organization.repository.OrganizationRepository; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import java.util.Optional; import static org.junit.jupiter.api.Assertions.assertEquals; @SpringBootTest @ActiveProfiles("test") public class OrganizationRespsitoryTest { @Autowired OrganizationRepository repo ; @Test public void test() { Organization org = Organization.builder() .id("org1") .name("test org") .contactPhone("203-550-5581") .contactEmail("[email protected]") .contactName("test contact") .build(); repo.save(org); Optional<Organization> result = repo.findById("org1"); assertEquals(result.get() , org); } }
5ed2f773606cc89aee78c120155a6df6503573a7
ed28529ad189a75f90f36ddcc242d33af1133852
/app/src/main/java/com/zvin/wificonnect/util/Const.java
bfd5a70780fed003cf843ec5a3b68415e17292d7
[]
no_license
ZVin-Chen/Android-Wifi-Connect
87dce5837d23e9106fed9498e868b5a3167c5cb4
479e07bfcb8ed8b8a44159a5a6ffa27211971e60
refs/heads/master
2021-01-10T14:42:36.490476
2016-01-15T08:48:19
2016-01-15T08:48:19
49,007,484
1
0
null
null
null
null
UTF-8
Java
false
false
902
java
package com.zvin.wificonnect.util; /** * Created by chenzhengwen on 2015/12/28. */ public class Const { public static final String MAIN_OBSERBER_TAG = "main_observer_tag"; public static final String PRE_LOGIN_TAG = "pre_login_tag--->"; public static final long http_timeout=60 * 1000; //网络连接超时 60秒 public static final long http_logout_timeout=60 * 1000; //下线时网络连接超时 20秒 public static final long free_biz_http_timeout=10 * 1000; //下线时网络连接超时 20秒 public static final String BAIDU_URL= "http://www.baidu.com"; public static final String NEWS_BAIDU = "http://news.baidu.com"; // 准现网地址,用于测试联调时使用 public static final String HOST = "120.197.230.56";// "120.197.230.56"; //portal判断是否是漫游的依据 public static final String JUDGE_ROAMING = "pccwwifi;roamhk"; }
1b8602095c418619ac1c309881890ee2e36e465b
6826e00925044a43e6175c7e5e0fe755e02b2e69
/Email_crypt/app/src/main/java/com/indeema/email/mail/store/imap/ImapMemoryLiteral.java
373a625c7d0f09fb2402f6a921a4ddb54d6639c5
[]
no_license
nazarcybulskij/DefaultEmail-OpenKeyChain
6e7fa5125221c218e3b08c2c918554da68dd265d
415ee83155a73725ba7bb768554e7813a8c6114c
refs/heads/master
2016-09-11T02:53:17.425139
2015-03-08T20:54:20
2015-03-08T20:54:20
31,715,869
0
0
null
null
null
null
UTF-8
Java
false
false
2,096
java
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.indeema.email.mail.store.imap; import com.indeema.email.FixedLengthInputStream; import com.indeema.emailcommon.Logging; import com.indeema.emailcommon.utility.Utility; import com.indeema.mail.utils.LogUtils; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; /** * Subclass of {@link ImapString} used for literals backed by an in-memory byte array. */ public class ImapMemoryLiteral extends ImapString { private byte[] mData; /* package */ ImapMemoryLiteral(FixedLengthInputStream in) throws IOException { // We could use ByteArrayOutputStream and IOUtils.copy, but it'd perform an unnecessary // copy.... mData = new byte[in.getLength()]; int pos = 0; while (pos < mData.length) { int read = in.read(mData, pos, mData.length - pos); if (read < 0) { break; } pos += read; } if (pos != mData.length) { LogUtils.w(Logging.LOG_TAG, ""); } } @Override public void destroy() { mData = null; super.destroy(); } @Override public String getString() { return Utility.fromAscii(mData); } @Override public InputStream getAsStream() { return new ByteArrayInputStream(mData); } @Override public String toString() { return String.format("{%d byte literal(memory)}", mData.length); } }
ca869a1f6d148ef0fca6efd6427ee28489b8c22d
4245b565c16d1d5223a1dde065e6b4d03aff4fb8
/app/src/androidTest/java/com/ivansolutions/gcmandroidnights/ApplicationTest.java
67e6fadd75e123253090dfb7999c31effd693a49
[]
no_license
sierisimo/GcmAndroidNights
8bdd41ed791263f18a5753d4b461072f11631d61
e84889eadcfaaf272a7a2ea49a31d38283689b59
refs/heads/master
2021-01-21T23:37:44.118733
2015-11-05T05:45:19
2015-11-05T05:45:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
365
java
package com.ivansolutions.gcmandroidnights; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
0bc5b90b44c23d6a3a9becb55e747b01f03cc9c8
e7c48e95f167f37edf8c4f5d9062d4d546211c81
/chbase-jaxb/src/main/java/com/chbase/methods/jaxb/messages/MessagePayload.java
231fa9aa4a3e2fc7e7ae87be4659e156166a3b1f
[]
no_license
CHBase/chbase-java-sdk
1d6b04e1884cfa20541bfe0d3ff0b7e3c1fcacd8
61c6143134162d11f897d446595a26a8abdcacd5
refs/heads/master
2023-02-19T09:14:26.321622
2023-02-09T07:10:58
2023-02-09T07:10:58
43,138,403
0
2
null
2023-02-09T07:11:00
2015-09-25T12:10:54
Java
UTF-8
Java
false
false
2,443
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2013.05.14 at 10:04:11 PM PDT // package com.chbase.methods.jaxb.messages; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;summary xmlns="http://www.w3.org/2001/XMLSchema" xmlns:this="urn:com.microsoft.wc.messages" xmlns:wc-types="urn:com.microsoft.wc.types"&gt; * The contents of the message to be enqueued. * &lt;/summary&gt; * </pre> * * <pre> * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;remarks xmlns="http://www.w3.org/2001/XMLSchema" xmlns:this="urn:com.microsoft.wc.messages" xmlns:wc-types="urn:com.microsoft.wc.types"/&gt; * </pre> * * * <p> * Java class for MessagePayload complex type. * * <p> * The following schema fragment specifies the expected content contained within * this class. * * <pre> * &lt;complexType name="MessagePayload"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;choice> * &lt;element name="HealthStatementMessage" type="{urn:com.microsoft.wc.messages}HealthStatementMessage"/> * &lt;/choice> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "MessagePayload", propOrder = { "healthStatementMessage" }) public class MessagePayload { @XmlElement(name = "HealthStatementMessage") protected HealthStatementMessage healthStatementMessage; /** * Gets the value of the healthStatementMessage property. * * @return possible object is {@link HealthStatementMessage } * */ public HealthStatementMessage getHealthStatementMessage() { return healthStatementMessage; } /** * Sets the value of the healthStatementMessage property. * * @param value * allowed object is {@link HealthStatementMessage } * */ public void setHealthStatementMessage(HealthStatementMessage value) { this.healthStatementMessage = value; } }
a86c9df6e856996eac4db5a27cdbd3a1f8145394
342440e2ad54cd78bb9a36c9a16a0b1503256e20
/app/src/main/java/com/example/mangoservices/Dashboard.java
ff64e3b3bf92754f401b0e31152ed9fc4f6a72b5
[]
no_license
hmgtech/MaterialUI-Mango-Services
e46dd81f86242848a9d2255e98139d3e69328bc8
8d357dc1c27117e757e46db071a4e9284d98ae18
refs/heads/master
2023-02-05T13:43:30.935987
2020-12-26T11:46:02
2020-12-26T11:46:02
324,538,281
1
0
null
null
null
null
UTF-8
Java
false
false
340
java
package com.example.mangoservices; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class Dashboard extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dashboard); } }
1a13c0d2a6415afd0c9b130b20eecad66a706d1d
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
/u-1/u-11/u-11-111/u-11-111-1111/u-11-111-1111-11111/u-11-111-1111-11111-f1915.java
9221350031ff2a683860a9d908cdb94a5e72204e
[]
no_license
apertureatf/perftest
f6c6e69efad59265197f43af5072aa7af8393a34
584257a0c1ada22e5486052c11395858a87b20d5
refs/heads/master
2020-06-07T17:52:51.172890
2019-06-21T18:53:01
2019-06-21T18:53:01
193,039,805
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117 6080341067780
5be7dd586371806d274fcc1aee86a65949fbc7dc
892c3c8f61a74fa33b23ac4eb95e619ffc0226eb
/javaee_01/src/main/java/myjava/servlets/LoginSServlet.java
8bf378434fc3302c0631cf2715c18ab2892ccae5
[]
no_license
mengchuize/javaee_hw3
925be3e7de95dde13a2bf09297f70f3770ecf8e5
6846c39fcd83f8615e87cbf04f0cdeeafbccbd5e
refs/heads/master
2022-07-03T05:26:36.255489
2020-03-25T12:18:10
2020-03-25T12:18:10
249,950,570
0
0
null
null
null
null
UTF-8
Java
false
false
1,318
java
package myjava.servlets; import myjava.tables.Student; 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 java.io.IOException; @WebServlet("/LoginSServlet") public class LoginSServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); String username = request.getParameter("susername"); String password = request.getParameter("spassword"); StudentD td=new StudentD(); Student t=td.search(username); if(t.getSpassword().equals(password)){ System.out.println("yes"); request.setAttribute( "susername ",username); request.getRequestDispatcher( "/student.jsp").forward(request,response); }else{ System.out.println("no"); request.getRequestDispatcher( "/failed.jsp").forward(request,response); } } }
9f3f2d259b9c195ee952920178ce2f03754dfd3a
26c4ec2efde07d976a42b5d8bf0af9586b315da4
/zing-dao/src/main/java/com/yibao/dao/entity/HospitalDepartmentDO.java
04aae4fa5403e897f32103b147e405200326a5aa
[]
no_license
wenyiliu/zings
270cc34021ecf2c5202dfed993a76c49e45979ed
e9ec4eb91530dde32488bc672330cfedd812dc5f
refs/heads/master
2022-07-12T19:52:49.101454
2019-08-05T05:06:00
2019-08-05T05:06:00
187,988,731
0
0
null
2022-06-29T17:25:01
2019-05-22T07:44:07
Java
UTF-8
Java
false
false
1,049
java
package com.yibao.dao.entity; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** * @author liuwenyi * @date 2019/5/23 */ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class HospitalDepartmentDO { /** * 自增ID */ private Integer id; /** * 是否删除(0:未删除 1:已删除) */ private Integer isDeleted; /** * 记录创建时间 */ private java.time.LocalDateTime createTime; /** * 记录修改时间 */ private java.time.LocalDateTime modifyTime; /** * 创建人,0表示无创建人值 */ private Integer creator; /** * 修改人,如果为0则表示纪录未修改 */ private Integer modifier; /** * 医院ID */ private Integer hospitalId; /** * 科室名称 */ private String departmentName; /** * 科室级别(1:普通科室 2:重点科室) */ private Integer departmentLevel; }
681dea1deecf1b792c93afcf80ef3c3762e54c95
5099514f6a536565058ed9ee9695faee25f3d7ba
/SwiftTrading/src/main/java/com/citi/swifttrading/generator/OrderBookItem.java
36083a8ed74b612b7bd65c9220ea5dfabc8a9ba8
[]
no_license
CitiAnalyst2017/SwiftTrading
b5244e753a5b5a79b8163b55b198732fc1e106cd
7f155702a5c5be402ec94c06dec2bdb07040d087
refs/heads/master
2021-01-02T19:17:13.336132
2018-11-09T18:26:42
2018-11-09T18:26:42
99,309,979
0
0
null
null
null
null
UTF-8
Java
false
false
525
java
package com.citi.swifttrading.generator; import lombok.Getter; import lombok.Setter; @Getter @Setter public class OrderBookItem { private String bid; private Double price; private int qty; public OrderBookItem(String bid, double price, int qty) { super(); this.bid = bid; this.price = price; this.qty = qty; } @Override public String toString() { return "OrderBookItem [bid=" + bid + ", price=" + price + ", qty=" + qty + "]"; } public OrderBookItem() { } }
1f5d6206892588365bc83665dcf2b415375afabb
c066c38e4785cd74df68f86dcd65e2625d83cd1c
/menu/src/main/java/cn/edu/xidian/menu/MenuApplication.java
6566a5c012845289db031953720615d8c10c6fe9
[]
no_license
AnInvalidName/orchestrator_springcloud
91444eae03a06acbde4ebecbe1400fcec6849021
9076e2093f7111e623f6314bcf264ae1e753d906
refs/heads/master
2022-06-24T21:47:40.761262
2019-12-13T02:36:00
2019-12-13T02:36:00
227,740,255
0
0
null
null
null
null
UTF-8
Java
false
false
414
java
package cn.edu.xidian.menu; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @EnableEurekaServer @SpringBootApplication public class MenuApplication { public static void main(String[] args) { SpringApplication.run(MenuApplication.class, args); } }
a3bfb4a3eea06975b344533135b8b71c4ece8d28
2c9e0541ed8a22bcdc81ae2f9610a118f62c4c4d
/harmony/java/trunk/classlib/modules/luni/src/main/java/java/util/Calendar.java
3d77276de08c835559fae326e30c6dffe7314c24
[]
no_license
JetBrains/jdk8u_tests
774de7dffd513fd61458b4f7c26edd7924c7f1a5
263c74f1842954bae0b34ec3703ad35668b3ffa2
refs/heads/master
2023-08-07T17:57:58.511814
2017-03-20T08:13:25
2017-03-20T08:16:11
70,048,797
11
9
null
null
null
null
UTF-8
Java
false
false
48,993
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package java.util; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.ObjectStreamField; import java.io.Serializable; /** * {@code Calendar} is an abstract base class for converting between a * {@code Date} object and a set of integer fields such as * {@code YEAR}, {@code MONTH}, {@code DAY}, * {@code HOUR}, and so on. (A {@code Date} object represents a * specific instant in time with millisecond precision. See {@link Date} for * information about the {@code Date} class.) * * <p> * Subclasses of {@code Calendar} interpret a {@code Date} * according to the rules of a specific calendar system. * * <p> * Like other locale-sensitive classes, {@code Calendar} provides a class * method, {@code getInstance}, for getting a default instance of * this class for general use. {@code Calendar}'s {@code getInstance} method * returns a calendar whose locale is based on system settings and whose time fields * have been initialized with the current date and time: <blockquote> * * <pre>Calendar rightNow = Calendar.getInstance()</pre> * * </blockquote> * * <p> * A {@code Calendar} object can produce all the time field values needed * to implement the date-time formatting for a particular language and calendar * style (for example, Japanese-Gregorian, Japanese-Traditional). * {@code Calendar} defines the range of values returned by certain * fields, as well as their meaning. For example, the first month of the year * has value {@code MONTH} == {@code JANUARY} for all calendars. * Other values are defined by the concrete subclass, such as {@code ERA} * and {@code YEAR}. See individual field documentation and subclass * documentation for details. * * <p> * When a {@code Calendar} is <em>lenient</em>, it accepts a wider * range of field values than it produces. For example, a lenient * {@code GregorianCalendar} interprets {@code MONTH} == * {@code JANUARY}, {@code DAY_OF_MONTH} == 32 as February 1. A * non-lenient {@code GregorianCalendar} throws an exception when given * out-of-range field settings. When calendars recompute field values for return * by {@code get()}, they normalize them. For example, a * {@code GregorianCalendar} always produces {@code DAY_OF_MONTH} * values between 1 and the length of the month. * * <p> * {@code Calendar} defines a locale-specific seven day week using two * parameters: the first day of the week and the minimal days in first week * (from 1 to 7). These numbers are taken from the locale resource data when a * {@code Calendar} is constructed. They may also be specified explicitly * through the API. * * <p> * When setting or getting the {@code WEEK_OF_MONTH} or * {@code WEEK_OF_YEAR} fields, {@code Calendar} must determine * the first week of the month or year as a reference point. The first week of a * month or year is defined as the earliest seven day period beginning on * {@code getFirstDayOfWeek()} and containing at least * {@code getMinimalDaysInFirstWeek()} days of that month or year. Weeks * numbered ..., -1, 0 precede the first week; weeks numbered 2, 3,... follow * it. Note that the normalized numbering returned by {@code get()} may * be different. For example, a specific {@code Calendar} subclass may * designate the week before week 1 of a year as week <em>n</em> of the * previous year. * * <p> * When computing a {@code Date} from time fields, two special * circumstances may arise: there may be insufficient information to compute the * {@code Date} (such as only year and month but no day in the month), or * there may be inconsistent information (such as "Tuesday, July 15, 1996" -- * July 15, 1996 is actually a Monday). * * <p> * <strong>Insufficient information.</strong> The calendar will use default * information to specify the missing fields. This may vary by calendar; for the * Gregorian calendar, the default for a field is the same as that of the start * of the epoch: i.e., YEAR = 1970, MONTH = JANUARY, DATE = 1, etc. * * <p> * <strong>Inconsistent information.</strong> If fields conflict, the calendar * will give preference to fields set more recently. For example, when * determining the day, the calendar will look for one of the following * combinations of fields. The most recent combination, as determined by the * most recently set single field, will be used. * * <blockquote> * * <pre> * MONTH + DAY_OF_MONTH * MONTH + WEEK_OF_MONTH + DAY_OF_WEEK * MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK * DAY_OF_YEAR * DAY_OF_WEEK + WEEK_OF_YEAR</pre> * * </blockquote> * * For the time of day: * * <blockquote> * * <pre> * HOUR_OF_DAY * AM_PM + HOUR</pre> * * </blockquote> * * <p> * <strong>Note:</strong> There are certain possible ambiguities in * interpretation of certain singular times, which are resolved in the following * ways: * <ol> * <li> 24:00:00 "belongs" to the following day. That is, 23:59 on Dec 31, 1969 * &lt; 24:00 on Jan 1, 1970 &lt; 24:01:00 on Jan 1, 1970 form a sequence of * three consecutive minutes in time. * * <li> Although historically not precise, midnight also belongs to "am", and * noon belongs to "pm", so on the same day, we have 12:00 am (midnight) &lt; 12:01 am, * and 12:00 pm (noon) &lt; 12:01 pm * </ol> * * <p> * The date or time format strings are not part of the definition of a calendar, * as those must be modifiable or overridable by the user at runtime. Use * {@link java.text.DateFormat} to format dates. * * <p> * <strong>Field manipulation methods</strong> * * <p> * {@code Calendar} fields can be changed using three methods: * {@code set()}, {@code add()}, and {@code roll()}. * * <p> * <strong>{@code set(f, value)}</strong> changes field {@code f} * to {@code value}. In addition, it sets an internal member variable to * indicate that field {@code f} has been changed. Although field * {@code f} is changed immediately, the calendar's milliseconds is not * recomputed until the next call to {@code get()}, * {@code getTime()}, or {@code getTimeInMillis()} is made. Thus, * multiple calls to {@code set()} do not trigger multiple, unnecessary * computations. As a result of changing a field using {@code set()}, * other fields may also change, depending on the field, the field value, and * the calendar system. In addition, {@code get(f)} will not necessarily * return {@code value} after the fields have been recomputed. The * specifics are determined by the concrete calendar class. * * <p> * <em>Example</em>: Consider a {@code GregorianCalendar} originally * set to August 31, 1999. Calling <code>set(Calendar.MONTH, * Calendar.SEPTEMBER)</code> * sets the calendar to September 31, 1999. This is a temporary internal * representation that resolves to October 1, 1999 if {@code getTime()}is * then called. However, a call to {@code set(Calendar.DAY_OF_MONTH, 30)} * before the call to {@code getTime()} sets the calendar to September * 30, 1999, since no recomputation occurs after {@code set()} itself. * * <p> * <strong>{@code add(f, delta)}</strong> adds {@code delta} to * field {@code f}. This is equivalent to calling <code>set(f, * get(f) + delta)</code> * with two adjustments: * * <blockquote> * <p> * <strong>Add rule 1</strong>. The value of field {@code f} after the * call minus the value of field {@code f} before the call is * {@code delta}, modulo any overflow that has occurred in field * {@code f}. Overflow occurs when a field value exceeds its range and, * as a result, the next larger field is incremented or decremented and the * field value is adjusted back into its range. * * <p> * <strong>Add rule 2</strong>. If a smaller field is expected to be invariant, * but &nbsp; it is impossible for it to be equal to its prior value because of * changes in its minimum or maximum after field {@code f} is changed, * then its value is adjusted to be as close as possible to its expected value. * A smaller field represents a smaller unit of time. {@code HOUR} is a * smaller field than {@code DAY_OF_MONTH}. No adjustment is made to * smaller fields that are not expected to be invariant. The calendar system * determines what fields are expected to be invariant. * </blockquote> * * <p> * In addition, unlike {@code set()}, {@code add()} forces an * immediate recomputation of the calendar's milliseconds and all fields. * * <p> * <em>Example</em>: Consider a {@code GregorianCalendar} originally * set to August 31, 1999. Calling {@code add(Calendar.MONTH, 13)} sets * the calendar to September 30, 2000. <strong>Add rule 1</strong> sets the * {@code MONTH} field to September, since adding 13 months to August * gives September of the next year. Since {@code DAY_OF_MONTH} cannot be * 31 in September in a {@code GregorianCalendar}, <strong>add rule 2</strong> * sets the {@code DAY_OF_MONTH} to 30, the closest possible value. * Although it is a smaller field, {@code DAY_OF_WEEK} is not adjusted by * rule 2, since it is expected to change when the month changes in a * {@code GregorianCalendar}. * * <p> * <strong>{@code roll(f, delta)}</strong> adds {@code delta} to * field {@code f} without changing larger fields. This is equivalent to * calling {@code add(f, delta)} with the following adjustment: * * <blockquote> * <p> * <strong>Roll rule</strong>. Larger fields are unchanged after the call. A * larger field represents a larger unit of time. {@code DAY_OF_MONTH} is * a larger field than {@code HOUR}. * </blockquote> * * <p> * <em>Example</em>: Consider a {@code GregorianCalendar} originally * set to August 31, 1999. Calling <code>roll(Calendar.MONTH, * 8)</code> sets * the calendar to April 30, <strong>1999</strong>. Add rule 1 sets the * {@code MONTH} field to April. Using a {@code GregorianCalendar}, * the {@code DAY_OF_MONTH} cannot be 31 in the month April. Add rule 2 * sets it to the closest possible value, 30. Finally, the <strong>roll rule</strong> * maintains the {@code YEAR} field value of 1999. * * <p> * <em>Example</em>: Consider a {@code GregorianCalendar} originally * set to Sunday June 6, 1999. Calling * {@code roll(Calendar.WEEK_OF_MONTH, -1)} sets the calendar to Tuesday * June 1, 1999, whereas calling {@code add(Calendar.WEEK_OF_MONTH, -1)} * sets the calendar to Sunday May 30, 1999. This is because the roll rule * imposes an additional constraint: The {@code MONTH} must not change * when the {@code WEEK_OF_MONTH} is rolled. Taken together with add rule * 1, the resultant date must be between Tuesday June 1 and Saturday June 5. * According to add rule 2, the {@code DAY_OF_WEEK}, an invariant when * changing the {@code WEEK_OF_MONTH}, is set to Tuesday, the closest * possible value to Sunday (where Sunday is the first day of the week). * * <p> * <strong>Usage model</strong>. To motivate the behavior of {@code add()} * and {@code roll()}, consider a user interface component with * increment and decrement buttons for the month, day, and year, and an * underlying {@code GregorianCalendar}. If the interface reads January * 31, 1999 and the user presses the month increment button, what should it * read? If the underlying implementation uses {@code set()}, it might * read March 3, 1999. A better result would be February 28, 1999. Furthermore, * if the user presses the month increment button again, it should read March * 31, 1999, not March 28, 1999. By saving the original date and using either * {@code add()} or {@code roll()}, depending on whether larger * fields should be affected, the user interface can behave as most users will * intuitively expect. * * <p> * <b>Note:</b> You should always use {@code roll} and {@code add} rather than * attempting to perform arithmetic operations directly on the fields of a * <tt>Calendar</tt>. It is quite possible for <tt>Calendar</tt> subclasses * to have fields with non-linear behavior, for example missing months or days * during non-leap years. The subclasses' <tt>add</tt> and <tt>roll</tt> * methods will take this into account, while simple arithmetic manipulations * may give invalid results. * * @see Date * @see GregorianCalendar * @see TimeZone */ public abstract class Calendar implements Serializable, Cloneable, Comparable<Calendar> { private static final long serialVersionUID = -1807547505821590642L; /** * Set to {@code true} when the calendar fields have been set from the time, set to * {@code false} when a field is changed and the fields must be recomputed. */ protected boolean areFieldsSet; /** * An integer array of calendar fields. The length is {@code FIELD_COUNT}. */ protected int[] fields; /** * A boolean array. Each element indicates if the corresponding field has * been set. The length is {@code FIELD_COUNT}. */ protected boolean[] isSet; /** * Set to {@code true} when the time has been set, set to {@code false} when a field is * changed and the time must be recomputed. */ protected boolean isTimeSet; /** * The time in milliseconds since January 1, 1970. */ protected long time; transient int lastTimeFieldSet; transient int lastDateFieldSet; private boolean lenient; private int firstDayOfWeek; private int minimalDaysInFirstWeek; private TimeZone zone; /** * Value of the {@code MONTH} field indicating the first month of the * year. */ public static final int JANUARY = 0; /** * Value of the {@code MONTH} field indicating the second month of * the year. */ public static final int FEBRUARY = 1; /** * Value of the {@code MONTH} field indicating the third month of the * year. */ public static final int MARCH = 2; /** * Value of the {@code MONTH} field indicating the fourth month of * the year. */ public static final int APRIL = 3; /** * Value of the {@code MONTH} field indicating the fifth month of the * year. */ public static final int MAY = 4; /** * Value of the {@code MONTH} field indicating the sixth month of the * year. */ public static final int JUNE = 5; /** * Value of the {@code MONTH} field indicating the seventh month of * the year. */ public static final int JULY = 6; /** * Value of the {@code MONTH} field indicating the eighth month of * the year. */ public static final int AUGUST = 7; /** * Value of the {@code MONTH} field indicating the ninth month of the * year. */ public static final int SEPTEMBER = 8; /** * Value of the {@code MONTH} field indicating the tenth month of the * year. */ public static final int OCTOBER = 9; /** * Value of the {@code MONTH} field indicating the eleventh month of * the year. */ public static final int NOVEMBER = 10; /** * Value of the {@code MONTH} field indicating the twelfth month of * the year. */ public static final int DECEMBER = 11; /** * Value of the {@code MONTH} field indicating the thirteenth month * of the year. Although {@code GregorianCalendar} does not use this * value, lunar calendars do. */ public static final int UNDECIMBER = 12; /** * Value of the {@code DAY_OF_WEEK} field indicating Sunday. */ public static final int SUNDAY = 1; /** * Value of the {@code DAY_OF_WEEK} field indicating Monday. */ public static final int MONDAY = 2; /** * Value of the {@code DAY_OF_WEEK} field indicating Tuesday. */ public static final int TUESDAY = 3; /** * Value of the {@code DAY_OF_WEEK} field indicating Wednesday. */ public static final int WEDNESDAY = 4; /** * Value of the {@code DAY_OF_WEEK} field indicating Thursday. */ public static final int THURSDAY = 5; /** * Value of the {@code DAY_OF_WEEK} field indicating Friday. */ public static final int FRIDAY = 6; /** * Value of the {@code DAY_OF_WEEK} field indicating Saturday. */ public static final int SATURDAY = 7; /** * Field number for {@code get} and {@code set} indicating the * era, e.g., AD or BC in the Julian calendar. This is a calendar-specific * value; see subclass documentation. * * @see GregorianCalendar#AD * @see GregorianCalendar#BC */ public static final int ERA = 0; /** * Field number for {@code get} and {@code set} indicating the * year. This is a calendar-specific value; see subclass documentation. */ public static final int YEAR = 1; /** * Field number for {@code get} and {@code set} indicating the * month. This is a calendar-specific value. The first month of the year is * {@code JANUARY}; the last depends on the number of months in a * year. * * @see #JANUARY * @see #FEBRUARY * @see #MARCH * @see #APRIL * @see #MAY * @see #JUNE * @see #JULY * @see #AUGUST * @see #SEPTEMBER * @see #OCTOBER * @see #NOVEMBER * @see #DECEMBER * @see #UNDECIMBER */ public static final int MONTH = 2; /** * Field number for {@code get} and {@code set} indicating the * week number within the current year. The first week of the year, as * defined by {@code getFirstDayOfWeek()} and * {@code getMinimalDaysInFirstWeek()}, has value 1. Subclasses * define the value of {@code WEEK_OF_YEAR} for days before the first * week of the year. * * @see #getFirstDayOfWeek * @see #getMinimalDaysInFirstWeek */ public static final int WEEK_OF_YEAR = 3; /** * Field number for {@code get} and {@code set} indicating the * week number within the current month. The first week of the month, as * defined by {@code getFirstDayOfWeek()} and * {@code getMinimalDaysInFirstWeek()}, has value 1. Subclasses * define the value of {@code WEEK_OF_MONTH} for days before the * first week of the month. * * @see #getFirstDayOfWeek * @see #getMinimalDaysInFirstWeek */ public static final int WEEK_OF_MONTH = 4; /** * Field number for {@code get} and {@code set} indicating the * day of the month. This is a synonym for {@code DAY_OF_MONTH}. The * first day of the month has value 1. * * @see #DAY_OF_MONTH */ public static final int DATE = 5; /** * Field number for {@code get} and {@code set} indicating the * day of the month. This is a synonym for {@code DATE}. The first * day of the month has value 1. * * @see #DATE */ public static final int DAY_OF_MONTH = 5; /** * Field number for {@code get} and {@code set} indicating the * day number within the current year. The first day of the year has value * 1. */ public static final int DAY_OF_YEAR = 6; /** * Field number for {@code get} and {@code set} indicating the * day of the week. This field takes values {@code SUNDAY}, * {@code MONDAY}, {@code TUESDAY}, {@code WEDNESDAY}, * {@code THURSDAY}, {@code FRIDAY}, and * {@code SATURDAY}. * * @see #SUNDAY * @see #MONDAY * @see #TUESDAY * @see #WEDNESDAY * @see #THURSDAY * @see #FRIDAY * @see #SATURDAY */ public static final int DAY_OF_WEEK = 7; /** * Field number for {@code get} and {@code set} indicating the * ordinal number of the day of the week within the current month. Together * with the {@code DAY_OF_WEEK} field, this uniquely specifies a day * within a month. Unlike {@code WEEK_OF_MONTH} and * {@code WEEK_OF_YEAR}, this field's value does <em>not</em> * depend on {@code getFirstDayOfWeek()} or * {@code getMinimalDaysInFirstWeek()}. {@code DAY_OF_MONTH 1} * through {@code 7} always correspond to <code>DAY_OF_WEEK_IN_MONTH * 1</code>; * {@code 8} through {@code 15} correspond to * {@code DAY_OF_WEEK_IN_MONTH 2}, and so on. * {@code DAY_OF_WEEK_IN_MONTH 0} indicates the week before * {@code DAY_OF_WEEK_IN_MONTH 1}. Negative values count back from * the end of the month, so the last Sunday of a month is specified as * {@code DAY_OF_WEEK = SUNDAY, DAY_OF_WEEK_IN_MONTH = -1}. Because * negative values count backward they will usually be aligned differently * within the month than positive values. For example, if a month has 31 * days, {@code DAY_OF_WEEK_IN_MONTH -1} will overlap * {@code DAY_OF_WEEK_IN_MONTH 5} and the end of {@code 4}. * * @see #DAY_OF_WEEK * @see #WEEK_OF_MONTH */ public static final int DAY_OF_WEEK_IN_MONTH = 8; /** * Field number for {@code get} and {@code set} indicating * whether the {@code HOUR} is before or after noon. E.g., at * 10:04:15.250 PM the {@code AM_PM} is {@code PM}. * * @see #AM * @see #PM * @see #HOUR */ public static final int AM_PM = 9; /** * Field number for {@code get} and {@code set} indicating the * hour of the morning or afternoon. {@code HOUR} is used for the * 12-hour clock. E.g., at 10:04:15.250 PM the {@code HOUR} is 10. * * @see #AM_PM * @see #HOUR_OF_DAY */ public static final int HOUR = 10; /** * Field number for {@code get} and {@code set} indicating the * hour of the day. {@code HOUR_OF_DAY} is used for the 24-hour * clock. E.g., at 10:04:15.250 PM the {@code HOUR_OF_DAY} is 22. * * @see #HOUR */ public static final int HOUR_OF_DAY = 11; /** * Field number for {@code get} and {@code set} indicating the * minute within the hour. E.g., at 10:04:15.250 PM the {@code MINUTE} * is 4. */ public static final int MINUTE = 12; /** * Field number for {@code get} and {@code set} indicating the * second within the minute. E.g., at 10:04:15.250 PM the * {@code SECOND} is 15. */ public static final int SECOND = 13; /** * Field number for {@code get} and {@code set} indicating the * millisecond within the second. E.g., at 10:04:15.250 PM the * {@code MILLISECOND} is 250. */ public static final int MILLISECOND = 14; /** * Field number for {@code get} and {@code set} indicating the * raw offset from GMT in milliseconds. */ public static final int ZONE_OFFSET = 15; /** * Field number for {@code get} and {@code set} indicating the * daylight savings offset in milliseconds. */ public static final int DST_OFFSET = 16; /** * This is the total number of fields in this calendar. */ public static final int FIELD_COUNT = 17; /** * Value of the {@code AM_PM} field indicating the period of the day * from midnight to just before noon. */ public static final int AM = 0; /** * Value of the {@code AM_PM} field indicating the period of the day * from noon to just before midnight. */ public static final int PM = 1; @SuppressWarnings("nls") private static String[] fieldNames = { "ERA=", "YEAR=", "MONTH=", "WEEK_OF_YEAR=", "WEEK_OF_MONTH=", "DAY_OF_MONTH=", "DAY_OF_YEAR=", "DAY_OF_WEEK=", "DAY_OF_WEEK_IN_MONTH=", "AM_PM=", "HOUR=", "HOUR_OF_DAY", "MINUTE=", "SECOND=", "MILLISECOND=", "ZONE_OFFSET=", "DST_OFFSET=" }; /** * Constructs a {@code Calendar} instance using the default {@code TimeZone} and {@code Locale}. */ protected Calendar() { this(TimeZone.getDefault(), Locale.getDefault()); } Calendar(TimeZone timezone) { fields = new int[FIELD_COUNT]; isSet = new boolean[FIELD_COUNT]; areFieldsSet = isTimeSet = false; setLenient(true); setTimeZone(timezone); } /** * Constructs a {@code Calendar} instance using the specified {@code TimeZone} and {@code Locale}. * * @param timezone * the timezone. * @param locale * the locale. */ protected Calendar(TimeZone timezone, Locale locale) { this(timezone); com.ibm.icu.util.Calendar icuCalendar = com.ibm.icu.util.Calendar .getInstance(com.ibm.icu.util.SimpleTimeZone .getTimeZone(timezone.getID()), locale); setFirstDayOfWeek(icuCalendar.getFirstDayOfWeek()); setMinimalDaysInFirstWeek(icuCalendar.getMinimalDaysInFirstWeek()); } /** * Adds the specified amount to a {@code Calendar} field. * * @param field * the {@code Calendar} field to modify. * @param value * the amount to add to the field. * @throws IllegalArgumentException * if {@code field} is {@code DST_OFFSET} or {@code * ZONE_OFFSET}. */ abstract public void add(int field, int value); /** * Returns whether the {@code Date} specified by this {@code Calendar} instance is after the {@code Date} * specified by the parameter. The comparison is not dependent on the time * zones of the {@code Calendar}. * * @param calendar * the {@code Calendar} instance to compare. * @return {@code true} when this Calendar is after calendar, {@code false} otherwise. * @throws IllegalArgumentException * if the time is not set and the time cannot be computed * from the current field values. */ public boolean after(Object calendar) { if (!(calendar instanceof Calendar)) { return false; } return getTimeInMillis() > ((Calendar) calendar).getTimeInMillis(); } /** * Returns whether the {@code Date} specified by this {@code Calendar} instance is before the * {@code Date} specified by the parameter. The comparison is not dependent on the * time zones of the {@code Calendar}. * * @param calendar * the {@code Calendar} instance to compare. * @return {@code true} when this Calendar is before calendar, {@code false} otherwise. * @throws IllegalArgumentException * if the time is not set and the time cannot be computed * from the current field values. */ public boolean before(Object calendar) { if (!(calendar instanceof Calendar)) { return false; } return getTimeInMillis() < ((Calendar) calendar).getTimeInMillis(); } /** * Clears all of the fields of this {@code Calendar}. All fields are initialized to * zero. */ public final void clear() { for (int i = 0; i < FIELD_COUNT; i++) { fields[i] = 0; isSet[i] = false; } areFieldsSet = isTimeSet = false; } /** * Clears the specified field to zero and sets the isSet flag to {@code false}. * * @param field * the field to clear. */ public final void clear(int field) { fields[field] = 0; isSet[field] = false; areFieldsSet = isTimeSet = false; } /** * Returns a new {@code Calendar} with the same properties. * * @return a shallow copy of this {@code Calendar}. * * @see java.lang.Cloneable */ @Override public Object clone() { try { Calendar clone = (Calendar) super.clone(); clone.fields = fields.clone(); clone.isSet = isSet.clone(); clone.zone = (TimeZone) zone.clone(); return clone; } catch (CloneNotSupportedException e) { return null; } } /** * Computes the time from the fields if the time has not already been set. * Computes the fields from the time if the fields are not already set. * * @throws IllegalArgumentException * if the time is not set and the time cannot be computed * from the current field values. */ protected void complete() { if (!isTimeSet) { computeTime(); isTimeSet = true; } if (!areFieldsSet) { computeFields(); areFieldsSet = true; } } /** * Computes the {@code Calendar} fields from {@code time}. */ protected abstract void computeFields(); /** * Computes {@code time} from the Calendar fields. * * @throws IllegalArgumentException * if the time cannot be computed from the current field * values. */ protected abstract void computeTime(); /** * Compares the specified object to this {@code Calendar} and returns whether they are * equal. The object must be an instance of {@code Calendar} and have the same * properties. * * @param object * the object to compare with this object. * @return {@code true} if the specified object is equal to this {@code Calendar}, {@code false} * otherwise. */ @Override public boolean equals(Object object) { if (this == object) { return true; } if (!(object instanceof Calendar)) { return false; } Calendar cal = (Calendar) object; return getTimeInMillis() == cal.getTimeInMillis() && isLenient() == cal.isLenient() && getFirstDayOfWeek() == cal.getFirstDayOfWeek() && getMinimalDaysInFirstWeek() == cal .getMinimalDaysInFirstWeek() && getTimeZone().equals(cal.getTimeZone()); } /** * Gets the value of the specified field after computing the field values by * calling {@code complete()} first. * * @param field * the field to get. * @return the value of the specified field. * * @throws IllegalArgumentException * if the fields are not set, the time is not set, and the * time cannot be computed from the current field values. * @throws ArrayIndexOutOfBoundsException * if the field is not inside the range of possible fields. * The range is starting at 0 up to {@code FIELD_COUNT}. */ public int get(int field) { complete(); return fields[field]; } /** * Gets the maximum value of the specified field for the current date. * * @param field * the field. * @return the maximum value of the specified field. */ public int getActualMaximum(int field) { int value, next; if (getMaximum(field) == (next = getLeastMaximum(field))) { return next; } complete(); long orgTime = time; set(field, next); do { value = next; roll(field, true); next = get(field); } while (next > value); time = orgTime; areFieldsSet = false; return value; } /** * Gets the minimum value of the specified field for the current date. * * @param field * the field. * @return the minimum value of the specified field. */ public int getActualMinimum(int field) { int value, next; if (getMinimum(field) == (next = getGreatestMinimum(field))) { return next; } complete(); long orgTime = time; set(field, next); do { value = next; roll(field, false); next = get(field); } while (next < value); time = orgTime; areFieldsSet = false; return value; } /** * Gets the list of installed {@code Locale}s which support {@code Calendar}. * * @return an array of {@code Locale}. */ public static synchronized Locale[] getAvailableLocales() { return Locale.getAvailableLocales(); } /** * Gets the first day of the week for this {@code Calendar}. * * @return the first day of the week. */ public int getFirstDayOfWeek() { return firstDayOfWeek; } /** * Gets the greatest minimum value of the specified field. This is the * biggest value that {@code getActualMinimum} can return for any possible * time. * * @param field * the field. * @return the greatest minimum value of the specified field. */ abstract public int getGreatestMinimum(int field); /** * Constructs a new instance of the {@code Calendar} subclass appropriate for the * default {@code Locale}. * * @return a {@code Calendar} subclass instance set to the current date and time in * the default {@code Timezone}. */ public static synchronized Calendar getInstance() { return new GregorianCalendar(); } /** * Constructs a new instance of the {@code Calendar} subclass appropriate for the * specified {@code Locale}. * * @param locale * the locale to use. * @return a {@code Calendar} subclass instance set to the current date and time. */ public static synchronized Calendar getInstance(Locale locale) { return new GregorianCalendar(locale); } /** * Constructs a new instance of the {@code Calendar} subclass appropriate for the * default {@code Locale}, using the specified {@code TimeZone}. * * @param timezone * the {@code TimeZone} to use. * @return a {@code Calendar} subclass instance set to the current date and time in * the specified timezone. */ public static synchronized Calendar getInstance(TimeZone timezone) { return new GregorianCalendar(timezone); } /** * Constructs a new instance of the {@code Calendar} subclass appropriate for the * specified {@code Locale}. * * @param timezone * the {@code TimeZone} to use. * @param locale * the {@code Locale} to use. * @return a {@code Calendar} subclass instance set to the current date and time in * the specified timezone. */ public static synchronized Calendar getInstance(TimeZone timezone, Locale locale) { return new GregorianCalendar(timezone, locale); } /** * Gets the smallest maximum value of the specified field. This is the * smallest value that {@code getActualMaximum()} can return for any * possible time. * * @param field * the field number. * @return the smallest maximum value of the specified field. */ abstract public int getLeastMaximum(int field); /** * Gets the greatest maximum value of the specified field. This returns the * biggest value that {@code get} can return for the specified field. * * @param field * the field. * @return the greatest maximum value of the specified field. */ abstract public int getMaximum(int field); /** * Gets the minimal days in the first week of the year. * * @return the minimal days in the first week of the year. */ public int getMinimalDaysInFirstWeek() { return minimalDaysInFirstWeek; } /** * Gets the smallest minimum value of the specified field. this returns the * smallest value thet {@code get} can return for the specified field. * * @param field * the field number. * @return the smallest minimum value of the specified field. */ abstract public int getMinimum(int field); /** * Gets the time of this {@code Calendar} as a {@code Date} object. * * @return a new {@code Date} initialized to the time of this {@code Calendar}. * * @throws IllegalArgumentException * if the time is not set and the time cannot be computed * from the current field values. */ public final Date getTime() { return new Date(getTimeInMillis()); } /** * Computes the time from the fields if required and returns the time. * * @return the time of this {@code Calendar}. * * @throws IllegalArgumentException * if the time is not set and the time cannot be computed * from the current field values. */ public long getTimeInMillis() { if (!isTimeSet) { computeTime(); isTimeSet = true; } return time; } /** * Gets the timezone of this {@code Calendar}. * * @return the {@code TimeZone} used by this {@code Calendar}. */ public TimeZone getTimeZone() { return zone; } /** * Returns an integer hash code for the receiver. Objects which are equal * return the same value for this method. * * @return the receiver's hash. * * @see #equals */ @Override public int hashCode() { return (isLenient() ? 1237 : 1231) + getFirstDayOfWeek() + getMinimalDaysInFirstWeek() + getTimeZone().hashCode(); } /** * Gets the value of the specified field without recomputing. * * @param field * the field. * @return the value of the specified field. */ protected final int internalGet(int field) { return fields[field]; } /** * Returns if this {@code Calendar} accepts field values which are outside the valid * range for the field. * * @return {@code true} if this {@code Calendar} is lenient, {@code false} otherwise. */ public boolean isLenient() { return lenient; } /** * Returns whether the specified field is set. * * @param field * a {@code Calendar} field number. * @return {@code true} if the specified field is set, {@code false} otherwise. */ public final boolean isSet(int field) { return isSet[field]; } /** * Adds the specified amount to the specified field and wraps the value of * the field when it goes beyond the maximum or minimum value for the * current date. Other fields will be adjusted as required to maintain a * consistent date. * * @param field * the field to roll. * @param value * the amount to add. */ public void roll(int field, int value) { boolean increment = value >= 0; int count = increment ? value : -value; for (int i = 0; i < count; i++) { roll(field, increment); } } /** * Increment or decrement the specified field and wrap the value of the * field when it goes beyond the maximum or minimum value for the current * date. Other fields will be adjusted as required to maintain a consistent * date. * * @param field * the number indicating the field to roll. * @param increment * {@code true} to increment the field, {@code false} to decrement. */ abstract public void roll(int field, boolean increment); /** * Sets a field to the specified value. * * @param field * the code indicating the {@code Calendar} field to modify. * @param value * the value. */ public void set(int field, int value) { fields[field] = value; isSet[field] = true; areFieldsSet = isTimeSet = false; if (field > MONTH && field < AM_PM) { lastDateFieldSet = field; } if (field == HOUR || field == HOUR_OF_DAY) { lastTimeFieldSet = field; } if (field == AM_PM) { lastTimeFieldSet = HOUR; } } /** * Sets the year, month and day of the month fields. Other fields are not * changed. * * @param year * the year. * @param month * the month. * @param day * the day of the month. */ public final void set(int year, int month, int day) { set(YEAR, year); set(MONTH, month); set(DATE, day); } /** * Sets the year, month, day of the month, hour of day and minute fields. * Other fields are not changed. * * @param year * the year. * @param month * the month. * @param day * the day of the month. * @param hourOfDay * the hour of day. * @param minute * the minute. */ public final void set(int year, int month, int day, int hourOfDay, int minute) { set(year, month, day); set(HOUR_OF_DAY, hourOfDay); set(MINUTE, minute); } /** * Sets the year, month, day of the month, hour of day, minute and second * fields. Other fields are not changed. * * @param year * the year. * @param month * the month. * @param day * the day of the month. * @param hourOfDay * the hour of day. * @param minute * the minute. * @param second * the second. */ public final void set(int year, int month, int day, int hourOfDay, int minute, int second) { set(year, month, day, hourOfDay, minute); set(SECOND, second); } /** * Sets the first day of the week for this {@code Calendar}. * * @param value * a {@code Calendar} day of the week. */ public void setFirstDayOfWeek(int value) { firstDayOfWeek = value; } /** * Sets this {@code Calendar} to accept field values which are outside the valid * range for the field. * * @param value * a boolean value. */ public void setLenient(boolean value) { lenient = value; } /** * Sets the minimal days in the first week of the year. * * @param value * the minimal days in the first week of the year. */ public void setMinimalDaysInFirstWeek(int value) { minimalDaysInFirstWeek = value; } /** * Sets the time of this {@code Calendar}. * * @param date * a {@code Date} object. */ public final void setTime(Date date) { setTimeInMillis(date.getTime()); } /** * Sets the time of this {@code Calendar}. * * @param milliseconds * the time as the number of milliseconds since Jan. 1, 1970. */ public void setTimeInMillis(long milliseconds) { if (!isTimeSet || !areFieldsSet || time != milliseconds) { time = milliseconds; isTimeSet = true; areFieldsSet = false; complete(); } } /** * Sets the {@code TimeZone} used by this Calendar. * * @param timezone * a {@code TimeZone}. */ public void setTimeZone(TimeZone timezone) { zone = timezone; areFieldsSet = false; } /** * Returns the string representation of this {@code Calendar}. * * @return the string representation of this {@code Calendar}. */ @Override @SuppressWarnings("nls") public String toString() { StringBuilder result = new StringBuilder(getClass().getName() + "[time=" + (isTimeSet ? String.valueOf(time) : "?") + ",areFieldsSet=" + areFieldsSet + // ",areAllFieldsSet=" + areAllFieldsSet + ",lenient=" + lenient + ",zone=" + zone + ",firstDayOfWeek=" + firstDayOfWeek + ",minimalDaysInFirstWeek=" + minimalDaysInFirstWeek); for (int i = 0; i < FIELD_COUNT; i++) { result.append(','); result.append(fieldNames[i]); result.append('='); if (isSet[i]) { result.append(fields[i]); } else { result.append('?'); } } result.append(']'); return result.toString(); } /** * Compares the times of the two {@code Calendar}, which represent the milliseconds * from the January 1, 1970 00:00:00.000 GMT (Gregorian). * * @param anotherCalendar * another calendar that this one is compared with. * @return 0 if the times of the two {@code Calendar}s are equal, -1 if the time of * this {@code Calendar} is before the other one, 1 if the time of this * {@code Calendar} is after the other one. * @throws NullPointerException * if the argument is null. * @throws IllegalArgumentException * if the argument does not include a valid time * value. */ public int compareTo(Calendar anotherCalendar) { if (null == anotherCalendar) { throw new NullPointerException(); } long timeInMillis = getTimeInMillis(); long anotherTimeInMillis = anotherCalendar.getTimeInMillis(); if (timeInMillis > anotherTimeInMillis) { return 1; } if (timeInMillis == anotherTimeInMillis) { return 0; } return -1; } @SuppressWarnings("nls") private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField("areFieldsSet", Boolean.TYPE), new ObjectStreamField("fields", int[].class), new ObjectStreamField("firstDayOfWeek", Integer.TYPE), new ObjectStreamField("isSet", boolean[].class), new ObjectStreamField("isTimeSet", Boolean.TYPE), new ObjectStreamField("lenient", Boolean.TYPE), new ObjectStreamField("minimalDaysInFirstWeek", Integer.TYPE), new ObjectStreamField("nextStamp", Integer.TYPE), new ObjectStreamField("serialVersionOnStream", Integer.TYPE), new ObjectStreamField("time", Long.TYPE), new ObjectStreamField("zone", TimeZone.class), }; @SuppressWarnings("nls") private void writeObject(ObjectOutputStream stream) throws IOException { complete(); ObjectOutputStream.PutField putFields = stream.putFields(); putFields.put("areFieldsSet", areFieldsSet); putFields.put("fields", this.fields); putFields.put("firstDayOfWeek", firstDayOfWeek); putFields.put("isSet", isSet); putFields.put("isTimeSet", isTimeSet); putFields.put("lenient", lenient); putFields.put("minimalDaysInFirstWeek", minimalDaysInFirstWeek); putFields.put("nextStamp", 2 /* MINIMUM_USER_STAMP */); putFields.put("serialVersionOnStream", 1); putFields.put("time", time); putFields.put("zone", zone); stream.writeFields(); } @SuppressWarnings("nls") private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { ObjectInputStream.GetField readFields = stream.readFields(); areFieldsSet = readFields.get("areFieldsSet", false); this.fields = (int[]) readFields.get("fields", null); firstDayOfWeek = readFields.get("firstDayOfWeek", Calendar.SUNDAY); isSet = (boolean[]) readFields.get("isSet", null); isTimeSet = readFields.get("isTimeSet", false); lenient = readFields.get("lenient", true); minimalDaysInFirstWeek = readFields.get("minimalDaysInFirstWeek", 1); time = readFields.get("time", 0L); zone = (TimeZone) readFields.get("zone", null); } }
4aae6ecdedec3881bfac3a8e29e483770d715e97
33cae071de05a68ce026bbbdeaa34780f965fd42
/src/数组与矩阵/搜索二维矩阵_II_240.java
eec92b83ab886890fc729e97e44f427f3bc522fe
[]
no_license
xiaok1024/AlgorithmWithDesign
85c04ab08f43409b5314fdc21220f0446aa3f2be
80f5fce4d4864a7451534d13cbc9bc83e4b042ef
refs/heads/master
2020-05-01T09:47:53.202394
2019-03-24T12:02:05
2019-03-24T12:02:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,317
java
package 数组与矩阵; public class 搜索二维矩阵_II_240 { /* * 编写一个高效的算法来搜索 m x n 矩阵 matrix 中的一个目标值 target。该矩阵具有以下特性: 每行的元素从左到右升序排列。 每列的元素从上到下升序排列。 * [ [1, 4, 7, 11, 15], [2, 5, 8, 12, 19], [3, 6, 9, 16, 22], [10, 13, 14, 17, 24], [18, 21, 23, 26, 30] ] 给定 target = 5,返回 true。 给定 target = 20,返回 false。 */ //思路:从右上角开始(行上最大,列上最小), 比较target 和 matrix[i][j]的值. 如果小于target(该行最大的数都小于target), 则该行不可能有此数, 所以i++; //如果大于target(该行右边的数大于target), 则该列不可能有此数, 所以j--(向左搜索). 遇到边界则表明该矩阵不含target. public boolean searchMatrix(int[][] matrix, int target) { //row为0 column 为0 if(matrix.length==0 || matrix[0].length ==0) return false; //从右上角开始 int i = 0; int j = matrix[0].length-1; //遍历,条件为不到达边界 while(i<=matrix.length-1 && j>=0) { //获取当前位置的值 int x = matrix[i][j]; if(x==target) return true; if(x < target) i++; if(x > target) j--; } return false; } }
d9a7b907832ed9ed4feb8ab4ec5d3b7d2c2cf2b1
a037b6c0ca1a936898c2996cacf8871fdb1ab109
/Lection15/ElectronicRegistry/servlets-layer/src/main/java/ru/senla/bialevich/servlets/GetAllRoomsServlet.java
b079a2eba867525f04d3a04aa32bfb0b97c6fdc4
[]
no_license
SiarheiBialevich/SenlaCourseJavaEE
8f7139b0c0f7ff0b3d9824ff7e8962e9e2f6afac
0543db4973589aaf0812704a80f52c34abaaec3a
refs/heads/master
2021-09-09T19:23:37.277007
2018-03-01T01:53:40
2018-03-01T01:53:40
103,466,137
0
1
null
2018-03-19T07:31:26
2017-09-14T00:36:43
Java
UTF-8
Java
false
false
920
java
package ru.senla.bialevich.servlets; import com.fasterxml.jackson.databind.ObjectMapper; import ru.senla.bialevich.model.Room; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.util.List; @WebServlet("/allRooms") public class GetAllRoomsServlet extends AbstractServlet { private static final long serialVersionUID = 5335416693092046179L; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ObjectMapper mapper = new ObjectMapper(); resp.setContentType(JSON); PrintWriter writer = resp.getWriter(); List<Room> rooms = hotel.getAllRooms(null); writer.write(mapper.writeValueAsString(rooms)); } }
8abc240a1828410931e351ed82d137b2db5f46fe
9256e3fcf749d857f3524b1f994c3eacb22556f5
/src/com/caglardev/agift/Plugin.java
f0e2d1a655c4cefbcc520ae4b17dea5eeba1f44b
[]
no_license
Caglar2306/Spigot-Bukkit-1.8.x-AGift
01e40f04a30ea9478fd7882018faa6fd6ed65c29
3611ce912b1eed5c3741a17cbc7c7da7e62d17c9
refs/heads/master
2021-01-13T01:02:59.076055
2015-11-27T23:41:27
2015-11-27T23:41:27
47,003,305
0
0
null
null
null
null
UTF-8
Java
false
false
3,386
java
package com.caglardev.agift; import java.util.Calendar; import java.util.HashMap; import java.util.Map.Entry; import org.bukkit.Material; import org.bukkit.plugin.java.JavaPlugin; import com.caglardev.agift.events.OnPlayerJoinEvent; import com.caglardev.agift.objects.Gift; public class Plugin extends JavaPlugin { // General public final String PLUGIN_NAME = "AGift"; // Configuration files public static Configuration configurationDefault; public static String CONFIG_DEFAULT = "Config.yml"; public static Configuration configurationTemplates; public static String CONFIG_TEMPLATES = "Template.yml"; public static Configuration configurationGifts; public static String CONFIG_GIFTS = "Gifts.yml"; public static Configuration configurationPlayers; public static String CONFIG_PLAYERS = "Players.yml"; public static HashMap<Integer, Gift> gifts; public static HashMap<String, Calendar> players; @Override public void onDisable() { System.out.println("Saving players..."); for(String key : configurationPlayers.getConfig().getConfigurationSection("Players").getKeys(false)) { configurationPlayers.getConfig().set("Players" + key, null); } for(Entry<String, Calendar> entry : players.entrySet()) { configurationPlayers.getConfig().set("Players." + entry.getKey(), entry.getValue().getTimeInMillis()); } configurationPlayers.saveConfig(); System.out.println("Players saved."); } @Override public void onEnable() { initializePlugin(this); } public void initializePlugin(JavaPlugin javaPlugin) { // Configuration files configurationDefault = new Configuration(javaPlugin, CONFIG_DEFAULT); configurationTemplates = new Configuration(javaPlugin, CONFIG_TEMPLATES); configurationGifts = new Configuration(javaPlugin, CONFIG_GIFTS); configurationPlayers = new Configuration(javaPlugin, CONFIG_PLAYERS); // Loading players if(!configurationPlayers.getConfig().contains("Players")) { configurationPlayers.getConfig().createSection("Players"); } configurationPlayers.saveConfig(); configurationPlayers.reloadConfig(); players = new HashMap<String, Calendar>(); for(String key : configurationPlayers.getConfig().getConfigurationSection("Players").getKeys(false)) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(configurationPlayers.getConfig().getLong("Players." + key, 0)); players.put(key, calendar); } // Loading gifts if(!configurationGifts.getConfig().contains("Gifts")) { configurationGifts.getConfig().createSection("Gifts"); } configurationGifts.saveConfig(); configurationGifts.reloadConfig(); gifts = new HashMap<Integer, Gift>(); for(String key : configurationGifts.getConfig().getConfigurationSection("Gifts").getKeys(false)) { Material material = Material.getMaterial(configurationGifts.getConfig().getString("Gifts." + key + ".Material")); if(material != null) { Gift gift = new Gift(material, configurationGifts.getConfig().getInt("Gifts." + key + ".Stack", 1)); if(configurationGifts.getConfig().getString("Gifts." + key + ".DisplayName") != null) { gift.setDisplayName(configurationGifts.getConfig().getString("Gifts." + key + ".DisplayName")); } gifts.put(gifts.size(), gift); } } this.getServer().getPluginManager().registerEvents(new OnPlayerJoinEvent(), this); } }
71562ba93f85d7853ce54d138b39fbaff30ccdfd
1bdab33b7bba71fc03965156649652f3462b2fc2
/src/test/java/Fifth/JavaLearning/JavaLearning/Strings/CompareTwoArrarys.java
74e6ca2cf7acb02cafdfbb1d873b32136e3ebcc0
[]
no_license
narendrareddytippala/JavaLearning
80f7a178bf30666975d9a781057ba33318b4a81c
a594859b283699ddcb3e5bc2d0e21d5be8ac6e2a
refs/heads/main
2023-04-10T05:54:26.718255
2021-04-05T16:36:47
2021-04-05T16:36:47
354,895,039
0
0
null
null
null
null
UTF-8
Java
false
false
251
java
package Fifth.JavaLearning.JavaLearning.Strings; import java.util.Arrays; public class CompareTwoArrarys { public static void main(String[] args) { int a[] = {2,4,6,7,9}; int b[] ={2,4,6,7,9}; System.out.println(Arrays.equals(a, b)); } }
0421a38452cbe790975a202649e4b6b18e35f858
0a638fa6d36556bb9024cbd415e51f5f77be57bc
/src/main/java/com/example/manager_house_88/domain/Collection.java
82e444327cbd0bffca8db1ed01cc70a0791fe86b
[]
no_license
Curtaingit/maneger_house_88
c14be7538275958b57267f654e0c7001d3a293ef
8801bb4aef3377c8a56b4d5a615259c30d391b53
refs/heads/master
2021-09-08T21:18:09.694845
2018-03-12T08:21:20
2018-03-12T08:21:20
116,771,407
1
0
null
null
null
null
UTF-8
Java
false
false
595
java
package com.example.manager_house_88.domain; import com.example.manager_house_88.bos.BaseEntity; import com.example.manager_house_88.bos.Bostype; import com.example.manager_house_88.bos.Entry; import com.fasterxml.jackson.annotation.JsonBackReference; import lombok.Getter; import lombok.Setter; import sun.management.counter.perf.PerfInstrumentation; import javax.persistence.*; @Getter @Setter @Entity(name = "t_collection") @Bostype("A08") public class Collection extends BaseEntity { /*用户id*/ private String userId; /*标的物id*/ private String commodityId; }
96ef1361078f67e79df872b85faa3bf2af9522ff
726cf01270d48994defec40733a0e69ac4c72d78
/src/main/java/com/tsystems/tschool/logiweb/services/impl/UserServiceImpl.java
609f3aae7733045f78bba1574e8ecc64b4c926d5
[]
no_license
raspyatnikov/tschool
d2d14031eb252abfec368619896c7c724ac2c1f3
1e1eb678b8b003fe1fc639d07b8a98acce1ee78f
refs/heads/master
2021-07-16T04:52:37.446686
2017-10-23T08:00:01
2017-10-23T08:00:01
107,146,413
0
0
null
null
null
null
UTF-8
Java
false
false
2,362
java
package com.tsystems.tschool.logiweb.services.impl; import com.tsystems.tschool.logiweb.dao.UserDao; import com.tsystems.tschool.logiweb.dao.exceptions.DaoException; import com.tsystems.tschool.logiweb.entities.User; import com.tsystems.tschool.logiweb.services.UserService; import com.tsystems.tschool.logiweb.services.exceptions.ServiceException; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.transaction.Transactional; import java.util.List; @Service public class UserServiceImpl implements UserService { @Autowired UserDao userDao; private static final Logger LOGGER = Logger.getLogger(OrderServiceImpl.class); @Transactional @Override public List<User> findAllUsers() throws ServiceException { try { return userDao.findAll(); } catch (DaoException e) { LOGGER.warn("Error in service layer"); throw new ServiceException(e.getMessage(), e); } } @Transactional @Override public void editUser(User editedUser) throws ServiceException { try { userDao.update(editedUser); } catch (DaoException e) { LOGGER.warn("Error in service layer"); throw new ServiceException(e.getMessage(), e); } } @Transactional @Override public int addUser(User newUser) throws ServiceException { try { userDao.create(newUser); return newUser.getId(); } catch (DaoException e) { LOGGER.warn("Error in service layer"); throw new ServiceException(e.getMessage(), e); } } @Transactional @Override public User findUserById(int id) throws ServiceException { try { return userDao.findById(id); } catch (DaoException e) { LOGGER.warn("Error in service layer"); throw new ServiceException(e.getMessage(), e); } } @Transactional @Override public User findUserByEmail(String email) throws ServiceException { try { return userDao.findUserByEmail(email); } catch (DaoException e) { LOGGER.warn("Error in service layer"); throw new ServiceException(e.getMessage(), e); } } }
0f872c49d217b10907710508e2b03410c132a6d3
f46894370c5e9cc7f5022b396a8d29a511c409b4
/portalobra/src/main/java/br/com/grupopibb/portalobra/dao/insumo/GrupoInsumosFacade.java
4aabd4c8c2f27ce67f1c729daa8a808011fbb870
[]
no_license
Manhattan/agenda
11298e51aac499d813083185bb5347988444e5b5
78341253012053b18c35a11bebf787334e57c221
refs/heads/master
2021-01-10T17:03:38.154163
2016-03-15T19:17:57
2016-03-15T19:17:57
53,972,210
0
0
null
null
null
null
UTF-8
Java
false
false
2,068
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package br.com.grupopibb.portalobra.dao.insumo; import br.com.grupopibb.portalobra.dao.commons.AbstractEntityBeans; import static br.com.grupopibb.portalobra.dao.commons.AbstractEntityBeans.getMapParams; import br.com.grupopibb.portalobra.model.insumo.GrupoInsumos; import br.com.grupopibb.portalobra.utils.UtilBeans; import java.util.List; import java.util.Map; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; /** * * @author tone.lima */ @Stateless @LocalBean //@Interceptors({LogTime.class}) public class GrupoInsumosFacade extends AbstractEntityBeans<GrupoInsumos, String> { @PersistenceContext(unitName = UtilBeans.PERSISTENCE_UNIT) private EntityManager em; public GrupoInsumosFacade() { super(GrupoInsumos.class, GrupoInsumosFacade.class); } @Override protected EntityManager getEntityManager() { return em; } public List<GrupoInsumos> findByClasse(final String classe){ Map<String, Object> params = getMapParams(); paramsFiltro(params, classe); return listPesqParam("GrupoInsumos.findByClasse", params); } public GrupoInsumos findByClasseGrupo(final String classeGrupo){ Map<String, Object> params = getMapParams(); paramsFiltro2(params, classeGrupo); return pesqParam("GrupoInsumos.findByClasseGrupo", params); } /** * Params do FindByClasse * @param params * @param classe */ private void paramsFiltro(Map<String, Object> params, final String classe){ params.put("classe", classe); } /** * Params do FindByClasseGrupo * @param params * @param classeGrupo */ private void paramsFiltro2(Map<String, Object> params, final String classeGrupo){ params.put("classeGrupo", classeGrupo); } }
12d27e0ff885c2defd52c06b7f776146845cdd1c
816553c97a66b15a2b0a23ab52b0d74a39532c6d
/SMS/gen/com/example/sms/R.java
2dea047a39ab3fda420d038d6c6dbe9d723f9411
[]
no_license
wesley5201314/Android-Project-Demo
4466ca5a94b7655091bce9d4243ee1550baa5bca
c75245f13538b3dfe2ed08eb6939f3e3cf171472
refs/heads/master
2020-06-06T04:57:34.857538
2015-02-02T10:20:44
2015-02-02T10:20:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,948
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.example.sms; public final class R { public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Example customization of dimensions originally defined in res/values/dimens.xml (such as screen margins) for screens with more than 820dp of available width. This would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). */ public static final int activity_horizontal_margin=0x7f040000; public static final int activity_vertical_margin=0x7f040001; } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int action_settings=0x7f080005; public static final int button1=0x7f080004; public static final int editText1=0x7f080001; public static final int editText2=0x7f080003; public static final int textView1=0x7f080000; public static final int textView2=0x7f080002; } public static final class layout { public static final int activity_main=0x7f030000; } public static final class menu { public static final int main=0x7f070000; } public static final class string { public static final int action_settings=0x7f050002; public static final int app_name=0x7f050000; public static final int button=0x7f050004; public static final int hello_world=0x7f050001; public static final int label=0x7f050003; public static final int success=0x7f050005; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f060000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f060001; } }
8baa9fc7b1e25c8479db4d68ba6fd040990793b6
b4c3d962d8f52aa7d00e9508d072560e115be078
/src/com/gersonberger/Stats.java
ce9035a87eafb26ca788ceae2b99efc18b214b96
[]
no_license
mrnamwen/IIDX-FX
2f93ca7fad41e928835159390e0082ded27dd2ed
3cbb4b5c179bd620c31c7fd25193eeea8ec508d9
refs/heads/master
2021-01-23T10:23:34.919769
2017-05-24T00:50:33
2017-05-24T00:50:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,171
java
package com.gersonberger; import javafx.collections.ObservableList; import java.util.Arrays; class Stats { //statsAllStatus[status] //status: 0=noplay, 1=failed, ..., 7=fullcombo private int[] statsAllStatus = new int[8]; //statsAllGrade[grade] //grade: 0=none, 1=F, 2=E, ..., 7=AA, 8=AAA, 8=MAX private int[] statsAllGrade = new int[10]; //statsLevel[level][status] //level: 0=1, 1=2, ..., 11=12 //status: 0=noplay, 1=failed, ..., 7=fullcombo private int[][] statsLevel = new int[12][8]; //statsLevel[style][status] //style: 0=1st Style, 1=Substream, ..., 23=copula //status: 0=noplay, 1=failed, ..., 7=fullcombo private int[][] statsStyle = new int[24][8]; Stats(ObservableList<SongEntry> masterData){ //init array with 0 for (int[] row : statsLevel) Arrays.fill(row, 0); for (int[] row : statsStyle) Arrays.fill(row, 0); int style; int grade; int status; int level; for (SongEntry songEntry : masterData) { if (songEntry.getOmnimix() == 1 && Main.songlist.equals(Style.COPULAFULL)) continue; style = Style.styleToInt(songEntry.getStyle()); grade = songEntry.getGrade().equals("") ? Grade.NONE_INT : Grade.gradeToInt(songEntry.getGrade().split(" ")[0]); status = Status.statusToInt(songEntry.getStatus()); level = Integer.valueOf(songEntry.getLevel()) - 1; statsAllStatus[status]++; statsAllGrade[grade]++; statsLevel[level][status]++; statsStyle[style][status]++; } } int getAllStatus(int status) { return statsAllStatus[status]; } int getAllGrade(int grade) { return statsAllGrade[grade]; } int getTotalClears() { return getAllStatus(Status.CLEAR_INT) + getAllStatus(Status.HARDCLEAR_INT) + getAllStatus(Status.EXHARDCLEAR_INT) + getAllStatus(Status.FULLCOMBO_INT); } int getTotal() { return getAllStatus(Status.NOPLAY_INT) + getAllStatus(Status.FAILED_INT) + getAllStatus(Status.ASSISTCLEAR_INT) + getAllStatus(Status.EASYCLEAR_INT) + getAllStatus(Status.CLEAR_INT) + getAllStatus(Status.HARDCLEAR_INT) + getAllStatus(Status.EXHARDCLEAR_INT) + getAllStatus(Status.FULLCOMBO_INT); } int getTotalPlayed() { return getAllStatus(Status.FAILED_INT) + getAllStatus(Status.ASSISTCLEAR_INT) + getAllStatus(Status.EASYCLEAR_INT) + getAllStatus(Status.CLEAR_INT) + getAllStatus(Status.HARDCLEAR_INT) + getAllStatus(Status.EXHARDCLEAR_INT) + getAllStatus(Status.FULLCOMBO_INT); } int getAllStyle(int style) { int val = 0; for (int i = 0; i < statsStyle[style].length; i++) { val += statsStyle[style][i]; } return val; } int getAllLevel(int level) { level--; int val = 0; for (int i = 0; i < statsLevel[level].length; i++) { val += statsLevel[level][i]; } return val; } int getLevelStatus(int level, int status) { return statsLevel[level - 1][status]; } int getLevelCleared(int level) { level--; return statsLevel[level][Status.CLEAR_INT] + statsLevel[level][Status.HARDCLEAR_INT] + statsLevel[level][Status.EXHARDCLEAR_INT] + statsLevel[level][Status.FULLCOMBO_INT]; } int getLevelNotCleared(int level) { level--; return statsLevel[level][Status.NOPLAY_INT] + statsLevel[level][Status.FAILED_INT] + statsLevel[level][Status.ASSISTCLEAR_INT] + statsLevel[level][Status.EASYCLEAR_INT]; } int getStyleStatus(int style, int status) { return statsStyle[style][status]; } int getStyleCleared(int style) { return statsStyle[style][Status.CLEAR_INT] + statsStyle[style][Status.HARDCLEAR_INT] + statsStyle[style][Status.EXHARDCLEAR_INT] + statsStyle[style][Status.FULLCOMBO_INT]; } int getStyleNotCleared(int style) { return statsStyle[style][Status.NOPLAY_INT] + statsStyle[style][Status.FAILED_INT] + statsStyle[style][Status.ASSISTCLEAR_INT] + statsStyle[style][Status.EASYCLEAR_INT]; } }
0cce8e063939475694fe8de67644fd7e02008f4f
c8d1c97678124f6c79747933f1dfc924564ded55
/src/main/java/pl/mbierut/models/weekend/Weekend.java
7598b8ffa519e58fee55bf23c6c31e684f53b373
[]
no_license
mbierut/Weekend-Planner
1d6c8a6230cb9769919bf1c95c082309acac8e73
3e31da95e5fab13dfb0c85373e4259ee43f6b932
refs/heads/master
2020-06-07T07:00:36.668612
2019-08-13T13:50:30
2019-08-13T13:50:30
192,956,385
0
2
null
null
null
null
UTF-8
Java
false
false
922
java
package pl.mbierut.models.weekend; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; @Data @JsonIgnoreProperties(ignoreUnknown = true) @AllArgsConstructor @NoArgsConstructor public class Weekend { private LocalDate startDate; private LocalDate endDate; public boolean hasOverlapWith(Weekend otherPeriod){ return !getStartDate().isAfter(otherPeriod.getEndDate()) && !getEndDate().isBefore(otherPeriod.getStartDate()); } public List<LocalDate> getAllDaysInclusive(){ List<LocalDate> allDates = new ArrayList<>(); LocalDate temp = startDate; while (!temp.isAfter(endDate)){ allDates.add(temp); temp = temp.plusDays(1); } return allDates; } }
f56f9bfe6033428fabc3a26eba41b2f569d39684
17e8438486cb3e3073966ca2c14956d3ba9209ea
/dso/tags/3.4.0_1/code/base/common/src/com/tc/util/Conversion.java
421f5b44a856841d621040b1173db25028ca2cd1
[]
no_license
sirinath/Terracotta
fedfc2c4f0f06c990f94b8b6c3b9c93293334345
00a7662b9cf530dfdb43f2dd821fa559e998c892
refs/heads/master
2021-01-23T05:41:52.414211
2015-07-02T15:21:54
2015-07-02T15:21:54
38,613,711
1
0
null
null
null
null
UTF-8
Java
false
false
13,749
java
/** * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright * notice. All rights reserved. */ package com.tc.util; import com.tc.bytes.TCByteBuffer; import com.tc.exception.TCException; import com.tc.exception.TCRuntimeException; import java.io.UnsupportedEncodingException; import java.text.DecimalFormat; import java.util.regex.Pattern; /** * Data conversion algorithms and whatnot can be found in java.io.DataInput and java.io.DataOutput. Contains methods for * converting from one kind of thing to another. * * @author orion */ public class Conversion { public static final long MIN_UINT = 0; public static final long MAX_UINT = 4294967295L; // 2^32 - 1 private static int makeInt(byte b3, byte b2, byte b1, byte b0) { return ((((b3 & 0xff) << 24) | ((b2 & 0xff) << 16) | ((b1 & 0xff) << 8) | ((b0 & 0xff) << 0))); } public static byte setFlag(byte flags, int offset, boolean value) { if (value) { return (byte) (flags | offset); } else { return (byte) (flags & ~offset); } } public static boolean getFlag(byte flags, int offset) { return (flags & offset) == offset; } /** * Helper method to convert a byte to an unsigned int. Use me when you want to treat a java byte as unsigned */ public static short byte2uint(byte b) { return (short) (b & 0xFF); } public static long bytes2uint(byte b[]) { return bytes2uint(b, 0, b.length); } public static long bytes2uint(byte b[], int length) { return bytes2uint(b, 0, length); } /** * Helper method to convert 1-4 bytes (big-endiand) into an unsigned int (max: 2^32 -1) */ public static long bytes2uint(byte b[], int offset, int length) { if ((length < 1) || (length > 4)) { throw new IllegalArgumentException("invalid byte array length: " + length); } if ((b.length - offset) < length) { throw new IllegalArgumentException("not enough data available for length " + length + " starting at offset " + offset + " in a byte array of length " + b.length); } long rv = 0; switch (length) { case 1: { return byte2uint(b[offset]); } case 2: { rv += ((long) byte2uint(b[0 + offset])) << 8; rv += byte2uint(b[1 + offset]); return rv; } case 3: { rv += ((long) byte2uint(b[0 + offset])) << 16; rv += ((long) byte2uint(b[1 + offset])) << 8; rv += byte2uint(b[2 + offset]); return rv; } case 4: { rv += ((long) byte2uint(b[0 + offset])) << 24; rv += ((long) byte2uint(b[1 + offset])) << 16; rv += ((long) byte2uint(b[2 + offset])) << 8; rv += byte2uint(b[3 + offset]); return rv; } default: { throw new RuntimeException("internal error"); } } } /** * Helper method to write a 4 byte unsigned integer value into a given byte array at a given offset * * @param l the unsigned int value to write * @param dest the byte array to write the uint into * @param index starting offset into the destination byte array */ public static void writeUint(long l, byte[] dest, int index) { if ((l > MAX_UINT) || (l < 0)) { throw new IllegalArgumentException("unsigned integer value invalid: " + l); } int pos = index; dest[pos++] = (byte) ((l >>> 24) & 0x000000FF); dest[pos++] = (byte) ((l >>> 16) & 0x000000FF); dest[pos++] = (byte) ((l >>> 8) & 0x000000FF); dest[pos++] = (byte) (l & 0x000000FF); return; } /** * Helper method to write a 4 byte java (signed) integer value into a given byte array at a given offset * * @param l the signed int value to write * @param dest the byte array to write the uint into * @param index starting offset into the destination byte array */ public static void writeInt(int i, byte[] dest, int index) { dest[index] = (byte) ((i >>> 24) & 0x000000FF); dest[index + 1] = (byte) ((i >>> 16) & 0x000000FF); dest[index + 2] = (byte) ((i >>> 8) & 0x000000FF); dest[index + 3] = (byte) ((i >>> 0) & 0x000000FF); return; } /** * Helper method to convert an unsigned short to 2 bytes (big-endian) */ public static byte[] ushort2bytes(int i) { if ((i > 0xFFFF) || (i < 0)) { throw new IllegalArgumentException("invalid short value: " + i); } byte[] rv = new byte[2]; rv[0] = (byte) ((i >>> 8) & 0x000000FF); rv[1] = (byte) ((i >>> 0) & 0x000000FF); return rv; } /** * Helper method to convert an unsigned integer to 4 bytes (big-endian) */ public static byte[] uint2bytes(long l) { if ((l > MAX_UINT) || (l < 0)) { throw new IllegalArgumentException("unsigned integer value out of range: " + l); } byte[] rv = new byte[4]; rv[0] = (byte) ((l >>> 24) & 0x000000FF); rv[1] = (byte) ((l >>> 16) & 0x000000FF); rv[2] = (byte) ((l >>> 8) & 0x000000FF); rv[3] = (byte) ((l >>> 0) & 0x000000FF); return rv; } /** * Helper method to convert a string to bytes in a safe way. */ public static String bytes2String(byte[] bytes) { try { return new String(bytes, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new TCRuntimeException(e); } } /** * Helper method to convert a string to bytes in a safe way. */ public static byte[] string2Bytes(String string) { try { return (string == null) ? new byte[0] : string.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new TCRuntimeException(e); } } public static boolean bytes2Boolean(byte[] bytes) { return (bytes[0] != 0 ? true : false); } public static byte[] boolean2Bytes(boolean v) { byte[] rv = new byte[1]; rv[0] = v ? (byte) 1 : (byte) 0; return rv; } public static byte[] byte2Bytes(byte v) { return new byte[] { v }; } public static char bytes2Char(byte[] bytes) { return (char) ((bytes[0] << 8) | (bytes[1] & 0xff)); } public static byte[] char2Bytes(char v) { return new byte[] { (byte) (0xff & (v >> 8)), (byte) (0xff & v) }; } public static double bytes2Double(byte[] bytes) { return Double.longBitsToDouble(Conversion.bytes2Long(bytes)); } public static byte[] double2Bytes(double l) { return Conversion.long2Bytes(Double.doubleToLongBits(l)); } public static float bytes2Float(byte[] bytes) { return Float.intBitsToFloat(Conversion.bytes2Int(bytes)); } public static byte[] float2Bytes(float l) { return Conversion.int2Bytes(Float.floatToIntBits(l)); } public static int bytes2Int(byte[] bytes, int offset) { return makeInt(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]); } public static int bytes2Int(byte[] bytes) { return makeInt(bytes[0], bytes[1], bytes[2], bytes[3]); } public static byte[] int2Bytes(int v) { byte[] rv = new byte[4]; rv[0] = (byte) ((v >>> 24) & 0xFF); rv[1] = (byte) ((v >>> 16) & 0xFF); rv[2] = (byte) ((v >>> 8) & 0xFF); rv[3] = (byte) ((v >>> 0) & 0xFF); return rv; } public static long bytes2Long(byte[] bytes) { return bytes2Long(bytes, 0); } public static long bytes2Long(byte[] bytes, int offset) { return (((long) bytes[offset] << 56) + ((long) (bytes[offset + 1] & 0xFF) << 48) + ((long) (bytes[offset + 2] & 0xFF) << 40) + ((long) (bytes[offset + 3] & 0xFF) << 32) + ((long) (bytes[offset + 4] & 0xFF) << 24) + ((bytes[offset + 5] & 0xFF) << 16) + ((bytes[offset + 6] & 0xFF) << 8) + ((bytes[offset + 7] & 0xFF) << 0)); } public static byte[] long2Bytes(long l) { byte[] rv = new byte[8]; writeLong(l, rv, 0); return rv; } public static void writeLong(long l, byte[] rv, int offset) { rv[offset] = (byte) (l >>> 56); rv[offset + 1] = (byte) (l >>> 48); rv[offset + 2] = (byte) (l >>> 40); rv[offset + 3] = (byte) (l >>> 32); rv[offset + 4] = (byte) (l >>> 24); rv[offset + 5] = (byte) (l >>> 16); rv[offset + 6] = (byte) (l >>> 8); rv[offset + 7] = (byte) (l >>> 0); } public static short bytes2Short(byte[] bytes) { short rv = (short) (((bytes[0] & 0xFF) << 8) + ((bytes[1] & 0xFF) << 0)); return rv; } public static byte[] short2Bytes(short v) { byte[] rv = new byte[2]; rv[0] = (byte) ((v >>> 8) & 0xFF); rv[1] = (byte) ((v >>> 0) & 0xFF); return rv; } public static boolean byte2Boolean(byte b) { return b != 0; } /** * @param value */ public static byte boolean2Byte(boolean value) { return (value) ? (byte) 1 : (byte) 0; } /** * Equivalent to calling <code>bytesToHex(b, 0, b.length)</code>. */ public static String bytesToHex(byte[] b) { return bytesToHex(b, 0, b.length); } /** * Converts a single byte to a hex string representation, can be decoded with Byte.parseByte(). * * @param b the byte to encode * @return a */ public static String bytesToHex(byte[] b, int index, int length) { StringBuffer buf = new StringBuffer(); byte leading, trailing; for (int pos = index; pos >= 0 && pos < index + length && pos < b.length; ++pos) { leading = (byte) ((b[pos] >>> 4) & 0x0f); trailing = (byte) (b[pos] & 0x0f); buf.append((0 <= leading) && (leading <= 9) ? (char) ('0' + leading) : (char) ('A' + (leading - 10))); buf.append((0 <= trailing) && (trailing <= 9) ? (char) ('0' + trailing) : (char) ('A' + (trailing - 10))); } return buf.toString(); } /** * @param hexString * @return an array of bytes, decoded from the hex-encoded string, if <code>hexString</code> is <code>null</code> or * the length is not a multiple of two then <code>null</code> is returned. */ public static byte[] hexToBytes(String hexString) { if (hexString == null || hexString.length() % 2 != 0) { return null; } int length = hexString.length(); byte rv[] = new byte[length / 2]; int x, y; for (x = 0, y = 0; x < length; x += 2, ++y) { rv[y] = Byte.parseByte(hexString.substring(x, x + 2), 16); } return rv; } public static String buffer2String(int length, TCByteBuffer buffer) { byte[] bytes = new byte[length]; buffer.get(bytes); return Conversion.bytes2String(bytes); } public static enum MemorySizeUnits { KILO("k"), MEGA("m"), GIGA("g"); private final String unit; private MemorySizeUnits(final String unit) { this.unit = unit; } public long getInBytes() throws MetricsFormatException { if (this.unit.equals(KILO.getUnit())) { return 1024; } else if (this.unit.equals(MEGA.getUnit())) { return 1024 * KILO.getInBytes(); } else if (this.unit.equals(GIGA.getUnit())) { return 1024 * MEGA.getInBytes(); } else { throw new MetricsFormatException("Unexpected size: " + toString()); } } @Override public String toString() { return "'" + this.unit + "'"; } public String getUnit() { return unit; } } // XXX: FIX rename method public static int memorySizeAsIntBytes(final String memorySizeInUnits) throws MetricsFormatException { long rv = memorySizeAsLongBytes(memorySizeInUnits); if (rv > Integer.MAX_VALUE) { throw new MetricsFormatException(memorySizeInUnits + " is greater than integer range"); } else { return (int) rv; } } public static long memorySizeAsLongBytes(final String memorySizeInUnits) throws MetricsFormatException { final String input = memorySizeInUnits.toLowerCase().trim(); // XXX: review pattern matcher regex if (!Pattern.matches("[0-9]*([.][0-9]+)? *([kmg])?", input)) { throw new MetricsFormatException("Unexpected Size: " + input); } String[] str = input.split("[kmg]"); if (str.length > 1) { throw new MetricsFormatException("Unexpected size: " + input); } double base = 0; try { base = Double.parseDouble(str[0].trim()); } catch (NumberFormatException nfe) { throw new MetricsFormatException("Unexpectes metrics: " + input); } if (input.endsWith(MemorySizeUnits.KILO.getUnit())) { return (long) (base * MemorySizeUnits.KILO.getInBytes()); } else if (input.endsWith(MemorySizeUnits.MEGA.getUnit())) { return (long) (base * MemorySizeUnits.MEGA.getInBytes()); } else if (input.endsWith(MemorySizeUnits.GIGA.getUnit())) { return (long) (base * MemorySizeUnits.GIGA.getInBytes()); } else { return (long) base; } } static DecimalFormat twoDForm = new DecimalFormat("#.##"); public static String memoryBytesAsSize(final long bytes) throws NumberFormatException, MetricsFormatException { if (bytes < MemorySizeUnits.KILO.getInBytes()) { return bytes + "b"; } else if (bytes < MemorySizeUnits.MEGA.getInBytes()) { double rv = (bytes / (MemorySizeUnits.KILO.getInBytes() * 1.0)); return Double.valueOf(twoDForm.format(rv)) + "k"; } else if (bytes < MemorySizeUnits.GIGA.getInBytes()) { double rv = (bytes / (MemorySizeUnits.MEGA.getInBytes() * 1.0)); return Double.valueOf(twoDForm.format(rv)) + "m"; } else { double rv = (bytes / (MemorySizeUnits.GIGA.getInBytes() * 1.0)); return Double.valueOf(twoDForm.format(rv)) + "g"; } } public static class MetricsFormatException extends TCException { public MetricsFormatException(String message) { super(message); } } }
[ "jvoegele@7fc7bbf3-cf45-46d4-be06-341739edd864" ]
jvoegele@7fc7bbf3-cf45-46d4-be06-341739edd864
c8a404e1937dd4a06e74ffff5684982a7c0bfbbe
cf8ff3ef7cdd9f7bee3ca1be9883a20c823837b0
/app/src/main/java/com/ibermatica/pruebaandroid/AsyncResponse.java
2d5c37668f91bb941120793ba6116afcbe1cfa18
[]
no_license
linchis/Prueba01Android
c62617547c0b59d8a4df2bff7e03a92c5719133a
64dbac2f3ac89395804f6b8f36303f29852e21fb
refs/heads/master
2020-06-01T04:39:49.113595
2019-06-07T02:35:05
2019-06-07T02:35:05
190,640,508
0
0
null
null
null
null
UTF-8
Java
false
false
112
java
package com.ibermatica.pruebaandroid; public interface AsyncResponse { void processFinish(String output); }
[ "osito1981" ]
osito1981
f821773e5098b913f2638e59e676b00f83b4092e
66b646058b66abbe18ea693414f0a7306514b2f1
/src/com/company/ninth_lesson/abs/AbstractShape.java
10f4d82422fc078936e291c57ca233b6ecfed9a9
[]
no_license
eugene-kuntsevich/java_course
821e73343b7c915cc99284c58ae7f81bebf145f9
4e201d74a62550a40c6067e7f3f5c34858609c4d
refs/heads/master
2023-01-09T18:31:15.864952
2020-11-15T12:34:56
2020-11-15T12:34:56
291,498,065
1
0
null
null
null
null
UTF-8
Java
false
false
278
java
package com.company.ninth_lesson.abs; public abstract class AbstractShape { protected int square; public AbstractShape(int square) { this.square = square; } protected void printSquare() { System.out.println("Shape"); } protected abstract int countPerimeter(); }
c5a8c8d0a418f6d90409a4cb5ff02783f0cab0c9
bce1e210182b186554efbf496263ba4392eccd92
/FORMULARIOS/MODULO PROSPECTOS/Prospectoss/output/webnxj/compilation/Modulo/DUDisponiblesFRM.java
4bf525a8d720447ab9d10200b6b196a30d00550f
[]
no_license
rokcrow/SIP
d267eb1acff4e329a4c8b66be2c87975094f2c39
27802c09d3295a1d2f3d80a33cace9ff86f9091c
refs/heads/master
2020-12-24T14:46:13.804760
2013-08-22T22:12:31
2013-08-22T22:12:31
10,773,608
0
1
null
null
null
null
UTF-8
Java
false
false
26,800
java
package Modulo; import java.sql.ResultSet; import java.sql.SQLException; import com.unify.nxj.mgr.LotusMigration; import com.unify.nxj.mgr.NXJDataView; import com.unify.nxj.mgr.NXJForm; import com.unify.nxj.mgr.NXJActivityForm; import com.unify.nxj.mgr.NXJSession; import com.unify.nxj.mgr.NXJCommand; import com.unify.nxj.mgr.NXJClearToAddExpression; import com.unify.nxj.mgr.NXJClearToFindExpression; import com.unify.nxj.mgr.NXJZoomReturnExpressions; import com.unify.nxj.mgr.NXJZoomReturnValuesInto; import com.unify.nxj.mgr.StatusCode; import com.unify.nxj.mgr.datatypes.CopyBack; import com.unify.nxj.mgr.datatypes.Nullable; import com.unify.nxj.mgr.datatypes.NullableVariable; import com.unify.nxj.mgr.datatypes.NullableField; import com.unify.nxj.mgr.datatypes.NullableAmount; import com.unify.nxj.mgr.datatypes.NullableAmountVariable; import com.unify.nxj.mgr.datatypes.NullableAmountField; import com.unify.nxj.mgr.datatypes.NullableAny; import com.unify.nxj.mgr.datatypes.NullableAnyVariable; import com.unify.nxj.mgr.datatypes.NullableBinary; import com.unify.nxj.mgr.datatypes.NullableBinaryVariable; import com.unify.nxj.mgr.datatypes.NullableBinaryField; import com.unify.nxj.mgr.datatypes.NullableBoolean; import com.unify.nxj.mgr.datatypes.NullableBooleanVariable; import com.unify.nxj.mgr.datatypes.NullableBooleanField; import com.unify.nxj.mgr.datatypes.NullableCopyBack; import com.unify.nxj.mgr.datatypes.NullableDate; import com.unify.nxj.mgr.datatypes.NullableDateVariable; import com.unify.nxj.mgr.datatypes.NullableDateField; import com.unify.nxj.mgr.datatypes.NullableDateTime; import com.unify.nxj.mgr.datatypes.NullableDateTimeVariable; import com.unify.nxj.mgr.datatypes.NullableDateTimeField; import com.unify.nxj.mgr.datatypes.NullableFactory; import com.unify.nxj.mgr.datatypes.NullableFloat; import com.unify.nxj.mgr.datatypes.NullableFloatVariable; import com.unify.nxj.mgr.datatypes.NullableFloatField; import com.unify.nxj.mgr.datatypes.NullableNumeric; import com.unify.nxj.mgr.datatypes.NullableNumericVariable; import com.unify.nxj.mgr.datatypes.NullableNumericField; import com.unify.nxj.mgr.datatypes.NullableString; import com.unify.nxj.mgr.datatypes.NullableStringVariable; import com.unify.nxj.mgr.datatypes.NullableStringField; import com.unify.nxj.mgr.datatypes.NullableText; import com.unify.nxj.mgr.datatypes.NullableTextVariable; import com.unify.nxj.mgr.datatypes.NullableTextField; import com.unify.nxj.mgr.datatypes.NullableTime; import com.unify.nxj.mgr.datatypes.NullableTimeVariable; import com.unify.nxj.mgr.datatypes.NullableTimeField; import com.unify.nxj.mgr.datatypes.NXJException; import com.unify.nxj.mgr.datatypes.NXJUndefinedValueException; import com.unify.nxj.mgr.datatypes.NXJNullValueException; import com.unify.nxj.mgr.datatypes.NXJType; import com.unify.nxj.mgr.datatypes.NXJButtonControl; import com.unify.nxj.mgr.datatypes.NXJDynamicTextControl; import com.unify.nxj.mgr.datatypes.NXJFileChooserControl; import com.unify.nxj.mgr.datatypes.NXJFontAwareControl; import com.unify.nxj.mgr.datatypes.NXJIframeControl; import com.unify.nxj.mgr.datatypes.NXJImageButtonControl; import com.unify.nxj.mgr.datatypes.NXJImageControl; import com.unify.nxj.mgr.datatypes.NXJJavascriptControl; import com.unify.nxj.mgr.datatypes.NXJLabelControl; import com.unify.nxj.mgr.datatypes.NXJLineControl; import com.unify.nxj.mgr.datatypes.NXJLinkControl; import com.unify.nxj.mgr.datatypes.NXJStyledTextBoxControl; import com.unify.nxj.mgr.datatypes.NXJTreeControl; import com.unify.nxj.mgr.datatypes.NXJTreeNode; import com.unify.nxj.mgr.datatypes.NXJLeafNode; import com.unify.nxj.mgr.datatypes.NXJNavigationBarControl; import com.unify.nxj.mgr.datatypes.NXJNonLeafNode; import com.unify.nxj.mgr.datatypes.NXJMenuControl; import com.unify.nxj.mgr.datatypes.NXJMenuNode; import com.unify.nxj.mgr.datatypes.NXJMenu; import com.unify.nxj.mgr.datatypes.NXJMenuItem; import com.unify.nxj.mgr.datatypes.NXJMenuSeparator; import com.unify.nxj.mgr.DataViewEventListener; import com.unify.nxj.mgr.FormEventListener; import com.unify.nxj.mgr.FieldEventListener; import com.unify.nxj.mgr.FileChooserEventListener; import com.unify.nxj.mgr.dataConnection.NXJDataConnection; import com.unify.nxj.mgr.dataConnection.NXJDataConnectionException; import com.unify.nxj.mgr.dataConnection.NXJDataConnectionOperationException; import com.unify.nxj.mgr.dataConnection.NXJParameter; import com.unify.nxj.mgr.dataConnection.NXJPreparedCall; import com.unify.nxj.mgr.NXJExceptionHandler; import com.unify.nxj.mgr.NXJExceptionHandler.NXJExceptionEvent; import com.unify.nxj.mgr.NXJExceptionHandlingLimitExceededException; import com.unify.nxj.mgr.NXJScriptException; import com.unify.nxj.mgr.NXJFormScriptException; import com.unify.nxj.mgr.NXJDataViewScriptException; import com.unify.nxj.mgr.NXJFieldScriptException; import com.unify.nxj.mgr.NXJDataViewTargetException; import com.unify.nxj.mgr.NXJFileUploadException; import com.unify.nxj.mgr.NXJRereadAndVerifyException; import com.unify.nxj.mgr.dataConnection.javaAdapter.NXJJavaClassDataSource; import com.unify.nxj.mgr.dataConnection.javaAdapter.NXJJavaClassTargetController; import com.unify.nxj.mgr.dataConnection.spi.NXJColumnSearchCriteria; import com.unify.nxj.mgr.dataConnection.spi.NXJColumnSearchRange; import com.unify.nxj.mgr.dataConnection.NXJColumnSortCriteria; import com.unify.pub.NameValuePair; public class DUDisponiblesFRM extends com.unify.nxj.mgr.NXJForm { /*multi_valued*/ NullableStringVariable xob_empresa = NullableFactory.createNullableStringVariable(this, "xob_empresa", true, false); public void beforeForm() throws Exception { xob_empresa.setClearAddExp(new NXJClearToAddExpression() { public Nullable evaluate() throws Exception { return ((Modulo.MenuFRM)us$findForm(Modulo.MenuFRM.class)).cajagrandeMenu.EMPRESA; } // evaluate }); } // beforeForm public com.unify.nxj.mgr.NXJMasterRelationshipExpression[] us$getPUBLIC_vuu_unidades_1_FindExpressions() { return new com.unify.nxj.mgr.NXJMasterRelationshipExpression[] { new com.unify.nxj.mgr.NXJMasterRelationshipExpression() { public String getColumnName() { return "vuu_obra"; } // getColumnName public com.unify.nxj.mgr.datatypes.NXJSearchRange[] evaluate() throws Exception { return new com.unify.nxj.mgr.datatypes.NXJSearchRange[] { new com.unify.nxj.mgr.datatypes.NXJSearchRange(com.unify.nxj.mgr.datatypes.NXJSearchRange.EqualOP, cajagrandeDUDisponibles.xob_obra, null) }; } // evaluate }, new com.unify.nxj.mgr.NXJMasterRelationshipExpression() { public String getColumnName() { return "vuu_empresa"; } // getColumnName public com.unify.nxj.mgr.datatypes.NXJSearchRange[] evaluate() throws Exception { return new com.unify.nxj.mgr.datatypes.NXJSearchRange[] { new com.unify.nxj.mgr.datatypes.NXJSearchRange(com.unify.nxj.mgr.datatypes.NXJSearchRange.EqualOP, DUDisponiblesFRM.xob_empresa, null) }; } // evaluate } }; } // us$getPUBLIC_vuu_unidades_1_FindExpressions public com.unify.nxj.mgr.NXJMasterAddExpression[] us$getPUBLIC_vuu_unidades_1_AddExpressions() { return new com.unify.nxj.mgr.NXJMasterAddExpression[] { new com.unify.nxj.mgr.NXJMasterAddExpression() { public String getColumnName() { return "vuu_obra"; } // getColumnName public Nullable evaluate() throws Exception { return cajagrandeDUDisponibles.xob_obra; } // evaluate }, new com.unify.nxj.mgr.NXJMasterAddExpression() { public String getColumnName() { return "vuu_empresa"; } // getColumnName public Nullable evaluate() throws Exception { return DUDisponiblesFRM.xob_empresa; } // evaluate } }; } // us$getPUBLIC_vuu_unidades_1_AddExpressions private DUDisponiblesFRM DUDisponiblesFRM = this; public class cajagrandeDUDisponibles extends com.unify.nxj.mgr.NXJBox { public class imprimirbtn extends ItemsForm.Boton { public imprimirbtn() { super(Modulo.DUDisponiblesFRM.cajagrandeDUDisponibles.this, "imprimirbtn", false); } // <init> } // imprimirbtn public imprimirbtn imprimirbtn = new imprimirbtn(); public NXJLabelControl label11 = new com.unify.nxj.mgr.datatypes.NXJLabelImpl(this, "label11", false); public NXJLabelControl label3 = new com.unify.nxj.mgr.datatypes.NXJLabelImpl(this, "label3", false); public NXJLabelControl label31 = new com.unify.nxj.mgr.datatypes.NXJLabelImpl(this, "label31", false); public NXJLabelControl label311 = new com.unify.nxj.mgr.datatypes.NXJLabelImpl(this, "label311", false); public class regresarbtn extends ItemsForm.Boton { public regresarbtn() { super(Modulo.DUDisponiblesFRM.cajagrandeDUDisponibles.this, "regresarbtn", false); } // <init> } // regresarbtn public regresarbtn regresarbtn = new regresarbtn(); public /*multi_valued*/ NullableStringField textfield11 = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "textfield11", true, true, 30); public NullableStringField total1 = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "total1", false, true, 100); public NullableStringField total2 = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "total2", false, true, 100); public /*multi_valued*/ NullableStringField vpy_nombre = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "vpy_nombre", true, true, 100); public /*multi_valued*/ NullableStringField xob_obra = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "xob_obra", true, true, 2); public class xob_proyecto extends com.unify.nxj.mgr.datatypes.NXJStringField { public void onDataAccept() throws Exception { final com.unify.nxj.mgr.datatypes.RegisterPool us$registerPool = getSession().us$getRegisterPool(); { getSession().us$setStatus(StatusCode.SS_NORM); NXJDataConnection us$conn1 = getConnection(); java.sql.PreparedStatement us$stmt1 = null; ResultSet us$rs1 = null; try { us$stmt1 = us$conn1.prepareStatement("SELECT vpy_nombre FROM vpy_proyectos WHERE vpy_codigo = ? AND vpy_empresa = ?"); xob_proyecto.us$setSqlParameterValue(us$stmt1, 1); ((Modulo.MenuFRM)us$findForm(Modulo.MenuFRM.class)).cajagrandeMenu.EMPRESA.us$setSqlParameterValue(us$stmt1, 2); us$rs1 = us$stmt1.executeQuery(); int us$rowsTouched1 = 0; try { java.sql.ResultSetMetaData us$rsmd1 = us$rs1.getMetaData(); if (us$rsmd1.getColumnCount() != 1) throw new SQLException(getSession().us$getMessage("EXPECTED_VS_ACTUAL_COLUMN_COUNT", new Object[] { Integer.toString(us$rsmd1.getColumnCount()), "1" })); com.unify.nxj.mgr.dataConnection.NXJDataIterator us$getter1 = us$conn1.createDataIterator(us$rs1); if (us$getter1.next()) { ++us$rowsTouched1; us$getter1.assignValueToVariable(vpy_nombre, 1); } } finally { if (us$rowsTouched1 == 0) getSession().us$setStatus(StatusCode.SS_NOREC); if (us$rs1 != null) us$rs1.close(); } } catch (SQLException us$ex1) { getSession().us$setStatus(us$conn1.mapToStatusCode(us$ex1)); throw us$ex1; } catch (NXJDataConnectionException us$ex1) { getSession().us$setStatus(us$conn1.mapToStatusCode(us$ex1)); throw us$ex1; } finally { if (us$stmt1 != null) us$conn1.us$closeStatement(us$stmt1); } } if (getSession().getStatus() == StatusCode.SS_NOREC) { getSession().displayToMessageBox("No existe el proyecto seleccionado en el maestro de proyectos"); xob_proyecto.assign(us$registerPool.allocateRegister().load(" ")); rejectOperation(); } } // onDataAccept public void whenValueChanges() throws Exception { { getSession().us$setStatus(StatusCode.SS_NORM); NXJDataConnection us$conn2 = getConnection(); java.sql.PreparedStatement us$stmt2 = null; ResultSet us$rs2 = null; try { us$stmt2 = us$conn2.prepareStatement("SELECT vpy_nombre FROM vpy_proyectos WHERE vpy_codigo = ? AND vpy_empresa = ?"); xob_proyecto.us$setSqlParameterValue(us$stmt2, 1); ((Modulo.MenuFRM)us$findForm(Modulo.MenuFRM.class)).cajagrandeMenu.EMPRESA.us$setSqlParameterValue(us$stmt2, 2); us$rs2 = us$stmt2.executeQuery(); int us$rowsTouched2 = 0; try { java.sql.ResultSetMetaData us$rsmd2 = us$rs2.getMetaData(); if (us$rsmd2.getColumnCount() != 1) throw new SQLException(getSession().us$getMessage("EXPECTED_VS_ACTUAL_COLUMN_COUNT", new Object[] { Integer.toString(us$rsmd2.getColumnCount()), "1" })); com.unify.nxj.mgr.dataConnection.NXJDataIterator us$getter2 = us$conn2.createDataIterator(us$rs2); if (us$getter2.next()) { ++us$rowsTouched2; us$getter2.assignValueToVariable(vpy_nombre, 1); } } finally { if (us$rowsTouched2 == 0) getSession().us$setStatus(StatusCode.SS_NOREC); if (us$rs2 != null) us$rs2.close(); } } catch (SQLException us$ex2) { getSession().us$setStatus(us$conn2.mapToStatusCode(us$ex2)); throw us$ex2; } catch (NXJDataConnectionException us$ex2) { getSession().us$setStatus(us$conn2.mapToStatusCode(us$ex2)); throw us$ex2; } finally { if (us$stmt2 != null) us$conn2.us$closeStatement(us$stmt2); } } } // whenValueChanges public xob_proyecto() { super(Modulo.DUDisponiblesFRM.cajagrandeDUDisponibles.this, "xob_proyecto", true, true, 2); setStyleClass("textfield"); us$setMultiValued(true); us$setView("text"); us$setFieldLength(2); setAutoAccept(true); us$setCandidateTargetColumnName("xob_proyecto"); setValueRetrievedDuringFetch(true); setExplicitSearchMode(NullableVariable.ExplicitSearchMode_DEFAULT); setFindable(true); setUpdateable(true); setCaseConversion(NullableField.CaseConversion_UPPER); setZoomFormName("Modulo/ProyectosFRM"); setZoomEnabled(true); us$executesDataAcceptValueChanges = true; } // <init> } // xob_proyecto public /*multi_valued*/ xob_proyecto xob_proyecto = new xob_proyecto(); public class PUBLIC_vuu_unidades extends com.unify.nxj.mgr.NXJDataView { /*multi_valued*/ NullableStringVariable vuu_empresa = NullableFactory.createNullableStringVariable(this, "vuu_empresa", true, false); /*multi_valued*/ NullableStringVariable vuu_obra = NullableFactory.createNullableStringVariable(this, "vuu_obra", true, false); public /*multi_valued*/ NullableFloatField vuu_area_const = new com.unify.nxj.mgr.datatypes.NXJFloatField(this, "vuu_area_const", true, true, 16); public /*multi_valued*/ NullableFloatField vuu_area_lote = new com.unify.nxj.mgr.datatypes.NXJFloatField(this, "vuu_area_lote", true, true, 16); public /*multi_valued*/ NullableStringField vuu_esquina = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "vuu_esquina", true, true, 2); public /*multi_valued*/ NullableStringField vuu_manzana = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "vuu_manzana", true, true, 3); public /*multi_valued*/ NullableStringField vuu_modelo = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "vuu_modelo", true, true, 3); public /*multi_valued*/ NullableStringField vuu_muro1 = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "vuu_muro1", true, true, 2); public /*multi_valued*/ NullableStringField vuu_muro2 = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "vuu_muro2", true, true, 2); public /*multi_valued*/ NullableStringField vuu_parque = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "vuu_parque", true, true, 2); public /*multi_valued*/ NullableAmountField vuu_precio_uni = new com.unify.nxj.mgr.datatypes.NXJAmountField(this, "vuu_precio_uni", true, true, 25); public /*multi_valued*/ NullableStringField vuu_unidad = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "vuu_unidad", true, true, 4); public PUBLIC_vuu_unidades(com.unify.nxj.mgr.NXJContainer container) { super("PUBLIC_vuu_unidades", container); us$setConnectionName("Connection1"); us$setTargetTableName("PUBLIC.vuu_unidades"); setAutoFind(true); us$setAutoRefresh(true); setStartInAddMode(false); us$setBindingType("connection"); vuu_area_const.setStyleClass("textfield"); vuu_area_const.us$setMultiValued(true); vuu_area_const.us$setView("text"); vuu_area_const.us$setFieldLength(16); vuu_area_const.us$setCandidateTargetColumnName("vuu_area_const"); vuu_area_const.setValueRetrievedDuringFetch(true); vuu_area_const.setFindable(true); vuu_area_const.setUpdateable(true); vuu_area_const.setDisplayJustify(NullableField.DisplayJustify_LEFT); vuu_area_const.setBackgroundColor("#999999"); vuu_area_lote.setStyleClass("textfield"); vuu_area_lote.us$setMultiValued(true); vuu_area_lote.us$setView("text"); vuu_area_lote.us$setFieldLength(16); vuu_area_lote.us$setCandidateTargetColumnName("vuu_area_lote"); vuu_area_lote.setValueRetrievedDuringFetch(true); vuu_area_lote.setFindable(true); vuu_area_lote.setUpdateable(true); vuu_area_lote.setDisplayJustify(NullableField.DisplayJustify_LEFT); vuu_area_lote.setBackgroundColor("#999999"); vuu_esquina.setStyleClass("textfield"); vuu_esquina.us$setMultiValued(true); vuu_esquina.us$setView("text"); vuu_esquina.us$setFieldLength(2); vuu_esquina.us$setCandidateTargetColumnName("vuu_esquina"); vuu_esquina.setValueRetrievedDuringFetch(true); vuu_esquina.setFindable(true); vuu_esquina.setUpdateable(true); vuu_esquina.setBackgroundColor("#999999"); vuu_manzana.setStyleClass("textfield"); vuu_manzana.us$setMultiValued(true); vuu_manzana.us$setView("text"); vuu_manzana.us$setFieldLength(3); vuu_manzana.us$setCandidateTargetColumnName("vuu_manzana"); vuu_manzana.setValueRetrievedDuringFetch(true); vuu_manzana.setFindable(true); vuu_manzana.setUpdateable(true); vuu_manzana.setBackgroundColor("#999999"); vuu_modelo.setStyleClass("textfield"); vuu_modelo.us$setMultiValued(true); vuu_modelo.us$setView("text"); vuu_modelo.us$setFieldLength(3); vuu_modelo.us$setCandidateTargetColumnName("vuu_modelo"); vuu_modelo.setValueRetrievedDuringFetch(true); vuu_modelo.setFindable(true); vuu_modelo.setUpdateable(true); vuu_modelo.setBackgroundColor("#999999"); vuu_muro1.setStyleClass("textfield"); vuu_muro1.us$setMultiValued(true); vuu_muro1.us$setView("text"); vuu_muro1.us$setFieldLength(2); vuu_muro1.us$setCandidateTargetColumnName("vuu_muro1"); vuu_muro1.setValueRetrievedDuringFetch(true); vuu_muro1.setFindable(true); vuu_muro1.setUpdateable(true); vuu_muro1.setBackgroundColor("#999999"); vuu_muro2.setStyleClass("textfield"); vuu_muro2.us$setMultiValued(true); vuu_muro2.us$setView("text"); vuu_muro2.us$setFieldLength(2); vuu_muro2.us$setCandidateTargetColumnName("vuu_muro2"); vuu_muro2.setValueRetrievedDuringFetch(true); vuu_muro2.setFindable(true); vuu_muro2.setUpdateable(true); vuu_muro2.setBackgroundColor("#999999"); vuu_parque.setStyleClass("textfield"); vuu_parque.us$setMultiValued(true); vuu_parque.us$setView("text"); vuu_parque.us$setFieldLength(2); vuu_parque.us$setCandidateTargetColumnName("vuu_parque"); vuu_parque.setValueRetrievedDuringFetch(true); vuu_parque.setFindable(true); vuu_parque.setUpdateable(true); vuu_parque.setBackgroundColor("#999999"); vuu_precio_uni.setStyleClass("textfield"); vuu_precio_uni.us$setMultiValued(true); vuu_precio_uni.us$setView("text"); vuu_precio_uni.us$setFieldLength(25); vuu_precio_uni.us$setCandidateTargetColumnName("vuu_precio_uni"); vuu_precio_uni.setValueRetrievedDuringFetch(true); vuu_precio_uni.setFindable(true); vuu_precio_uni.setUpdateable(true); vuu_precio_uni.setDisplayJustify(NullableField.DisplayJustify_LEFT); vuu_precio_uni.setBackgroundColor("#999999"); vuu_unidad.setStyleClass("textfield"); vuu_unidad.us$setMultiValued(true); vuu_unidad.us$setView("text"); vuu_unidad.us$setFieldLength(4); vuu_unidad.us$setCandidateTargetColumnName("vuu_unidad"); vuu_unidad.setValueRetrievedDuringFetch(true); vuu_unidad.setFindable(true); vuu_unidad.setUpdateable(true); vuu_unidad.setBackgroundColor("#999999"); us$addTargetMapping("vuu_empresa", "vuu_empresa"); us$addTargetMapping("vuu_obra", "vuu_obra"); } // <init> } // PUBLIC_vuu_unidades public final PUBLIC_vuu_unidades PUBLIC_vuu_unidades = new PUBLIC_vuu_unidades(this); public class box11 extends com.unify.nxj.mgr.NXJBox { public class image1 extends ItemsForm.Logo { public image1() { super(Modulo.DUDisponiblesFRM.cajagrandeDUDisponibles.box11.this, "image1", false); } // <init> } // image1 public image1 image1 = new image1(); public box11(com.unify.nxj.mgr.NXJContainer enclosingContainer) { super("box11", enclosingContainer); us$setBackgroundColor("#e30000"); } // <init> } // box11 public final box11 box11 = new box11(this); public class cajaarribaDUDisponibles extends com.unify.nxj.mgr.NXJBox { public NullableStringField actualempresa = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "actualempresa", false, true, 100); public NullableStringField actualusuario = new com.unify.nxj.mgr.datatypes.NXJStringField(this, "actualusuario", false, true, 100); public class label1 extends ItemsForm.TituloLBL { public label1() { super(Modulo.DUDisponiblesFRM.cajagrandeDUDisponibles.cajaarribaDUDisponibles.this, "label1", false); } // <init> } // label1 public label1 label1 = new label1(); public NXJLabelControl label211 = new com.unify.nxj.mgr.datatypes.NXJLabelImpl(this, "label211", false); public cajaarribaDUDisponibles(com.unify.nxj.mgr.NXJContainer enclosingContainer) { super("cajaarribaDUDisponibles", enclosingContainer); us$setBackgroundColor("#e30000"); cajaarribaDUDisponiblespropertySetter_0(); } // <init> private void cajaarribaDUDisponiblespropertySetter_0() { actualempresa.setStyleClass("textfield"); actualempresa.us$setView("text"); actualempresa.setFindable(false); actualempresa.setStopForInput(false); actualusuario.setStyleClass("textfield"); actualusuario.us$setView("text"); actualusuario.setFindable(false); actualusuario.setStopForInput(false); label211.setStyleClass("label"); } // cajaarribaDUDisponiblespropertySetter_0 } // cajaarribaDUDisponibles public final cajaarribaDUDisponibles cajaarribaDUDisponibles = new cajaarribaDUDisponibles(this); public cajagrandeDUDisponibles(com.unify.nxj.mgr.NXJContainer enclosingContainer) { super("cajagrandeDUDisponibles", enclosingContainer); us$setBackgroundColor("#cccccc"); xob_proyecto.setZoomReturnValuesInto(new NXJZoomReturnValuesInto() { public void assignValues(com.unify.nxj.mgr.datatypes.Register[] values) throws Exception { if (values.length != 1) throw new Exception("TODO: handle value array size mismatch"); xob_proyecto.us$assignZoomValue(values[0]); } // assignValues }); cajagrandeDUDisponiblespropertySetter_0(); } // <init> private void cajagrandeDUDisponiblespropertySetter_0() { label11.setStyleClass("label"); label11.setForegroundColor("Black"); label11.setFontFamily("Verdana"); label11.setFontSize("14"); label11.us$setFontWeight("bold"); label3.setStyleClass("label"); label3.setFontSize("12"); label31.setStyleClass("label"); label31.setFontSize("12"); label311.setStyleClass("label"); label311.setFontSize("12"); textfield11.setStyleClass("textfield"); textfield11.us$setMultiValued(true); textfield11.us$setView("text"); textfield11.us$setFieldLength(30); textfield11.us$setCandidateTargetColumnName("xob_nombre"); textfield11.setValueRetrievedDuringFetch(true); textfield11.setExplicitSearchMode(NullableVariable.ExplicitSearchMode_DEFAULT); textfield11.setFindable(true); textfield11.setUpdateable(true); textfield11.setCaseConversion(NullableField.CaseConversion_UPPER); total1.setStyleClass("textfield"); total1.us$setView("text"); total1.setFindable(false); total2.setStyleClass("textfield"); total2.us$setView("text"); total2.setFindable(false); vpy_nombre.setStyleClass("textfield"); vpy_nombre.us$setMultiValued(true); vpy_nombre.us$setView("text"); vpy_nombre.setFindable(true); vpy_nombre.setUpdateable(false); vpy_nombre.setStopForInput(false); vpy_nombre.setCaseConversion(NullableField.CaseConversion_UPPER); xob_obra.setStyleClass("textfield"); xob_obra.us$setMultiValued(true); xob_obra.us$setView("text"); xob_obra.us$setFieldLength(2); xob_obra.setAutoAccept(true); xob_obra.us$setCandidateTargetColumnName("xob_obra"); xob_obra.setValueRetrievedDuringFetch(true); xob_obra.setExplicitSearchMode(NullableVariable.ExplicitSearchMode_DEFAULT); xob_obra.setFindable(true); xob_obra.setUpdateable(true); xob_obra.setCaseConversion(NullableField.CaseConversion_UPPER); } // cajagrandeDUDisponiblespropertySetter_0 } // cajagrandeDUDisponibles public final cajagrandeDUDisponibles cajagrandeDUDisponibles = new cajagrandeDUDisponibles(this); public DUDisponiblesFRM(NXJSession session, NXJForm prevForm) { super("DUDisponiblesFRM", session, prevForm); us$initializeFormSpecificProperties(); } // <init> protected DUDisponiblesFRM(String formName, NXJSession session, NXJForm prevForm) { super(formName, session, prevForm); us$initializeFormSpecificProperties(); } // <init> private void us$initializeFormSpecificProperties() { us$setConnectionName("Connection1"); us$setTargetTableName("PUBLIC.xob_obras"); setStartInAddMode(false); us$setBindingType("connection"); Modulo.DUDisponiblesFRM.this.cajagrandeDUDisponibles.PUBLIC_vuu_unidades.us$setMasterDataView(Modulo.DUDisponiblesFRM.this); Modulo.DUDisponiblesFRM.this.cajagrandeDUDisponibles.PUBLIC_vuu_unidades.us$setMasterRelationshipCriteria(Modulo.DUDisponiblesFRM.this.us$getPUBLIC_vuu_unidades_1_FindExpressions()); Modulo.DUDisponiblesFRM.this.cajagrandeDUDisponibles.PUBLIC_vuu_unidades.us$setMasterRelationshipAddExpr(Modulo.DUDisponiblesFRM.this.us$getPUBLIC_vuu_unidades_1_AddExpressions()); us$setBackgroundColor("#999999"); us$addTargetMapping("xob_empresa", "xob_empresa"); } // us$initializeFormSpecificProperties public static final String menuLabel = "DUDisponiblesFRM"; } // DUDisponiblesFRM
a232b0a1bccc7981b3336146d8fcf3a75fdb19b9
d0d1459d49b48c5b32bf075084f7b123bac94c9c
/src/main/java/com/cibt/mavenprogram/dao/EmployeeDAO.java
2e359e6c1d7c441a297f9a46763cc72257e03100
[]
no_license
dineshmaharjan/maven_example_part1
30fdae66c7e0325f37735caf7914932546abf833
01182ad7f70d685aae2bf6f560f31eee26e8b308
refs/heads/master
2020-04-07T05:44:32.777252
2018-11-18T17:20:21
2018-11-18T17:20:21
158,108,128
2
0
null
null
null
null
UTF-8
Java
false
false
364
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.cibt.mavenprogram.dao; import com.cibt.mavenprogram.entity.Employee; /** * * @author Alucard */ public interface EmployeeDAO extends GenericDAO<Employee>{ }
f2d526e2d2399b8542083248d0892c3d7927edb8
51d5c1cf1b188db5abc2532e9a2f4a609c01875e
/springMVC/src/main/java/cn/fx/jlx/springMVC/springMVC/pojo/Goodsimage.java
6bcd4549a5c1146485a6f3fb46b29f2a5ef8ba28
[]
no_license
javagp1/RepforJAVA
f719a70e93d45a2a34bbf3de7fce18a2921a69bc
600749471f2b2aed463f5ebdc2a47540a291b477
refs/heads/master
2020-09-17T00:23:36.205049
2019-12-05T11:42:43
2019-12-05T11:42:43
223,930,572
0
0
null
2020-07-02T01:28:08
2019-11-25T11:17:08
Java
UTF-8
Java
false
false
767
java
package cn.fx.jlx.springMVC.springMVC.pojo; public class Goodsimage { private Integer gimgid; private String gimgurl; private Integer gdid; private Integer gimgtype; public Integer getGimgid() { return gimgid; } public void setGimgid(Integer gimgid) { this.gimgid = gimgid; } public String getGimgurl() { return gimgurl; } public void setGimgurl(String gimgurl) { this.gimgurl = gimgurl; } public Integer getGdid() { return gdid; } public void setGdid(Integer gdid) { this.gdid = gdid; } public Integer getGimgtype() { return gimgtype; } public void setGimgtype(Integer gimgtype) { this.gimgtype = gimgtype; } }
1921dbfc966285c80e1d9b976e2bb7db286eb58c
a93c3ce9b7758ad09858084e6ce620dbf7b4921e
/food/app/src/main/java/com/example/duska/food/ShowRecipeActivity.java
b36c235308aebd4c2d495177bcbc6e87177e08db
[]
no_license
DashaZhirenok/food
591e46e28505c6cc66f6dfd7b93c512450679edd
588647dd1395142a9b1fd7188d73089be71a8d18
refs/heads/master
2020-12-24T09:08:00.031706
2016-12-21T19:45:04
2016-12-21T19:45:04
73,306,204
0
0
null
null
null
null
UTF-8
Java
false
false
4,053
java
package com.example.duska.food; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ScrollView; import android.widget.TextView; public class ShowRecipeActivity extends AppCompatActivity implements View.OnClickListener{ Button show,back; TextView textmenu, textshow; DBHelper dbHelper; ScrollView scrollView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_show_recipe); textmenu = (TextView) findViewById(R.id.textmenu); textshow = (TextView) findViewById(R.id.textshow); show = (Button) findViewById(R.id.show); back = (Button) findViewById(R.id.back); scrollView = (ScrollView) findViewById(R.id.scrollView); back.setOnClickListener(OncBack); show.setOnClickListener(this); dbHelper = new DBHelper(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_add, menu); return true; }; @Override //действия при нажатии на пункты меню public boolean onOptionsItemSelected(MenuItem item){ int id = item.getItemId(); switch (id) { case R.id.menu_add: Intent gotoadd = new Intent(); gotoadd.setClass(ShowRecipeActivity.this, MainActivity.class); startActivity(gotoadd); break; case R.id.menu_home: Intent gotohome = new Intent(); gotohome.setClass(ShowRecipeActivity.this, HomeActivity.class); startActivity(gotohome); break; case R.id.help: Intent gotohelp = new Intent(); gotohelp.setClass(ShowRecipeActivity.this, HelpActivity.class); startActivity(gotohelp); break; } return super.onOptionsItemSelected(item); } View.OnClickListener OncBack = new View.OnClickListener() { @Override public void onClick(View v) { Intent gotoback = new Intent(); gotoback.setClass(ShowRecipeActivity.this, ShowActivity.class); startActivity(gotoback); } }; @Override public void onClick(View v) { SQLiteDatabase database = dbHelper.getWritableDatabase(); // Делаем запрос Cursor cursor3 = database.query(DBHelper.TABLE_RECIPES, null, null, null, null, null, null); try { // Узнаем индекс каждого столбца int idColumnIndex = cursor3.getColumnIndex(DBHelper.KEY_ID3); int nameofdishinrecipeColumnIndex = cursor3.getColumnIndex(DBHelper.KEY_NAMEOFDISHINRECIPE); int recipeColumnIndex = cursor3.getColumnIndex(DBHelper.KEY_RECIPE); // Проходим через все ряды while (cursor3.moveToNext()) { // Используем индекс для получения строки или числа int currentID = cursor3.getInt(idColumnIndex); String currentNameofdishinrecipe = cursor3.getString(nameofdishinrecipeColumnIndex); String currentRecipe = cursor3.getString(recipeColumnIndex); // Выводим значения каждого столбца textshow.append(("\n" + currentID + ": " + currentNameofdishinrecipe + " (" + currentRecipe + "). ")); } } finally { // Всегда закрываем курсор после чтения cursor3.close(); } } }
57f084d42aa881968a5dd6ac7f84e06911ae64ed
fb17bf9ae3457e4a237dbd9d4832529423cac2a1
/gitlet/Gitlet.java
b876d83921716122391a9e7fe5ded9dd84ac66a6
[]
no_license
siyanshen/Gitlet
35c6d4a863c3cc8f87adf8c77b259fd0485837f3
355b2c6306ad8f22e7ac411e8c68ce91a28604b8
refs/heads/master
2020-04-01T18:34:27.446255
2018-10-17T18:02:33
2018-10-17T18:02:33
153,500,924
0
0
null
null
null
null
UTF-8
Java
false
false
29,815
java
package gitlet; import java.io.File; import java.io.IOException; import java.util.Set; import java.util.TreeMap; import java.util.HashSet; import java.io.Serializable; /** hahaha. * @author Siyan Shen */ public class Gitlet implements Serializable { /** magic number. */ static final int M = 40; /** working directory. */ static final File W = new File("."); /** my head commit id. */ private String head; /** * key: name of the files. val: contents of files. */ private TreeMap<String, String> stagedFiles; /** files to be removed.*/ private HashSet<String> rmFiles; /** * name of current branch. */ private Branch currentBranch; /** * name of the branch val: Branch id. */ private HashSet<Branch> branches; /** * Constructor that initializes all variables. */ public Gitlet() { head = null; currentBranch = null; branches = null; stagedFiles = new TreeMap<>(); rmFiles = new HashSet<>(); } /** * Saves the current state of Gitlet G. */ public static void save(Gitlet g) throws IOException { File savedGitlet = new File(".gitlet/history.ser"); if (!savedGitlet.exists()) { savedGitlet.createNewFile(); Utils.writeContents(savedGitlet, Utils.serialize(g)); } else { Utils.writeContents(savedGitlet, Utils.serialize(g)); } } /** * Creates .gitlet directory if it doesn't already exist. */ public void init() throws IOException { File dir = new File(".gitlet"); if (!dir.exists()) { dir.mkdir(); Commit initial = new Commit(this, null, "initial commit", true, false); initial.setID(); new File(".gitlet/objects").mkdir(); head = initial.getID(); File newcommit = new File(".gitlet/objects/" + head + ".ser"); newcommit.createNewFile(); Utils.writeObject(newcommit, initial); Branch master = new Branch("master", initial.getID()); new File(".gitlet/index").mkdir(); File newbranch = new File(".gitlet/index/master.ser"); newbranch.createNewFile(); Utils.writeObject(newbranch, master); new File(".gitlet/blobs").mkdir(); branches = new HashSet<>(); branches.add(master); currentBranch = master; } else { System.out.println("A gitlet version control system already exists " + "in the current directory."); } } /** * Add a file FILENAME to the staging area. If the current working version * of the file is identical to the version in the current commit, * do not stage it to be added, and remove it from the staging area * if it is already there (as can happen when a file is changed, * added, and then changed back). If the file had been marked to * be removed, delete that mark. */ public void addFile(String filename) { if (!(new File(filename).exists())) { System.out.println("File does not exist."); System.exit(0); } String key = filename; String val = Utils.readContentsAsString(new File(filename)); if (rmFiles.contains(filename)) { rmFiles.remove(filename); } File headcommit = new File(String.format("%s%s%s", ".gitlet/objects/", head, ".ser")); Commit realhead = Utils.readObject(headcommit, Commit.class); if (realhead.getMyBlobs().keySet().contains(filename)) { File file = new File(String.format("%s%s%s", ".gitlet/blobs/", realhead.getMyBlobs().get(filename), ".ser")); if (val.equals(Utils.readContentsAsString(file))) { if (stagedFiles.containsKey(filename)) { stagedFiles.keySet().remove(filename); } return; } } stagedFiles.put(key, val); } /** * Commit with message MSG, CONFLICT, P2. */ public void commitCmnd(String msg, boolean conflict, String p2) throws IOException { Commit newhead = new Commit(this, head, msg, false, conflict); newhead.setID(); if (conflict) { newhead.setParent2(p2); } head = newhead.getID(); File object = new File(".gitlet/objects/" + head + ".ser"); object.createNewFile(); Utils.writeObject(object, newhead); currentBranch.setHead(head); File branch = new File(String.format("%s%s%s", ".gitlet/index/", currentBranch.getName(), ".ser")); Utils.writeObject(branch, currentBranch); } /** * rm command. * Unstage the file FILENAME if it is currently staged. If the file is * tracked in the current commit, mark it to indicate that it is not to * be included in the next commit, and remove the file from the * working directory if the user has not already done so (do not remove * it unless it is tracked in the current commit). */ public void removeFile(String filename) { File headcommit = new File(String.format("%s%s%s", ".gitlet/objects/", head, ".ser")); Commit realhead = Utils.readObject(headcommit, Commit.class); if (!stagedFiles.keySet().contains(filename) && !realhead.getMyBlobs().keySet().contains(filename)) { System.out.println(" No reason to remove the file."); System.exit(0); } if (stagedFiles.keySet().contains(filename)) { stagedFiles.keySet().remove(filename); } if (realhead.getMyBlobs().containsKey(filename)) { rmFiles.add(filename); File unwantedfile = new File(filename); if (unwantedfile.exists()) { unwantedfile.delete(); } } } /** * log command. * Starting at the current head commit, display information about each * commit backwards along the commit tree until the initial commit, * following the first parent commit links, ignoring any second parents * found in merge commits. * For merge commits (those that have two parent commits), add a line * just below the first. */ public void log() { File headcommit = new File(String.format("%s%s%s", ".gitlet/objects/", head, ".ser")); Commit realhead = Utils.readObject(headcommit, Commit.class); Commit p = realhead; while (p != null) { p.printInfo(); if (p.getParent() != null) { File parentcommit = new File(String.format("%s%s%s", ".gitlet/objects/", p.getParent(), ".ser")); Commit realparent = Utils.readObject(parentcommit, Commit.class); p = realparent; } else { p = null; } } } /** * global-log command. * displays information about all commits ever made. The order of the * commits does not matter. */ public void globalLog() { File dir = new File(".gitlet/objects"); File[] directoryListing = dir.listFiles(); for (File child : directoryListing) { Commit realchild = Utils.readObject(child, Commit.class); realchild.printInfo(); } } /** * find command. * Prints out the ids of all commits that have the given commit * message MSG, one per line. */ public void find(String msg) { File dir = new File(".gitlet/objects"); File[] directoryListing = dir.listFiles(); boolean exist = false; for (File child : directoryListing) { Commit realchild = Utils.readObject(child, Commit.class); if (realchild.getMsg().equals(msg)) { System.out.println(realchild.getID()); exist = true; } } if (!exist) { System.out.println("Found no commit with that message."); } } /** * status command. * Displays what branches currently exist, and marks the current branch * with a *. Also displays what files have been staged or marked for * untracking. */ public void status() { System.out.println("=== Branches ==="); File dir = new File(".gitlet/index"); File[] directoryListing = dir.listFiles(); HashSet<String> workingname = new HashSet<>(); for (File file : directoryListing) { workingname.add(file.getName().substring(0, file.getName().length() - 4)); } String[] b = Utils.sorthashset(workingname); for (String child : b) { if (child.equals(currentBranch.getName())) { System.out.print("*"); } System.out.println(child); } System.out.println("\n=== Staged Files ==="); String[] stage = Utils.sortset(stagedFiles.keySet()); for (String filename : stage) { System.out.println(filename); } System.out.println("\n=== Removed Files ==="); String[] r = Utils.sorthashset(rmFiles); for (String filename : r) { System.out.println(filename); } System.out.println(""); System.out.println("=== Modifications Not Staged For Commit ===\n"); System.out.println("=== Untracked Files ===\n"); } /** * check out file with FILENAME. * Takes the version of the file as it exists in the head commit, the * front of the current branch, and puts it in the working directory, * overwriting the version of the file that's already there if there is * one. The new version of the file is not staged. * <p> * Failure cases: * If the file does not exist in the previous commit, aborts, printing * the error message File does not exist in that commit. **/ public void checkoutfile(String filename) throws IOException { File headcommit = new File(".gitlet/objects/" + head + ".ser"); Commit realhead = Utils.readObject(headcommit, Commit.class); if (!realhead.getMyBlobs().keySet().contains(filename)) { System.out.println("File does not exist in that commit."); System.exit(0); } String blobid = realhead.getMyBlobs().get(filename); File newfile = new File(".gitlet/blobs/" + blobid + ".ser"); String newcontent = Utils.readContentsAsString(newfile); File oldfile = new File(filename); if (oldfile.exists()) { Utils.writeContents(oldfile, newcontent); } else { oldfile.createNewFile(); Utils.writeContents(oldfile, newcontent); } } /** * check out file in a given commit. * Takes the version of the file FILENAME * as it exists in the commit with the * given id COMMITID1, and puts it in the working directory, * overwriting the * version of the file that's already there if there is one. * The new version of the file is not staged. * <p> * Failure cases: * If no commit with the given id exists, print * No commit with that id exists. * Else, if the file does not exist in the given commit, print * File does not exist in that commit. */ public void checkoutcommit(String commitid1, String filename) throws IOException { String commitid = null; File dir = new File(".gitlet/objects"); File[] files = dir.listFiles(); boolean exist = false; for (File file : files) { String shortid = file.getName(). substring(0, commitid1.length()); if (shortid.equals(commitid1)) { commitid = file.getName().substring(0, M); exist = true; break; } } if (!exist) { System.out.println("No commit with that id exists."); return; } File targetcommit = new File(".gitlet/objects/" + commitid + ".ser"); Commit realtarget = Utils.readObject(targetcommit, Commit.class); if (!realtarget.getMyBlobs().keySet().contains(filename)) { System.out.println("File does not exist in that commit."); System.exit(0); } String blobid = realtarget.getMyBlobs().get(filename); File newfile = new File(".gitlet/blobs/" + blobid + ".ser"); String newcontent = Utils.readContentsAsString(newfile); File oldfile = new File(filename); if (oldfile.exists()) { Utils.writeContents(oldfile, newcontent); } else { oldfile.createNewFile(); Utils.writeContents(oldfile, newcontent); } } /** * check out branch with BRANCHNAME. * Takes all files in the commit at the head of the given branch, and puts * them in the working directory, overwriting the versions of the files that * are already there if they exist. Also, at the end of this command, the * given branch will now be considered the current branch (HEAD). Any files * that are tracked in the current branch but are not present in the * checked-out branch are deleted. The staging area is cleared, unless the * checked-out branch is the current branch (see Failure cases below). * <p> * Failure cases: * 1, If no branch with that name exists, print No such branch exists. * 2, If that branch is the current branch, print No need to checkout * the current branch. * 3, If a working file is untracked in the current branch and would * be overwritten by the checkout, print There is an untracked file * in the way; delete it or add it first. and exit; * perform this check before doing anything else. */ public void checkoutbranch(String branchname) throws IOException { if (currentBranch.getName().equals(branchname)) { System.out.println("No need to checkout the current branch."); return; } boolean exist = false; Branch targetbranch = new Branch(null, null); for (Branch branch : branches) { if (branch.getName().equals(branchname)) { exist = true; targetbranch = branch; break; } } if (!exist) { System.out.println("No such branch exists."); return; } Commit targetcommit = targetbranch.getCommit(); Commit currentcommit = currentBranch.getCommit(); File dir = new File("."); File[] directoryListing = dir.listFiles(); for (File child : directoryListing) { String filename = child.getName(); if (!currentcommit.getMyBlobs().keySet().contains(filename) && !filename.equals(".gitlet") && !rmFiles.contains(filename) && !stagedFiles.containsKey(filename)) { System.out.println("There is an untracked file " + "in the way; delete it or add it first."); return; } } stagedFiles.clear(); rmFiles.clear(); for (String child : targetcommit.getMyBlobs().keySet()) { checkoutcommit(targetcommit.getID(), child); } for (File child : directoryListing) { if (!targetcommit.getMyBlobs().keySet(). contains(child.getName()) && !child.getName().equals(".gitlet")) { child.delete(); } } currentBranch = targetbranch; head = currentBranch.getHead(); } /** * branch. * Creates a new branch with BRANCHNAME, and points it at the current * head node. A branch is nothing more than a name for a reference (a * SHA-1 identifier) to a commit node. This command does NOT immediately * switch to the newly created branch (just as in real Git). Before you ever * call branch, your code should be running with a default branch called * "master". */ public void branch(String branchname) throws IOException { for (Branch branch : branches) { if (branch.getName().equals(branchname)) { System.out.println("A branch with that name already exists"); System.exit(0); } } Branch newbranch = new Branch(branchname, head); branches.add(newbranch); new File(".gitlet/index").mkdir(); File newbranchfile = new File(".gitlet/index/" + branchname + ".ser"); newbranchfile.createNewFile(); Utils.writeObject(newbranchfile, newbranch); } /** * rm-branch. * Deletes the branch with the given name RMDBRANCH. * If a branch with the given name does not exist, aborts. Print the * error message A branch with that name does not exist. If you try * to remove the branch you're currently on, aborts, printing the error * message Cannot remove the current branch. */ public void rmbranch(String rmdbranch) { if (currentBranch.getName().equals(rmdbranch)) { System.out.println("Cannot remove the current branch."); System.exit(0); } boolean exist = false; for (Branch branch : branches) { if (branch.getName().equals(rmdbranch)) { branches.remove(branch); exist = true; break; } } if (!exist) { System.out.println("A branch with that name does not exist."); System.exit(0); } } /** * reset. * Checks out all the files tracked by the given commit COMMITID1. * Removes tracked * files that are not present in that commit. Also moves the current * branch's head to that commit node. See the intro for an example of * what happens to the head pointer after using reset. The [commit id] * may be abbreviated as for checkout. The staging area is cleared. * The command is essentially checkout of an arbitrary commit that also * changes the current branch head. * Failure case: * If no commit with the given id exists, print No commit with that id * exists. * If a working file is untracked in the current branch and would * be overwritten by the reset, print There is an untracked file in the * way; delete it or add it first. and exit; perform this check before * doing anything else. */ public void reset(String commitid1) throws IOException { String commitid = null; File dir = new File(".gitlet/objects"); File[] files = dir.listFiles(); boolean exist = false; for (File file : files) { if (file.getName().substring(0, commitid1.length()) .equals(commitid1)) { commitid = file.getName().substring(0, M); exist = true; break; } } if (!exist) { System.out.println("No commit with that id exists."); return; } File targetcommit = new File(".gitlet/objects/" + commitid + ".ser"); Commit realtarget = Utils.readObject(targetcommit, Commit.class); Commit currentcommit = currentBranch.getCommit(); File dir1 = new File("."); File[] directoryListing = dir1.listFiles(); if (directoryListing != null) { for (File child : directoryListing) { String filename = child.getName(); if (!currentcommit.getMyBlobs().keySet().contains(filename) && !filename.equals(".gitlet") && !stagedFiles.containsKey(filename) && !rmFiles.contains(filename)) { System.out.println("There is an untracked file " + "in the way; delete it or add it first."); return; } } } stagedFiles.clear(); rmFiles.clear(); for (String blobs : realtarget.getMyBlobs().keySet()) { checkoutcommit(commitid1, blobs); } if (directoryListing != null) { for (File file : directoryListing) { if (!realtarget.getMyBlobs().keySet() .contains(file.getName()) && !file.getName().equals(".gitlet")) { file.delete(); } } } currentBranch.setHead(commitid); head = commitid; } /** MERGEBRANCH. */ public void premerge1(String mergebranch) throws IOException { File[] directoryListing = W.listFiles(); for (File child : directoryListing) { if (untracked(child.getName())) { System.out.println("There is an untracked file in the way; " + "delete it or add it first."); System.exit(0); } } } /** ME, YOU, GCD, return conflict. */ public boolean mergepart1(Commit me, Commit you, Commit gcd) throws IOException { boolean result1 = false; for (String file : you.getMyBlobs().keySet()) { if (!same(file, you, gcd) && same(file, me, gcd)) { checkoutcommit(you.getID(), file); stagedFiles.put(file, you.getMyBlobs().get(file)); continue; } if ((same(file, you, gcd) && !same(file, me, gcd)) || same(file, you, me)) { continue; } if (!same(file, you, gcd) && !exist(file, me)) { result1 = true; File f2 = new File(".gitlet/blobs/" + you.getBlobid(file) + ".ser"); String v1 = ""; String v2 = Utils.readContentsAsString(f2); String result = "<<<<<<< HEAD\n" + v1 + "=======\n" + v2 + ">>>>>>>\n"; File working = new File(file); if (working.exists()) { Utils.writeContents(working, result); } else { working.createNewFile(); Utils.writeContents(working, result); } stagedFiles.put(file, result); if (rmFiles.contains(file)) { rmFiles.remove(file); } } } return result1; } /** * Merge. * Merges files from the given branch MERGEBRANCH * into the current branch. */ public void merge(String mergebranch) throws IOException { preMerge(mergebranch); Branch target = target(mergebranch); Commit me = realcommit(head); Commit you = target.getCommit(); premerge1(mergebranch); Commit gcd = splitpoint(me, you); boolean conflict = mergepart1(me, you, gcd); Set<String> meblobs = Utils.copyhashset(me.getMyBlobs().keySet()); for (String file : meblobs) { if (same(file, gcd, you) && !same(file, gcd, me)) { continue; } if (same(file, gcd, me) && !exist(file, you)) { File dir = new File(file); dir.delete(); rmFiles.add(file); if (stagedFiles.containsKey(file)) { stagedFiles.remove(file); } continue; } String v1, v2 = ""; if (!same(file, you, gcd) && !same(file, me, gcd) && !same(file, you, me)) { conflict = true; File f1 = new File(".gitlet/blobs/" + me.getBlobid(file) + ".ser"); v1 = Utils.readContentsAsString(f1); if (exist(file, you)) { File f2 = new File(".gitlet/blobs/" + you.getBlobid(file) + ".ser"); v2 = Utils.readContentsAsString(f2); } String result = "<<<<<<< HEAD\n" + v1 + "=======\n" + v2 + ">>>>>>>\n"; File working = new File(file); if (working.exists()) { Utils.writeContents(working, result); } else { working.createNewFile(); Utils.writeContents(working, result); } stagedFiles.put(file, result); if (rmFiles.contains(file)) { rmFiles.remove(file); } } } commitCmnd("Merged " + mergebranch + " into " + currentBranch.getName() + ".", conflict, you.getID()); if (conflict) { System.out.println("Encountered a merge conflict."); } } /** return if a file with NAME is untracked. */ public boolean untracked(String name) { Commit commit = currentBranch.getCommit(); return (!commit.getMyBlobs().containsKey(name) && !stagedFiles.containsKey(name) && !rmFiles.contains(name) && !name.equals(".gitlet")); } /** prerequisites of merging the given branch MERGEBRANCH. */ public void preMerge(String mergebranch) { if (!stagedFiles.isEmpty() || !rmFiles.isEmpty()) { System.out.println("You have uncommitted changes."); System.exit(0); } if (currentBranch.getName().equals(mergebranch)) { System.out.println("Cannot merge a branch with itself."); System.exit(0); } } /** return our target branch with the name MERGEBRANCH. */ public Branch target(String mergebranch) { boolean exist = false; Branch target = null; for (Branch branch : branches) { if (branch.getName().equals(mergebranch)) { exist = true; target = branch; break; } } if (!exist) { System.out.println("A branch with that name does not exist."); System.exit(0); } return target; } /** * helper to find a splitpoint. * * @param c1 my head commit * @param c2 given commit * @return common ancester */ public Commit splitpoint(Commit c1, Commit c2) { HashSet<String> c1history = new HashSet<>(); HashSet<String> c2history = new HashSet<>(); Commit p1 = c1; Commit p2 = c2; while (p1 != null) { c1history.add(p1.getID()); Commit pointerparent = realcommit(p1.getParent()); p1 = pointerparent; } while (p2 != null) { c2history.add(p2.getID()); Commit pointerparent = realcommit(p2.getParent()); p2 = pointerparent; } if (c1history.contains(c2.getID())) { System.out.println(" Given branch is an" + " ancestor of the current branch."); System.exit(0); } if (c2history.contains(c1.getID())) { System.out.println("Current branch fast-forwarded."); head = c2.getID(); currentBranch.setHead(head); System.exit(0); } Commit p = c2; while (p != null) { if (c1history.contains(p.getID())) { return p; } p = realcommit(p.getParent()); } return null; } /** * helper method to return whether ME have a FILE or not. */ public boolean exist(String file, Commit me) { if (me.getMyBlobs().isEmpty()) { return false; } return me.getMyBlobs().keySet().contains(file); } /** * helper method to return whether a given file FILE is at the same status * in ME and one of my ANCESTOR. */ public boolean same(String file, Commit me, Commit ancestor) { if ((!exist(file, me)) && (!exist(file, ancestor))) { return true; } if (exist(file, me) && exist(file, ancestor)) { return me.getMyBlobs().get(file) .equals(ancestor.getMyBlobs().get(file)); } return false; } /** using input ARGS to determine input.*/ public void checkout(String[] args) throws IOException { if (args.length == 2) { checkoutbranch(args[1]); } else if (args.length == 3) { checkoutfile(args[2]); } else if (args.length == 4) { checkoutcommit(args[1], args[3]); } } /** * helper method to return a real commit from a given ID. */ public Commit realcommit(String id) { if (id == null) { return null; } File dir = new File(".gitlet/objects/" + id + ".ser"); Commit result = Utils.readObject(dir, Commit.class); return result; } /** * return files to be removed. */ public HashSet<String> getRmFiles() { return rmFiles; } /** * return files to be staged. */ public TreeMap<String, String> getStagedFiles() { return stagedFiles; } }