blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
โŒ€
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
00750a90688a760abb490266306e17fb577d1484
9fe642be33f33c5c2ee9022cc109236746a5953e
/4.SourceCode/Quanlyvanthucode/src/java/Controller/Khungdangnhap.java
91f53486fa5e0165251ad0a8c04868c89727b966
[]
no_license
NTDJane/Quanlyvanthu
0a9311984fbb43e39857fc2f7efdb28cfe389c5a
e6d90d06e573b8d6dbfb40fac6fd172603ea4947
refs/heads/master
2020-03-25T04:10:03.268709
2018-10-04T10:14:30
2018-10-04T10:14:30
140,164,569
0
0
null
null
null
null
UTF-8
Java
false
false
3,365
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 Controller; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author nguyendoan */ @WebServlet(name = "Khungdangnhap", urlPatterns = {"/Khungdangnhap"}) public class Khungdangnhap extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet Khungdangnhap</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet Khungdangnhap at " + request.getContextPath() + "</h1>"); out.println("</body>"); out.println("</html>"); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setAttribute("view", "Login.jsp"); String url="/Login.jsp"; RequestDispatcher dis = request.getRequestDispatcher(url); dis.forward(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setAttribute("view", "Login.jsp"); String url="/Login.jsp"; RequestDispatcher dis = request.getRequestDispatcher(url); dis.forward(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "nguyentrungdoan79@gmail.com" ]
nguyentrungdoan79@gmail.com
415e522d5f55daf88172f8f8796b24d555b6a4af
afd0f946244a46ff2c703d8e9177bb04cb2a896d
/src/test/java/com/project/nutricipe/controller/user/UpdateUserTest.java
a026b97c10eeeadb4680f923fceecbe25154757b
[]
no_license
CrusadeTX/Nutricipe
e77e1e64f494d41e32b062481ed04c4cbc9f97fc
b795497be091dec0b435fb8503bc77c4fdabeafc
refs/heads/main
2023-05-07T08:56:19.675622
2021-05-30T15:51:45
2021-05-30T15:51:45
337,756,113
1
0
null
null
null
null
UTF-8
Java
false
false
4,586
java
package com.project.nutricipe.controller.user; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import org.hamcrest.core.IsEqual; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ErrorCollector; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.web.bind.annotation.RequestParam; import com.project.nutricipe.bean.RoleBean; import com.project.nutricipe.bean.UserBean; import com.project.nutricipe.controller.UserController; import com.project.nutricipe.repo.DietRepo; import com.project.nutricipe.repo.RoleRepo; import com.project.nutricipe.repo.UserRepo; import com.project.nutricipe.security.UserPrincipal; @RunWith(Parameterized.class) public class UpdateUserTest { @Parameters(name = "{index}: with id = {0} , email = {1}, username = {2}, password = {3}, repeatPassword = {4}, dietId = {5}, loggedUser = {6}, role= {7} and expected result={8}") public static Iterable<Object[]> data() { return Arrays.asList(new Object[][] { // { 0,null, null, null, null, null, null, "ROLE_USER", "Input parameters cant be null!" }, { 1,"email6@mail.com", "username2", "pass3", "pass3", "0", new UserBean("username", "password", "email@email.com"), "ROLE_USER", "User has been successfully updated!" }, { 1,"email6@mail.com", "username2", "pass3", "pass3", "0", null, "ROLE_USER", "Error Unauthenticated!" }, { 1,"email5@mail.com", "username", "pass", "pass2", "0", new UserBean("username", "password", "email@email.com"), "ROLE_ADMIN", "Error Password mismatch!" }, { 1,"email3@email.com", "username", "pass", "pass", "0", new UserBean("username", "password", "email@email.com"), "ROLE_USER", "Error Email exists!" }, {1,"email5@mail.com", "name2", "pass", "pass", "0", new UserBean("username", "password", "email@email.com"), "ROLE_USER", "Error Username exists!" }, { 2,"email5@mail.com", "name", "pass", "pass", "0", new UserBean("username", "password", "email@email.com"), "ROLE_USER", "Error Unauthorized!" }, }); } @Parameter(0) public int id; @Parameter(1) public String email; @Parameter(2) public String username; @Parameter(3) public String password; @Parameter(4) public String repeatPassword; @Parameter(5) public String dietId; @Parameter(6) public UserBean loggedUser; @Parameter(7) public String roleCode; @Parameter(8) public String expectedResult; private UserController userController; private UserRepo userRepo; private UserPrincipal principal; //private RoleRepo roleRepo; //private DietRepo dietRepo= new DietRepo(); private PasswordEncoder encoder = new BCryptPasswordEncoder(); @Rule public ErrorCollector collector = new ErrorCollector(); @Before public void setup() { RoleBean role = new RoleBean(); role.setCode(roleCode); role.setId(1); Set<RoleBean> roles = new HashSet<>(Arrays.asList(role)); //roleRepo = mock(RoleRepo.class); userRepo = mock(UserRepo.class); if (loggedUser != null) { loggedUser.setRoles(roles); loggedUser.setId(1); principal = new UserPrincipal(loggedUser, roles); } else { principal = new UserPrincipal(null,roles); } UserBean user1 = new UserBean(); user1.setId(1); user1.setUsername("username"); user1.setPassword("password"); user1.setEmail("email2@email.com"); UserBean user2 = new UserBean(); user2.setId(3); user2.setUsername("name2"); user2.setPassword("pass2"); user2.setEmail("email3@email.com"); List<UserBean> users = new ArrayList<UserBean>(); users.add(user1); users.add(user2); doReturn(users).when(userRepo).findAll(); //doReturn(role).when(roleRepo).findRoleByCode("ROLE_USER"); userController = new UserController(userRepo, null, null, null, encoder,null); } @Test public void testUpdateUser() { final List<String> result = userController.updateUser(id,email, username, password, repeatPassword, dietId, principal); collector.checkThat(result.get(0), IsEqual.equalTo(expectedResult)); } }
[ "angel.terziev97@gmail.com" ]
angel.terziev97@gmail.com
66319aab84cc7b34bbdf189001cf73ccbf9ef529
41368bc9bc1a883fb3fa08bebfe12ffde2e9f44f
/castle/src/castle/HanderGo.java
a46dddfd5a3035117ea63a4a54548587f94cb093
[]
no_license
ZHYzhy-github/Android_job
d69e363da264a8d2f3bb1e5790b6d032d54547f5
14c7bdfc07d0c31ca7959f396e6e0986522b9f8c
refs/heads/master
2022-07-17T09:33:18.373185
2020-05-20T12:01:23
2020-05-20T12:01:23
256,585,089
0
0
null
null
null
null
UTF-8
Java
false
false
177
java
package castle; public class HanderGo extends Hander { public HanderGo( Game game) { super(game); } @Override public void doCmd(String str) { game.goRoom(str); } }
[ "ZHY1745363522@outlook.com" ]
ZHY1745363522@outlook.com
d7f1ac3673c55cea6a50dcc3e4bcf9fcc4e87960
23c4083850265c579f65599538e4c2c0f0b7eeaa
/lambda/src/test/java/net/movingjin/api/optional/OptionalTest.java
f94da1b1b94ae2cae5e5944f6dc575588f55551a
[]
no_license
movingJin/bithumb_tech_academy
2b3218c8aa1985e90252378da34e4e94c9203bd7
ebdcb0c6dcfd0d9ddacc00f6ac61703c00ad2175
refs/heads/main
2023-08-10T19:32:47.212937
2021-09-12T13:08:10
2021-09-12T13:08:10
398,764,239
0
0
null
null
null
null
UTF-8
Java
false
false
1,615
java
package net.movingjin.api.optional; import lombok.Data; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.time.LocalTime; import java.util.*; import java.util.function.*; import java.util.stream.Stream; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; public class OptionalTest { @Data class Order { private final Long id; private final Date date; private final Member member; } @Data class Member { private final Long id; private final String name; private final Address address; } @Data class Address { private final String street; private final String city; private final String zipcode; } /* ์ฃผ๋ฌธ์„ ํ•œ ํšŒ์›์ด ์‚ฌ๋Š” ๋„์‹œ๋Š”?*/ public String getCityOfMemberFromOrder(Order order){ return Optional.ofNullable(order) .map(Order::getMember) //ํ•œ ์š”์†Œ์š”์†Œ๋งˆ๋‹ค ์ ๊ฒ€ํ•˜๋Š” ๊ธฐ๋Šฅ .map(Member::getAddress) .map(Address::getCity) .orElse("No Address"); } //NULL์ด ์•„๋‹Œ, ๋นˆ ๊ฐ’์ธ ๊ฒฝ์šฐ /* ์ฃผ์–ด์ง„ ์‹œ๊ฐ„(๋ถ„) ๋‚ด์— ์ƒ์„ฑ๋œ ์ฃผ๋ฌผ์„ ํ•œ ํšŒ์›์ •๋ณด๋Š”? */ public Optional<Member> getMemberOrderWithin(Order order, int min){ return Optional.ofNullable(order) .filter(o -> o.getDate().getTime() > System.currentTimeMillis() - min * 1000) .map(Order::getMember); } @Test @DisplayName("") void apply(){ } }
[ "shdlehdwls@gmail.com" ]
shdlehdwls@gmail.com
d64b99f1e1d560f6ebb079dbc5220dc9ec2eb2fb
a0375df37c278acf735b7c01d6b07f801519443d
/app/src/main/java/com/example/quranapp/Word.java
d4c4cabdd673c6e8ec7f2351bda3ec00018dffa9
[]
no_license
iamhamzaawan/Quran-App
bcff323fa9324b0a382692935bd672ca479f7d0b
f5069103ff2905035c6c1fd9b21bc0f7e88a1f25
refs/heads/master
2023-01-13T07:06:47.843152
2020-11-14T13:07:11
2020-11-14T13:07:11
266,223,360
0
0
null
null
null
null
UTF-8
Java
false
false
1,268
java
package com.example.quranapp; public class Word { private long id; private long surahId; private long verseId; private long wordsId; private String wordsAr; private String translate; private String translateEn; public long getId() { return id; } public void setId(long id) { this.id = id; } public long getSurahId() { return surahId; } public void setSurahId(long surahId) { this.surahId = surahId; } public long getVerseId() { return verseId; } public void setVerseId(long verseId) { this.verseId = verseId; } public long getWordsId() { return wordsId; } public void setWordsId(long wordsId) { this.wordsId = wordsId; } public String getWordsAr() { return wordsAr; } public void setWordsAr(String wordsAr) { this.wordsAr = wordsAr; } public String getTranslate() { return translate; } public void setTranslate(String translate) { this.translate = translate; } public String getTranslateEn() { return translateEn; } public void setTranslateEn(String translateEn) { this.translateEn = translateEn; } }
[ "hamza_awan1996@hotmail.com" ]
hamza_awan1996@hotmail.com
b0e15257d512bb789b602f54176566afe6d1d4a7
48388738d49c29bacc3a34c14e1cf741c2a96cfe
/src/main/java/com/esperluette/nice/web/rest/LocationResource.java
66dae4f5397e501b456c86a424bdb52151613d1f
[]
no_license
yolocodefrench/java-nice
fed650266d9a3e4c5f1d11fe9d9f4ad82bf9d484
979b6da425ed423c68cfc9702a50d5943031af0e
refs/heads/master
2020-04-20T07:42:40.714162
2019-02-05T21:03:34
2019-02-05T21:03:34
168,717,512
0
0
null
null
null
null
UTF-8
Java
false
false
1,847
java
package com.esperluette.nice.web.rest; import com.esperluette.nice.domain.Location; import com.esperluette.nice.domain.User; import com.esperluette.nice.domain.dto.UserDTO; import com.esperluette.nice.repository.LocationRepository; import com.esperluette.nice.repository.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.util.UriComponentsBuilder; import javax.servlet.http.HttpServletResponse; import java.util.List; @Controller @RequestMapping(path = "/api/locations") public class LocationResource { @Autowired private LocationRepository locationRepository; @RequestMapping(path = "", method = RequestMethod.GET) @ResponseBody public List<Location> getAllLocations(final UriComponentsBuilder uriBuilder, final HttpServletResponse response){ List<Location> locations = locationRepository.findAll(); return locations; } @RequestMapping(path = "/for-types/{types}", method = RequestMethod.GET) @ResponseBody public List<Location> getAllLocationsForTypes(@PathVariable(name = "types") List<String> types, @RequestParam(name = "disabled_access") boolean disabled_access, final UriComponentsBuilder uriBuilder, final HttpServletResponse response){ List<Location> locations = locationRepository.findByType(types, disabled_access); return locations; } }
[ "rcharre@oceaneconsulting.com" ]
rcharre@oceaneconsulting.com
006f280a1485dcfb6a0a8888803e09f61b966b45
091b902e6551be6b20251317ce52255a488eacd6
/cobcaixa/src/main/java/crvnluz/cobcaixa/config/jms/JmsConfig.java
a4d6bf529c68cda70fa084d1a9dc840a0d418341
[]
no_license
samuelevangelista1983/clubelivro
763c183641e37e54368325c25ededd2508f23e09
c48882a9ad6f4252eb42218ce1d00753996ce659
refs/heads/master
2022-07-01T21:53:46.632676
2019-09-29T02:08:12
2019-09-29T02:08:12
125,671,040
0
0
null
2022-06-20T23:02:58
2018-03-17T21:38:43
Java
UTF-8
Java
false
false
2,034
java
package crvnluz.cobcaixa.config.jms; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.RedeliveryPolicy; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jms.connection.CachingConnectionFactory; import org.springframework.jms.core.JmsTemplate; import org.springframework.stereotype.Component; @Configuration @Component public class JmsConfig { @Value("${activemq.broker.url}") private String brokerUrl; @Value("${activemq.broker.username}") private String usuario = "admin"; @Value("${activemq.broker.password}") private String senha = "admin"; @Value("${activemq.broker.client.id.prefix}") private String clientIdPrefix; @Bean public ActiveMQConnectionFactory connectionFactory() { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); connectionFactory.setBrokerURL(brokerUrl); connectionFactory.setPassword(usuario); connectionFactory.setUserName(senha); //connectionFactory.setWatchTopicAdvisories(false); connectionFactory.setClientID(clientIdPrefix); /*RedeliveryPolicy policy = new RedeliveryPolicy(); policy.setMaximumRedeliveries(6); // tenta enviar atรฉ conseguir policy.setInitialRedeliveryDelay(120000); // espera 2 minutos inicialmente para tentar reenviar policy.setMaximumRedeliveryDelay(3600000); // espera no mรกximo 1 hora policy.setBackOffMultiplier(2.0); // multiplica por cinco o tempo de espera a cada nova tentativa de reenvio policy.setUseExponentialBackOff(true); connectionFactory.setRedeliveryPolicy(policy);*/ return connectionFactory; } @Bean public CachingConnectionFactory cachingConnectionFactory() { return new CachingConnectionFactory(connectionFactory()); } @Bean public JmsTemplate getJmsTemplate() { JmsTemplate jmsTemplate = new JmsTemplate(cachingConnectionFactory()); jmsTemplate.setPubSubDomain(true); return jmsTemplate; } }
[ "samuelevangelista@gmail.com" ]
samuelevangelista@gmail.com
e922796d83bbe94651f930ea7835a1d946737184
5d855765cfce5df6f32e429b32e85b86fdaa6f7b
/app/src/main/java/com/example/shane/smartfeeder/ViewStoredClips.java
0a3c1ddfc3ce4858c27660e52a131f59a9cfb071
[]
no_license
shaner125/Smart-Feeder
6e70e268bcd740167992a1cdb000ed7215111bd4
5d5b756142c4cf66f4e6646f32c2e2b4de76583b
refs/heads/master
2020-04-11T16:19:51.925401
2019-05-13T17:20:08
2019-05-13T17:20:08
161,920,487
0
0
null
null
null
null
UTF-8
Java
false
false
5,033
java
package com.example.shane.smartfeeder; import android.content.Intent; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.VideoView; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class ViewStoredClips extends AppCompatActivity { ListView listview; public VideoView videoViewLandscape; FirebaseStorage storage = FirebaseStorage.getInstance("gs://smart-feeder-1d272.appspot.com"); private DatabaseReference mDatabase ; StorageReference storageRef = storage.getReference(); String vidURL; static String[] ListElements = new String[]{}; public static List< String > ListElementsArrayList = new ArrayList< String > (Arrays.asList(ListElements)); Button btnBack; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_stored_clips); videoViewLandscape= (VideoView) findViewById(R.id.videoView1); videoViewLandscape.setVisibility(View.GONE); final ArrayAdapter< String > adapter = new ArrayAdapter < String > (ViewStoredClips.this, android.R.layout.simple_list_item_1, ListElementsArrayList); listview = (ListView) findViewById(R.id.listView1); listview.setAdapter(adapter); btnBack = (Button)findViewById(R.id.btn_back); mDatabase = FirebaseDatabase.getInstance().getReference().child("medialinks"); mDatabase.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot snapshot) { try { if (snapshot.getValue() != null) { try { Log.e("TAG", "" + snapshot.getValue()); // your name values you will get here ListElementsArrayList.clear(); for(DataSnapshot child : snapshot.getChildren() ){ ListElementsArrayList.add(0,child.getValue().toString()); adapter.notifyDataSetChanged(); Log.e("TAG", "" + ListElementsArrayList.toString()); } } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { Log.e("onCancelled", " cancelled"); } }); listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> arg0,View arg1, int position, long arg3) { String data=(String)arg0.getItemAtPosition(position); Log.e("TAG", "" + data); storageRef.child(data).getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() { @Override public void onSuccess(Uri uri) { videoViewLandscape.setVisibility(View.VISIBLE); videoViewLandscape.setVideoURI(uri); videoViewLandscape.requestFocus(); videoViewLandscape.start(); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { Log.e("TAG", "NOT WORKINGGGGGGG"); } }); } }); videoViewLandscape.setOnCompletionListener(new MediaPlayer.OnCompletionListener(){ @Override public void onCompletion(MediaPlayer mp){ mp.stop(); videoViewLandscape.setVisibility(View.GONE); } }); btnBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } }
[ "x15745561@student.ncirl.ie" ]
x15745561@student.ncirl.ie
90d49ec19174d337c1b1fceec4168ba280d9a56b
817f9361cdd8dfa674bdad75d93bc4770dba36ba
/JaewoongByeon/0813/TryCollection.java
700ee69818a029a234fe59bb0e8eb835cc8fb533
[]
no_license
JaewoongByeon/test_java
1133e6a3251ae68990d069f87d4bcdb1c5425179
85a989dbcf518da63fb1865511e11f104bdc2bb2
refs/heads/master
2020-07-03T10:05:31.419539
2019-08-13T08:55:34
2019-08-13T08:55:34
201,874,353
0
0
null
null
null
null
UTF-8
Java
false
false
1,119
java
import java.util.ArrayList; import java.util.HashMap; public class TryCollection { public static void main(String[] args) { ArrayList<String> list = new ArrayList<String>(); list.add("Item1"); list.add("Item2"); list.add("Item3"); list.add("Item4"); ArrayList<Integer> list2 = new ArrayList<Integer>(); list2.add(49); list2.add(900); list2.add(123); list2.add(23); HashMap<Object, Object> hmap = new HashMap<Object, Object>(); hmap.put("str", list); hmap.put("integer", list2); ArrayList<Integer> outlist01 = new ArrayList<Integer>(); outlist01 = (ArrayList<Integer>) hmap.get("integer"); ArrayList<String> outlist02 = new ArrayList<String>(); outlist02 = (ArrayList<String>) hmap.get("str"); for (int i = 0; i < outlist01.size(); i++) { System.out.printf("\nlist1 [" + i + "] = " + outlist01.get(i)); } for (int i = 0; i < outlist02.size(); i++) { System.out.printf("\nlist2 [" + i + "] = " + outlist02.get(i)); } } }
[ "jwbyeon330@gmail.com" ]
jwbyeon330@gmail.com
4dd0002961ee010bfb1a002a0fa3b3d853446e12
6aef3bceeea91f45f1d8de360019407cc8192c52
/src/main/java/com/amruthaa/ApiRunner.java
e21668d6f849583a0401bb4be630914b5a28e8c7
[]
no_license
amruthaarajan/capstone-app
17609ca2a966148b4c44f4911850da19c62dd9fc
73075f8787f351a69b0a08269a219e3b363c82b0
refs/heads/master
2020-03-12T08:26:39.250325
2018-12-15T03:50:55
2018-12-15T03:50:55
130,527,661
0
0
null
2018-12-03T04:16:47
2018-04-22T02:13:07
Java
UTF-8
Java
false
false
4,230
java
package com.amruthaa; import com.amruthaa.models.UserInput; import com.google.gson.Gson; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Paths; public final class ApiRunner { public static String sentimentalAnalysisApi(String urlString, UserInput data) throws Exception { byte[] encoded = Files.readAllBytes(Paths.get(data.getDataUrl())); StringBuilder url = new StringBuilder(urlString); URL obj = new URL(url.toString()); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("User-Agent", "Server:API"); con.setRequestProperty("Content-Type","text/plain"); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(new String(encoded, Charset.defaultCharset())); wr.flush(); wr.close(); int responseCode = con.getResponseCode(); System.out.println("\nSending 'POST' request to URL : " + url.toString()); System.out.println("Response Code : " + responseCode); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuilder response; response = new StringBuilder(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); return response.toString(); } public static String imageClassificationLinearRegressionApi(String urlString, UserInput data) throws Exception { StringBuilder url = new StringBuilder(urlString); URL obj = new URL(url.toString()); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("User-Agent", "Server:API"); con.setRequestProperty("Content-Type", "application/json"); con.setDoOutput(true); Gson gson = new Gson(); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(gson.toJson(data)); wr.flush(); wr.close(); System.out.println("\nSending 'POST' request to URL : " + url.toString()); int responseCode = con.getResponseCode(); System.out.println("Response Code : " + responseCode); InputStream inputStream = con.getInputStream(); String[] temp = data.getDataUrl().split("\\."); String saveFilePath = temp[0] + "_completed." + temp[1]; // opens an output stream to save into file FileOutputStream outputStream = new FileOutputStream(saveFilePath); int bytesRead = -1; byte[] buffer = new byte[4096]; while ((bytesRead = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); } outputStream.close(); inputStream.close(); return saveFilePath; } public static String analyticsApi(String urlString, String data) throws Exception { StringBuilder url = new StringBuilder(urlString); URL obj = new URL(url.toString()); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("User-Agent", "Server:API"); con.setRequestProperty("Content-Type","application/json"); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(data); wr.flush(); wr.close(); int responseCode = con.getResponseCode(); System.out.println("\nSending 'POST' request to URL : " + url.toString()); System.out.println("Response Code : " + responseCode); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuilder response; response = new StringBuilder(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); return response.toString(); } }
[ "amruthaa.rajan20@gmail.com" ]
amruthaa.rajan20@gmail.com
b01271020e87e88f7459e53d84d83076e66e79d9
6455923403eeb1a0d880c3d82b1306a41b356c98
/src/main/java/com/test/automation/selenium/testScripts/Recurring/TC_Customer_AddCustomer_Check_Token.java
aa558b95e138071741d81835ccee89681b79d11c
[]
no_license
aritraautomation/UIAutomation
8db586c9d27d4e673f0594f11f5f867dc8d8a306
94e070354f2fdc53a0136440e70f167dc19d011c
refs/heads/master
2023-02-02T23:27:22.052461
2020-12-24T14:42:16
2020-12-24T14:42:16
324,151,173
0
0
null
null
null
null
UTF-8
Java
false
false
3,439
java
package com.test.automation.selenium.testScripts.Recurring; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import com.test.automation.selenium.businesscomponents.*; import com.test.automation.selenium.framework.Browser; import com.test.automation.selenium.framework.logResult; public class TC_Customer_AddCustomer_Check_Token { Browser browser; logResult logresult; public WebDriver driver; String txtBillingPlan = null; String txtTokenNumber = null; String txtCustomerNo = null; String txtCustomerName = null; String txtPhoneNo = null; public void ExecuteTest(String browserType, String strProgramDetails, String strTestEnvDetails, logResult result) throws Exception { this.logresult = result; browser=new Browser(this.logresult); this.driver = browser.Open(browserType,BCEnvironment.appURL); Login login = Login.getInstance(); TokenManager token = new TokenManager(); Recurring rd = new Recurring(); Logout logout = new Logout(); String credentials = login.run(6, browser, logresult); Thread.sleep(4000); token.requestCheckToken(4, browser, logresult); Thread.sleep(1000); token.requestCheckToken(6, browser, logresult); Thread.sleep(1000); token.requestCheckToken(8, browser, logresult); Thread.sleep(1000); try{ driver=browser.driver; txtTokenNumber = driver.findElement(By.id("requestTokenCopyInput")).getAttribute("value"); browser.excel.storeCellData("Recurring_CustomerAdd", txtTokenNumber, 29, 27); Thread.sleep(1000); } catch(Exception e){ logresult.logTest("Test Execution", "Status", "INFO", "Exception occurred!!!", e.getMessage(), ""); } token.requestCheckToken(32, browser, logresult); Thread.sleep(1000); rd.addBillingPlan(4, browser, logresult); Thread.sleep(1000); rd.addCustomer(4, browser, logresult); Thread.sleep(1000); rd.addCustomer(30, browser, logresult); Thread.sleep(1000); try{ driver=browser.driver; driver.findElement(By.xpath("//div[@id='billingPlan-0']/ul/li[2]/a")).click(); Thread.sleep(1000); } catch(Exception e){ logresult.logTest("Test Execution", "Status", "INFO", "Exception occurred!!!", e.getMessage(), ""); } rd.addCustomer(8, browser, logresult); Thread.sleep(1000); try{ driver=browser.driver; txtCustomerNo = driver.findElement(By.id("customerNumber")).getAttribute("value"); browser.excel.storeCellData("Recurring_CustomerAdd", "text::"+txtCustomerNo, 12, 67); txtCustomerName = driver.findElement(By.id("customerName")).getAttribute("value"); browser.excel.storeCellData("Recurring_CustomerAdd", "text::"+txtCustomerName, 12, 68); txtPhoneNo = driver.findElement(By.id("phoneNumber")).getAttribute("value"); browser.excel.storeCellData("Recurring_CustomerAdd", "text::"+txtPhoneNo, 12, 69); Thread.sleep(1000); } catch(Exception e){ logresult.logTest("Test Execution", "Status", "INFO", "Exception occurred!!!", e.getMessage(), ""); } rd.addCustomer(10, browser, logresult); Thread.sleep(1000); rd.addCustomer(12, browser, logresult); Thread.sleep(1000); logout.run(4, browser, logresult); Thread.sleep(1000); logout.run(6, browser, logresult); Thread.sleep(1000); logout.run(8, browser, logresult);CredentialManager.getInstance().releaseCredentials(credentials); Thread.sleep(1000); browser.Close(); } }
[ "aritras@rssoftware.co.in" ]
aritras@rssoftware.co.in
6513dbad9385917b0266fb0170c14aa4285f18af
d2f3df06b7fd8ebe7a82414653a64b5a531836ba
/src/Composite/Product.java
0c5419770bdeab28321eba9f5fd5d1521be2917f
[]
no_license
MarlonCosta/DesignPatterns
23908152fd7f2bcf35e53f3487190157b05dbe7e
b83437a8947bcbf658e4063b0389cd071962b861
refs/heads/master
2020-03-29T14:02:27.662005
2018-12-02T06:28:17
2018-12-02T06:28:17
149,995,404
0
0
null
null
null
null
UTF-8
Java
false
false
224
java
package Composite; public class Product extends Item { double price = 0; public Product(double price) { this.price = price; } @Override public double getPrice() { return price; } }
[ "marlon.costa@ieee.org" ]
marlon.costa@ieee.org
5973d8763e1277c85219abc77f3bf2d5a11f119c
34d3e4b9377b2b6b2d5daa7447c952d01308f1bb
/Owner_Microservice/src/main/java/com/spring/casestudy/model/Room.java
f3b835c5bc0abd4aed9de33cce91dbcad2b677d6
[]
no_license
D-MGaikwad/casestudynew
15029e8f5034d5d8915a8527c296a34f6b93bae6
6f02f7a3dc9eebaafb69800e5e00278e0f2e9ce0
refs/heads/master
2023-07-24T15:59:17.306188
2021-09-08T15:01:13
2021-09-08T15:01:13
404,342,549
0
0
null
null
null
null
UTF-8
Java
false
false
961
java
package com.spring.casestudy.model; import org.springframework.data.annotation.Id; public class Room { @Id private int roomNumber; private boolean singleRoom; private boolean doubleRoom; private String roomType; public int getRoomNumber() { return roomNumber; } public void setRoomNumber(int roomNumber) { this.roomNumber = roomNumber; } public boolean isSingleRoom() { return singleRoom; } public void setSingleRoom(boolean singleRoom) { this.singleRoom = singleRoom; } public boolean isDoubleRoom() { return doubleRoom; } public void setDoubleRoom(boolean doubleRoom) { this.doubleRoom = doubleRoom; } public String getRoomType() { return roomType; } public void setRoomType(String roomType) { this.roomType = roomType; } @Override public String toString() { return "Room [roomNumber=" + roomNumber + ", singleRoom=" + singleRoom + ", doubleRoom=" + doubleRoom + ", roomType=" + roomType + "]"; } }
[ "devika2gaikwad@gmail.com" ]
devika2gaikwad@gmail.com
a32a40a910ccf1ba71f7a1a83f034e41a659e8f4
ebfa13afd28d57ccd51572d5a7abd031d61c159f
/DateBaseManagementSys/fileManager/XMLWriter.java
795cfb1273309f50bfac54a48650d2635fa703dc
[]
no_license
mostafashabana/DatabaseManagementSystem
fb50f62862f068dbf2b3d233afc99825068b537c
c768a62fd54392da461945944907bf0b0d114993
refs/heads/master
2020-04-25T19:12:01.473814
2019-02-28T00:24:50
2019-02-28T00:24:50
173,011,320
0
0
null
null
null
null
UTF-8
Java
false
false
3,361
java
package fileManager; import java.io.File; import java.nio.file.Path; import java.sql.SQLException; import java.util.List; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import dbms.Column; import dbms.MiniTable; public class XMLWriter implements IFileWriter { private DocumentBuilder documentBuilder = null; private Transformer transformer = null; private File file; public XMLWriter() { DocumentBuilderFactory documentFactory = DocumentBuilderFactory .newInstance(); try { documentBuilder = documentFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { e.printStackTrace(); } TransformerFactory transformerFactory = TransformerFactory .newInstance(); try { transformer = transformerFactory.newTransformer(); } catch (TransformerConfigurationException e) { e.printStackTrace(); } transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); file = null; } @Override public void write(String tName, Path dbPath, List<Column> cols, MiniTable requiredTable) throws SQLException { file = createXml(tName, dbPath, cols); DTD dtdFile = new DTD(); dtdFile.creat(cols, dbPath + File.separator + tName + ".dtd"); requiredTable.setDataFile(file); requiredTable.setDtDFile(dtdFile.getMyDtdFile()); } private File createXml(String tName, Path dbPath, List<Column> cols) throws SQLException { File f = null; Document doc = documentBuilder.newDocument(); Element rootElement = doc.createElement("table"); doc.appendChild(rootElement); Attr nameAttribute = doc.createAttribute("name"); nameAttribute.setValue(tName); rootElement.setAttributeNode(nameAttribute); createColumns(cols, rootElement, doc); transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, tName + ".dtd"); DOMSource source = new DOMSource(doc); try { f = new File(dbPath + File.separator + tName + ".xml"); // System.out.println(f.getPath()); StreamResult result = new StreamResult(f); transformer.transform(source, result); } catch (TransformerException e) { throw new SQLException("cannot create the file"); } return f; } private void createColumns(List<Column> cols, Element root, Document doc) { int counter = 1; for (Column column : cols) { Element element = doc.createElement("column" + (counter++)); root.appendChild(element); Attr attribute = doc.createAttribute("name"); attribute.setValue(column.getName()); element.setAttributeNode(attribute); attribute = doc.createAttribute("type"); attribute.setValue(column.getType()); element.setAttributeNode(attribute); for (String cell : column.getColElements()) { Element info = doc.createElement(column.getName()); info.appendChild(doc.createTextNode(cell)); element.appendChild(info); } } } }
[ "mostafashabana96@gmail.com" ]
mostafashabana96@gmail.com
9566ef2060e614b4a0787d968adb2231e22d1117
c8503c654072dffcc318665ab018e819f7c6b50f
/talent_cabin_practice/src/internal/string/ReverseString.java
56da68d7a53ac9d46814b3717aac754c928b0067
[]
no_license
shiwanjaleesuman/Test
e4852771079be7473709cea5a86068ae548d5cb8
d278f5caccadc5783f05266c728f8b471af48e54
refs/heads/master
2022-11-05T17:40:07.374643
2020-06-25T13:32:19
2020-06-25T13:32:19
274,889,261
0
0
null
null
null
null
UTF-8
Java
false
false
628
java
/** * */ package internal.string; import java.util.Scanner; /** * @author OneStop * */ public class ReverseString { public void reverseString(String str) { StringBuffer sb = new StringBuffer(str); sb.reverse(); String reverse = ""; int n = str.length(); for(int i=n-1; i>=0; i--) { reverse = reverse+str.charAt(i); } System.out.println("Reversed string: "+reverse); } public static void main(String[] args) { Scanner s= new Scanner(System.in); System.out.println("Enter the String: "); String str = s.nextLine(); ReverseString obj = new ReverseString(); obj.reverseString(str); } }
[ "s.suman@intershop.com" ]
s.suman@intershop.com
8e721691bf98bbad946f7fd06bdf9a179d7941eb
6f02997f8eefbff449ba0389f485acc41d38e95d
/fire-engines/fire-flink/src/main/java/org/apache/rocketmq/flink/serialization/JsonDeserializationSchema.java
10036e7e16cc8e5bad6e892b9959ae4bd870d8a0
[ "Apache-2.0" ]
permissive
chengyzs/fire
96045c91067dae037e04f300683b7e3c35ff045f
18a659322adfc02b590ccc16150c082579568a76
refs/heads/main
2023-05-15T14:25:55.649640
2021-06-09T07:35:50
2021-06-09T07:35:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,331
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 org.apache.rocketmq.flink.serialization; import org.apache.flink.api.common.serialization.DeserializationSchema; import org.apache.flink.api.common.typeinfo.TypeHint; import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.table.data.RowData; import java.io.IOException; import java.nio.charset.StandardCharsets; /** * ๅฐ†rocketmqๆถˆๆฏๅๅบๅˆ—ๅŒ–ๆˆRowData * @author ChengLong 2021-5-9 13:40:17 */ public class JsonDeserializationSchema implements TagKeyValueDeserializationSchema<RowData> { private DeserializationSchema<RowData> key; private DeserializationSchema<RowData> value; public JsonDeserializationSchema(DeserializationSchema<RowData> key, DeserializationSchema<RowData> value) { this.key = key; this.value = value; } @Override public RowData deserializeTagKeyAndValue(byte[] tag, byte[] key, byte[] value) { /*String keyString = key != null ? new String(key, StandardCharsets.UTF_8) : null; String valueString = value != null ? new String(value, StandardCharsets.UTF_8) : null;*/ if (value != null) { try { // ่ฐƒ็”จsql connector็š„format่ฟ›่กŒๅๅบๅˆ—ๅŒ– return this.value.deserialize(value); } catch (IOException e) { e.printStackTrace(); } } return null; } @Override public TypeInformation<RowData> getProducedType() { return TypeInformation.of(new TypeHint<RowData>(){}); } }
[ "wangchenglong@zto.com" ]
wangchenglong@zto.com
cd08623122f94519287f492b9b07126ab81cf84e
cd76e7fd5a16e44dc9cc73308bd2de6a1f63e803
/src/by/epam/like_it/service/validator/Validator.java
eaa1cf90ef8c751a051adbdd87d07f945add0edf
[]
no_license
Redchush/LIKE_IT
5345f4193a7aae595955ee861042fd7560773e28
5c977875478e0bc64c80710412006de20db7dc6f
refs/heads/master
2021-01-17T16:17:28.612482
2016-10-13T08:25:38
2016-10-13T08:25:38
70,783,902
0
0
null
null
null
null
UTF-8
Java
false
false
852
java
package by.epam.like_it.service.validator; import by.epam.like_it.exception.service.validation.info.ValidationInfoException; import by.epam.like_it.model.bean.util_interface.Entity; import by.epam.like_it.service.validator.util.ValidationNavigator; /** * Provides interface to validate input parameters * @param <T> - param of entity to be validated */ public interface Validator<T> { ValidationNavigator NAVIGATOR = ValidationNavigator.getInstance(); /** * Validates the values in the fields of the object entity. Throw an ValidationInfoException with the InvalidInfo * object in case of failing validation * @param entity object type T which is need vo validate. * */ void isValidForCreate(T entity) throws ValidationInfoException; void isValidForUpdate(T entity) throws ValidationInfoException; }
[ "redchush@gmail.com" ]
redchush@gmail.com
c0478a782424a80f87aed4cec17e31fd1f6c1d82
5f3f496094a3039ba92f1b0d33503741ae0fbcf1
/app/src/main/java/jay/com/rxuidemo/launch/LaunchActivity.java
89c9b4f7e6ed40a7ae0a4548a30f99dfc837ac14
[ "Apache-2.0" ]
permissive
JK-V/Rx2BindingAndroid
0d4b7d723cbd6759f19cb65bb8aaa1376d75924e
8554ec214ae512fa7af9ab804c35415cf56a0557
refs/heads/master
2021-01-24T02:29:02.783542
2018-02-25T15:41:38
2018-02-25T15:41:38
122,848,995
0
0
null
null
null
null
UTF-8
Java
false
false
1,030
java
package jay.com.rxuidemo.launch; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import jay.com.rxuidemo.R; public class LaunchActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_launch); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); } }
[ "swati verma" ]
swati verma
e220505ba83eafabb9e75c2ae275e1568556831e
342ae041d0ecc8bf29451a1186877ee854155106
/No FriendlyFire/src/de/diemex/no/friendlyfire/NoFriendlyFire.java
1bc5ef833c5a22f78d4dfe95d76b30b539e943b6
[]
no_license
BeSseR89/NoFriendlyFire
6cfa4a90a96b064b0bad2cffbecb6bf083e2a4af
ae70ff15924e7f021b118615d9660287d0c5cd9d
refs/heads/master
2020-12-25T02:30:58.282022
2013-02-12T23:09:43
2013-02-12T23:09:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,704
java
/* NoFriendlyFire Bukkit Plugin By Diemex Copyright (C) 2013 Diemex This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.diemex.no.friendlyfire; import java.io.File; import java.io.IOException; import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.plugin.java.JavaPlugin; public class NoFriendlyFire extends JavaPlugin implements Listener{ String msg_noFriendlyFire; String msg_DamagedBy; boolean config_showNoFriendlyFire; boolean config_showDamagedBy; FileConfiguration config; String configPath = "plugins" + File.separator + "NoFriendlyFire" + File.separator + "config.yml"; @Override public void onEnable() { //Register the Event so we get notified when it's called getServer().getPluginManager().registerEvents(this, this); //Config to customize the messages config = YamlConfiguration.loadConfiguration(new File(configPath)); FileConfiguration saveConfig = new YamlConfiguration(); config_showNoFriendlyFire = config.getBoolean("NoFriendlyFire.FriendlyFireMsg.Show", true); msg_noFriendlyFire = config.getString("NoFriendlyFire.FriendlyFireMsg.MsgFriendlyFire", "Friendly Fire won't be tolerated!"); config_showDamagedBy = config.getBoolean("NoFriendlyFire.DamagedByMsg.Show", false); msg_DamagedBy = config.getString("NoFriendlyFire.DamagedByMsg.MsgDamagedBy", "is a bad teammate, watch your back!"); saveConfig.set("NoFriendlyFire.FriendlyFireMsg.Show", config_showNoFriendlyFire); saveConfig.set("NoFriendlyFire.FriendlyFireMsg.MsgFriendlyFire", msg_noFriendlyFire); saveConfig.set("NoFriendlyFire.DamagedByMsg.Show", config_showDamagedBy); saveConfig.set("NoFriendlyFire.DamagedByMsg.MsgDamagedBy", msg_DamagedBy); try { saveConfig.save(new File(configPath)); } catch (IOException e) { getLogger().warning("Unable to write config to " + configPath); } super.onEnable(); } @EventHandler(priority = EventPriority.LOWEST) void onEntityDamage(EntityDamageByEntityEvent event){ Entity damager = event.getDamager(); Entity damagee = event.getEntity(); // if (!(damagee instanceof Player)) return; if (!(damager instanceof Player)) { //Damage is caused by the arrow not the player shooting it if (damager instanceof Arrow) { Arrow arrow = (Arrow) damager; if (arrow.getShooter() != null && arrow.getShooter() instanceof Player) { damager = arrow.getShooter(); } else //Skeleton { return; } } else //If not damaged by player or damaged by arrow this doesn't interest us { return; } } Player pDamager = (Player)damager; Player pDamagee = (Player)damagee; if (areOnSameTeam(pDamager, pDamagee)) { event.setCancelled(true); if (config_showNoFriendlyFire) pDamager.sendMessage(ChatColor.RED + msg_noFriendlyFire); if (config_showDamagedBy) pDamagee.sendMessage(ChatColor.RED + pDamager.getName() + " " + msg_DamagedBy); } } boolean areOnSameTeam (Player damager, Player damagee) { String teamDamager = null; String teamDamagee = null; //Check for up to 5 teams //Check Damager for permissions for (int i = 1; i <= 5; i++) { if (damager.hasPermission("nofriendlyfire.team"+i)) { teamDamager = "nofriendlyfire.team"+i; } if (teamDamager != null) break; //out of the loop } //Check Damagee for permissions for (int i = 1; i <= 5; i++) { if (damagee.hasPermission("nofriendlyfire.team"+i)) { teamDamagee = "nofriendlyfire.team"+i; } if (teamDamagee != null) break; //out of the loop } if (teamDamager != null && teamDamagee != null) { if (teamDamager.equalsIgnoreCase(teamDamagee)) { return true; //Same team } } return false; } }
[ "x22cookies@gmail.com" ]
x22cookies@gmail.com
ef1b740cc238b2443dda5d542765cc0438831abb
6ccb70181b91915c718e20acac14fcc82abb9135
/com.tojoy.order.service/com.tojoy.order.util/src/main/java/com/tojoy/vhall/api/WebinarAPI.java
8c6c3e88f70baa470b61a89e45eff2467ca5ba65
[]
no_license
sengeiou/jtwarehouse
70592aee6408878269f8b07ebb29308c488aacc7
ca272915eb222e93d331de00418550dad2a5cc46
refs/heads/master
2021-09-01T23:18:22.496819
2017-12-29T04:50:01
2017-12-29T04:50:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,177
java
package com.tojoy.vhall.api; import java.util.HashMap; import java.util.Map; import org.apache.commons.lang.StringUtils; import com.alibaba.fastjson.JSON; import com.tojoy.vhall.resp.WebinarChatResp; import com.tojoy.vhall.resp.WebinarFetchResp; import com.tojoy.vhall.resp.WebinarListResp; import com.tojoy.vhall.resp.WebinarStateResp; import com.tojoy.vhall.resp.WebinarTrackResp; import com.tojoy.vhall.resp.WebinarWholeAuthUrlResp; /** * ๅพฎๆดปๅŠจ(ไนŸ็งฐไผš่ฎฎ)API * @author liangwj * @version 1.0 */ public class WebinarAPI extends BaseAPI { private static final String LIST_URL = "http://e.vhall.com/api/vhallapi/v2/webinar/list"; private static final String FETCH_URL = "http://e.vhall.com/api/vhallapi/v2/webinar/fetch"; private static final String STATE_URL = "http://e.vhall.com/api/vhallapi/v2/webinar/state"; private static final String TRACK_URL = "http://e.vhall.com/api/vhallapi/v2/report/track"; private static final String CHAT_URL = "http://e.vhall.com/api/vhallapi/v2/chat/history"; private static final String WHOLE_AUTH_URL = "http://e.vhall.com/api/vhallapi/v2/webinar/whole-auth-url"; /** * ่Žทๅ–ๆดปๅŠจๅˆ—่กจ * @return */ public final static WebinarListResp listWebinar(Integer page, Integer rows){ Map<String, String> params = new HashMap<String, String>(); Integer start = (page-1)*rows; params.put("limit", rows.toString()); params.put("pos", start.toString()); return new WebinarListResp(doPostVhall(LIST_URL, params)); } /** * ่Žทๅ–ๆดปๅŠจไฟกๆฏ * @param webinar_id ๆดปๅŠจID * @return */ public final static WebinarFetchResp fetchWebinar(String webinar_id){ Map<String, String> params = new HashMap<String, String>(); params.put("webinar_id", webinar_id); params.put("fields", "id,alias_name,user_id,subject,introduction,img_url,category,is_open,layout,verify,password" + ",type,is_single_video,is_iframe,auto_record,is_chat,buffer,t_start,end_time,host,live_start_time"); Map<String, ?> result = doPostVhall(FETCH_URL, params); return new WebinarFetchResp(result); } /** * ่Žทๅ–ๆดปๅŠจ็Šถๆ€ * @param webinar_id ๆดปๅŠจID * @return */ public final static WebinarStateResp stateWebinar(String webinar_id){ Map<String, String> params = new HashMap<String, String>(); params.put("webinar_id", webinar_id); Map<String, ?> result = doPostVhall(STATE_URL, params); return new WebinarStateResp(result); } /** * ่Žทๅ–ๆดปๅŠจ่ง‚ไผ—่ง‚็œ‹่ฎฐๅฝ• * @param webinar_id ๆดปๅŠจID * @param type ็ฑปๅž‹ 1ไธบ็›ดๆ’ญ๏ผŒ2ไธบๅ›žๆ”พ๏ผŒ้ป˜่ฎคไธบ็›ดๆ’ญ * @return */ public final static WebinarTrackResp trackWebinar(String webinar_id, int type){ Map<String, String> params = new HashMap<String, String>(); params.put("webinar_id", webinar_id); params.put("type", String.valueOf(type==2?2:1)); //params.put("pos", "1"); //params.put("limit", "1000"); Map<String, ?> result = doPostVhall(TRACK_URL, params); return new WebinarTrackResp(result); } /** * ่Žทๅ–ๆดปๅŠจๅކๅฒ่Šๅคฉ่ฎฐๅฝ• * @param webinar_id ๆดปๅŠจID * @param startTime ๅฝขๅฆ‚2016-11-30 10:16:43๏ผŒๅช่Žทๅ–ๅœจ่ฏฅๆ—ถ้—ดๅŽ็š„ * @param endTime ๅฝขๅฆ‚2016-11-30 10:16:43๏ผŒๅช่Žทๅ–ๅœจ่ฏฅๆ—ถ้—ดๅ‰็š„ * @param pos ๅˆ†้กตๅผ€ๅง‹ ๆ•ฐๅญ— * @param limit ่ฟ”ๅ›žๆกๆ•ฐ ๆ•ฐๅญ— * @return */ public final static WebinarChatResp chatWebinar(String webinar_id, String startTime, String endTime, int pos, int limit){ Map<String, String> params = new HashMap<String, String>(); params.put("webinar_id", webinar_id); if(StringUtils.isNotBlank(startTime)){ params.put("start_time", startTime); } if(StringUtils.isNotBlank(endTime)){ params.put("end_time", endTime); } params.put("pos", String.valueOf(pos<=0?1:pos)); params.put("limit", String.valueOf(limit<=0||limit>200?200:limit)); Map<String, ?> result = doPostVhall(CHAT_URL, params); return new WebinarChatResp(result); } /** * ๅ…จๅฑ€้…็ฝฎ็ฌฌไธ‰ๆ–นKๅ€ผ้ชŒ่ฏURL๏ผŒ้’ˆๅฏนๆ‰€ๆœ‰็š„ๆดปๅŠจ้…็ฝฎ็”Ÿๆ•ˆ๏ผŒๅฆ‚ๆžœ้’ˆๅฏนๅ•ไธชๆดปๅŠจๅ†ๅš้…็ฝฎ๏ผŒไปฅๅ•ไธชๆดปๅŠจ้…็ฝฎไธบๆœ€็ปˆ้…็ฝฎ * @param exist_3rd_auth้ป˜่ฎคไธบ0ไธๅผ€ๅฏ๏ผŒ1ไธบๅผ€ๅฏ,ๆ˜ฏๅฆๅผ€ๅฏ็ฌฌไธ‰ๆ–นKๅ€ผ้ชŒ่ฏๆŸฅ็œ‹่ฏดๆ˜Ž * @param auth_url http://domain,<256ไธชๅญ—็ฌฆ,็ฌฌไธ‰ๆ–นKๅ€ผ้ชŒ่ฏๆŽฅๅฃURL(exist_3rd_authไธบ1ๅฟ…ๅกซ) * @param failure_url http://domain,<256ไธชๅญ—็ฌฆ,็ฌฌไธ‰ๆ–นKๅ€ผ้ชŒ่ฏๅคฑ่ดฅ่ทณ่ฝฌURL(ๅฏ้€‰) * @param cover_child ๆ˜ฏๅฆ่ฆ†็›–ๅญ่ดฆๅท๏ผŒ1ไธบ่ฆ†็›–๏ผŒ0ไธบไธ่ฆ†็›–๏ผŒ้ป˜่ฎคไธบ0 * @return */ public final static WebinarWholeAuthUrlResp wholeAuthUrlWebinar (int exist_3rd_auth,String auth_url,String failure_url,int cover_child){ Map<String, String> params = new HashMap<String, String>(); params.put("exist_3rd_auth", String.valueOf(exist_3rd_auth)); params.put("auth_url", auth_url==null?"":auth_url); params.put("failure_url", failure_url==null?"":failure_url); params.put("cover_child", String.valueOf(cover_child)); Map<String, ?> result = doPostVhall(WHOLE_AUTH_URL, params); return new WebinarWholeAuthUrlResp(result); } /** * ่Žทๅ–ไธŠไผ ่ง†้ข‘ๅˆ—่กจ * @return */ public final static WebinarListResp listUploadWebinar(Integer page,Integer rows){ Map<String, String> params = new HashMap<String, String>(); Integer start = (page-1)*rows; params.put("limit", rows.toString()); params.put("pos", start.toString()); params.put("status", "4"); return new WebinarListResp(doPostVhall(LIST_URL, params)); } public static void main(String[] args){ String webinar_id = "710282432"; // WebinarFetchResp p1 = fetchWebinar(webinar_id); // WebinarStateResp p2 = stateWebinar(webinar_id); // WebinarTrackResp p3 = trackWebinar(webinar_id,1); // WebinarChatResp p4 = chatWebinar(webinar_id,null,null,0,1000); WebinarWholeAuthUrlResp p5 = wholeAuthUrlWebinar(1,"http://www.51adven.com/wxfront/m/vhall/validk.jhtml","",1); // System.out.println(JSON.toJSON(p1)); // System.out.println(JSON.toJSON(p2)); // System.out.println(JSON.toJSON(p3)); // System.out.println(JSON.toJSON(p4)); System.out.println(JSON.toJSON(p5)); } }
[ "fglovezzr@163.com" ]
fglovezzr@163.com
f97299a464f3e31bde1e330703dda7bb3c224704
ff8e565d636190ea8ef19cd3a76fbf282c36ef4f
/src/main/java/com/vtpavlov/enterpriseportal/model/AccountsManagement/GoogleLoginBean.java
c76245ecc23144021e5c15874611a38733135c8e
[]
no_license
vtpavlov/enterprise-portal
253cbb3269a97f31b9d2974ee7d2ac5b8dee8254
7871b75b3c4e9a5a990cf2ce54ca249e730564d6
refs/heads/master
2021-01-13T01:23:20.453920
2014-08-02T07:43:24
2014-08-02T07:43:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
578
java
package com.vtpavlov.enterpriseportal.model.AccountsManagement; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.RequestScoped; @ManagedBean @RequestScoped public class GoogleLoginBean { @ManagedProperty("#{param.code}") private String code; public String login() { //TODO Should send the code to google API server and receive a token System.out.print(code); return "login"; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } }
[ "vesko.pav11@gmail.com" ]
vesko.pav11@gmail.com
ae18906356bf404fdd60cb3c8555a2ff8fea49ac
c085b210929e79fe6978d1c3181767f042ddafb5
/order-server/src/test/java/com/zjc/orderserver/OrderServerApplicationTests.java
b95d3e0a2eeb96f0e7a443fe263b743e63f29ddb
[]
no_license
zjc1750514326/Dragon
398bca785fcef6f7833c2c2c3c93cc673fc552b5
e0cbee1b1e1000960174fca4433919fabf7b4a2f
refs/heads/master
2020-04-24T10:02:33.383570
2019-02-24T08:56:39
2019-02-24T08:56:39
171,880,316
0
0
null
null
null
null
UTF-8
Java
false
false
350
java
package com.zjc.orderserver; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class OrderServerApplicationTests { @Test public void contextLoads() { } }
[ "1750514326@qq.com" ]
1750514326@qq.com
06ed786d7bfac4a6449d7e560adb9f52a3318bd0
3c52faabf5948f375098e119515b227734db6fc5
/codeforces/1371/D.java
1696f755d38cff7b394d871200efaa287e5efa38
[]
no_license
Akash-Kunwar/CP
d693237e7adafdbff37e4dc13edd45ee68494d29
c55c80e91d24039f4f937d9fd0604e09cbd34d35
refs/heads/master
2023-02-02T04:40:08.357342
2020-04-13T14:53:00
2020-12-21T15:32:40
323,367,319
0
0
null
null
null
null
UTF-8
Java
false
false
4,735
java
import java.util.*; import java.lang.*; import java.io.*; public class GFG { public static void main (String[] args) throws Exception { FastScanner sc = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); int t =sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int k=sc.nextInt(); if(k%n==0){ out.println("0"); } else{ out.println("2"); } int arr[][]=new int [n][n]; int x=0,y=0; for(int i=0;i<n && k>0;i++){ x=0; y=i; for(int j=0;j<n && k>0;j++){ arr[x][y]=1; k--; x=(x+1)%(n); y=(y+1)%(n); } } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ out.print(arr[i][j]+""); } out.println(); } } out.close(); } } class FastScanner { final private int BUFFER_SIZE = 1 << 17; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public FastScanner(InputStream in) { din = new DataInputStream(in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String nextLine() throws Exception { StringBuffer sb = new StringBuffer(""); byte c = read(); while (c <= ' ') c = read(); do { sb.append((char)c); c = read(); } while(c > ' '); return sb.toString(); } public char nextChar() throws Exception { byte c = read(); while(c <= ' ') c = read(); return (char)c; } public int nextInt() throws Exception { int ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = c == '-'; if (neg) c = read(); do { ret = ret * 10 + c - '0'; c = read(); } while (c > ' '); if (neg) return -ret; return ret; } public long nextLong() throws Exception { long ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = c == '-'; if (neg) c = read(); do { ret = ret * 10 + c - '0'; c = read(); } while (c > ' '); if (neg) return -ret; return ret; } private void fillBuffer() throws Exception { bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); if (bytesRead == -1) buffer[0] = -1; } private byte read() throws Exception { if (bufferPointer == bytesRead) fillBuffer(); return buffer[bufferPointer++]; } public double nextDouble() throws Exception { double ret = 0, div = 1; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (c == '.') { while ((c = read()) >= '0' && c <= '9') { ret += (c - '0') / (div *= 10); } } if (neg) return -ret; return ret; } private static int binarySearchPM(int[] arr, int key) { int n = arr.length; int mid = -1; int begin = 0, end = n; while(begin <= end) { mid = (begin + end) / 2; if(mid == n) { return n; } if(key < arr[mid]) { end = mid - 1; } else if(key > arr[mid]) { begin = mid + 1; } else { return mid; } } //System.out.println(begin+" "+end); return -begin; //expected Index } // function to find last index <= y static int upperIndex(int arr[], int n, int y) { int l = 0, h = n - 1; while (l <= h) { int mid = (l + h) / 2; if (arr[mid] <= y) l = mid + 1; else h = mid - 1; } return h; } static int lowerIndex(int arr[], int n, int x) { int l = 0, h = n - 1; while (l <= h) { int mid = (l + h) / 2; if (arr[mid] >= x) h = mid - 1; else l = mid + 1; } return l; } }
[ "akashkunwar08@gmail.com" ]
akashkunwar08@gmail.com
1aedafc04389b6e66ba234be7d0725047b9c29d6
580711cf8eaef179fe6af794798694908eef90e4
/src/test/java/cucumber/stepdefs/support/Hooks.java
be041018c58288d779d07580b952a867db8c52a4
[]
no_license
ealden/OldEmersonsGame
dd5e2e302e0c05321c344dbcacfa12c36407183e
6b6c58b19b8370bf224b5c79becedd371b505d95
refs/heads/master
2021-06-09T21:54:44.209806
2016-11-25T07:46:11
2016-11-25T07:46:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
585
java
package cucumber.stepdefs.support; import cucumber.api.java.After; import cucumber.api.java.Before; import static com.odde.emersonsgame.data.support.Databases.getDatabaseTester; import static com.odde.emersonsgame.data.support.Databases.getNewDatabaseTester; import static cucumber.stepdefs.support.Browsers.closeBrowser; public class Hooks { @Before public void beforeScenario() throws Exception { getNewDatabaseTester(); } @After public void afterScenario() throws Exception { closeBrowser(); getDatabaseTester().onTearDown(); } }
[ "ealden@odd-e.com" ]
ealden@odd-e.com
bcd25caaa922afb114fa952bc068623774c56da6
b24a5af8ba7fa4073d79ea0a449801b4d0ffc004
/jmetal-core/src/main/java/org/uma/jmetal/qualityindicator/impl/Spread.java
749121c52d2459d1ef0d4c28504aa9f3bbd9a64f
[]
no_license
vitordeatorreao/jMetal
1cdf04c75e4312837285551ea32ef33431ede3e9
29601499ee820231ec224119bd96790cb83e47ab
refs/heads/master
2020-12-11T08:07:54.176541
2015-05-18T19:26:40
2015-05-18T19:26:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,273
java
// Spread.java // // Author: // Antonio J. Nebro <antonio@lcc.uma.es> // Juan J. Durillo <durillo@lcc.uma.es> // // Copyright (c) 2011 Antonio J. Nebro, Juan J. Durillo // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. package org.uma.jmetal.qualityindicator.impl; import org.uma.jmetal.qualityindicator.QualityIndicator; import org.uma.jmetal.solution.Solution; import org.uma.jmetal.util.JMetalException; import org.uma.jmetal.util.front.Front; import org.uma.jmetal.util.front.imp.ArrayFront; import org.uma.jmetal.util.front.util.FrontUtils; import org.uma.jmetal.util.naming.impl.SimpleDescribedEntity; import org.uma.jmetal.util.point.impl.LexicographicalPointComparator; import org.uma.jmetal.util.point.impl.PointUtils; import java.util.List; /** * This class implements the spread quality indicator. It must be only to two bi-objective problem. * Reference: Deb, K., Pratap, A., Agarwal, S., Meyarivan, T.: A fast and * elitist multiobjective genetic algorithm: NSGA-II. IEEE Trans. on Evol. Computation 6 (2002) 182-197 */ public class Spread extends SimpleDescribedEntity implements QualityIndicator { /** * Constructor. * Creates a new instance of a Spread object */ public Spread() { super("SPREAD", "SPREAD quality indicator") ; } @Override public double execute(Front paretoFrontApproximation, Front trueParetoFront) { if (paretoFrontApproximation == null) { throw new JMetalException("The pareto front approximation object is null") ; } else if (trueParetoFront == null) { throw new JMetalException("The pareto front object is null"); } return spread(paretoFrontApproximation, trueParetoFront); } @Override public double execute(List<? extends Solution> paretoFrontApproximation, List<? extends Solution> trueParetoFront) { if (paretoFrontApproximation == null) { throw new JMetalException("The pareto front approximation object is null") ; } else if (trueParetoFront == null) { throw new JMetalException("The pareto front object is null"); } return this.execute(new ArrayFront(paretoFrontApproximation), new ArrayFront(trueParetoFront)) ; } /** * Calculates the Spread metric. * * @param front The front. * @param trueParetoFront The true pareto front. */ public double spread(Front front, Front trueParetoFront) { double[] maximumValue; double[] minimumValue; Front normalizedFront; Front normalizedParetoFront; // STEP 1. Obtain the maximum and minimum values of the Pareto front maximumValue = FrontUtils.getMaximumValues(trueParetoFront); minimumValue = FrontUtils.getMinimumValues(trueParetoFront); // STEP 2. Get the normalized front and true Pareto fronts normalizedFront = FrontUtils.getNormalizedFront(front, maximumValue, minimumValue); normalizedParetoFront = FrontUtils.getNormalizedFront(trueParetoFront, maximumValue, minimumValue); // STEP 3. Sort normalizedFront and normalizedParetoFront; normalizedFront.sort(new LexicographicalPointComparator()); normalizedParetoFront.sort(new LexicographicalPointComparator()); // STEP 4. Compute df and dl (See specifications in Deb's description of the metric) double df = PointUtils.euclideanDistance(normalizedFront.getPoint(0), normalizedParetoFront.getPoint(0)) ; double dl = PointUtils.euclideanDistance( normalizedFront.getPoint(normalizedFront.getNumberOfPoints()-1), normalizedParetoFront.getPoint(normalizedParetoFront.getNumberOfPoints()-1)) ; double mean = 0.0; double diversitySum = df + dl; int numberOfPoints = normalizedFront.getNumberOfPoints() ; // STEP 5. Calculate the mean of distances between points i and (i - 1). // (the points are in lexicografical order) for (int i = 0; i < (numberOfPoints - 1); i++) { mean += PointUtils.euclideanDistance(normalizedFront.getPoint(i), normalizedFront.getPoint(i + 1)); } mean = mean / (double) (numberOfPoints - 1); // STEP 6. If there are more than a single point, continue computing the // metric. In other case, return the worse value (1.0, see metric's description). if (numberOfPoints > 1) { for (int i = 0; i < (numberOfPoints - 1); i++) { diversitySum += Math.abs(PointUtils.euclideanDistance(normalizedFront.getPoint(i), normalizedFront.getPoint(i + 1)) - mean); } return diversitySum / (df + dl + (numberOfPoints - 1) * mean); } else { return 1.0; } } @Override public String getName() { return super.getName() ; } }
[ "ajnebro@outlook.com" ]
ajnebro@outlook.com
3589753175bc3349eb2906678ffc96dd8174e13d
f3a456ac51089d4a693dea95b5894995860442f3
/app/src/main/java/be/project/sitereck/ProjectManager/POJO/DataForCard.java
28354fd08b2f3e221ccd74433e0a73570d1e12b8
[]
no_license
mayurilamkane/SiteReck
979eb5b3b894e7559d991f70bcba100545d9de89
7381ccfb9d96a6408c6d32263518258747b3877f
refs/heads/master
2022-07-07T11:49:58.975928
2020-05-14T07:47:17
2020-05-14T07:47:17
272,607,385
1
0
null
2020-06-16T04:13:58
2020-06-16T04:13:58
null
UTF-8
Java
false
false
349
java
package be.project.sitereck.ProjectManager.POJO; public class DataForCard { private String Title, Desc; public DataForCard(String title, String desc){ Title = title; Desc = desc; } public String getTitle() { return Title; } public String getDesc() { return Desc; } }
[ "yuvrajvansure@gmail.com" ]
yuvrajvansure@gmail.com
e7d3dc2e205370e0dc32ae7ebca77cc763ab8f1c
fb41d7543c552e6cd06a63396786c8e23ae698c4
/src/main/java/net/training/domain/relationship/manytomany/GrandParent.java
63fa0f1bd27c1815d2c289db503f017cb8c69d34
[]
no_license
tsoyaleksey/jpa-hibernate-training
3022d7accefbb888f8c2949f1eb7d97726a78f8e
d499118acb60f5d20f34cdb977f751923f050141
refs/heads/master
2020-03-21T02:09:52.674069
2018-06-23T08:15:05
2018-06-23T08:15:05
137,979,612
0
0
null
null
null
null
UTF-8
Java
false
false
762
java
package net.training.domain.relationship.manytomany; import java.util.HashSet; import java.util.Set; import lombok.Data; import net.training.domain.BaseEntity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; @Data @Entity public class GrandParent extends BaseEntity { @Column(name = "name") private String name; @ManyToMany @JoinTable( name = "GRANDPA_TO_CHILD", joinColumns = @JoinColumn(name = "GRANDPA_ID", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "CHILD_ID", referencedColumnName = "id") ) private Set<GrandChild> childrens = new HashSet<>(); }
[ "aleksey_tsoy@epam.com" ]
aleksey_tsoy@epam.com
fea39bac36b8e110831b0b22e397573924be678a
f0ec508f4b480d8d5399a2880e4cbb0533fc2fc1
/com.gzedu.xlims.biz/src/main/java/com/gzedu/xlims/serviceImpl/exam/temp/ExportExamStudentSeat2VO.java
3298b656e7b86bd87e9f98d4660e3d3b0bbf56f5
[]
no_license
lizm335/MyLizm
a327bd4d08a33c79e9b6ef97144d63dae7114a52
1bcca82395b54d431fb26817e61a294f9d7dd867
refs/heads/master
2020-03-11T17:25:25.687426
2018-04-19T03:10:28
2018-04-19T03:10:28
130,146,458
3
0
null
null
null
null
UTF-8
Java
false
false
402
java
/** * Copyright(c) 2013 ็‰ˆๆƒๆ‰€ๆœ‰๏ผšๅนฟๅทž่ฟœ็จ‹ๆ•™่‚ฒไธญๅฟƒ www.969300.com */ package com.gzedu.xlims.serviceImpl.exam.temp; /** * ๅŠŸ่ƒฝ่ฏดๆ˜Ž๏ผš * * @author ๆŽๆ˜Ž liming@eenet.com * @Date 2016ๅนด12ๆœˆ9ๆ—ฅ * @version 2.5 * */ public class ExportExamStudentSeat2VO { // ๅญฆๅท ๅง“ๅ ๅทๅท ็ง‘็›ฎๅ็งฐ ่€ƒ่ฏ•ๅฝขๅผ ่€ƒ่ฏ•ๆ—ฅๆœŸ ่€ƒ่ฏ•ๆ—ถ้—ด ่€ƒๅœบๅŠๅบงไฝๅท ่€ƒ็‚น ่€ƒ็‚นๅœฐๅ€ }
[ "lizengming@eenet.com" ]
lizengming@eenet.com
e30e75ac562f067d8d3ec729c5af342a3bc4b0e1
66efebf2ecd7aa8b7e44ef8bcc9ae4327d654066
/src/OfficeHours/Practice_03_25_2020/SingleIfStatement_Practice.java
c4b020e149cbd3207c1ae3d5b28f0fc25a728eae
[]
no_license
AdilMuhammed/Spring2020B17_Java
ab9e9e9b1dabc2bba3f1df8c32283cc9526c355e
e1f58f5aa7c67f27e877137f77e9a0d08ad386c6
refs/heads/master
2022-11-06T16:33:15.099526
2020-06-29T18:54:09
2020-06-29T18:54:09
258,073,919
0
0
null
null
null
null
UTF-8
Java
false
false
467
java
package OfficeHours.Practice_03_25_2020; public class SingleIfStatement_Practice { public static void main(String[] args) { if(!true){ System.out.println("True"); } if(8 > 9){ System.out.println("8 is greater than 9"); } if(8 < 9){ System.out.println("8 is less than 9"); } if(8 == 9){ System.out.println("8 is equal to 9"); } } }
[ "adilabdulrahman83@gmail.com" ]
adilabdulrahman83@gmail.com
e787b80d838af6db2c6a9e5f21a313b0c0b0ebea
53a2f970032fb9a2a0862f02c61e25d39cd9929b
/src/main/java/io/pivotal/pal/tracker/PalTrackerApplication.java
c59b7b991a45a42bde178c2096c9bd7536036ff7
[]
no_license
usailaanjum/pal-tracker2
e0a0a03da4190f98328e7f614ff952f79d350f3a
5d49a993b442918a73e9da1de3421b10fd35cf49
refs/heads/master
2021-02-19T16:14:58.063554
2020-01-08T16:09:21
2020-03-08T17:49:17
245,315,705
0
0
null
null
null
null
UTF-8
Java
false
false
1,041
java
package io.pivotal.pal.tracker; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; <<<<<<< HEAD ======= import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; >>>>>>> 65651fe... Add TimeEntry MVC in memory @SpringBootApplication public class PalTrackerApplication { public static void main(String[] args){ SpringApplication.run(PalTrackerApplication.class, args); } @Bean <<<<<<< HEAD public TimeEntryRepository timeEntryRepository(){ return timeEntryRepository(); } ======= TimeEntryRepository timeEntryRepository() { return new InMemoryTimeEntryRepository(); } >>>>>>> 65651fe... Add TimeEntry MVC in memory }
[ "usailaanjum@gmail.com" ]
usailaanjum@gmail.com
6f8e43d8abff6e7c9a6721c1440d9d28de033767
92234b40626160cd7cd65916229fc918b48e959e
/1.JavaSyntax/src/com/javarush/task/task08/task0812/Solution.java
ebbd1a3deca3feb3e0aa3dedbdc646eb32438324
[]
no_license
evoyager/JavaRushTasks
3c2394e978832be0e5709155d68c6b42a986cff1
e3c43648f322790c16c415bd8c42266e99d35058
refs/heads/master
2020-04-20T08:56:59.789305
2019-05-28T19:47:54
2019-05-28T19:47:54
168,753,799
0
0
null
null
null
null
UTF-8
Java
false
false
1,118
java
package com.javarush.task.task08.task0812; import java.io.*; import java.util.ArrayList; /* Cะฐะผะฐั ะดะปะธะฝะฝะฐั ะฟะพัะปะตะดะพะฒะฐั‚ะตะปัŒะฝะพัั‚ัŒ */ public class Solution { public static void main(String[] args) throws IOException { ArrayList<Integer> list = new ArrayList<>(); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); list.add(Integer.parseInt(reader.readLine())); int prevNum = list.get(0); int currNum; int resultLength = 1; int currLength = 1; for (int i = 1; i < 10; i++) { currNum = Integer.parseInt(reader.readLine()); list.add(currNum); if (currNum == prevNum) { currLength++; } else { if (currLength > resultLength) { resultLength = currLength; } prevNum = currNum; currLength = 1; } } if (currLength > resultLength) { resultLength = currLength; } System.out.println(resultLength); } }
[ "ievgen_gusar@epam.com" ]
ievgen_gusar@epam.com
fbcc2530a77c501f3fb09d003beeb2eaec32c739
f4e9a7c963e36d027b94735530c3269cc92e14af
/app/src/main/java/com/example/ecommerce/Interface/ItemClickListener.java
8c652c8e427ff00bdb4b3d893ed8e758353d2d5a
[]
no_license
krishanj20/Android-Studio-Shopping-App
9b4e8d64a081f69fa84ed2b4c8a98c174c4b8a88
6633cee926e4b9dccbb5fbd654632535086d6b73
refs/heads/master
2020-06-02T15:12:25.039978
2019-06-10T16:34:57
2019-06-10T16:34:57
191,204,046
1
1
null
null
null
null
UTF-8
Java
false
false
173
java
package com.example.ecommerce.Interface; import android.view.View; public interface ItemClickListener { void onClick(View view, int position, boolean isLongClick); }
[ "krishanjethwa@msn.com" ]
krishanjethwa@msn.com
322a7c2f08840c2fbf2f5c10396e06a05210764a
92cddeeebd6968bd83eda626550e4ccf3662a6f5
/app/src/test/java/com/example/mbreath/audiorecordtest/ExampleUnitTest.java
dce5b74384bba3f4c5b9e901039e26d0a2e9969c
[]
no_license
avratanu/R13
24616683be9dda6ec0d6694a771aff98ef1c6f3d
ad24f329504156127efba020e60ce3eae8f57c06
refs/heads/master
2021-05-16T00:27:20.459455
2017-10-10T10:37:07
2017-10-10T10:37:07
106,404,665
0
0
null
null
null
null
UTF-8
Java
false
false
413
java
package com.example.mbreath.audiorecordtest; 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); } }
[ "31072048+avratanu@users.noreply.github.com" ]
31072048+avratanu@users.noreply.github.com
bf9192ee902bcb9ff4f5dee42ae4bc4c5f6576a1
83a2b8ea20496b916180c40c051fc41179435cd3
/exampleTypeErrorProgram.java
c4586a0715a28b0526756effecbfcd36ac06e728
[]
no_license
garzon/miniJavaInterpreter
48b62479efbdfa0d124dd54a53b54ce26fabaf59
8b2dd3ed3d45e6b84e056175f51b2e5168acc9d3
refs/heads/master
2021-01-12T04:25:37.943700
2017-01-02T12:14:00
2017-01-02T12:14:00
77,609,489
1
0
null
null
null
null
UTF-8
Java
false
false
485
java
class MiniJava { public static void main(String[] args) { Seq seq = new NotSeq(); // error // polymorphism Seq seq2 = new SeqSubClass(); // ok int a = 1 + seq2.returnTrue(seq2.returnTrue()) * 3; boolean b = (1+seq2.a); int c; int d; for(c = 1; c; d += 1); } } class NotSeq { public int test() { return test(); }} class Seq { public boolean returnTrue(int b) { return true; } } class SeqSubClass extends Seq { int a; }
[ "610204679@qq.com" ]
610204679@qq.com
d20ee3ee8642fc97c93326dd7b33f00a7b0bd11b
0f021178751c8396a1e885830d5a355e89b5357f
/leetcode/src/dataStructure/LinkedList.java
fbc2a3fa31fefec02327e1af73f65d06a6e00619
[ "Apache-2.0" ]
permissive
danceli/leetcode-and-dataStructure
70f58dd4b9e880c0baac17d36d1a0d1f3054ad46
0fa468e6aec26b6d5773273e4b45b908da127c42
refs/heads/main
2023-05-28T15:58:41.212292
2021-06-06T02:11:53
2021-06-06T02:11:53
366,887,082
0
0
null
null
null
null
UTF-8
Java
false
false
4,401
java
package dataStructure; import org.omg.CORBA.INTERNAL; public class LinkedList<E> { private class Node { public E e; public Node next; public Node(E e, Node next) { this.e = e; this.next = next; } public Node(E e) { this.e = e; this.next = null; } public Node() { this(null, null); } @Override public String toString() { return e.toString(); } } private Node dummyHead; private int size; public LinkedList() { dummyHead = new Node(null, null); size = 0; } //่Žทๅ–้“พ่กจไธญ็š„ๅ…ƒ็ด ไธชๆ•ฐ public int getSize() { return size; } //่ฟ”ๅ›ž้“พ่กจๆ˜ฏๅฆไธบ็ฉบ public boolean isEmpty() { return size == 0; } //ๅœจ้“พ่กจๅคด้ƒจๆทปๅŠ ๅ…ƒ็ด  public void addFirst(E e) { // Node node = new Node(e); // node.next = head; // head = node; // size++; // head = new Node(e, head); // size++; add(0, e); } //ๅœจ้“พ่กจ็š„(index - based)ไฝ็ฝฎๆทปๅŠ ๆ–ฐ็š„ๅ…ƒ็ด  public void add(int index, E e) { if(index < 0 || index > size) { throw new IllegalArgumentException("index is not validate"); } Node prev = dummyHead; for(int i = 0; i < index; i++) { prev = prev.next; } prev.next = new Node(e, prev.next); size++; } public void addLast(E e) { add(size, e); } //่Žทๅพ—้“พ่กจ็š„็ฌฌindex(0, based)ไธชไฝ็ฝฎ็š„ๅ…ƒ็ด  public E get(int index) { if(index < 0 || index > size) { throw new IllegalArgumentException("get failed. Illegal index"); } Node cur = dummyHead.next; for(int i = 0; i < index; i++) { cur = cur.next; } return cur.e; } //่Žทๅ–้“พ่กจ็š„็ฌฌไธ€ไธชๅ…ƒ็ด  public E getFirst() { return get(0); } //่Žทๅ–้“พ่กจ็š„ๆœ€ๅŽไธ€ไธชๅ…ƒ็ด  public E getLast() { return get(size - 1); } //ไฟฎๆ”น้“พ่กจ็š„็ฌฌindex(0-based)ไธชๅ…ƒ็ด ไธบe public void set(int index, E e) { if(index < 0 || index >= size) { throw new IllegalArgumentException("index is Illegal"); } Node cur = dummyHead.next; for(int i = 0; i < index; i++) { cur = cur.next; } cur.e = e; } //ๆŸฅ็œ‹้“พ่กจๅ…ƒ็ด ๆ˜ฏๅฆๆœ‰่Š‚็‚นe public boolean contains(E e) { Node cur = dummyHead.next; while(cur.next != null) { if(cur.e.equals(e)) { return true; } cur = cur.next; } return false; } //ไปŽ้“พ่กจไธญๅˆ ้™คindex(0-based)ไฝ็ฝฎ็š„ๅ…ƒ็ด ๏ผŒ่ฟ”ๅ›žๅˆ ้™คๅ…ƒ็ด  public E remove(int index) { if(index < 0 || index >= size) { throw new IllegalArgumentException("Remove failed. index is illgeal"); } Node prev = dummyHead; for(int i = 0; i < index; i++) { prev = prev.next; } Node retNode = prev.next; prev.next = retNode.next; retNode.next = null; size--; return retNode.e; } //ไปŽ้“พ่กจไธญๅˆ ้™คๆœ€ๅŽไธ€ไธชๅ…ƒ็ด  public E removeLast() { return remove(size - 1); } //ไปŽ้“พ่กจไธญๅˆ ้™ค็ฌฌไธ€ไธชๅ…ƒ็ด  public E removeFirst() { return remove(0); } @Override public String toString() { StringBuilder string = new StringBuilder(); string.append("LinkedList "); // Node cur = dummyHead.next; // while(cur != null) { // string.append(cur.e + "->"); // cur = cur.next; // } for(Node cur = dummyHead.next; cur != null; cur = cur.next) { string.append(cur.e + "->"); } string.append("NULL"); return string.toString(); } public static void main(String[] args) { LinkedList<Integer> linkedlist = new LinkedList<>(); for(int i = 0; i < 10; i++) { linkedlist.addLast(i * 2); } linkedlist.removeFirst(); linkedlist.removeLast(); System.out.println(linkedlist); } }
[ "332535219@qq.com" ]
332535219@qq.com
3a20a857378c8dec20cadf4bfade1a3d6ab53f13
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_493e9de0917564812d2a6ec2674a014ca3ed9e96/RulesBinderImpl/2_493e9de0917564812d2a6ec2674a014ca3ed9e96_RulesBinderImpl_s.java
3f123777aabb00b225affb7c59261b2de7463b29
[]
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
31,260
java
/* $Id$ * * 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 org.apache.commons.digester3; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.beanutils.ConvertUtils; import org.apache.commons.digester3.rulesbinder.BackToLinkedRuleBuilder; import org.apache.commons.digester3.rulesbinder.BeanPropertySetterBuilder; import org.apache.commons.digester3.rulesbinder.CallMethodBuilder; import org.apache.commons.digester3.rulesbinder.CallParamBuilder; import org.apache.commons.digester3.rulesbinder.ConverterBuilder; import org.apache.commons.digester3.rulesbinder.FactoryCreateBuilder; import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder; import org.apache.commons.digester3.rulesbinder.NestedPropertiesBuilder; import org.apache.commons.digester3.rulesbinder.ObjectCreateBuilder; import org.apache.commons.digester3.rulesbinder.ObjectParamBuilder; import org.apache.commons.digester3.rulesbinder.ParamTypeBuilder; import org.apache.commons.digester3.rulesbinder.PathCallParamBuilder; import org.apache.commons.digester3.rulesbinder.SetPropertiesBuilder; import org.apache.commons.digester3.rulesbinder.SetPropertyBuilder; import org.apache.commons.digester3.spi.ObjectCreationFactory; import org.apache.commons.digester3.spi.RuleProvider; import org.apache.commons.digester3.spi.Rules; import org.apache.commons.digester3.spi.TypeConverter; /** * The Digester EDSL implementation. */ final class RulesBinderImpl implements RulesBinder { /** * Errors that can occur during binding time or rules creation. */ private final List<ErrorMessage> errors = new ArrayList<ErrorMessage>(); /** * The data structure where storing the providers binding. */ private final Collection<RegisteredProvider> providers = new ArrayList<RegisteredProvider>(); /** * {@inheritDoc} */ public void addError(String messagePattern, Object... arguments) { this.addError(new ErrorMessage(messagePattern, arguments)); } /** * {@inheritDoc} */ public void addError(Throwable t) { String message = "An exception was caught and reported. Message: " + t.getMessage(); this.addError(new ErrorMessage(message, t)); } /** * * * @param errorMessage */ private void addError(ErrorMessage errorMessage) { this.errors.add(errorMessage); } /** * * * @return */ public boolean containsErrors() { return !this.errors.isEmpty(); } /** * * * @return */ public List<ErrorMessage> getErrors() { return errors; } /** * {@inheritDoc} */ public void install(RulesModule rulesModule) { rulesModule.configure(this); } /** * {@inheritDoc} */ public LinkedRuleBuilder forPattern(String pattern) { final String keyPattern; if (pattern == null || pattern.length() == 0) { this.addError(new IllegalArgumentException("Null or empty pattern is not valid")); keyPattern = null; } else { if (pattern.endsWith("/")) { // to help users who accidently add '/' to the end of their patterns keyPattern = pattern.substring(0, pattern.length() - 1); } else { keyPattern = pattern; } } return new LinkedRuleBuilder() { private final LinkedRuleBuilder mainBuilder = this; private String namespaceURI; public LinkedRuleBuilder withNamespaceURI(/* @Nullable */ String namespaceURI) { this.namespaceURI = namespaceURI; return this; } /** * */ public ParamTypeBuilder<SetTopRule> setTop(final String methodName) { if (methodName == null || methodName.length() == 0) { addError("{forPattern(\"%s\").setTop(String)} empty 'methodName' not allowed", keyPattern); } return this.addProvider( new AbstractParamTypeBuilder<SetTopRule>(keyPattern, methodName, RulesBinderImpl.this, this) { @Override protected String getCalledMethodName() { return "setTop"; } public SetTopRule get() { return setNamespaceAndReturn( new SetTopRule(this.getMethodName(), this.getParamType(), this.isUseExactMatch())); } }); } /** * */ public ParamTypeBuilder<SetRootRule> setRoot(final String methodName) { if (methodName == null || methodName.length() == 0) { addError("{forPattern(\"%s\").setRoot(String)} empty 'methodName' not allowed", keyPattern); } return this.addProvider( new AbstractParamTypeBuilder<SetRootRule>(keyPattern, methodName, RulesBinderImpl.this, this) { @Override protected String getCalledMethodName() { return "setRoot"; } public SetRootRule get() { return setNamespaceAndReturn( new SetRootRule(this.getMethodName(), this.getParamType(), this.isUseExactMatch())); } }); } /** * */ public SetPropertyBuilder setProperty(final String attributePropertyName) { if (attributePropertyName == null || attributePropertyName.length() == 0) { addError("{forPattern(\"%s\").setProperty(String)} empty 'attributePropertyName' not allowed", keyPattern); } return this.addProvider(new SetPropertyBuilder() { private String valueAttributeName; public SetPropertyRule get() { return setNamespaceAndReturn(new SetPropertyRule(attributePropertyName, valueAttributeName)); } public LinkedRuleBuilder then() { return mainBuilder; } public SetPropertyBuilder extractingValueFromAttribute(String valueAttributeName) { if (attributePropertyName == null || attributePropertyName.length() == 0) { addError("{forPattern(\"%s\").setProperty(\"%s\").extractingValueFromAttribute(String)} empty 'valueAttributeName' not allowed", keyPattern, attributePropertyName); } this.valueAttributeName = valueAttributeName; return this; } }); } /** * */ public SetPropertiesBuilder setProperties() { return this.addProvider(new SetPropertiesBuilder() { private final Map<String, String> aliases = new HashMap<String, String>(); private boolean ignoreMissingProperty = true; public SetPropertiesRule get() { return setNamespaceAndReturn(new SetPropertiesRule(this.aliases, this.ignoreMissingProperty)); } public LinkedRuleBuilder then() { return mainBuilder; } public SetPropertiesBuilder ignoreMissingProperty(boolean ignoreMissingProperty) { this.ignoreMissingProperty = ignoreMissingProperty; return this; } public SetPropertiesBuilder addAlias(String attributeName, /* @Nullable */String propertyName) { if (attributeName == null) { addError("{forPattern(\"%s\").setProperties().addAlias(String,String)} empty 'methodName' not allowed", keyPattern); } else { this.aliases.put(attributeName, propertyName); } return this; } }); } /** * */ public ParamTypeBuilder<SetNextRule> setNext(final String methodName) { if (methodName == null || methodName.length() == 0) { addError("{forPattern(\"%s\").setNext(String)} empty 'methodName' not allowed", keyPattern); } return this.addProvider( new AbstractParamTypeBuilder<SetNextRule>(keyPattern, methodName, RulesBinderImpl.this, this) { @Override protected String getCalledMethodName() { return "setNext"; } public SetNextRule get() { return setNamespaceAndReturn( new SetNextRule(this.getMethodName(), this.getParamType(), this.isUseExactMatch())); } }); } /** * */ public NestedPropertiesBuilder setNestedProperties() { return this.addProvider(new NestedPropertiesBuilder() { private final Map<String, String> elementNames = new HashMap<String, String>(); private boolean trimData = true; private boolean allowUnknownChildElements = false; public SetNestedPropertiesRule get() { return setNamespaceAndReturn( new SetNestedPropertiesRule(elementNames, trimData, allowUnknownChildElements)); } public LinkedRuleBuilder then() { return mainBuilder; } public NestedPropertiesBuilder trimData(boolean trimData) { this.trimData = trimData; return this; } public NestedPropertiesBuilder addAlias(String elementName, String propertyName) { if (elementName == null) { addError("{forPattern(\"%s\").setNestedProperties().addAlias(String,String)} empty 'methodName' not allowed", keyPattern); } else { this.elementNames.put(elementName, propertyName); } return this; } }); } /** * */ public BeanPropertySetterBuilder setBeanProperty() { return this.addProvider(new BeanPropertySetterBuilder() { private String propertyName; public BeanPropertySetterRule get() { return setNamespaceAndReturn(new BeanPropertySetterRule(this.propertyName)); } public LinkedRuleBuilder then() { return mainBuilder; } public BeanPropertySetterBuilder withName(String propertyName) { this.propertyName = propertyName; return this; } }); } /** * */ public <T> ObjectParamBuilder objectParam(/* @Nullable */final T paramObj) { return this.addProvider(new ObjectParamBuilder() { private int paramIndex = 0; private String attributeName; public ObjectParamRule get() { return setNamespaceAndReturn(new ObjectParamRule(paramIndex, attributeName, paramObj)); } public LinkedRuleBuilder then() { return mainBuilder; } public ObjectParamBuilder ofIndex(int paramIndex) { if (paramIndex < 0) { addError("{forPattern(\"%s\").objectParam(%s).ofIndex(int)} negative index argument not allowed", keyPattern, String.valueOf(paramObj)); } this.paramIndex = paramIndex; return this; } public ObjectParamBuilder matchingAttribute(/* @Nullable */String attributeName) { this.attributeName = attributeName; return this; } }); } /** * */ public FactoryCreateBuilder factoryCreate() { return this.addProvider(new FactoryCreateBuilder() { private String className; private String attributeName; private boolean ignoreCreateExceptions; private ObjectCreationFactory<?> creationFactory; public FactoryCreateRule get() { // loading error, the rest are binding errors if (className == null && attributeName == null && creationFactory == null) { throw new DigesterLoadingException("{forPattern(\"%s\").factoryCreate()} at least one between 'className' ar 'attributeName' or 'creationFactory' has to be specified", keyPattern); } return setNamespaceAndReturn( new FactoryCreateRule(keyPattern, attributeName, creationFactory, ignoreCreateExceptions)); } public LinkedRuleBuilder then() { return mainBuilder; } public <T> FactoryCreateBuilder usingFactory(/* @Nullable */ObjectCreationFactory<T> creationFactory) { this.creationFactory = creationFactory; return this; } public FactoryCreateBuilder overriddenByAttribute(/* @Nullable */String attributeName) { this.attributeName = attributeName; return this; } public FactoryCreateBuilder ofType(Class<?> type) { if (type == null) { addError("{forPattern(\"%s\").factoryCreate().ofType(Class<?>)} NULL Java type not allowed", keyPattern); return this; } return this.ofType(type.getName()); } public FactoryCreateBuilder ofType(/* @Nullable */String className) { this.className = className; return this; } public FactoryCreateBuilder ignoreCreateExceptions(boolean ignoreCreateExceptions) { this.ignoreCreateExceptions = ignoreCreateExceptions; return this; } }); } /** * */ public ObjectCreateBuilder createObject() { return this.addProvider(new ObjectCreateBuilder() { private String className; private String attributeName; public ObjectCreateRule get() { if (this.className == null && this.attributeName == null) { throw new DigesterLoadingException("{forPattern(\"%s\").createObject()} At least one between 'className' or 'attributeName' has to be specified", keyPattern); } return setNamespaceAndReturn(new ObjectCreateRule(this.className, this.attributeName)); } public LinkedRuleBuilder then() { return mainBuilder; } public ObjectCreateBuilder ofTypeSpecifiedByAttribute(String attributeName) { this.attributeName = attributeName; return this; } public ObjectCreateBuilder ofType(Class<?> type) { if (type == null) { addError("{forPattern(\"%s\").createObject().ofType(Class<?>)} NULL Java type not allowed", keyPattern); return this; } return this.ofType(type.getName()); } public ObjectCreateBuilder ofType(String className) { this.className = className; return this; } }); } /** * */ public PathCallParamBuilder callParamPath() { return this.addProvider(new PathCallParamBuilder() { private int paramIndex = 0; public PathCallParamRule get() { return setNamespaceAndReturn(new PathCallParamRule(this.paramIndex)); } public LinkedRuleBuilder then() { return mainBuilder; } public PathCallParamBuilder ofIndex(int paramIndex) { if (paramIndex < 0) { addError("{forPattern(\"%s\").callParamPath().ofIndex(int)} negative index argument not allowed", keyPattern); } this.paramIndex = paramIndex; return this; } }); } /** * */ public CallParamBuilder callParam() { return this.addProvider(new CallParamBuilder() { private int paramIndex = 0; private int stackIndex = 0; private boolean fromStack = false; private String attributeName; public CallParamRule get() { return setNamespaceAndReturn(new CallParamRule(paramIndex, fromStack, stackIndex, attributeName)); } public LinkedRuleBuilder then() { return mainBuilder; } public CallParamBuilder withStackIndex(int stackIndex) { this.stackIndex = stackIndex; return this; } public CallParamBuilder ofIndex(int paramIndex) { if (paramIndex < 0) { addError("{forPattern(\"%s\").callParam().ofIndex(int)} negative index argument not allowed", keyPattern); } this.paramIndex = paramIndex; return this; } public CallParamBuilder fromStack(boolean fromStack) { this.fromStack = fromStack; return this; } public CallParamBuilder fromAttribute(/* @Nullable */String attributeName) { this.attributeName = attributeName; return this; } }); } /** * */ public CallMethodBuilder callMethod(final String methodName) { if (methodName == null || methodName.length() == 0) { addError("{forPattern(\"%s\").callMethod(String)} empty 'methodName' not allowed", keyPattern); } return this.addProvider(new CallMethodBuilder() { private int targetOffset; private int paramCount = 0; private Class<?>[] paramTypes; private boolean useExactMatch = false; public CallMethodRule get() { Class<?>[] paramTypes = null; if (this.paramTypes == null) { if (this.paramCount == 0) { paramTypes = new Class<?>[] { String.class }; } else { paramTypes = new Class<?>[this.paramCount]; for (int i = 0; i < paramTypes.length; i++) { paramTypes[i] = String.class; } } } else { paramTypes = this.paramTypes; } return setNamespaceAndReturn( new CallMethodRule(targetOffset, methodName, paramCount, paramTypes, useExactMatch)); } public LinkedRuleBuilder then() { return mainBuilder; } public CallMethodBuilder useExactMatch(boolean useExactMatch) { this.useExactMatch = useExactMatch; return this; } public CallMethodBuilder withTargetOffset(int targetOffset) { this.targetOffset = targetOffset; return this; } public CallMethodBuilder withParamCount(int paramCount) { if (paramCount < 0) { addError("{forPattern(\"%s\").callMethod().withParamCount(int)} negative parameters counter not allowed", keyPattern); } this.paramCount = paramCount; return null; } public CallMethodBuilder withParamTypes(/* @Nullable */Class<?>... paramTypes) { this.paramTypes = paramTypes; return this; } }); } /** * */ public <R extends Rule> BackToLinkedRuleBuilder<R> addRule(final R rule) { if (rule == null) { addError("{forPattern(\"%s\").addRule()} null rule not valid", keyPattern); } return this.addRuleCreatedBy(new RuleProvider<R>() { public R get() { return rule; } }); } /** * */ public <R extends Rule> BackToLinkedRuleBuilder<R> addRuleCreatedBy(final RuleProvider<R> provider) { if (provider == null) { addError("{forPattern(\"%s\").addRuleCreatedBy()} null rule not valid", keyPattern); } return this.addProvider(new BackToLinkedRuleBuilder<R>() { public LinkedRuleBuilder then() { return mainBuilder; } public R get() { return setNamespaceAndReturn(provider.get()); } }); } /** * Add a provider in the data structure where storing the providers binding. * * @param <R> The rule will be created by the given provider * @param provider The provider has to be stored in the data structure * @return The provider itself has to be stored in the data structure */ private <R extends Rule, RP extends RuleProvider<R>> RP addProvider(RP provider) { if (keyPattern == null) { return provider; } providers.add(new RegisteredProvider(keyPattern, provider)); return provider; } /** * Set the namespaceURI to the given rule and return it. * * @param <R> The rule type to apply the namespaceURI * @param rule The rule to apply the namespaceURI * @return The rule type to apply the namespaceURI */ private <R extends Rule> R setNamespaceAndReturn(R rule) { rule.setNamespaceURI(namespaceURI); return rule; } }; } /** * Invokes the bound providers, then create the rule and associate it to the related pattern, * storing them in the proper {@link Rules} implementation data structure. * * @param rules The {@link Rules} implementation to store the produced {@link Rule}s */ public void populateRules(Rules rules) { for (RegisteredProvider registeredProvider : this.providers) { rules.add(registeredProvider.getPattern(), registeredProvider.getProvider().get()); } } /** * Used to associate rule providers with paths in the rules binder. */ private static class RegisteredProvider { private final String pattern; private final RuleProvider<? extends Rule> provider; public <R extends Rule> RegisteredProvider(String pattern, RuleProvider<R> provider) { this.pattern = pattern; this.provider = provider; } public String getPattern() { return pattern; } public RuleProvider<? extends Rule> getProvider() { return provider; } } /** * Abstract {@link ParamTypeBuilder} implementation for {@code setNext()}, {@code setRoot()} and {@code setTop()} * * @param <R> The rule type has to be created */ private static abstract class AbstractParamTypeBuilder<R extends Rule> implements ParamTypeBuilder<R> { private final String keyPattern; private final String methodName; private final RulesBinder binder; private final LinkedRuleBuilder mainLinkedBuilder; private boolean useExactMatch = false; private String paramType; public AbstractParamTypeBuilder(String keyPattern, String methodName, RulesBinder binder, LinkedRuleBuilder mainBuilder) { this.keyPattern = keyPattern; this.methodName = methodName; this.binder = binder; this.mainLinkedBuilder = mainBuilder; } /** * {@inheritDoc} */ public final LinkedRuleBuilder then() { return this.mainLinkedBuilder; } /** * {@inheritDoc} */ public final ParamTypeBuilder<R> useExactMatch(boolean useExactMatch) { this.useExactMatch = useExactMatch; return this; } /** * {@inheritDoc} */ public final ParamTypeBuilder<R> withParameterType(Class<?> paramType) { if (paramType == null) { this.binder.addError("{forPattern(\"%s\").%s.withParameterType(Class<?>)} NULL Java type not allowed", this.keyPattern, this.getCalledMethodName()); return this; } return this.withParameterType(paramType.getName()); } /** * {@inheritDoc} */ public ParamTypeBuilder<R> withParameterType(String paramType) { this.paramType = paramType; return this; } protected abstract String getCalledMethodName(); public String getMethodName() { return methodName; } public String getParamType() { return paramType; } public boolean isUseExactMatch() { return useExactMatch; } } /** * {@inheritDoc} */ public <T> ConverterBuilder<T> convert(final Class<T> type) { if (type == null) { this.addError(new IllegalArgumentException("NULL type is not allowed to be converted")); } return new ConverterBuilder<T>() { public void withConverter(TypeConverter<T> typeConverter) { if (typeConverter == null) { addError(new IllegalArgumentException( String.format("NULL TypeConverter is not allowed for converting '%s' type", type.getName()))); } ConvertUtils.register(new BeanUtilsConverterFacade(typeConverter), type); } }; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
7c215c0330265b95732bb66776c2de0575e4770a
d8d1f3ea057b40ef2a80672ee43a7278f591b3ff
/SqlProcessorProject/src/main/java/com/sqlprocessor/join/LeftJoinTableColumnColumn.java
af23cd1a46df1e8ec8895e079fc4185e8645a233
[ "Apache-2.0" ]
permissive
Otaka/mydifferentprojects
3e0971fc08a563660d943942cc9dd682cf7ee81a
28489042fb574d1178a6d814b6accc29cdc3aeed
refs/heads/master
2020-04-07T05:39:07.776684
2018-04-09T19:21:37
2018-04-09T19:21:37
40,618,466
0
0
null
null
null
null
UTF-8
Java
false
false
1,014
java
package com.sqlprocessor.join; import com.sqlprocessor.table.SqlTable; import net.sf.jsqlparser.expression.Expression; /** * @author sad */ public class LeftJoinTableColumnColumn { private SqlTable table; private String keyField; private SqlTable dependentTable; private String dependentField; public LeftJoinTableColumnColumn(SqlTable table,String keyField, SqlTable dependentTable, String dependentField) { this.table = table; this.keyField = keyField; this.dependentTable = dependentTable; this.dependentField = dependentField; } public String getDependentField() { return dependentField; } public SqlTable getDependentTable() { return dependentTable; } public String getKeyField() { return keyField; } public SqlTable getTable() { return table; } @Override public String toString() { return table+":"+keyField+" "+dependentTable+":"+dependentField; } }
[ "demonmitnik@rambler.ru" ]
demonmitnik@rambler.ru
3701c587f5993e05acea523c9566347afbaed3db
e62054f18009b6935db0a4c4dcfa96004876b017
/CodeGym/src/main/java/LevelThree/FillPoolWithWater.java
1ce0f675fac1d2389014d0f622f9416f02ab5f33
[]
no_license
EliCas5931/CodeGymLessons
8b7387967a36537035fa7d22f003a24e2e6f611f
2de10c9135097e779d512526d76319c52caddbfd
refs/heads/master
2021-01-26T04:21:04.023667
2020-03-24T16:36:58
2020-03-24T16:36:58
243,306,959
0
0
null
null
null
null
UTF-8
Java
false
false
1,249
java
package LevelThree; public class FillPoolWithWater { // Amigo, today our task is to fill the ship's pool. Calculate how many liters of water are // needed to fill the pool all the way up. The pool is known to have linear dimensions a x b x c, // given in meters. // // These dimensions are passed to the getVolume method. The method should return the // number of liters of water needed to fill the pool. // // Consider this example: // The getVolume method is called with the arguments 25, 5, and 2. // // Example output: // 250000 // Requirements: // โ€ข The getVolume(int, int, int) method must be public and static. // โ€ข The getVolume(int, int, int) method must return a long. // โ€ข The getVolume(int, int, int) method should not display anything. // โ€ข The getVolume(int, int, int) method must return the correct amount of water, in liters, that is needed to fill the pool. // Code given: public static void main(String[] args) { System.out.println(getVolume(25, 5, 2)); } public static long getVolume(int a, int b, int c) { //write your code here long vol = a * b * c * 1000; return vol; } }
[ "elizabeth.perry.339@gmail.com" ]
elizabeth.perry.339@gmail.com
a518ff058bca1ec91972f27c982bf675dc1a284f
4935336a68a4c6d7fa60da65dbdd6f84c294fe3e
/jOOQ/src/main/java/org/jooq/tools/jdbc/MockConfiguration.java
384c1484f0e409d5c3ae0e8199d48bbdd17bf8bc
[ "Apache-2.0" ]
permissive
alexturc/jOOQ
847686df256a2caa15a7ce616a3db510e5e5369f
5cd280e9d440696878c69f2b527dac552a42363d
refs/heads/master
2021-09-06T13:58:29.852910
2018-02-05T09:47:48
2018-02-05T09:47:48
111,011,011
1
0
null
2017-11-16T19:06:34
2017-11-16T19:06:34
null
UTF-8
Java
false
false
12,031
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Other licenses: * ----------------------------------------------------------------------------- * Commercial licenses for this work are available. These replace the above * ASL 2.0 and offer limited warranties, support, maintenance, and commercial * database integrations. * * For more information, please visit: http://www.jooq.org/licenses * * * * * * * * * * * * * * * * */ package org.jooq.tools.jdbc; import java.sql.Connection; import java.time.Clock; import java.util.Map; import java.util.concurrent.Executor; import javax.sql.DataSource; import org.jooq.Configuration; import org.jooq.ConnectionProvider; import org.jooq.ConverterProvider; import org.jooq.DSLContext; import org.jooq.DiagnosticsListener; import org.jooq.DiagnosticsListenerProvider; import org.jooq.ExecuteListener; import org.jooq.ExecuteListenerProvider; import org.jooq.ExecutorProvider; import org.jooq.RecordListener; import org.jooq.RecordListenerProvider; import org.jooq.RecordMapper; import org.jooq.RecordMapperProvider; import org.jooq.RecordUnmapper; import org.jooq.RecordUnmapperProvider; import org.jooq.SQLDialect; import org.jooq.TransactionListener; import org.jooq.TransactionListenerProvider; import org.jooq.TransactionProvider; import org.jooq.VisitListener; import org.jooq.VisitListenerProvider; import org.jooq.conf.Settings; /** * A mock configuration. * <p> * This {@link Configuration} wraps a delegate <code>Configuration</code> and * wraps all {@link ConnectionProvider} references in * {@link MockConnectionProvider}. * * @author Lukas Eder */ @SuppressWarnings("deprecation") public class MockConfiguration implements Configuration { /** * Generated UID */ private static final long serialVersionUID = 2600901130544049995L; private final Configuration delegate; private final MockDataProvider provider; public MockConfiguration(Configuration delegate, MockDataProvider provider) { this.delegate = delegate; this.provider = provider; } @Override public DSLContext dsl() { return delegate.dsl(); } @Override public Map<Object, Object> data() { return delegate.data(); } @Override public Object data(Object key) { return delegate.data(key); } @Override public Object data(Object key, Object value) { return delegate.data(key, value); } @Override public Clock clock() { return delegate.clock(); } @Override public ConnectionProvider connectionProvider() { return new MockConnectionProvider(delegate.connectionProvider(), provider); } @Override public ExecutorProvider executorProvider() { return delegate.executorProvider(); } @Override public TransactionProvider transactionProvider() { return delegate.transactionProvider(); } @Override public RecordMapperProvider recordMapperProvider() { return delegate.recordMapperProvider(); } @Override public RecordUnmapperProvider recordUnmapperProvider() { return delegate.recordUnmapperProvider(); } @Override public RecordListenerProvider[] recordListenerProviders() { return delegate.recordListenerProviders(); } @Override public ExecuteListenerProvider[] executeListenerProviders() { return delegate.executeListenerProviders(); } @Override public VisitListenerProvider[] visitListenerProviders() { return delegate.visitListenerProviders(); } @Override public TransactionListenerProvider[] transactionListenerProviders() { return delegate.transactionListenerProviders(); } @Override public DiagnosticsListenerProvider[] diagnosticsListenerProviders() { return delegate.diagnosticsListenerProviders(); } @Override public ConverterProvider converterProvider() { return delegate.converterProvider(); } @Override public org.jooq.SchemaMapping schemaMapping() { return delegate.schemaMapping(); } @Override public SQLDialect dialect() { return delegate.dialect(); } @Override public SQLDialect family() { return delegate.family(); } @Override public Settings settings() { return delegate.settings(); } @Override public Configuration set(Clock newClock) { return delegate.set(newClock); } @Override public Configuration set(ConnectionProvider newConnectionProvider) { return delegate.set(newConnectionProvider); } @Override public Configuration set(Connection newConnection) { return delegate.set(newConnection); } @Override public Configuration set(DataSource newDataSource) { return delegate.set(newDataSource); } @Override public Configuration set(Executor newExecutor) { return delegate.set(newExecutor); } @Override public Configuration set(ExecutorProvider newExecutorProvider) { return delegate.set(newExecutorProvider); } @Override public Configuration set(TransactionProvider newTransactionProvider) { return delegate.set(newTransactionProvider); } @Override public Configuration set(RecordMapper<?, ?> newRecordMapper) { return delegate.set(newRecordMapper); } @Override public Configuration set(RecordMapperProvider newRecordMapperProvider) { return delegate.set(newRecordMapperProvider); } @Override public Configuration set(RecordUnmapper<?, ?> newRecordUnmapper) { return delegate.set(newRecordUnmapper); } @Override public Configuration set(RecordUnmapperProvider newRecordUnmapperProvider) { return delegate.set(newRecordUnmapperProvider); } @Override public Configuration set(RecordListener... newRecordListeners) { return delegate.set(newRecordListeners); } @Override public Configuration set(RecordListenerProvider... newRecordListenerProviders) { return delegate.set(newRecordListenerProviders); } @Override public Configuration set(ExecuteListener... newExecuteListeners) { return delegate.set(newExecuteListeners); } @Override public Configuration set(ExecuteListenerProvider... newExecuteListenerProviders) { return delegate.set(newExecuteListenerProviders); } @Override public Configuration set(VisitListener... newVisitListeners) { return delegate.set(newVisitListeners); } @Override public Configuration set(VisitListenerProvider... newVisitListenerProviders) { return delegate.set(newVisitListenerProviders); } @Override public Configuration set(TransactionListener... newTransactionListeners) { return delegate.set(newTransactionListeners); } @Override public Configuration set(TransactionListenerProvider... newTransactionListenerProviders) { return delegate.set(newTransactionListenerProviders); } @Override public Configuration set(DiagnosticsListener... newDiagnosticsListeners) { return delegate.set(newDiagnosticsListeners); } @Override public Configuration set(DiagnosticsListenerProvider... newDiagnosticsListenerProviders) { return delegate.set(newDiagnosticsListenerProviders); } @Override public Configuration set(ConverterProvider newConverterProvider) { return delegate.set(newConverterProvider); } @Override public Configuration set(SQLDialect newDialect) { return delegate.set(newDialect); } @Override public Configuration set(Settings newSettings) { return delegate.set(newSettings); } @Override public Configuration derive() { return delegate.derive(); } @Override public Configuration derive(Clock newClock) { return delegate.derive(newClock); } @Override public Configuration derive(Connection newConnection) { return delegate.derive(newConnection); } @Override public Configuration derive(DataSource newDataSource) { return delegate.derive(newDataSource); } @Override public Configuration derive(ConnectionProvider newConnectionProvider) { return delegate.derive(newConnectionProvider); } @Override public Configuration derive(Executor newExecutor) { return delegate.derive(newExecutor); } @Override public Configuration derive(ExecutorProvider newExecutorProvider) { return delegate.derive(newExecutorProvider); } @Override public Configuration derive(TransactionProvider newTransactionProvider) { return delegate.derive(newTransactionProvider); } @Override public Configuration derive(RecordMapper<?, ?> newRecordMapper) { return delegate.derive(newRecordMapper); } @Override public Configuration derive(RecordMapperProvider newRecordMapperProvider) { return delegate.derive(newRecordMapperProvider); } @Override public Configuration derive(RecordUnmapper<?, ?> newRecordUnmapper) { return delegate.derive(newRecordUnmapper); } @Override public Configuration derive(RecordUnmapperProvider newRecordUnmapperProvider) { return delegate.derive(newRecordUnmapperProvider); } @Override public Configuration derive(RecordListener... newRecordListeners) { return delegate.derive(newRecordListeners); } @Override public Configuration derive(RecordListenerProvider... newRecordListenerProviders) { return delegate.derive(newRecordListenerProviders); } @Override public Configuration derive(ExecuteListener... newExecuteListeners) { return delegate.derive(newExecuteListeners); } @Override public Configuration derive(ExecuteListenerProvider... newExecuteListenerProviders) { return delegate.derive(newExecuteListenerProviders); } @Override public Configuration derive(VisitListener... newVisitListeners) { return delegate.derive(newVisitListeners); } @Override public Configuration derive(VisitListenerProvider... newVisitListenerProviders) { return delegate.derive(newVisitListenerProviders); } @Override public Configuration derive(TransactionListener... newTransactionListeners) { return delegate.derive(newTransactionListeners); } @Override public Configuration derive(TransactionListenerProvider... newTransactionListenerProviders) { return delegate.derive(newTransactionListenerProviders); } @Override public Configuration derive(DiagnosticsListener... newDiagnosticsListeners) { return delegate.derive(newDiagnosticsListeners); } @Override public Configuration derive(DiagnosticsListenerProvider... newDiagnosticsListenerProviders) { return delegate.derive(newDiagnosticsListenerProviders); } @Override public Configuration derive(ConverterProvider newConverterProvider) { return delegate.derive(newConverterProvider); } @Override public Configuration derive(SQLDialect newDialect) { return delegate.derive(newDialect); } @Override public Configuration derive(Settings newSettings) { return delegate.derive(newSettings); } }
[ "lukas.eder@gmail.com" ]
lukas.eder@gmail.com
b3228a41498de8ff26c5ced2f104b6af8ec6e0d5
db167181ff25b5894676b77a2fa126b7fd04b193
/core/src/com/klocek/lowrez/Pause.java
8ec6f63d153e07935dfd2c3a261a22870cb26ab8
[ "MIT" ]
permissive
kklocek/PixelBeerFever
0cbde299ef100964d41654bac5f110944a7b4d09
d5f2d40eb7ad72bddde42ac9e8983c70a36d1b3b
refs/heads/master
2021-01-12T02:27:54.967639
2017-01-07T15:35:04
2017-01-07T15:35:04
77,959,660
1
1
null
null
null
null
UTF-8
Java
false
false
1,838
java
package com.klocek.lowrez; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.utils.Disposable; /** * Created by Konrad on 2016-05-01. */ public class Pause implements Disposable { private Texture buttonTexture; private Texture pausedTexture; private Game gameManager; private SpriteBatch batch; private Camera camera; private Vector3 input; private boolean isPaused = false; public Pause(Game gameManager) { this.gameManager = gameManager; batch = gameManager.getBatch(); camera = gameManager.getCamera(); buttonTexture = new Texture(Gdx.files.internal("pause.png")); pausedTexture = new Texture(Gdx.files.internal("paused.png")); input = new Vector3(); } public void update(float delta) { if (isPaused) batch.draw(pausedTexture, 160, 236 + 128); batch.draw(buttonTexture, 8, GameConstants.HEIGHT - 8 - buttonTexture.getHeight()); if (Gdx.input.justTouched()) { input.set(Gdx.input.getX(), Gdx.input.getY(), 0); input = camera.unproject(input); if (input.x >= 8 && input.x <= 8 + buttonTexture.getWidth() && input.y <= GameConstants.HEIGHT && input.y >= GameConstants.HEIGHT - buttonTexture.getHeight()) { isPaused = !isPaused; } } } public boolean isPaused() { return isPaused; } public void setPaused(boolean paused) { isPaused = paused; } @Override public void dispose() { buttonTexture.dispose(); pausedTexture.dispose(); } }
[ "xqwzts251@gmail.com" ]
xqwzts251@gmail.com
abf0eaffdd671ca8ea9af815a20f9db20bc12ae5
729667ce2a218bd8ef3ff0ed80b915aac6e6da74
/app/src/main/java/sk/berops/android/vehiculum/gui/toll/ActivityTollAdd.java
185d3d86ee5f385824b76030be26a4f4e1cf9235
[]
no_license
gazoo4/vehiculum
96019fe5922567b82e909496ce951ab49a806ada
08e23d92ca1cae2ef3560963f0653ccf53ae4447
refs/heads/master
2021-09-13T08:59:47.276971
2017-04-18T08:21:29
2017-04-18T08:21:29
19,882,173
1
0
null
null
null
null
UTF-8
Java
false
false
2,201
java
package sk.berops.android.vehiculum.gui.toll; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import sk.berops.android.vehiculum.R; import sk.berops.android.vehiculum.dataModel.expense.FieldEmptyException; import sk.berops.android.vehiculum.dataModel.expense.TollEntry; import sk.berops.android.vehiculum.gui.MainActivity; import sk.berops.android.vehiculum.gui.common.ActivityEntryGenericAdd; public class ActivityTollAdd extends ActivityEntryGenericAdd { protected Spinner spinnerTollType; protected TollEntry tollEntry; @Override protected void onCreate(Bundle savedInstanceState) { if (tollEntry == null) { tollEntry = new TollEntry(); } entry = tollEntry; super.onCreate(savedInstanceState); } @Override protected void loadLayout() { setContentView(R.layout.activity_toll); } @Override protected void attachGuiObjects() { super.attachGuiObjects(); textViewDistanceUnit = (TextView) findViewById(R.id.activity_toll_distance_unit); editTextMileage = (EditText) findViewById(R.id.activity_toll_mileage); editTextCost = (EditText) findViewById(R.id.activity_toll_cost); editTextComment = (EditText) findViewById(R.id.activity_toll_comment); spinnerCurrency = (Spinner) findViewById(R.id.activity_toll_currency); spinnerTollType = (Spinner) findViewById(R.id.activity_toll_type); listEditTexts.add(editTextMileage); listEditTexts.add(editTextCost); listEditTexts.add(editTextComment); mapSpinners.put(R.array.activity_expense_add_currency, spinnerCurrency); mapSpinners.put(R.array.activity_toll_type, spinnerTollType); } @Override protected void updateFields() throws FieldEmptyException { super.updateFields(); updateType(); } private void updateType() { TollEntry.Type type; type = TollEntry.Type.getType(spinnerTollType.getSelectedItemPosition()); tollEntry.setType(type); } @Override public boolean onClick(View view) { if (super.onClick(view)) { startActivity(new Intent(this, MainActivity.class)); return true; } return false; } }
[ "bernard.halas@gmail.com" ]
bernard.halas@gmail.com
e9e2d98d0c1baf8924512ee8f55dc90c62e834f6
2a5454697b4bb7fc137e191a7e3f27c86e43405e
/app/src/androidTest/java/com/example/kimhun/practice/ExampleInstrumentedTest.java
7bfe838f0dc36bbcfc2aed117955128768818952
[]
no_license
hihi5345/Practice
082268f8e4ba4dcb0827676d625051add1ca9fbf
daef51fbba0bb53d3a64d6d20bf033d57c8a7387
refs/heads/master
2020-12-02T11:19:54.440703
2017-07-17T04:55:32
2017-07-17T04:55:32
96,629,145
0
1
null
2017-07-17T04:55:32
2017-07-08T16:00:23
Java
UTF-8
Java
false
false
758
java
package com.example.kimhun.practice; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.kimhun.practice", appContext.getPackageName()); } }
[ "hihi5345@naver.com" ]
hihi5345@naver.com
d50433bf1f3c3991d2ab8c78e07a9e77c60e8ae1
d280a2d40061513f62916a631f48956b3465c516
/src/main/java/org/jim/java8/IDefaultMethod.java
0947435502579083a9f167d96894442e134a0227
[ "Apache-2.0" ]
permissive
jinshunjing/java-test
9c33e0181e41426274c4621453d83fca096d7ae1
b23419e1f80a31eb8baa8517f754b28e44d98238
refs/heads/master
2020-04-18T16:55:30.069144
2020-03-05T13:58:05
2020-03-05T13:58:05
167,643,504
0
0
null
null
null
null
UTF-8
Java
false
false
217
java
package org.jim.java8; /** * Java 8 ๅผ•ๅ…ฅไบ†ๆŽฅๅฃ็š„้ป˜่ฎคๆ–นๆณ• * * @author JSJ */ public interface IDefaultMethod { double calc(double v); default String version() { return "1.0.0"; } }
[ "jim@jimdeMacBook-Pro.local" ]
jim@jimdeMacBook-Pro.local
1605a33e2eb1e1af51d884c686ac0fb0434879d7
9f7f68bee08d17acb837dde717e70ebb2c336fc8
/core/core-tool/src/main/java/com/chinasofti/core/tool/support/upload/FileNameLengthLimitExceededException.java
0bff3e317adb93f5bf558a7f2d23aea22e571db1
[]
no_license
630173235/TestingTool
fd1f3a98d9bce614634b000d8f0a0f0eafdb3fa8
c709f3ff9470d9a5b51962dd86fde405c47f3bca
refs/heads/master
2023-04-09T03:37:29.362430
2021-04-13T06:16:05
2021-04-13T06:16:05
357,159,490
2
1
null
null
null
null
UTF-8
Java
false
false
438
java
package com.chinasofti.core.tool.support.upload; import com.chinasofti.core.tool.api.IResultCode; /** * ๆ–‡ไปถๅ็งฐ่ถ…้•ฟ้™ๅˆถๅผ‚ๅธธ็ฑป * * */ public class FileNameLengthLimitExceededException extends FileException { public FileNameLengthLimitExceededException(int defaultFileNameLength) { super("upload.filename.exceed.length : " + defaultFileNameLength ); } private static final long serialVersionUID = 1L; }
[ "630173235@qq.com" ]
630173235@qq.com
68ce652008e4a6023a01d1fe56ed1a4500c469c0
4b79bafe19ffbb89a154ddadd1fd7d2f2efebef1
/CloudXplor_Server/src/main/java/com/clxpr/demo/model/threadmodel/PriorityAndStateThread.java
4cbf0e0cf142d1f7761d27ac430b56eb3a3e73a5
[]
no_license
furrukhkhan1998/CloudXplor
7647035730ec7a0d7d3465e23bbbe603caf42f3c
01a9ee99834b41887d301419ed3438eb3e8d99fa
refs/heads/master
2023-08-11T23:31:19.921273
2021-09-18T23:51:33
2021-09-18T23:51:33
407,969,065
0
0
null
null
null
null
UTF-8
Java
false
false
622
java
package com.clxpr.demo.model.threadmodel; import java.util.ArrayList; public class PriorityAndStateThread { private ArrayList <String> id; private ArrayList <String> state; private ArrayList <String> priority; public ArrayList<String> getId() { return id; } public void setId(ArrayList<String> id) { this.id = id; } public ArrayList<String> getState() { return state; } public void setState(ArrayList<String> state) { this.state = state; } public ArrayList<String> getPriority() { return priority; } public void setPriority(ArrayList<String> priority) { this.priority = priority; } }
[ "furrukhkhan10@gmail.com" ]
furrukhkhan10@gmail.com
2efe1a94a9e638d78eb3dbe422cb0925a8746a43
0f7b94114a9b978748eea90fbde3eb2f576fa237
/complete/src/data_struct/in_class/d11_13/Triangle.java
780b6c6b73b7cd8dc58f76e09baec89d70170833
[ "MIT" ]
permissive
pegurnee/2013-03-211
5738dd015e8849ea8ba3f186081e3fdc6888e09b
90da5f58a83ceca9cbf6b7b7907517372f3cffff
refs/heads/master
2021-01-15T10:18:09.649693
2015-07-05T17:25:42
2015-07-05T17:25:42
15,784,812
2
0
null
null
null
null
UTF-8
Java
false
false
513
java
package data_struct.in_class.d11_13; public class Triangle { private int width; public Triangle (int awidth) { width = awidth; } public int getAreaIter() { int area = 0; if (width <= 0) return 0; for (int i=1; i<=width; i++) area += i; return area; } /** * Extra Credit +3 points * Write a recursive method to calculate the area of the triangle */ // public int getAreaRec() { //Base cases: width <= 0 or width = 1 //width > 1: area of smaller triangle + width } }
[ "pegurnee@gmail.com" ]
pegurnee@gmail.com
921fd0a6904493386c33d9ce2b8c251062c74de2
6439559ea0920c0ef129dc2bf949fa4cbdf076d8
/src/com/company/Porsche.java
f460dbdb3d47f3a68c5bcd794402357716b8d3e6
[]
no_license
Renchiiks/PolymorphismCar
d60f31134d127ecc33090d3f3406a7b9c1b78a5d
a0f8c056a81f15cf81000248dea30cc762ed4443
refs/heads/master
2022-12-11T11:12:22.841712
2020-08-25T10:59:27
2020-08-25T10:59:27
290,190,565
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
package com.company; public class Porsche extends Car { public Porsche() { super("Porsche", true, 8, 2, "red"); } @Override public String startEngine() { return "Porsche engine is running"; } @Override public String accelerate(int speed) { return "Porsche is driving at: " + speed + " at 60 seconds"; } @Override public String brake() { return "I am in the front window"; } }
[ "Renchiiks" ]
Renchiiks
5e628ca17fd7bed3fdcf84af4daae4991b2e1fb8
e977c424543422f49a25695665eb85bfc0700784
/benchmark/icse15/432705/buggy-version/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java
f6a1bf6ddec0524e13bca7ffe77d34dcbcfaf769
[]
no_license
amir9979/pattern-detector-experiment
17fcb8934cef379fb96002450d11fac62e002dd3
db67691e536e1550245e76d7d1c8dced181df496
refs/heads/master
2022-02-18T10:24:32.235975
2019-09-13T15:42:55
2019-09-13T15:42:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
135,438
java
/* Derby - Class org.apache.derby.client.net.NetConnectionReply 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 org.apache.derby.client.net; import javax.transaction.xa.Xid; import org.apache.derby.client.am.Connection; import org.apache.derby.client.am.ConnectionCallbackInterface; import org.apache.derby.client.am.StatementCallbackInterface; import org.apache.derby.client.am.ResultSetCallbackInterface; import org.apache.derby.client.am.DisconnectException; import org.apache.derby.client.am.SqlException; import org.apache.derby.client.am.ClientMessageId; import org.apache.derby.client.am.Sqlca; import java.io.UnsupportedEncodingException; import org.apache.derby.client.am.UnitOfWorkListener; import org.apache.derby.shared.common.error.ExceptionSeverity; import org.apache.derby.shared.common.error.ExceptionUtil; import org.apache.derby.shared.common.reference.SQLState; import org.apache.derby.shared.common.reference.MessageId; import org.apache.derby.shared.common.i18n.MessageUtil; public class NetConnectionReply extends Reply implements ConnectionReplyInterface { private static MessageUtil msgutil_ = SqlException.getMessageUtil(); NetConnectionReply(NetAgent netAgent, int bufferSize) { super(netAgent, bufferSize); } // NET only entry point void readExchangeServerAttributes(Connection connection) throws SqlException { startSameIdChainParse(); parseEXCSATreply((NetConnection) connection); endOfSameIdChainData(); agent_.checkForChainBreakingException_(); } void verifyDeferredReset() throws SqlException { readDssHeader(); verifyConnectReply(CodePoint.EXCSATRD); readDssHeader(); verifyConnectReply(CodePoint.ACCSECRD); readDssHeader(); verifyConnectReply(CodePoint.SECCHKRM); readDssHeader(); verifyConnectReply(CodePoint.ACCRDBRM); agent_.checkForChainBreakingException_(); } void verifyConnectReply(int codept) throws SqlException { if (peekCodePoint() != codept) { parseConnectError(); return; } readLengthAndCodePoint(); skipBytes(); if (codept == CodePoint.ACCRDBRM) { int peekCP = peekCodePoint(); if (peekCP == Reply.END_OF_SAME_ID_CHAIN) { return; } parseTypdefsOrMgrlvlovrs(); NetSqlca netSqlca = parseSQLCARD(null); netAgent_.netConnection_.completeSqlca(netSqlca); } } void parseConnectError() throws DisconnectException { int peekCP = peekCodePoint(); switch (peekCP) { case CodePoint.CMDCHKRM: parseCMDCHKRM(); break; case CodePoint.MGRLVLRM: parseMGRLVLRM(); break; default: parseCommonError(peekCP); } } void readDummyExchangeServerAttributes(Connection connection) throws SqlException { startSameIdChainParse(); parseDummyEXCSATreply((NetConnection) connection); endOfSameIdChainData(); agent_.checkForChainBreakingException_(); } // NET only entry point void readAccessSecurity(Connection connection, int securityMechanism) throws SqlException { startSameIdChainParse(); parseACCSECreply((NetConnection) connection, securityMechanism); endOfSameIdChainData(); agent_.checkForChainBreakingException_(); } // NET only entry point void readSecurityCheck(Connection connection) throws SqlException { startSameIdChainParse(); parseSECCHKreply((NetConnection) connection); endOfSameIdChainData(); agent_.checkForChainBreakingException_(); } // NET only entry point void readAccessDatabase(Connection connection) throws SqlException { startSameIdChainParse(); parseACCRDBreply((NetConnection) connection); endOfSameIdChainData(); agent_.checkForChainBreakingException_(); } public void readCommitSubstitute(ConnectionCallbackInterface connection) throws DisconnectException { startSameIdChainParse(); parseDummyEXCSATreply((NetConnection) connection); endOfSameIdChainData(); } public void readLocalCommit(ConnectionCallbackInterface connection) throws DisconnectException { startSameIdChainParse(); parseRDBCMMreply(connection); endOfSameIdChainData(); } public void readLocalRollback(ConnectionCallbackInterface connection) throws DisconnectException { startSameIdChainParse(); parseRDBRLLBCKreply(connection); endOfSameIdChainData(); } public void readLocalXAStart(ConnectionCallbackInterface connection) throws DisconnectException { } public void readLocalXACommit(ConnectionCallbackInterface connection) throws DisconnectException { } public void readLocalXARollback(ConnectionCallbackInterface connection) throws DisconnectException { } protected void readXaStartUnitOfWork(NetConnection conn) throws DisconnectException { } protected int readXaEndUnitOfWork(NetConnection conn) throws DisconnectException { return 0; } protected int readXaPrepare(NetConnection conn) throws DisconnectException { return 0; } protected void readXaCommit(NetConnection conn) throws DisconnectException { } protected int readXaRollback(NetConnection conn) throws DisconnectException { return 0; } protected void readXaRecover(NetConnection conn) throws DisconnectException { } protected void readXaForget(NetConnection conn) throws DisconnectException { } //------------------parse reply for specific command-------------------------- // These methods are "private protected", which is not a recognized java privilege, // but means that these methods are private to this class and to subclasses, // and should not be used as package-wide friendly methods. // Parse the reply for the RDB Commit Unit of Work Command. // This method handles the parsing of all command replies and reply data // for the rdbcmm command. private void parseRDBCMMreply(ConnectionCallbackInterface connection) throws DisconnectException { int peekCP = parseTypdefsOrMgrlvlovrs(); if (peekCP != CodePoint.ENDUOWRM && peekCP != CodePoint.SQLCARD) { parseCommitError(connection); return; } if (peekCP == CodePoint.ENDUOWRM) { parseENDUOWRM(connection); peekCP = parseTypdefsOrMgrlvlovrs(); } NetSqlca netSqlca = parseSQLCARD(null); connection.completeSqlca(netSqlca); } // Parse the reply for the RDB Rollback Unit of Work Command. // This method handles the parsing of all command replies and reply data // for the rdbrllbck command. private void parseRDBRLLBCKreply(ConnectionCallbackInterface connection) throws DisconnectException { int peekCP = parseTypdefsOrMgrlvlovrs(); if (peekCP != CodePoint.ENDUOWRM) { parseRollbackError(); return; } parseENDUOWRM(connection); peekCP = parseTypdefsOrMgrlvlovrs(); NetSqlca netSqlca = parseSQLCARD(null); connection.completeSqlca(netSqlca); } // Parse the reply for the Exchange Server Attributes Command. // This method handles the parsing of all command replies and reply data // for the excsat command. private void parseEXCSATreply(NetConnection netConnection) throws DisconnectException { if (peekCodePoint() != CodePoint.EXCSATRD) { parseExchangeServerAttributesError(); return; } parseEXCSATRD(netConnection); } // Parse the reply for the Exchange Server Attributes Command (Dummy) // This method handles the parsing of all command replies and reply data // for the excsat command. private void parseDummyEXCSATreply(NetConnection netConnection) throws DisconnectException { if (peekCodePoint() != CodePoint.EXCSATRD) { parseExchangeServerAttributesError(); return; } parseDummyEXCSATRD(netConnection); } // Parse the reply for the Access Security Command. // This method handles the parsing of all command replies and reply data // for the accsec command. private void parseACCSECreply(NetConnection netConnection, int securityMechanism) throws DisconnectException { int peekCP = peekCodePoint(); if (peekCP != CodePoint.ACCSECRD) { parseAccessSecurityError(netConnection); return; } parseACCSECRD(netConnection, securityMechanism); peekCP = peekCodePoint(); if (peekCP == Reply.END_OF_SAME_ID_CHAIN) { return; } } // Parse the reply for the Security Check Command. // This method handles the parsing of all command replies and reply data // for the secchk command. private void parseSECCHKreply(NetConnection netConnection) throws DisconnectException { if (peekCodePoint() != CodePoint.SECCHKRM) { parseSecurityCheckError(netConnection); return; } parseSECCHKRM(netConnection); if (peekCodePoint() == CodePoint.SECTKN) { // rpydta used only if the security mechanism returns // a security token that must be sent back to the source system. // this is only used for DCSSEC. In the case of DCESEC, // the sectkn must be returned as reply data if DCE is using // mutual authentication. // Need to double check what to map this to. This is probably // incorrect but consider it a conversation protocol error // 0x03 - OBJDSS sent when not allowed. //parseSECTKN (true); boolean done = false; byte[] bytes = parseSECTKN(false); } } // Parse the reply for the Access RDB Command. // This method handles the parsing of all command replies and reply data // for the accrdb command. private void parseACCRDBreply(NetConnection netConnection) throws DisconnectException { int peekCP = peekCodePoint(); if (peekCP != CodePoint.ACCRDBRM) { parseAccessRdbError(netConnection); return; } parseACCRDBRM(netConnection); peekCP = peekCodePoint(); if (peekCP == Reply.END_OF_SAME_ID_CHAIN) { return; } parseTypdefsOrMgrlvlovrs(); NetSqlca netSqlca = parseSQLCARD(null); netConnection.completeSqlca(netSqlca); } protected int parseTypdefsOrMgrlvlovrs() throws DisconnectException { boolean targetTypedefCloned = false; while (true) { int peekCP = peekCodePoint(); if (peekCP == CodePoint.TYPDEFNAM) { if (!targetTypedefCloned) { netAgent_.targetTypdef_ = (Typdef) netAgent_.targetTypdef_.clone(); targetTypedefCloned = true; } parseTYPDEFNAM(); } else if (peekCP == CodePoint.TYPDEFOVR) { if (!targetTypedefCloned) { netAgent_.targetTypdef_ = (Typdef) netAgent_.targetTypdef_.clone(); targetTypedefCloned = true; } parseTYPDEFOVR(); } else { return peekCP; } } } //-----------------------------parse DDM Reply Messages----------------------- protected void parseCommitError(ConnectionCallbackInterface connection) throws DisconnectException { int peekCP = peekCodePoint(); switch (peekCP) { case CodePoint.ABNUOWRM: NetSqlca sqlca = parseAbnormalEndUow(connection,null); connection.completeSqlca(sqlca); break; case CodePoint.CMDCHKRM: parseCMDCHKRM(); break; case CodePoint.RDBNACRM: parseRDBNACRM(); break; default: parseCommonError(peekCP); break; } } void parseRollbackError() throws DisconnectException { int peekCP = peekCodePoint(); switch (peekCP) { case CodePoint.CMDCHKRM: parseCMDCHKRM(); break; case CodePoint.RDBNACRM: parseRDBNACRM(); break; default: parseCommonError(peekCP); break; } } void parseExchangeServerAttributesError() throws DisconnectException { int peekCP = peekCodePoint(); switch (peekCP) { case CodePoint.CMDCHKRM: parseCMDCHKRM(); break; case CodePoint.MGRLVLRM: parseMGRLVLRM(); break; default: parseCommonError(peekCP); } } void parseAccessSecurityError(NetConnection netConnection) throws DisconnectException { int peekCP = peekCodePoint(); switch (peekCP) { case CodePoint.CMDCHKRM: parseCMDCHKRM(); break; case CodePoint.RDBNFNRM: parseRDBNFNRM(netConnection); break; case CodePoint.RDBAFLRM: parseRdbAccessFailed(netConnection); break; default: parseCommonError(peekCP); } } void parseSecurityCheckError(NetConnection netConnection) throws DisconnectException { int peekCP = peekCodePoint(); switch (peekCP) { case CodePoint.CMDCHKRM: parseCMDCHKRM(); break; case CodePoint.OBJNSPRM: parseOBJNSPRM(); break; case CodePoint.RDBNFNRM: parseRDBNFNRM(netConnection); break; case CodePoint.RDBAFLRM: parseRdbAccessFailed(netConnection); break; default: parseCommonError(peekCP); } } void parseAccessRdbError(NetConnection netConnection) throws DisconnectException { int peekCP = peekCodePoint(); switch (peekCP) { case CodePoint.CMDCHKRM: parseCMDCHKRM(); break; case CodePoint.RDBACCRM: parseRDBACCRM(); break; case CodePoint.RDBAFLRM: parseRdbAccessFailed(netConnection); break; case CodePoint.RDBATHRM: parseRDBATHRM(netConnection); break; case CodePoint.RDBNFNRM: parseRDBNFNRM(netConnection); break; default: parseCommonError(peekCP); } } // Called by all the NET*Reply classes. void parseCommonError(int peekCP) throws DisconnectException { switch (peekCP) { case CodePoint.CMDNSPRM: parseCMDNSPRM(); break; case CodePoint.PRCCNVRM: parsePRCCNVRM(); break; case CodePoint.SYNTAXRM: parseSYNTAXRM(); break; case CodePoint.VALNSPRM: parseVALNSPRM(); break; default: doObjnsprmSemantics(peekCP); } } /** * Perform necessary actions for parsing of a ABNUOWRM message. * * @param connection an implementation of the ConnectionCallbackInterface * * @return an NetSqlca object obtained from parsing the ABNUOWRM * @throws DisconnectException * */ NetSqlca parseAbnormalEndUow(ConnectionCallbackInterface connection,UnitOfWorkListener uwl) throws DisconnectException { parseABNUOWRM(); if (peekCodePoint() != CodePoint.SQLCARD) { parseTypdefsOrMgrlvlovrs(); } NetSqlca netSqlca = parseSQLCARD(null); if(ExceptionUtil.getSeverityFromIdentifier(netSqlca.getSqlState()) > ExceptionSeverity.STATEMENT_SEVERITY || uwl == null) connection.completeAbnormalUnitOfWork(); else connection.completeAbnormalUnitOfWork(uwl); return netSqlca; } /** * Perform necessary actions for parsing of a ABNUOWRM message. * * @param connection an implementation of the StatementCallbackInterface * * @return an NetSqlca object obtained from parsing the ABNUOWRM * @throws DisconnectException * */ NetSqlca parseAbnormalEndUow(StatementCallbackInterface s) throws DisconnectException { return parseAbnormalEndUow(s.getConnectionCallbackInterface(),s); } /** * Perform necessary actions for parsing of a ABNUOWRM message. * * @param connection an implementation of the ResultsetCallbackInterface * * @return an NetSqlca object obtained from parsing the ABNUOWRM * @throws DisconnectException * */ NetSqlca parseAbnormalEndUow(ResultSetCallbackInterface r) throws DisconnectException { return parseAbnormalEndUow(r.getConnectionCallbackInterface(),r); } void parseRdbAccessFailed(NetConnection netConnection) throws DisconnectException { parseRDBAFLRM(); // an SQLCARD is returned if an RDBALFRM is returned. // this SQLCARD always follows the RDBALFRM. // TYPDEFNAM and TYPDEFOVR are MTLINC if (peekCodePoint() == CodePoint.TYPDEFNAM) { parseTYPDEFNAM(); parseTYPDEFOVR(); } else { parseTYPDEFOVR(); parseTYPDEFNAM(); } NetSqlca netSqlca = parseSQLCARD(null); //Check if the SQLCARD has null SQLException if(netSqlca.getSqlErrmc() == null) netConnection.setConnectionNull(true); else netConnection.completeSqlca(netSqlca); } // The Security Check (SECCHKRM) Reply Message indicates the acceptability // of the security information. // this method returns the security check code. it is up to the caller to check // the value of this return code and take the appropriate action. // // Returned from Server: // SVRCOD - required (0 - INFO, 8 - ERROR, 16 -SEVERE) // SECCHKCD - required // SECTKN - optional, ignorable // SVCERRNO - optional private void parseSECCHKRM(NetConnection netConnection) throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean secchkcdReceived = false; int secchkcd = CodePoint.SECCHKCD_00; boolean sectknReceived = false; byte[] sectkn = null; parseLengthAndMatchCodePoint(CodePoint.SECCHKRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { // severity code. it's value is dictated by the SECCHKCD. // right now it will not be checked that it is the correct value // for the SECCHKCD. maybe this will be done in the future. foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_INFO, CodePoint.SVRCOD_SEVERE); peekCP = peekCodePoint(); } if (peekCP == CodePoint.SECCHKCD) { // security check code. this specifies the state of the security information. // there is a relationship between this value and the SVRCOD value. // right now this driver will not check these values against each other. foundInPass = true; secchkcdReceived = checkAndGetReceivedFlag(secchkcdReceived); secchkcd = parseSECCHKCD(); peekCP = peekCodePoint(); } if (peekCP == CodePoint.SECTKN) { // security token. // used when mutual authentication of the source and target servers // is requested. The architecture lists this as an instance variable // and also says that the SECTKN flows as reply data to the secchk cmd and // it must flow after the secchkrm message. Right now this driver doesn't // support ay mutual authentication so it will be ignored (it is listed // as an ignorable instance variable in the ddm manual). foundInPass = true; sectknReceived = checkAndGetReceivedFlag(sectknReceived); sectkn = parseSECTKN(true); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); // check for the required instance variables. checkRequiredObjects(svrcodReceived, secchkcdReceived); netConnection.securityCheckComplete(svrcod, secchkcd); } // Access to RDB Completed (ACRDBRM) Reply Message specifies that an // instance of the SQL application manager has been created and is bound // to the specified relation database (RDB). // // Returned from Server: // SVRCOD - required (0 - INFO, 4 - WARNING) // PRDID - required // TYPDEFNAM - required (MINLVL 4) (QTDSQLJVM) // TYPDEFOVR - required // RDBINTTKN - optional // CRRTKN - optional // USRID - optional // SRVLST - optional (MINLVL 5) private void parseACCRDBRM(NetConnection netConnection) throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean prdidReceived = false; String prdid = null; boolean typdefnamReceived = false; boolean typdefovrReceived = false; boolean rdbinttknReceived = false; boolean crrtknReceived = false; byte[] crrtkn = null; boolean usridReceived = false; String usrid = null; parseLengthAndMatchCodePoint(CodePoint.ACCRDBRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { // severity code. If the target SQLAM cannot support the typdefovr // parameter values specified for the double-byte and mixed-byte CCSIDs // on the corresponding ACCRDB command, then the severity code WARNING // is specified on the ACCRDBRM. foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_INFO, CodePoint.SVRCOD_WARNING); peekCP = peekCodePoint(); } // this is the product release level of the target RDB server. if (peekCP == CodePoint.PRDID) { foundInPass = true; prdidReceived = checkAndGetReceivedFlag(prdidReceived); prdid = parsePRDID(false); // false means do not skip the bytes peekCP = peekCodePoint(); } if (peekCP == CodePoint.TYPDEFNAM) { // this is the name of the data type to the data representation mapping // definitions tha the target SQLAM uses when sending reply data objects. foundInPass = true; typdefnamReceived = checkAndGetReceivedFlag(typdefnamReceived); parseTYPDEFNAM(); peekCP = peekCodePoint(); } if (peekCP == CodePoint.TYPDEFOVR) { // this is the single-byte, double-byte, and mixed-byte CCSIDs of the // scalar data arrays (SDA) in the identified data type to data representation // mapping definitions. foundInPass = true; typdefovrReceived = checkAndGetReceivedFlag(typdefovrReceived); parseTYPDEFOVR(); peekCP = peekCodePoint(); } if (peekCP == CodePoint.USRID) { // specifies the target defined user ID. It is returned if the value of // TRGDFTRT is TRUE in ACCRDB. Right now this driver always sets this // value to false so this should never get returned here. // if it is returned, it could be considered an error but for now // this driver will just skip the bytes. foundInPass = true; usridReceived = checkAndGetReceivedFlag(usridReceived); usrid = parseUSRID(true); peekCP = peekCodePoint(); } if (peekCP == CodePoint.CRRTKN) { // carries information to correlate with the work being done on bahalf // of an application at the source and at the target server. // defualt value is ''. // this parameter is only retunred if an only if the CRRTKN parameter // is not received on ACCRDB. We will rely on server to send us this // in ACCRDBRM foundInPass = true; crrtknReceived = checkAndGetReceivedFlag(crrtknReceived); crrtkn = parseCRRTKN(false); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); // check for the required instance variables. checkRequiredObjects(svrcodReceived, prdidReceived, typdefnamReceived, typdefovrReceived); netConnection.rdbAccessed(svrcod, prdid, crrtknReceived, crrtkn); } // The End Unit of Work Condition (ENDUOWRM) Reply Mesage specifies // that the unit of work has ended as a result of the last command. // // Returned from Server: // SVRCOD - required (4 WARNING) // UOWDSP - required // RDBNAM - optional void parseENDUOWRM(ConnectionCallbackInterface connection) throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean uowdspReceived = false; int uowdsp = 0; boolean rdbnamReceived = false; String rdbnam = null; parseLengthAndMatchCodePoint(CodePoint.ENDUOWRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_WARNING, CodePoint.SVRCOD_WARNING); peekCP = peekCodePoint(); } if (peekCP == CodePoint.UOWDSP) { foundInPass = true; uowdspReceived = checkAndGetReceivedFlag(uowdspReceived); uowdsp = parseUOWDSP(); peekCP = peekCodePoint(); } if (peekCP == CodePoint.RDBNAM) { foundInPass = true; rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); rdbnam = parseRDBNAM(true); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived, uowdspReceived); netAgent_.setSvrcod(svrcod); if (uowdsp == CodePoint.UOWDSP_COMMIT) { connection.completeLocalCommit(); } else { connection.completeLocalRollback(); } } // Command Check Reply Message indicates that the requested // command encountered an unarchitected and implementation-specific // condition for which there is no architected message. If the severity // code value is ERROR or greater, the command has failed. The // message can be accompanied by other messages that help to identify // the specific condition. // The CMDCHKRM should not be used as a general catch-all in place of // product-defined messages when using product extensions to DDM. // PROTOCOL architects the SQLSTATE value depending on SVRCOD // SVRCOD 0 -> SQLSTATE is not returned // SVRCOD 8 -> SQLSTATE of 58008 or 58009 // SVRCOD 16,32,64,128 -> SQLSTATE of 58009 // // Messages // SQLSTATE : 58009 // Execution failed due to a distribution protocol error that caused deallocation of the conversation. // SQLCODE : -30020 // Execution failed because of a Distributed Protocol // Error that will affect the successful execution of subsequent // commands and SQL statements: Reason Code <reason-code>. // Some possible reason codes include: // 121C Indicates that the user is not authorized to perform the requested command. // 1232 The command could not be completed because of a permanent error. // In most cases, the server will be in the process of an abend. // 220A The target server has received an invalid data description. // If a user SQLDA is specified, ensure that the fields are // initialized correctly. Also, ensure that the length does not // exceed the maximum allowed length for the data type being used. // // The command or statement cannot be processed. The current // transaction is rolled back and the application is disconnected // from the remote database. // // // Returned from Server: // SVRCOD - required (0 - INFO, 4 - WARNING, 8 - ERROR, 16 - SEVERE, // 32 - ACCDMG, 64 - PRMDMG, 128 - SESDMG)) // RDBNAM - optional (MINLVL 3) // RECCNT - optional (MINVAL 0, MINLVL 3) // // Called by all the Reply classesCMDCHKRM protected void parseCMDCHKRM() throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean rdbnamReceived = false; String rdbnam = null; parseLengthAndMatchCodePoint(CodePoint.CMDCHKRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_INFO, CodePoint.SVRCOD_SESDMG); peekCP = peekCodePoint(); } if (peekCP == CodePoint.RDBNAM) { foundInPass = true; rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); rdbnam = parseRDBNAM(true); peekCP = peekCodePoint(); } // skip over the RECCNT since it can't be found in the DDM book. if (peekCP == 0x115C) { foundInPass = true; parseLengthAndMatchCodePoint(0x115C); skipBytes(); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived); netAgent_.setSvrcod(svrcod); agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED), msgutil_.getTextMessage(MessageId.CONN_DRDA_CMDCHKRM))); } // RDB Not Accessed Reply Message indicates that the access relational // database command (ACCRDB) was not issued prior to a command // requesting the RDB Services. // PROTOCOL Architects an SQLSTATE of 58008 or 58009. // // Messages // SQLSTATE : 58009 // Execution failed due to a distribution protocol error that caused deallocation of the conversation. // SQLCODE : -30020 // Execution failed because of a Distributed Protocol // Error that will affect the successful execution of subsequent // commands and SQL statements: Reason Code <reason-code>. // Some possible reason codes include: // 121C Indicates that the user is not authorized to perform the requested command. // 1232 The command could not be completed because of a permanent error. // In most cases, the server will be in the process of an abend. // 220A The target server has received an invalid data description. // If a user SQLDA is specified, ensure that the fields are // initialized correctly. Also, ensure that the length does not // exceed the maximum allowed length for the data type being used. // // The command or statement cannot be processed. The current // transaction is rolled back and the application is disconnected // from the remote database. // // // Returned from Server: // SVRCOD - required (8 - ERROR) // RDBNAM - required // // Called by all the NET*Reply classes. void parseRDBNACRM() throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean rdbnamReceived = false; String rdbnam = null; parseLengthAndMatchCodePoint(CodePoint.RDBNACRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); peekCP = peekCodePoint(); } if (peekCP == CodePoint.RDBNAM) { foundInPass = true; rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); rdbnam = parseRDBNAM(true); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived, rdbnamReceived); netAgent_.setSvrcod(svrcod); agent_.accumulateChainBreakingReadExceptionAndThrow( new DisconnectException(agent_, new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED), msgutil_.getTextMessage(MessageId.CONN_DRDA_RDBNACRM))); } // RDB Not Found Reply Message indicates that the target // server cannot find the specified relational database. // PROTOCOL architects an SQLSTATE of 08004. // // Messages // SQLSTATE : 8004 // The application server rejected establishment of the connection. // SQLCODE : -30061 // The database alias or database name <name> was not found at the remote node. // The statement cannot be processed. // // // Returned from Server: // SVRCOD - required (8 - ERROR) // RDBNAM - required // private void parseRDBNFNRM(NetConnection netConnection) throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean rdbnamReceived = false; String rdbnam = null; parseLengthAndMatchCodePoint(CodePoint.RDBNFNRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); peekCP = peekCodePoint(); } if (peekCP == CodePoint.RDBNAM) { foundInPass = true; rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); rdbnam = parseRDBNAM(true); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived, rdbnamReceived); netAgent_.setSvrcod(svrcod); agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, new ClientMessageId(SQLState.NET_DATABASE_NOT_FOUND), netConnection.databaseName_)); } // Not Authorized to RDB Reply Message specifies that // the requester is not authorized to access the specified // relational database. // PROTOCOL architects an SQLSTATE of 08004 // // Messages // SQLSTATE : 8004 // Authorization ID <authorization-ID> attempted to perform the specified // <operation> without having been granted the proper authorization to do so. // SQLCODE : -30060 // <authorization-ID> does not have the privilege to perform operation <operation>. // // // Returned from Server: // SVRCOD - required (8 - ERROR) // RDBNAM - required // private void parseRDBATHRM(NetConnection netConnection) throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean rdbnamReceived = false; String rdbnam = null; parseLengthAndMatchCodePoint(CodePoint.RDBATHRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); peekCP = peekCodePoint(); } if (peekCP == CodePoint.RDBNAM) { foundInPass = true; rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); rdbnam = parseRDBNAM(true); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived, rdbnamReceived); netAgent_.setSvrcod(svrcod); netAgent_.accumulateReadException(new SqlException(agent_.logWriter_, new ClientMessageId(SQLState.NET_CONNECT_AUTH_FAILED), msgutil_.getTextMessage(MessageId.CONN_USER_NOT_AUTHORIZED_TO_DB))); } // Data Stream Syntax Error Reply Message indicates that the data // sent to the target agent does not structurally conform to the requirements // of the DDM architecture. The target agent terminated paring of the DSS // when the condition SYNERRCD specified was detected. // PROTOCOL architects an SQLSTATE of 58008 or 58009. // // Messages // SQLSTATE : 58009 // Execution failed due to a distribution protocol error that caused deallocation of the conversation. // SQLCODE : -30020 // Execution failed because of a Distributed Protocol // Error that will affect the successful execution of subsequent // commands and SQL statements: Reason Code <reason-code>. // Some possible reason codes include: // 121C Indicates that the user is not authorized to perform the requested command. // 1232 The command could not be completed because of a permanent error. // In most cases, the server will be in the process of an abend. // 220A The target server has received an invalid data description. // If a user SQLDA is specified, ensure that the fields are // initialized correctly. Also, ensure that the length does not // exceed the maximum allowed length for the data type being used. // // The command or statement cannot be processed. The current // transaction is rolled back and the application is disconnected // from the remote database. // // // Returned from Server: // SVRCOD - required (8 - ERROR) // SYNERRCD - required // RECCNT - optional (MINVAL 0, MINLVL 3) (will not be returned - should be ignored) // CODPNT - optional (MINLVL 3) // RDBNAM - optional (MINLVL 3) // protected void parseSYNTAXRM() throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean synerrcdReceived = false; int synerrcd = 0; boolean rdbnamReceived = false; String rdbnam = null; boolean codpntReceived = false; int codpnt = 0; parseLengthAndMatchCodePoint(CodePoint.SYNTAXRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); peekCP = peekCodePoint(); } if (peekCP == CodePoint.SYNERRCD) { foundInPass = true; synerrcdReceived = checkAndGetReceivedFlag(synerrcdReceived); synerrcd = parseSYNERRCD(); peekCP = peekCodePoint(); } if (peekCP == CodePoint.RDBNAM) { foundInPass = true; rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); rdbnam = parseRDBNAM(true); peekCP = peekCodePoint(); } if (peekCP == CodePoint.CODPNT) { foundInPass = true; codpntReceived = checkAndGetReceivedFlag(codpntReceived); codpnt = parseCODPNT(); peekCP = peekCodePoint(); } // RECCNT will be skipped. if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived, synerrcdReceived); netAgent_.setSvrcod(svrcod); doSyntaxrmSemantics(codpnt); } // RDB Currently Accessed Reply Message inidcates that the // ACCRDB command cannot be issued because the requester // has access to a relational database. // PROTOCOL architects an SQLSTATE of 58008 or 58009. // // Messages // SQLSTATE : 58009 // Execution failed due to a distribution protocol error that caused deallocation of the conversation. // SQLCODE : -30020 // Execution failed because of a Distributed Protocol // Error that will affect the successful execution of subsequent // commands and SQL statements: Reason Code <reason-code>. // Some possible reason codes include: // 121C Indicates that the user is not authorized to perform the requested command. // 1232 The command could not be completed because of a permanent error. // In most cases, the server will be in the process of an abend. // 220A The target server has received an invalid data description. // If a user SQLDA is specified, ensure that the fields are // initialized correctly. Also, ensure that the length does not // exceed the maximum allowed length for the data type being used. // // The command or statement cannot be processed. The current // transaction is rolled back and the application is disconnected // from the remote database. // // // Returned from Server: // SVRCOD - required (8 - ERROR) // RDBNAM - required // private void parseRDBACCRM() throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean rdbnamReceived = false; String rdbnam = null; parseLengthAndMatchCodePoint(CodePoint.RDBACCRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); peekCP = peekCodePoint(); } if (peekCP == CodePoint.RDBNAM) { foundInPass = true; rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); rdbnam = parseRDBNAM(true); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived, rdbnamReceived); netAgent_.setSvrcod(svrcod); agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED), msgutil_.getTextMessage(MessageId.CONN_DRDA_RDBACCRM))); } // RDB Access Failed Reply Message specifies that the relational // database failed the attempted connection. // An SQLCARD object must also be returned, following the // RDBAFLRM, to explain why the RDB failed the connection. // In addition, the target SQLAM instance is destroyed. // The SQLSTATE is returned in the SQLCARD. // // Messages // SQLSTATE : 58009 // Execution failed due to a distribution protocol error that caused deallocation of the conversation. // SQLCODE : -30020 // Execution failed because of a Distributed Protocol // Error that will affect the successful execution of subsequent // commands and SQL statements: Reason Code <reason-code>. // Some possible reason codes include: // 121C Indicates that the user is not authorized to perform the requested command. // 1232 The command could not be completed because of a permanent error. // In most cases, the server will be in the process of an abend. // 220A The target server has received an invalid data description. // If a user SQLDA is specified, ensure that the fields are // initialized correctly. Also, ensure that the length does not // exceed the maximum allowed length for the data type being used. // // The command or statement cannot be processed. The current // transaction is rolled back and the application is disconnected // from the remote database. // // // Returned from Server: // SVRCOD - required (8 - ERROR) // RDBNAM - required // private void parseRDBAFLRM() throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean rdbnamReceived = false; String rdbnam = null; parseLengthAndMatchCodePoint(CodePoint.RDBAFLRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); peekCP = peekCodePoint(); } if (peekCP == CodePoint.RDBNAM) { foundInPass = true; rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); rdbnam = parseRDBNAM(true); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived, rdbnamReceived); netAgent_.setSvrcod(svrcod); } // Parameter Value Not Supported Reply Message indicates // that the parameter value specified is either not recognized // or not supported for the specified parameter. // The VALNSPRM can only be specified in accordance with // the rules specified for DDM subsetting. // The code point of the command parameter in error is // returned as a parameter in this message. // PROTOCOL Architects an SQLSTATE of 58017. // // if codepoint is 0x119C,0x119D, or 0x119E then SQLSTATE 58017, SQLCODE -332 // else SQLSTATE 58017, SQLCODE -30073 // // Messages // SQLSTATE : 58017 // The DDM parameter value is not supported. // SQLCODE : -332 // There is no available conversion for the source code page // <code page> to the target code page <code page>. // Reason code <reason-code>. // The reason codes are as follows: // 1 source and target code page combination is not supported // by the database manager. // 2 source and target code page combination is either not // supported by the database manager or by the operating // system character conversion utility on the client node. // 3 source and target code page combination is either not // supported by the database manager or by the operating // system character conversion utility on the server node. // // SQLSTATE : 58017 // The DDM parameter value is not supported. // SQLCODE : -30073 // <parameter-identifier> Parameter value <value> is not supported. // Some possible parameter identifiers include: // 002F The target server does not support the data type // requested by the application requester. // The target server does not support the CCSID // requested by the application requester. Ensure the CCSID // used by the requester is supported by the server. // 119C - Verify the single-byte CCSID. // 119D - Verify the double-byte CCSID. // 119E - Verify the mixed-byte CCSID. // // The current environment command or SQL statement // cannot be processed successfully, nor can any subsequent // commands or SQL statements. The current transaction is // rolled back and the application is disconnected // from the remote database. The command cannot be processed. // // Returned from Server: // SVRCOD - required (8 - ERROR) // CODPNT - required // RECCNT - optional (MINLVL 3, MINVAL 0) (will not be returned - should be ignored) // RDBNAM - optional (MINLVL 3) // protected void parseVALNSPRM() throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean rdbnamReceived = false; String rdbnam = null; boolean codpntReceived = false; int codpnt = 0; parseLengthAndMatchCodePoint(CodePoint.VALNSPRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); peekCP = peekCodePoint(); } if (peekCP == CodePoint.RDBNAM) { foundInPass = true; rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); rdbnam = parseRDBNAM(true); peekCP = peekCodePoint(); } if (peekCP == CodePoint.CODPNT) { foundInPass = true; codpntReceived = checkAndGetReceivedFlag(codpntReceived); codpnt = parseCODPNT(); peekCP = peekCodePoint(); } // RECCNT will be skipped if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived, codpntReceived); netAgent_.setSvrcod(svrcod); doValnsprmSemantics(codpnt, "\"\""); } // Conversational Protocol Error Reply Message // indicates that a conversational protocol error occurred. // PROTOCOL architects the SQLSTATE value depending on SVRCOD // SVRCOD 8 -> SQLSTATE of 58008 or 58009 // SVRCOD 16,128 -> SQLSTATE of 58009 // // Messages // SQLSTATE : 58009 // Execution failed due to a distribution protocol error that caused deallocation of the conversation. // SQLCODE : -30020 // Execution failed because of a Distributed Protocol // Error that will affect the successful execution of subsequent // commands and SQL statements: Reason Code <reason-code>. // Some possible reason codes include: // 121C Indicates that the user is not authorized to perform the requested command. // 1232 The command could not be completed because of a permanent error. // In most cases, the server will be in the process of an abend. // 220A The target server has received an invalid data description. // If a user SQLDA is specified, ensure that the fields are // initialized correctly. Also, ensure that the length does not // exceed the maximum allowed length for the data type being used. // // The command or statement cannot be processed. The current // transaction is rolled back and the application is disconnected // from the remote database. // // // Returned from Server: // SVRCOD - required (8 - ERROR, 16 - SEVERE, 128 - SESDMG) // PRCCNVCD - required // RECCNT - optional (MINVAL 0, MINLVL 3) // RDBNAM - optional (NINLVL 3) // protected void parsePRCCNVRM() throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean rdbnamReceived = false; String rdbnam = null; boolean prccnvcdReceived = false; int prccnvcd = 0; parseLengthAndMatchCodePoint(CodePoint.PRCCNVRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_SESDMG); peekCP = peekCodePoint(); } if (peekCP == CodePoint.RDBNAM) { foundInPass = true; rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); rdbnam = parseRDBNAM(true); peekCP = peekCodePoint(); } if (peekCP == CodePoint.PRCCNVCD) { foundInPass = true; prccnvcdReceived = checkAndGetReceivedFlag(prccnvcdReceived); prccnvcd = parsePRCCNVCD(); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived, prccnvcdReceived); netAgent_.setSvrcod(svrcod); doPrccnvrmSemantics(CodePoint.PRCCNVRM); } // Object Not Supported Reply Message indicates that the target // server does not recognize or support the object // specified as data in an OBJDSS for the command associated // with the object. // The OBJNSPRM is also returned if an object is found in a // valid collection in an OBJDSS (such as RECAL collection) // that that is not valid for that collection. // PROTOCOL Architects an SQLSTATE of 58015. // // Messages // SQLSTATE : 58015 // The DDM object is not supported. // SQLCODE : -30071 // <object-identifier> Object is not supported. // The current transaction is rolled back and the application // is disconnected from the remote database. The command // cannot be processed. // // // Returned from Server: // SVRCOD - required (8 - ERROR, 16 - SEVERE) // CODPNT - required // RECCNT - optional (MINVAL 0) (will not be returned - should be ignored) // RDBNAM - optional (MINLVL 3) // // Also called by NetPackageReply and NetStatementReply void parseOBJNSPRM() throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean rdbnamReceived = false; String rdbnam = null; boolean codpntReceived = false; int codpnt = 0; parseLengthAndMatchCodePoint(CodePoint.OBJNSPRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_SEVERE); peekCP = peekCodePoint(); } if (peekCP == CodePoint.RDBNAM) { foundInPass = true; rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); rdbnam = parseRDBNAM(true); peekCP = peekCodePoint(); } if (peekCP == CodePoint.CODPNT) { foundInPass = true; codpntReceived = checkAndGetReceivedFlag(codpntReceived); codpnt = parseCODPNT(); peekCP = peekCodePoint(); } // skip the RECCNT if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived, codpntReceived); netAgent_.setSvrcod(svrcod); doObjnsprmSemantics(codpnt); } // Manager-Level Conflict (MGRLVLRM) Reply Message indicates that // the manager levels specified in the MGRLVLLS conflict amoung // themselves or with previously specified manager levels. // - The manager-level dependencies of one specified manager violates another // specified maanger level. // - The manager- level specified attempts to respecify a manager level that // previously EXCSAT command specified. // PROTOCOL architects an SQLSTATE of 58010. // // Messages // SQLSTATE : 58010 // Execution failed due to a distributed protocol error that will affect // the successful execution of subsequent DDM commands or SQL statements. // SQLCODE : -30021 // Execution failed due to a distribution protocol error // that will affect the successful execution of subsequent // commands and SQL statements: Manager <manager> at Level <level> // not supported. // // A system error occurred that prevented successful connection // of the application to the remote database. // // // Returned from Server: // SVRCOD - required (8 - ERROR) // MGRLVLLS - required // private void parseMGRLVLRM() throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean mgrlvllsReceived = false; int[] managerCodePoint = null; int[] managerLevel = null; parseLengthAndMatchCodePoint(CodePoint.MGRLVLRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); peekCP = peekCodePoint(); } if (peekCP == CodePoint.MGRLVLLS) { foundInPass = true; mgrlvllsReceived = checkAndGetReceivedFlag(mgrlvllsReceived); parseLengthAndMatchCodePoint(CodePoint.MGRLVLLS); int managerListLength = getDdmLength(); if ((managerListLength == 0) || ((managerListLength % 7) != 0)) { doSyntaxrmSemantics(CodePoint.SYNERRCD_OBJ_LEN_NOT_ALLOWED); } int managerCount = managerListLength / 7; managerCodePoint = new int[managerCount]; managerLevel = new int[managerCount]; for (int i = 0; i < managerCount; i++) { managerCodePoint[i] = parseCODPNTDR(); managerLevel[i] = parseMGRLVLN(); } peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived, mgrlvllsReceived); netAgent_.setSvrcod(svrcod); doMgrlvlrmSemantics(managerCodePoint, managerLevel); } // Command Not Supported Reply Message indicates that the specified // command is not recognized or not supported for the // specified target. The reply message can be returned // only in accordance with the architected rules for DDM subsetting. // PROTOCOL architects an SQLSTATE of 58014. // // Messages // SQLSTATE : 58014 // The DDM command is not supported. // SQLCODE : -30070 // <command-identifier> Command is not supported. // The current transaction is rolled back and the application is // disconnected from the remote database. The statement cannot be processed. // // // Returned from Server: // SVRCOD - required (4 - WARNING, 8 - ERROR) (MINLVL 2) // CODPNT - required // RDBNAM - optional (MINLVL 3) // protected void parseCMDNSPRM() throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean rdbnamReceived = false; String rdbnam = null; boolean srvdgnReceived = false; byte[] srvdgn = null; boolean codpntReceived = false; int codpnt = 0; parseLengthAndMatchCodePoint(CodePoint.CMDNSPRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_WARNING, CodePoint.SVRCOD_ERROR); peekCP = peekCodePoint(); } if (peekCP == CodePoint.RDBNAM) { foundInPass = true; rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); rdbnam = parseRDBNAM(true); peekCP = peekCodePoint(); } if (peekCP == CodePoint.CODPNT) { foundInPass = true; codpntReceived = checkAndGetReceivedFlag(codpntReceived); codpnt = parseCODPNT(); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived, codpntReceived); netAgent_.setSvrcod(svrcod); agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, new ClientMessageId(SQLState.DRDA_DDM_COMMAND_NOT_SUPPORTED), Integer.toHexString(codpnt))); } // Abnormal End Unit of Work Condition Reply Message indicates // that the current unit of work ended abnormally because // of some action at the target server. This can be caused by a // deadlock resolution, operator intervention, or some similar // situation that caused the relational database to rollback // the current unit of work. This reply message is returned only // if an SQLAM issues the command. Whenever an ABNUOWRM is returned // in response to a command, an SQLCARD object must also be returned // following the ABNUOWRM. The SQLSTATE is returned in the SQLCARD. // // Returned from Server: // SVRCOD - required (8 - ERROR) // RDBNAM - required // // Called by all the NET*Reply classes. void parseABNUOWRM() throws DisconnectException { boolean svrcodReceived = false; int svrcod = CodePoint.SVRCOD_INFO; boolean rdbnamReceived = false; String rdbnam = null; parseLengthAndMatchCodePoint(CodePoint.ABNUOWRM); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SVRCOD) { foundInPass = true; svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); peekCP = peekCodePoint(); } if (peekCP == CodePoint.RDBNAM) { // skip the rbbnam since it doesn't tell us anything new. // there is no way to return it to the application anyway. // not having to convert this to a string is a time saver also. foundInPass = true; rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); rdbnam = parseRDBNAM(true); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(svrcodReceived, rdbnamReceived); // the abnuowrm has been received, do whatever state changes are necessary netAgent_.setSvrcod(svrcod); } //--------------------- parse DDM Reply Data-------------------------------------- // The Server Attributes Reply Data (EXCSATRD) returns the following // information in response to an EXCSAT command: // - the target server's class name // - the target server's support level for each class of manager // the source requests // - the target server's product release level // - the target server's external name // - the target server's name // // Returned from Server: // EXTNAM - optional // MGRLVLLS - optional // SRVCLSNM - optional // SRVNAM - optional // SRVRLSLV - optional private void parseEXCSATRD(NetConnection netConnection) throws DisconnectException { boolean extnamReceived = false; String extnam = null; boolean mgrlvllsReceived = false; boolean srvclsnmReceived = false; String srvclsnm = null; boolean srvnamReceived = false; String srvnam = null; boolean srvrlslvReceived = false; String srvrlslv = null; parseLengthAndMatchCodePoint(CodePoint.EXCSATRD); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.EXTNAM) { // External Name is the name of the job, task, or process // on a system for which a DDM server is active. For a target // DDM server, the external name is the name of the job the system creates // or activates to run the DDM server. // No semantic meaning is assigned to external names in DDM. // External names are transmitted to aid in problem determination. // This driver will save the external name of the target (the // driver may use it for logging purposes later). foundInPass = true; extnamReceived = checkAndGetReceivedFlag(extnamReceived); extnam = parseEXTNAM(); peekCP = peekCodePoint(); } if (peekCP == CodePoint.MGRLVLLS) { // Manager-Level List // specifies a list of code points and support levels for the // classes of managers a server supports foundInPass = true; mgrlvllsReceived = checkAndGetReceivedFlag(mgrlvllsReceived); parseMGRLVLLS(netConnection); // need to review this one, check input and output peekCP = peekCodePoint(); } if (peekCP == CodePoint.SRVCLSNM) { // Server Class Name // specifies the name of a class of ddm servers. foundInPass = true; srvclsnmReceived = checkAndGetReceivedFlag(srvclsnmReceived); srvclsnm = parseSRVCLSNM(); peekCP = peekCodePoint(); } if (peekCP == CodePoint.SRVNAM) { // Server Name // no semantic meaning is assigned to server names in DDM, // it is recommended (by the DDM manual) that the server's // physical or logical location identifier be used as a server name. // server names are transmitted for problem determination purposes. // this driver will save this name and in the future may use it // for logging errors. foundInPass = true; srvnamReceived = checkAndGetReceivedFlag(srvnamReceived); srvnam = parseSRVNAM(); peekCP = peekCodePoint(); } if (peekCP == CodePoint.SRVRLSLV) { // Server Product Release Level // specifies the procuct release level of a ddm server. // the contents are unarchitected. // this driver will save this information and in the future may // use it for logging purposes. foundInPass = true; srvrlslvReceived = checkAndGetReceivedFlag(srvrlslvReceived); srvrlslv = parseSRVRLSLV(); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); // according the the DDM book, all these instance variables are optional netConnection.setServerAttributeData(extnam, srvclsnm, srvnam, srvrlslv); } // Must make a version that does not change state in the associated connection private void parseDummyEXCSATRD(NetConnection netConnection) throws DisconnectException { boolean extnamReceived = false; String extnam = null; boolean mgrlvllsReceived = false; boolean srvclsnmReceived = false; String srvclsnm = null; boolean srvnamReceived = false; String srvnam = null; boolean srvrlslvReceived = false; String srvrlslv = null; parseLengthAndMatchCodePoint(CodePoint.EXCSATRD); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.EXTNAM) { // External Name is the name of the job, task, or process // on a system for which a DDM server is active. For a target // DDM server, the external name is the name of the job the system creates // or activates to run the DDM server. // No semantic meaning is assigned to external names in DDM. // External names are transmitted to aid in problem determination. // This driver will save the external name of the target (the // driver may use it for logging purposes later). foundInPass = true; extnamReceived = checkAndGetReceivedFlag(extnamReceived); extnam = parseEXTNAM(); peekCP = peekCodePoint(); } if (peekCP == CodePoint.MGRLVLLS) { // Manager-Level List // specifies a list of code points and support levels for the // classes of managers a server supports foundInPass = true; mgrlvllsReceived = checkAndGetReceivedFlag(mgrlvllsReceived); parseMGRLVLLS(netConnection); // need to review this one, check input and output peekCP = peekCodePoint(); } if (peekCP == CodePoint.SRVCLSNM) { // Server Class Name // specifies the name of a class of ddm servers. foundInPass = true; srvclsnmReceived = checkAndGetReceivedFlag(srvclsnmReceived); srvclsnm = parseSRVCLSNM(); peekCP = peekCodePoint(); } if (peekCP == CodePoint.SRVNAM) { // Server Name // no semantic meaning is assigned to server names in DDM, // it is recommended (by the DDM manual) that the server's // physical or logical location identifier be used as a server name. // server names are transmitted for problem determination purposes. // this driver will save this name and in the future may use it // for logging errors. foundInPass = true; srvnamReceived = checkAndGetReceivedFlag(srvnamReceived); srvnam = parseSRVNAM(); peekCP = peekCodePoint(); } if (peekCP == CodePoint.SRVRLSLV) { // Server Product Release Level // specifies the procuct release level of a ddm server. // the contents are unarchitected. // this driver will save this information and in the future may // use it for logging purposes. foundInPass = true; srvrlslvReceived = checkAndGetReceivedFlag(srvrlslvReceived); srvrlslv = parseSRVRLSLV(); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); // according the the DDM book, all these instance variables are optional // don't change state of netConnection because this is a DUMMY flow //netConnection.setServerAttributeData (extnam, srvclsnm, srvnam, srvrlslv); } // The Access Security Reply Data (ACSECRD) Collection Object contains // the security information from a target server's security manager. // this method returns the security check code received from the server // (if the server does not return a security check code, this method // will return 0). it is up to the caller to check // the value of this return code and take the appropriate action. // // Returned from Server: // SECMEC - required // SECTKN - optional (MINLVL 6) // SECCHKCD - optional private void parseACCSECRD(NetConnection netConnection, int securityMechanism) throws DisconnectException { boolean secmecReceived = false; int[] secmecList = null; boolean sectknReceived = false; byte[] sectkn = null; boolean secchkcdReceived = false; int secchkcd = 0; parseLengthAndMatchCodePoint(CodePoint.ACCSECRD); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.SECMEC) { // security mechanism. // this value must either reflect the value sent in the ACCSEC command // if the target server supports it; or the values the target server // does support when it does not support or accept the value // requested by the source server. // the secmecs returned are treated as a list and stored in // targetSecmec_List. // if the target server supports the source's secmec, it // will be saved in the variable targetSecmec_ (NOTE: so // after calling this method, if targetSecmec_'s value is zero, // then the target did NOT support the source secmec. any alternate // secmecs would be contained in targetSecmec_List). foundInPass = true; secmecReceived = checkAndGetReceivedFlag(secmecReceived); secmecList = parseSECMEC(); peekCP = peekCodePoint(); } if (peekCP == CodePoint.SECTKN) { // security token foundInPass = true; sectknReceived = checkAndGetReceivedFlag(sectknReceived); sectkn = parseSECTKN(false); peekCP = peekCodePoint(); } if (peekCP == CodePoint.SECCHKCD) { // security check code. // included if and only if an error is detected when processing // the ACCSEC command. this has an implied severity code // of ERROR. foundInPass = true; secchkcdReceived = checkAndGetReceivedFlag(secchkcdReceived); secchkcd = parseSECCHKCD(); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); checkRequiredObjects(secmecReceived); netConnection.setAccessSecurityData(secchkcd, securityMechanism, secmecList, sectknReceived, sectkn); } // Called by all the NET*Reply classes. void parseTYPDEFNAM() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.TYPDEFNAM); netAgent_.targetTypdef_.setTypdefnam(readString()); } // Called by all the NET*Reply classes. void parseTYPDEFOVR() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.TYPDEFOVR); pushLengthOnCollectionStack(); int peekCP = peekCodePoint(); while (peekCP != Reply.END_OF_COLLECTION) { boolean foundInPass = false; if (peekCP == CodePoint.CCSIDSBC) { foundInPass = true; netAgent_.targetTypdef_.setCcsidSbc(parseCCSIDSBC()); peekCP = peekCodePoint(); } if (peekCP == CodePoint.CCSIDDBC) { foundInPass = true; netAgent_.targetTypdef_.setCcsidDbc(parseCCSIDDBC()); peekCP = peekCodePoint(); } if (peekCP == CodePoint.CCSIDMBC) { foundInPass = true; netAgent_.targetTypdef_.setCcsidMbc(parseCCSIDMBC()); peekCP = peekCodePoint(); } if (!foundInPass) { doPrmnsprmSemantics(peekCP); } } popCollectionStack(); } // The SYNCCRD Reply Mesage // // Returned from Server: // XARETVAL - required int parseSYNCCRD(ConnectionCallbackInterface connection) throws DisconnectException { return 0; } // Process XA return value protected int parseXARETVAL() throws DisconnectException { return 0; } // Process XA return value protected byte parseSYNCTYPE() throws DisconnectException { return 0; } // This method handles the parsing of all command replies and reply data // for the SYNCCTL command. protected int parseSYNCCTLreply(ConnectionCallbackInterface connection) throws DisconnectException { return 0; } // Called by the XA commit and rollback parse reply methods. void parseSYNCCTLError(int peekCP) throws DisconnectException { switch (peekCP) { case CodePoint.CMDCHKRM: parseCMDCHKRM(); break; case CodePoint.PRCCNVRM: parsePRCCNVRM(); break; case CodePoint.SYNTAXRM: parseSYNTAXRM(); break; case CodePoint.VALNSPRM: parseVALNSPRM(); break; default: doObjnsprmSemantics(peekCP); } } // Manager-Level List. // Specifies a list of code points and support levels for the // classes of managers a server supports. // The target server must not provide information for any target // managers unless the source explicitly requests it. // For each manager class, if the target server's support level // is greater than or equal to the source server's level, then the source // server's level is returned for that class if the target server can operate // at the source's level; otherwise a level 0 is returned. If the target // server's support level is less than the source server's level, the // target server's level is returned for that class. If the target server // does not recognize the code point of a manager class or does not support // that class, it returns a level of 0. The target server then waits // for the next command or for the source server to terminate communications. // When the source server receives EXCSATRD, it must compare each of the entries // in the mgrlvlls parameter it received to the corresponding entries in the mgrlvlls // parameter it sent. If any level mismatches, the source server must decide // whether it can use or adjust to the lower level of target support for that manager // class. There are no architectural criteria for making this decision. // The source server can terminate communications or continue at the target // servers level of support. It can also attempt to use whatever // commands its user requests while receiving eror reply messages for real // functional mismatches. // The manager levels the source server specifies or the target server // returns must be compatible with the manager-level dependencies of the specified // manangers. Incompatible manager levels cannot be specified. // After this method successfully returns, the targetXXXX values (where XXXX // represents a manager name. example targetAgent) contain the negotiated // manager levels for this particular connection. private void parseMGRLVLLS(NetConnection netConnection) throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.MGRLVLLS); // each manager class and level is 4 bytes long. // get the length of the mgrlvls bytes, make sure it contains // the correct number of bytes for a mgrlvlls object, and calculate // the number of manager's returned from the server. int managerListLength = getDdmLength(); if ((managerListLength == 0) || ((managerListLength % 4) != 0)) { doSyntaxrmSemantics(CodePoint.SYNERRCD_OBJ_LEN_NOT_ALLOWED); } int managerCount = managerListLength / 4; // the managerCount should be equal to the same number of // managers sent on the excsat. // read each of the manager levels returned from the server. for (int i = 0; i < managerCount; i++) { // first two byte are the manager's codepoint, next two bytes are the level. int managerCodePoint = parseCODPNTDR(); int managerLevel = parseMGRLVLN(); // check each manager to make sure levels are within proper limits // for this driver. Also make sure unexpected managers are not returned. switch (managerCodePoint) { case CodePoint.AGENT: if ((managerLevel < NetConfiguration.MIN_AGENT_MGRLVL) || (managerLevel > netConnection.targetAgent_)) { doMgrlvlrmSemantics(managerCodePoint, managerLevel); } netConnection.targetAgent_ = managerLevel; break; case CodePoint.CMNTCPIP: if ((managerLevel < NetConfiguration.MIN_CMNTCPIP_MGRLVL) || (managerLevel > netConnection.targetCmntcpip_)) { doMgrlvlrmSemantics(managerCodePoint, managerLevel); } netConnection.targetCmntcpip_ = managerLevel; break; case CodePoint.RDB: if ((managerLevel < NetConfiguration.MIN_RDB_MGRLVL) || (managerLevel > netConnection.targetRdb_)) { doMgrlvlrmSemantics(managerCodePoint, managerLevel); } netConnection.targetRdb_ = managerLevel; break; case CodePoint.SECMGR: if ((managerLevel < NetConfiguration.MIN_SECMGR_MGRLVL) || (managerLevel > netConnection.targetSecmgr_)) { doMgrlvlrmSemantics(managerCodePoint, managerLevel); } netConnection.targetSecmgr_ = managerLevel; break; case CodePoint.SQLAM: if ((managerLevel < NetConfiguration.MIN_SQLAM_MGRLVL) || (managerLevel > netAgent_.targetSqlam_)) { doMgrlvlrmSemantics(managerCodePoint, managerLevel); } netAgent_.orignalTargetSqlam_ = managerLevel; break; case CodePoint.CMNAPPC: if ((managerLevel < NetConfiguration.MIN_CMNAPPC_MGRLVL) || (managerLevel > netConnection.targetCmnappc_)) { doMgrlvlrmSemantics(managerCodePoint, managerLevel); } netConnection.targetCmnappc_ = managerLevel; break; case CodePoint.XAMGR: if ((managerLevel != 0) && (managerLevel < NetConfiguration.MIN_XAMGR_MGRLVL) || (managerLevel > netConnection.targetXamgr_)) { doMgrlvlrmSemantics(managerCodePoint, managerLevel); } netConnection.targetXamgr_ = managerLevel; break; case CodePoint.SYNCPTMGR: if ((managerLevel != 0) && (managerLevel < NetConfiguration.MIN_SYNCPTMGR_MGRLVL) || (managerLevel > netConnection.targetSyncptmgr_)) { doMgrlvlrmSemantics(managerCodePoint, managerLevel); } netConnection.targetSyncptmgr_ = managerLevel; break; case CodePoint.RSYNCMGR: if ((managerLevel != 0) && (managerLevel < NetConfiguration.MIN_RSYNCMGR_MGRLVL) || (managerLevel > netConnection.targetRsyncmgr_)) { doMgrlvlrmSemantics(managerCodePoint, managerLevel); } netConnection.targetRsyncmgr_ = managerLevel; break; // The target server must not provide information for any target managers // unless the source explicitly requests. The following managers are never requested. default: doMgrlvlrmSemantics(managerCodePoint, managerLevel); break; } } } // The External Name is the name of the job, task, or process on a // system for which a DDM server is active. On a source DDM server, // the external name is the name of the job that is requesting // access to remote resources. For a target DDM server, // the external name is the name of the job the system // creates or activates to run the DDM server. // No semantic meaning is assigned to external names in DDM. // External names are transmitted to aid in problem determination. protected String parseEXTNAM() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.EXTNAM); return readString(); } // Server Class name specifies the name of a class of DDM servers. // Server class names are assigned for each product involved in PROTOCOL. protected String parseSRVCLSNM() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.SRVCLSNM); return readString(); } // Server Name is the name of the DDM server. // No semantic meaning is assigned to server names in DDM, // but it is recommended that the server names are transmitted // for problem determination. protected String parseSRVNAM() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.SRVNAM); return readString(); } // Server Product Release Level String specifies the product // release level of a DDM server. The contents of the // parameter are unarchitected. Up to 255 bytes can be sent. // SRVRLSLV should not be used in place of product-defined // extensions to carry information not related to the products // release level. protected String parseSRVRLSLV() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.SRVRLSLV); return readString(); } // Manager-Level Number Attribute Binary Integer Number specifies // the level of a defined DDM manager. protected int parseMGRLVLN() throws DisconnectException { return readUnsignedShort(); } // Security Mechanims. protected int[] parseSECMEC() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.SECMEC); return readUnsignedShortList(); } // The Security Token Byte String is information provided and used // by the various security mechanisms. protected byte[] parseSECTKN(boolean skip) throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.SECTKN); if (skip) { skipBytes(); return null; } return readBytes(); } // The Security Check Code String codifies the security information // and condition for the SECCHKRM. protected int parseSECCHKCD() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.SECCHKCD); int secchkcd = readUnsignedByte(); if ((secchkcd < CodePoint.SECCHKCD_00) || (secchkcd > CodePoint.SECCHKCD_15)) { doValnsprmSemantics(CodePoint.SECCHKCD, secchkcd); } return secchkcd; } // Product specific Identifier specifies the product release level // of a DDM server. protected String parsePRDID(boolean skip) throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.PRDID); if (skip) { skipBytes(); return null; } else { return readString(); } } // The User Id specifies an end-user name. protected String parseUSRID(boolean skip) throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.USRID); if (skip) { skipBytes(); return null; } return readString(); }; // Code Point Data Representation specifies the data representation // of a dictionary codepoint. Code points are hexadecimal aliases for DDM // named terms. protected int parseCODPNTDR() throws DisconnectException { return readUnsignedShort(); } // Correlation Token specifies a token that is conveyed between source // and target servers for correlating the processing between servers. protected byte[] parseCRRTKN(boolean skip) throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.CRRTKN); if (skip) { skipBytes(); return null; } return readBytes(); } // Unit of Work Disposition Scalar Object specifies the disposition of the // last unit of work. protected int parseUOWDSP() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.UOWDSP); int uowdsp = readUnsignedByte(); if ((uowdsp != CodePoint.UOWDSP_COMMIT) && (uowdsp != CodePoint.UOWDSP_ROLLBACK)) { doValnsprmSemantics(CodePoint.UOWDSP, uowdsp); } return uowdsp; } // Relational Database Name specifies the name of a relational // database of the server. A server can have more than one RDB. protected String parseRDBNAM(boolean skip) throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.RDBNAM); if (skip) { skipBytes(); return null; } return readString(); }; protected int parseXIDCNT() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.XIDCNT); return readUnsignedShort(); } protected Xid parseXID() throws DisconnectException { return null; } protected java.util.Hashtable parseIndoubtList() throws DisconnectException { return null; } // Syntax Error Code String specifies the condition that caused termination // of data stream parsing. protected int parseSYNERRCD() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.SYNERRCD); int synerrcd = readUnsignedByte(); if ((synerrcd < 0x01) || (synerrcd > 0x1D)) { doValnsprmSemantics(CodePoint.SYNERRCD, synerrcd); } return synerrcd; } // The Code Point Data specifies a scalar value that is an architected code point. protected int parseCODPNT() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.CODPNT); return parseCODPNTDR(); } // Conversational Protocol Error Code specifies the condition // for which the PRCCNVRm was returned. protected int parsePRCCNVCD() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.PRCCNVCD); int prccnvcd = readUnsignedByte(); if ((prccnvcd != 0x01) && (prccnvcd != 0x02) && (prccnvcd != 0x03) && (prccnvcd != 0x04) && (prccnvcd != 0x05) && (prccnvcd != 0x06) && (prccnvcd != 0x10) && (prccnvcd != 0x11) && (prccnvcd != 0x12) && (prccnvcd != 0x13) && (prccnvcd != 0x15)) { doValnsprmSemantics(CodePoint.PRCCNVCD, prccnvcd); } return prccnvcd; } // CCSID for Single-Byte Characters specifies a coded character // set identifier for single-byte characters. protected int parseCCSIDSBC() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.CCSIDSBC); return readUnsignedShort(); } // CCSID for Mixed-Byte Characters specifies a coded character // set identifier for mixed-byte characters. protected int parseCCSIDMBC() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.CCSIDMBC); return readUnsignedShort(); } // CCSID for Double-Byte Characters specifies a coded character // set identifier for double-byte characters. protected int parseCCSIDDBC() throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.CCSIDDBC); return readUnsignedShort(); } // Severity Code is an indicator of the severity of a condition // detected during the execution of a command. protected int parseSVRCOD(int minSvrcod, int maxSvrcod) throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.SVRCOD); int svrcod = readUnsignedShort(); if ((svrcod != CodePoint.SVRCOD_INFO) && (svrcod != CodePoint.SVRCOD_WARNING) && (svrcod != CodePoint.SVRCOD_ERROR) && (svrcod != CodePoint.SVRCOD_SEVERE) && (svrcod != CodePoint.SVRCOD_ACCDMG) && (svrcod != CodePoint.SVRCOD_PRMDMG) && (svrcod != CodePoint.SVRCOD_SESDMG)) { doValnsprmSemantics(CodePoint.SVRCOD, svrcod); } if (svrcod < minSvrcod || svrcod > maxSvrcod) { doValnsprmSemantics(CodePoint.SVRCOD, svrcod); } return svrcod; } protected int parseFastSVRCOD(int minSvrcod, int maxSvrcod) throws DisconnectException { matchCodePoint(CodePoint.SVRCOD); int svrcod = readFastUnsignedShort(); if ((svrcod != CodePoint.SVRCOD_INFO) && (svrcod != CodePoint.SVRCOD_WARNING) && (svrcod != CodePoint.SVRCOD_ERROR) && (svrcod != CodePoint.SVRCOD_SEVERE) && (svrcod != CodePoint.SVRCOD_ACCDMG) && (svrcod != CodePoint.SVRCOD_PRMDMG) && (svrcod != CodePoint.SVRCOD_SESDMG)) { doValnsprmSemantics(CodePoint.SVRCOD, svrcod); } if (svrcod < minSvrcod || svrcod > maxSvrcod) { doValnsprmSemantics(CodePoint.SVRCOD, svrcod); } return svrcod; } protected NetSqlca parseSQLCARD(Sqlca[] rowsetSqlca) throws DisconnectException { parseLengthAndMatchCodePoint(CodePoint.SQLCARD); int ddmLength = getDdmLength(); ensureBLayerDataInBuffer(ddmLength); NetSqlca netSqlca = parseSQLCARDrow(rowsetSqlca); adjustLengths(getDdmLength()); return netSqlca; } //--------------------------parse FDOCA objects------------------------ // SQLCARD : FDOCA EARLY ROW // SQL Communications Area Row Description // // FORMAT FOR ALL SQLAM LEVELS // SQLCAGRP; GROUP LID 0x54; ELEMENT TAKEN 0(all); REP FACTOR 1 NetSqlca parseSQLCARDrow(Sqlca[] rowsetSqlca) throws DisconnectException { return parseSQLCAGRP(rowsetSqlca); } // SQLNUMROW : FDOCA EARLY ROW // SQL Number of Elements Row Description // // FORMAT FOR SQLAM LEVELS // SQLNUMGRP; GROUP LID 0x58; ELEMENT TAKEN 0(all); REP FACTOR 1 int parseSQLNUMROW() throws DisconnectException { return parseSQLNUMGRP(); } int parseFastSQLNUMROW() throws DisconnectException { return parseFastSQLNUMGRP(); } // SQLNUMGRP : FDOCA EARLY GROUP // SQL Number of Elements Group Description // // FORMAT FOR ALL SQLAM LEVELS // SQLNUM; PROTOCOL TYPE I2; ENVLID 0x04; Length Override 2 private int parseSQLNUMGRP() throws DisconnectException { return readShort(); } private int parseFastSQLNUMGRP() throws DisconnectException { return readFastShort(); } // SQLCAGRP : FDOCA EARLY GROUP // SQL Communcations Area Group Description // // FORMAT FOR SQLAM <= 6 // SQLCODE; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLSTATE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 5 // SQLERRPROC; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 8 // SQLCAXGRP; PROTOCOL TYPE N-GDA; ENVLID 0x52; Length Override 0 // // FORMAT FOR SQLAM >= 7 // SQLCODE; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLSTATE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 5 // SQLERRPROC; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 8 // SQLCAXGRP; PROTOCOL TYPE N-GDA; ENVLID 0x52; Length Override 0 // SQLDIAGGRP; PROTOCOL TYPE N-GDA; ENVLID 0x56; Length Override 0 private NetSqlca parseSQLCAGRP(Sqlca[] rowsetSqlca) throws DisconnectException { if (readFastUnsignedByte() == CodePoint.NULLDATA) { return null; } int sqlcode = readFastInt(); byte[] sqlstate = readFastBytes(5); byte[] sqlerrproc = readFastBytes(8); NetSqlca netSqlca = null; try { netSqlca = new NetSqlca(netAgent_.netConnection_, sqlcode, sqlstate, sqlerrproc); } catch(SqlException sqle) { throw new DisconnectException(netAgent_,sqle); } parseSQLCAXGRP(netSqlca); if (netAgent_.targetSqlam_ >= NetConfiguration.MGRLVL_7) { netSqlca.setRowsetRowCount(parseSQLDIAGGRP(rowsetSqlca)); } return netSqlca; } // SQLCAXGRP : EARLY FDOCA GROUP // SQL Communications Area Exceptions Group Description // // FORMAT FOR SQLAM <= 6 // SQLRDBNME; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 18 // SQLERRD1; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLERRD2; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLERRD3; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLERRD4; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLERRD5; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLERRD6; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLWARN0; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN1; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN2; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN3; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN4; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN5; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN6; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN7; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN8; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN9; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARNA; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLERRMSG_m; PROTOCOL TYPE VCM; ENVLID 0x3E; Length Override 70 // SQLERRMSG_s; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 70 // // FORMAT FOR SQLAM >= 7 // SQLERRD1; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLERRD2; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLERRD3; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLERRD4; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLERRD5; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLERRD6; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLWARN0; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN1; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN2; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN3; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN4; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN5; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN6; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN7; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN8; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARN9; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLWARNA; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLRDBNAME; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 255 // SQLERRMSG_m; PROTOCOL TYPE VCM; ENVLID 0x3E; Length Override 70 // SQLERRMSG_s; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 70 private void parseSQLCAXGRP(NetSqlca netSqlca) throws DisconnectException { if (readFastUnsignedByte() == CodePoint.NULLDATA) { netSqlca.setContainsSqlcax(false); return; } if (netAgent_.targetSqlam_ < NetConfiguration.MGRLVL_7) { // skip over the rdbnam for now // SQLRDBNME; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 18 skipFastBytes(18); } // SQLERRD1 to SQLERRD6; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 int[] sqlerrd = new int[6]; readFastIntArray(sqlerrd); // SQLWARN0 to SQLWARNA; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 byte[] sqlwarn = readFastBytes(11); if (netAgent_.targetSqlam_ >= NetConfiguration.MGRLVL_7) { // skip over the rdbnam for now // SQLRDBNAME; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 255 parseFastVCS(); } int sqlerrmcCcsid = 0; byte[] sqlerrmc = readFastLDBytes(); if (sqlerrmc != null) { sqlerrmcCcsid = netAgent_.targetTypdef_.getCcsidMbc(); skipFastBytes(2); } else { sqlerrmc = readFastLDBytes(); sqlerrmcCcsid = netAgent_.targetTypdef_.getCcsidSbc(); } netSqlca.setSqlerrd(sqlerrd); netSqlca.setSqlwarnBytes(sqlwarn); netSqlca.setSqlerrmcBytes(sqlerrmc, sqlerrmcCcsid); // sqlerrmc may be null } // SQLDIAGGRP : FDOCA EARLY GROUP // SQL Diagnostics Group Description - Identity 0xD1 // Nullable Group // SQLDIAGSTT; PROTOCOL TYPE N-GDA; ENVLID 0xD3; Length Override 0 // SQLDIAGCN; DRFA TYPE N-RLO; ENVLID 0xF6; Length Override 0 // SQLDIAGCI; PROTOCOL TYPE N-RLO; ENVLID 0xF5; Length Override 0 private long parseSQLDIAGGRP(Sqlca[] rowsetSqlca) throws DisconnectException { if (readFastUnsignedByte() == CodePoint.NULLDATA) { return 0; } long row_count = parseSQLDIAGSTT(rowsetSqlca); parseSQLDIAGCI(rowsetSqlca); parseSQLDIAGCN(); return row_count; } // this is duplicated in parseColumnMetaData, but different // DAGroup under NETColumnMetaData requires a lot more stuffs including // precsion, scale and other stuffs protected String parseFastVCS() throws DisconnectException { // doublecheck what readString() does if the length is 0 return readFastString(readFastUnsignedShort(), netAgent_.targetTypdef_.getCcsidSbcEncoding()); } //----------------------non-parsing computational helper methods-------------- protected boolean checkAndGetReceivedFlag(boolean receivedFlag) throws DisconnectException { if (receivedFlag) { // this method will throw a disconnect exception if // the received flag is already true; doSyntaxrmSemantics(CodePoint.SYNERRCD_DUP_OBJ_PRESENT); } return true; } protected void checkRequiredObjects(boolean receivedFlag) throws DisconnectException { if (!receivedFlag) { doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND); } } protected void checkRequiredObjects(boolean receivedFlag, boolean receivedFlag2) throws DisconnectException { if (!receivedFlag || !receivedFlag2) { doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND); } } protected void checkRequiredObjects(boolean receivedFlag, boolean receivedFlag2, boolean receivedFlag3) throws DisconnectException { if (!receivedFlag || !receivedFlag2 || !receivedFlag3) { doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND); } } protected void checkRequiredObjects(boolean receivedFlag, boolean receivedFlag2, boolean receivedFlag3, boolean receivedFlag4) throws DisconnectException { if (!receivedFlag || !receivedFlag2 || !receivedFlag3 || !receivedFlag4) { doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND); } } protected void checkRequiredObjects(boolean receivedFlag, boolean receivedFlag2, boolean receivedFlag3, boolean receivedFlag4, boolean receivedFlag5, boolean receivedFlag6) throws DisconnectException { if (!receivedFlag || !receivedFlag2 || !receivedFlag3 || !receivedFlag4 || !receivedFlag5 || !receivedFlag6) { doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND); } } protected void checkRequiredObjects(boolean receivedFlag, boolean receivedFlag2, boolean receivedFlag3, boolean receivedFlag4, boolean receivedFlag5, boolean receivedFlag6, boolean receivedFlag7) throws DisconnectException { if (!receivedFlag || !receivedFlag2 || !receivedFlag3 || !receivedFlag4 || !receivedFlag5 || !receivedFlag6 || !receivedFlag7) { doSyntaxrmSemantics(CodePoint.SYNERRCD_REQ_OBJ_NOT_FOUND); } } // These methods are "private protected", which is not a recognized java privilege, // but means that these methods are private to this class and to subclasses, // and should not be used as package-wide friendly methods. protected void doObjnsprmSemantics(int codePoint) throws DisconnectException { agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, new ClientMessageId(SQLState.DRDA_DDM_OBJECT_NOT_SUPPORTED), Integer.toHexString(codePoint))); } // Also called by NetStatementReply. protected void doPrmnsprmSemantics(int codePoint) throws DisconnectException { agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, new ClientMessageId(SQLState.DRDA_DDM_PARAM_NOT_SUPPORTED), Integer.toHexString(codePoint))); } // Also called by NetStatementReply void doValnsprmSemantics(int codePoint, int value) throws DisconnectException { doValnsprmSemantics(codePoint, Integer.toString(value)); } void doValnsprmSemantics(int codePoint, String value) throws DisconnectException { // special case the FDODTA codepoint not to disconnect. if (codePoint == CodePoint.FDODTA) { agent_.accumulateReadException(new SqlException(agent_.logWriter_, new ClientMessageId(SQLState.DRDA_DDM_PARAMVAL_NOT_SUPPORTED), Integer.toHexString(codePoint))); return; } if (codePoint == CodePoint.CCSIDSBC || codePoint == CodePoint.CCSIDDBC || codePoint == CodePoint.CCSIDMBC) { // the server didn't like one of the ccsids. // the message should reflect the error in question. right now these values // will be hard coded but this won't be correct if our driver starts sending // other values to the server. In order to pick up the correct values, // a little reorganization may need to take place so that this code (or // whatever code sets the message) has access to the correct values. int cpValue = 0; switch (codePoint) { case CodePoint.CCSIDSBC: cpValue = netAgent_.typdef_.getCcsidSbc(); break; case CodePoint.CCSIDDBC: cpValue = netAgent_.typdef_.getCcsidDbc(); break; case CodePoint.CCSIDMBC: cpValue = netAgent_.typdef_.getCcsidSbc(); break; default: // should never be in this default case... cpValue = 0; break; } agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, new ClientMessageId(SQLState.DRDA_NO_AVAIL_CODEPAGE_CONVERSION), new Integer(cpValue), value)); return; } // the problem isn't with one of the ccsid values so... // Returning more information would // require rearranging this code a little. agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, new ClientMessageId(SQLState.DRDA_DDM_PARAMVAL_NOT_SUPPORTED), Integer.toHexString(codePoint))); } void doDtamchrmSemantics() throws DisconnectException { agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED), msgutil_.getTextMessage(MessageId.CONN_DRDA_DTARMCHRM))); } // Messages // SQLSTATE : 58010 // Execution failed due to a distribution protocol error that // will affect the successful execution of subsequent DDM commands // or SQL statements. // SQLCODE : -30021 // Execution failed because of a Distributed Protocol // Error that will affect the successful execution of subsequent // commands and SQL statements: Manager <manager> at Level // <level> not supported. // // A system erro occurred that prevented successful connection // of the application to the remote database. This message (SQLCODE) // is producted for SQL CONNECT statement. private void doMgrlvlrmSemantics(String manager, String level) throws DisconnectException { agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, new ClientMessageId(SQLState.DRDA_MGRLVLRM), manager, level)); } private void doMgrlvlrmSemantics(int manager, int level) throws DisconnectException { doMgrlvlrmSemantics("0x" + Integer.toHexString(manager), "0x" + Integer.toHexString(level)); } private void doMgrlvlrmSemantics(int[] nameList, int[] levelList) throws DisconnectException { StringBuffer managerNames = new StringBuffer(100); StringBuffer managerLevels = new StringBuffer(100); int count = nameList.length; for (int i = 0; i < count; i++) { managerNames.append("0x"); managerNames.append(nameList[i]); managerLevels.append("0x"); managerLevels.append(levelList[i]); if (i != (count - 1)) { managerNames.append(","); managerLevels.append(","); } } doMgrlvlrmSemantics(managerNames.toString(), managerLevels.toString()); } // The client can detect that a conversational protocol error has occurred. // This can also be detected at the server in which case a PRCCNVRM is returned. // The Conversation Protocol Error Code, PRCCNVRM, describes the various errors. // // Note: Not all of these may be valid at the client. See descriptions for // which ones make sense for client side errors/checks. // Conversation Error Code Description of Error // ----------------------- -------------------- // 0x01 RPYDSS received by target communications manager. // 0x02 Multiple DSSs sent without chaining or multiple // DSS chains sent. // 0x03 OBJDSS sent when not allowed. // 0x04 Request correlation identifier of an RQSDSS // is less than or equal to the previous // RQSDSS's request correlatio identifier in the chain. // 0x05 Request correlation identifier of an OBJDSS // does not equal the request correlation identifier // of the preceding RQSDSS. // 0x06 EXCSAT was not the first command after the connection // was established. // 0x10 ACCSEC or SECCHK command sent in wrong state. // 0x11 SYNCCTL or SYNCRSY command is used incorrectly. // 0x12 RDBNAM mismatch between ACCSEC, SECCHK, and ACCRDB. // 0x13 A command follows one that returned EXTDTAs as reply object. // // When the client detects these errors, it will be handled as if a PRCCNVRM is returned // from the server. In this PRCCNVRM case, PROTOCOL architects an SQLSTATE of 58008 or 58009 // depening of the SVRCOD. In this case, a 58009 will always be returned. // Messages // SQLSTATE : 58009 // Execution failed due to a distribution protocol error that caused deallocation of the conversation. // SQLCODE : -30020 // Execution failed because of a Distributed Protocol // Error that will affect the successful execution of subsequent // commands and SQL statements: Reason Code <reason-code>. // Some possible reason codes include: // 121C Indicates that the user is not authorized to perform the requested command. // 1232 The command could not be completed because of a permanent error. // In most cases, the server will be in the process of an abend. // 220A The target server has received an invalid data description. // If a user SQLDA is specified, ensure that the fields are // initialized correctly. Also, ensure that the length does not // exceed the maximum allowed length for the data type being used. // // The command or statement cannot be processed. The current // transaction is rolled back and the application is disconnected // from the remote database. protected void doPrccnvrmSemantics(int conversationProtocolErrorCode) throws DisconnectException { // we may need to map the conversation protocol error code, prccnvcd, to some kind // of reason code. For now just return the prccnvcd as the reason code agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED), msgutil_.getTextMessage(MessageId.CONN_DRDA_PRCCNVRM, Integer.toHexString(conversationProtocolErrorCode)))); } // SQL Diagnostics Condition Token Array - Identity 0xF7 // SQLNUMROW; ROW LID 0x68; ELEMENT TAKEN 0(all); REP FACTOR 1 // SQLTOKROW; ROW LID 0xE7; ELEMENT TAKEN 0(all); REP FACTOR 0(all) void parseSQLDCTOKS() throws DisconnectException { if (readFastUnsignedByte() == CodePoint.NULLDATA) { return; } int num = parseFastSQLNUMROW(); for (int i = 0; i < num; i++) { parseSQLTOKROW(); } } // SQL Diagnostics Condition Information Array - Identity 0xF5 // SQLNUMROW; ROW LID 0x68; ELEMENT TAKEN 0(all); REP FACTOR 1 // SQLDCIROW; ROW LID 0xE5; ELEMENT TAKEN 0(all); REP FACTOR 0(all) private void parseSQLDIAGCI(Sqlca[] rowsetSqlca) throws DisconnectException { if (readFastUnsignedByte() == CodePoint.NULLDATA) { return; } int num = parseFastSQLNUMROW(); if (num == 0) { resetRowsetSqlca(rowsetSqlca, 0); } // lastRow is the row number for the last row that had a non-null SQLCA. int lastRow = 1; for (int i = 0; i < num; i++) { lastRow = parseSQLDCROW(rowsetSqlca, lastRow); } resetRowsetSqlca(rowsetSqlca, lastRow + 1); } // SQL Diagnostics Connection Array - Identity 0xF6 // SQLNUMROW; ROW LID 0x68; ELEMENT TAKEN 0(all); REP FACTOR 1 // SQLCNROW; ROW LID 0xE6; ELEMENT TAKEN 0(all); REP FACTOR 0(all) private void parseSQLDIAGCN() throws DisconnectException { if (readUnsignedByte() == CodePoint.NULLDATA) { return; } int num = parseFastSQLNUMROW(); for (int i = 0; i < num; i++) { parseSQLCNROW(); } } // SQL Diagnostics Connection Row - Identity 0xE6 // SQLCNGRP; GROUP LID 0xD6; ELEMENT TAKEN 0(all); REP FACTOR 1 private void parseSQLCNROW() throws DisconnectException { parseSQLCNGRP(); } // SQL Diagnostics Condition Row - Identity 0xE5 // SQLDCGRP; GROUP LID 0xD5; ELEMENT TAKEN 0(all); REP FACTOR 1 private int parseSQLDCROW(Sqlca[] rowsetSqlca, int lastRow) throws DisconnectException { return parseSQLDCGRP(rowsetSqlca, lastRow); } // SQL Diagnostics Token Row - Identity 0xE7 // SQLTOKGRP; GROUP LID 0xD7; ELEMENT TAKEN 0(all); REP FACTOR 1 private void parseSQLTOKROW() throws DisconnectException { parseSQLTOKGRP(); } // check on SQLTOKGRP format private void parseSQLTOKGRP() throws DisconnectException { skipFastNVCMorNVCS(); } // SQL Diagnostics Statement Group Description - Identity 0xD3 // Nullable Group // SQLDSFCOD; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDSCOST; PROTOCOL TYPE I4; ENVLID 0X02; Length Override 4 // SQLDSLROW; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDSNPM; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDSNRS; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDSRNS; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDSDCOD; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDSROWC; PROTOCOL TYPE FD; ENVLID 0x0E; Length Override 31 // SQLDSNROW; PROTOCOL TYPE FD; ENVLID 0x0E; Length Override 31 // SQLDSROWCS; PROTOCOL TYPE FD; ENVLID 0x0E; Length Override 31 // SQLDSACON; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLDSACRH; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLDSACRS; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLDSACSL; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLDSACSE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLDSACTY; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLDSCERR; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLDSMORE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 private long parseSQLDIAGSTT(Sqlca[] rowsetSqlca) throws DisconnectException { if (readFastUnsignedByte() == CodePoint.NULLDATA) { return 0; } int sqldsFcod = readFastInt(); // FUNCTION_CODE int sqldsCost = readFastInt(); // COST_ESTIMATE int sqldsLrow = readFastInt(); // LAST_ROW skipFastBytes(16); long sqldsRowc = readFastLong(); // ROW_COUNT skipFastBytes(24); return sqldsRowc; } // SQL Diagnostics Connection Group Description - Identity 0xD6 // Nullable // // SQLCNSTATE; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLCNSTATUS; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLCNATYPE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLCNETYPE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 1 // SQLCNPRDID; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 8 // SQLCNRDB; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 255 // SQLCNCLASS; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 255 // SQLCNAUTHID; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 255 private void parseSQLCNGRP() throws DisconnectException { skipBytes(18); String sqlcnRDB = parseFastVCS(); // RDBNAM String sqlcnClass = parseFastVCS(); // CLASS_NAME String sqlcnAuthid = parseFastVCS(); // AUTHID } // SQL Diagnostics Condition Group Description // // SQLDCCODE; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDCSTATE; PROTOCOL TYPE FCS; ENVLID Ox30; Lengeh Override 5 // SQLDCREASON; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDCLINEN; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDCROWN; PROTOCOL TYPE FD; ENVLID 0x0E; Lengeh Override 31 // SQLDCER01; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDCER02; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDCER03; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDCER04; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDCPART; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDCPPOP; PROTOCOL TYPE I4; ENVLID 0x02; Length Override 4 // SQLDCMSGID; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 10 // SQLDCMDE; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 8 // SQLDCPMOD; PROTOCOL TYPE FCS; ENVLID 0x30; Length Override 5 // SQLDCRDB; PROTOCOL TYPE VCS; ENVLID 0x32; Length Override 255 // SQLDCTOKS; PROTOCOL TYPE N-RLO; ENVLID 0xF7; Length Override 0 // SQLDCMSG_m; PROTOCOL TYPE NVMC; ENVLID 0x3F; Length Override 32672 // SQLDCMSG_S; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 32672 // SQLDCCOLN_m; PROTOCOL TYPE NVCM ; ENVLID 0x3F; Length Override 255 // SQLDCCOLN_s; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // SQLDCCURN_m; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCCURN_s; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // SQLDCPNAM_m; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCPNAM_s; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // SQLDCXGRP; PROTOCOL TYPE N-GDA; ENVLID 0xD3; Length Override 1 private int parseSQLDCGRP(Sqlca[] rowsetSqlca, int lastRow) throws DisconnectException { int sqldcCode = readFastInt(); // SQLCODE String sqldcState = readFastString(5, Typdef.UTF8ENCODING); // SQLSTATE int sqldcReason = readFastInt(); // REASON_CODE int sqldcLinen = readFastInt(); // LINE_NUMBER int sqldcRown = (int) readFastLong(); // ROW_NUMBER // save +20237 in the 0th entry of the rowsetSqlca's. // this info is going to be used when a subsequent fetch prior is issued, and if already // received a +20237 then we've gone beyond the first row and there is no need to // flow another fetch to the server. if (sqldcCode == 20237) { rowsetSqlca[0] = new NetSqlca(netAgent_.netConnection_, sqldcCode, sqldcState, null); } else { if (rowsetSqlca[sqldcRown] != null) { rowsetSqlca[sqldcRown].resetRowsetSqlca(netAgent_.netConnection_, sqldcCode, sqldcState, null); } else { rowsetSqlca[sqldcRown] = new NetSqlca(netAgent_.netConnection_, sqldcCode, sqldcState, null); } } // reset all entries between lastRow and sqldcRown to null for (int i = lastRow + 1; i < sqldcRown; i++) { rowsetSqlca[i] = null; } skipFastBytes(47); String sqldcRdb = parseFastVCS(); // RDBNAM // skip the tokens for now, since we already have the complete message. parseSQLDCTOKS(); // MESSAGE_TOKENS String sqldcMsg = parseFastNVCMorNVCS(); // MESSAGE_TEXT // skip the following for now. skipFastNVCMorNVCS(); // COLUMN_NAME skipFastNVCMorNVCS(); // PARAMETER_NAME skipFastNVCMorNVCS(); // EXTENDED_NAMES parseSQLDCXGRP(); // SQLDCXGRP return sqldcRown; } // SQL Diagnostics Extended Names Group Description - Identity 0xD5 // Nullable // // SQLDCXRDB_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCXSCH_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCXNAM_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCXTBLN_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCXRDB_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // SQLDCXSCH_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // SQLDCXNAM_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // SQLDCXTBLN_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // // SQLDCXCRDB_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCXCSCH_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCXCNAM_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCXCRDB_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // SQLDCXCSCH_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // SQLDCXCNAM_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // // SQLDCXRRDB_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCXRSCH_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCXRNAM_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCXRRDB_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // SQLDCXRSCH_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // SQLDCXRNAM_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // // SQLDCXTRDB_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCXTSCH_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCXTNAM_m ; PROTOCOL TYPE NVCM; ENVLID 0x3F; Length Override 255 // SQLDCXTRDB_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // SQLDCXTSCH_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 // SQLDCXTNAM_s ; PROTOCOL TYPE NVCS; ENVLID 0x33; Length Override 255 private void parseSQLDCXGRP() throws DisconnectException { if (readFastUnsignedByte() == CodePoint.NULLDATA) { return; } skipFastNVCMorNVCS(); // OBJECT_RDBNAM skipFastNVCMorNVCS(); // OBJECT_SCHEMA skipFastNVCMorNVCS(); // SPECIFIC_NAME skipFastNVCMorNVCS(); // TABLE_NAME String sqldcxCrdb = parseFastVCS(); // CONSTRAINT_RDBNAM skipFastNVCMorNVCS(); // CONSTRAINT_SCHEMA skipFastNVCMorNVCS(); // CONSTRAINT_NAME parseFastVCS(); // ROUTINE_RDBNAM skipFastNVCMorNVCS(); // ROUTINE_SCHEMA skipFastNVCMorNVCS(); // ROUTINE_NAME parseFastVCS(); // TRIGGER_RDBNAM skipFastNVCMorNVCS(); // TRIGGER_SCHEMA skipFastNVCMorNVCS(); // TRIGGER_NAME } private String parseFastNVCMorNVCS() throws DisconnectException { String stringToBeSet = null; int vcm_length = 0; int vcs_length = 0; if (readFastUnsignedByte() != CodePoint.NULLDATA) { vcm_length = readFastUnsignedShort(); if (vcm_length > 0) { stringToBeSet = readFastString(vcm_length, netAgent_.targetTypdef_.getCcsidMbcEncoding()); } if (readFastUnsignedByte() != CodePoint.NULLDATA) { agent_.accumulateChainBreakingReadExceptionAndThrow( new DisconnectException(agent_, new ClientMessageId( SQLState.NET_NVCM_NVCS_BOTH_NON_NULL))); } } else { if (readFastUnsignedByte() != CodePoint.NULLDATA) { vcs_length = readFastUnsignedShort(); if (vcs_length > 0) { stringToBeSet = readFastString(vcs_length, netAgent_.targetTypdef_.getCcsidSbcEncoding()); } } } return stringToBeSet; } private void skipFastNVCMorNVCS() throws DisconnectException { int vcm_length = 0; int vcs_length = 0; if (readFastUnsignedByte() != CodePoint.NULLDATA) { vcm_length = readFastUnsignedShort(); if (vcm_length > 0) //stringToBeSet = readString (vcm_length, netAgent_.targetTypdef_.getCcsidMbcEncoding()); { skipFastBytes(vcm_length); } if (readFastUnsignedByte() != CodePoint.NULLDATA) { agent_.accumulateChainBreakingReadExceptionAndThrow( new DisconnectException(agent_, new ClientMessageId( SQLState.NET_NVCM_NVCS_BOTH_NON_NULL))); } } else { if (readFastUnsignedByte() != CodePoint.NULLDATA) { vcs_length = readFastUnsignedShort(); if (vcs_length > 0) //stringToBeSet = readString (vcs_length, netAgent_.targetTypdef_.getCcsidSbcEncoding()); { skipFastBytes(vcs_length); } } } } void resetRowsetSqlca(Sqlca[] rowsetSqlca, int row) { // rowsetSqlca can be null. int count = ((rowsetSqlca == null) ? 0 : rowsetSqlca.length); for (int i = row; i < count; i++) { rowsetSqlca[i] = null; } } }
[ "durieuxthomas@hotmail.com" ]
durieuxthomas@hotmail.com
bbe81c43fa2d35a6a9c41cefc68b19a546e3cae7
66d3122f8f031d6e8b27e8ead7aa5ae0d7e33b45
/net/minecraft/client/block/ColoredBlock.java
14659f8be885b993d4cc08f37bb8ea260f550858
[]
no_license
gurachan/minecraft1.14-dp
c10059787555028f87a4c8183ff74e6e1cfbf056
34daddc03be27d5a0ee2ab9bc8b1deb050277208
refs/heads/master
2022-01-07T01:43:52.836604
2019-05-08T17:18:13
2019-05-08T17:18:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
133
java
package net.minecraft.client.block; import net.minecraft.util.DyeColor; public interface ColoredBlock { DyeColor getColor(); }
[ "879139909@qq.com" ]
879139909@qq.com
a6e2c4f688b9e2e12137b6568cf5291a8778454d
37a15aa6c36cc19af8c0962ccf6f283ed42ca2fe
/src/day40_Encapsulation/Test.java
0479a01d82a3b05552761f64a40c7ef59d888c7a
[]
no_license
bilaluslu/Java_Practice
a434b30111861e3e667b097cabe63b5f4bc9820e
844dc5b47e26fad5524b05009d6384215da6da7b
refs/heads/master
2022-12-10T11:12:06.594518
2020-08-29T03:32:02
2020-08-29T03:32:02
257,975,319
0
0
null
null
null
null
UTF-8
Java
false
false
449
java
package day40_Encapsulation; public class Test { public static void main(String[] args) { Encapsulation obj = new Encapsulation(); //System.out.println( obj.SSN ); // compile error System.out.println( obj.getSSN() ); // returns 0, we did not initialize yet //obj.SSN = 123456; // compile error obj.setSSN(123456); System.out.println( obj.getSSN() ); // returns 123456 } }
[ "uslubilal45@gmail.com" ]
uslubilal45@gmail.com
11b61945ade350735107443a1e11e839fb90d7fa
161e1a6d406857e94f5954157f9b1b87a07d4292
/StartUp.java
19febed3ffe7ede1d5ebe2ff0a456a8c261e0c1b
[]
no_license
iwatakeshi/a-student-guide-to-object-oriented-development
b908d73a96c9cb2cf38494fc4b62a742ef3dbb89
f91f43430bfea00234e1321195be8567b529deed
refs/heads/master
2021-01-18T17:38:38.143481
2016-10-26T01:05:26
2016-10-26T01:05:26
71,952,389
0
0
null
null
null
null
UTF-8
Java
false
false
676
java
package bikeshop; /* Generated by Together */ public class StartUp { public static void main(String[] args){ /* This little program will run through the methods on IssueBikeUI * calling each in turn, like a user with a front end would do. */ // First, create the UI IssueBikeUI ui = new IssueBikeUI(); // 1. Show details for chosen bike ui.showBikeDetails(100); // 2. Calculate cost of hiring this bike for 5 days ui.calculateCost(5); // 3. Create new customer, payment and hire ui.createCustomer("Bob Smith", "WC4 7HJ", 9864356); // 4. Calculate the total cost ui.calculateTotalPayment(); } }
[ "iwatakeshi@gmail.com" ]
iwatakeshi@gmail.com
ae161284341cf6d75d2da03e930f11f0857974af
87ffe6cef639e2b96b8d5236b5ace57e16499491
/app/src/main/java/com/xiaomi/mipush/sdk/MiPushMessage.java
a2dcf4d33c05001b32d80db0cb91752a5365761f
[]
no_license
leerduo/FoodsNutrition
24ffeea902754b84a2b9fbd3299cf4fceb38da3f
a448a210e54f789201566da48cc44eceb719b212
refs/heads/master
2020-12-11T05:45:34.531682
2015-08-28T04:35:05
2015-08-28T04:35:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,372
java
package com.xiaomi.mipush.sdk; import java.util.HashMap; import java.util.Map; public class MiPushMessage implements PushMessageHandler.a { private String a; private int b; private String c; private String d; private String e; private int f; private int g; private int h; private boolean i; private String j; private String k; private String l; private HashMap<String, String> m = new HashMap(); public String a() { return this.a; } public void a(int paramInt) { this.b = paramInt; } public void a(String paramString) { this.a = paramString; } public void a(Map<String, String> paramMap) { this.m.clear(); if (paramMap != null) { this.m.putAll(paramMap); } } public void a(boolean paramBoolean) { this.i = paramBoolean; } public String b() { return this.c; } public void b(int paramInt) { this.g = paramInt; } public void b(String paramString) { this.c = paramString; } public String c() { return this.d; } public void c(int paramInt) { this.h = paramInt; } public void c(String paramString) { this.d = paramString; } public String d() { return this.e; } public void d(int paramInt) { this.f = paramInt; } public void d(String paramString) { this.e = paramString; } public void e(String paramString) { this.j = paramString; } public boolean e() { return this.i; } public String f() { return this.l; } public void f(String paramString) { this.k = paramString; } public int g() { return this.f; } public void g(String paramString) { this.l = paramString; } public Map<String, String> h() { return this.m; } public String toString() { return "messageId={" + this.a + "},passThrough={" + this.f + "},alias={" + this.d + "},topic={" + this.e + "},content={" + this.c + "},description={" + this.j + "},title={" + this.k + "},isNotified={" + this.i + "},notifyId={" + this.h + "},notifyType={" + this.g + "}, category={" + this.l + "}, extra={" + this.m + "}"; } } /* Location: D:\15036015\ๅ็ผ–่ฏ‘\shiwuku\classes_dex2jar.jar * Qualified Name: com.xiaomi.mipush.sdk.MiPushMessage * JD-Core Version: 0.7.0-SNAPSHOT-20130630 */
[ "1060221762@qq.com" ]
1060221762@qq.com
559184be4c3a524eaee389a33d51d95276fe5e9b
a26ef48d26ec3d5d1091910edfd4acc8a679faa8
/vertx/src/main/java/net/kuujo/copycat/vertx/VertxEventBusProtocolServer.java
da666e80caf3f27b6c070b100393e3f650af2e1c
[ "Apache-2.0" ]
permissive
y-higuchi/copycat
07920bfc7968ea0963db03ff1147f7cecd35d966
968b153131e732a241d84ac3a0525bd812ffb60f
refs/heads/master
2021-01-15T16:37:07.723942
2015-02-05T10:59:03
2015-02-05T10:59:03
26,004,909
0
1
null
null
null
null
UTF-8
Java
false
false
3,046
java
/* * Copyright 2014 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 net.kuujo.copycat.vertx; import net.kuujo.copycat.protocol.ProtocolHandler; import net.kuujo.copycat.protocol.ProtocolServer; import org.vertx.java.core.Context; import org.vertx.java.core.Handler; import org.vertx.java.core.Vertx; import org.vertx.java.core.eventbus.Message; import org.vertx.java.core.eventbus.ReplyFailure; import java.nio.ByteBuffer; import java.util.concurrent.CompletableFuture; /** * Vert.x event bus protocol server. * * @author <a href="http://github.com/kuujo">Jordan Halterman</a> */ public class VertxEventBusProtocolServer implements ProtocolServer, Handler<Message<byte[]>> { private final String address; private final Vertx vertx; private final Context context; private ProtocolHandler handler; public VertxEventBusProtocolServer(String address, Vertx vertx) { this.address = address; this.vertx = vertx; this.context = vertx.currentContext(); } @Override public void handle(Message<byte[]> message) { if (handler != null) { handler.apply(ByteBuffer.wrap(message.body())).whenComplete((reply, error) -> { context.runOnContext(v -> { if (error != null) { message.fail(0, error.getMessage()); } else { byte[] bytes = new byte[reply.remaining()]; reply.get(bytes); message.reply(bytes); } }); }); } else { message.fail(ReplyFailure.NO_HANDLERS.toInt(), "No message handler registered"); } } @Override public void handler(ProtocolHandler handler) { this.handler = handler; } @Override public CompletableFuture<Void> listen() { final CompletableFuture<Void> future = new CompletableFuture<>(); vertx.eventBus().registerHandler(address, this, result -> { if (result.failed()) { future.completeExceptionally(result.cause()); } else { future.complete(null); } }); return future; } @Override public CompletableFuture<Void> close() { final CompletableFuture<Void> future = new CompletableFuture<>(); vertx.eventBus().unregisterHandler(address, this, result -> { if (result.failed()) { future.completeExceptionally(result.cause()); } else { future.complete(null); } }); return future; } @Override public String toString() { return String.format("%s[address=%s]", getClass().getSimpleName(), address); } }
[ "jordan.halterman@gmail.com" ]
jordan.halterman@gmail.com
ae59f6b2ed89f09b9ba4c64b1d0c43584d4bd637
784c7326b9c63218483f08591879751352ae055f
/sping-bean/src/main/java/com/zjs/bwcx/spring/่‡ชๅŠจ่ฃ…้…/java/JavaConfig.java
e856b0c3048e9c21bc3546c2cbcb52c1af01983a
[]
no_license
shizhijie/spring
4f28067f2124ab93332395dbe5e445792545d2e2
ebd49b656e6ff844a6feff6f6a2fd0b5c7b1aa6a
refs/heads/master
2020-04-16T12:18:36.412795
2019-05-22T03:36:50
2019-05-22T03:36:50
165,572,921
0
0
null
null
null
null
UTF-8
Java
false
false
364
java
package com.zjs.bwcx.spring.่‡ชๅŠจ่ฃ…้….java; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class JavaConfig { @Bean public CompactDisc sgtPeppers() { return new SgtPeppers(); } @Bean public CDPlayer cdPlayer() { return new CDPlayer(sgtPeppers()); } }
[ "18232529363@163.com" ]
18232529363@163.com
4fb9a6f674ff98d8c115fda9d7de90d92d45c5f4
79e0d9b45b7daefbcbc2a06cbbd595a29aae022c
/main/src/java/main/self/micromagic/coder/StringCoder.java
e511c990f2c23fd33592770d6a46d6ff79bc9ed2
[ "Apache-2.0" ]
permissive
biankudingcha/eterna
fd3863273008b370072129ed4a1ca8fb390cb503
ab32d1b804dc5698a0f85bcf457d0c05b72e852c
refs/heads/master
2023-03-18T15:46:29.987896
2020-04-29T01:41:53
2020-04-29T01:41:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,249
java
package self.micromagic.coder; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.Writer; import java.util.BitSet; import self.micromagic.util.StringTool; /** * ๅฏนๅญ—็ฌฆไธฒ็š„็‰นๆฎŠๅญ—็ฌฆ่ฟ›่กŒ็ผ–็ ๅค„็†็š„ๅทฅๅ…ท. */ public class StringCoder { /** * 16่ฟ›ๅˆถ็š„ๅญ—็ฌฆ. */ protected static final char[] HEX_NUMS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; /** * ๆ ‡่ฏ†็ผ–/่งฃ็ ไธญๆ–ญ็š„ๅผ‚ๅธธ. */ protected static final RuntimeException BREAK_FLAG = new RuntimeException("break"); /** * ๅฏ้ข„ๅ–ๆˆ–ๅ‘ๅ‰่ฏปๅ–ๅญ—็ฌฆ็š„ไธชๆ•ฐ. */ protected final int bufSize; /** * ๅ…จๅฑ€่ฏปๅ–ๅˆฐ็š„็ดขๅผ•ๅ€ผ. */ protected int totalIndex; /** * ๅทฒ่ฏปๅ–ๅญ—็ฌฆ็š„็ผ“ๅญ˜. */ protected final char[] charBuf; /** * ๅฝ“ๅ‰ๅญ—็ฌฆ็ผ“ๅญ˜ไธญๅญ˜ๆ”พ็š„ๅญ—็ฌฆไธชๆ•ฐ. */ protected int charCount; /** * ๅฝ“ๅ‰่ฏปๅ–ๅˆฐ็š„ๅญ—็ฌฆ็ดขๅผ•ๅ€ผ. */ protected int charIndex; /** * ๅญ—็ฌฆ็š„่พ“ๅ‡บ็ผ“ๅญ˜. */ protected final char[] outBuf; /** * ่พ“ๅ‡บ็ผ“ๅญ˜ไฝฟ็”จๅˆฐ็š„็ดขๅผ•ๅ€ผ. */ protected int outIndex; /** * ๆœ‰ๆ•ˆ็š„, ไธ้œ€่ฆ่ฟ›่กŒ่ฝฌๆข็š„ๅญ—็ฌฆ้›†. */ protected final BitSet validChars; /** * ่ฝฌไน‰ๅญ—็ฌฆ. */ protected final char escapeChar; /** * ้ป˜่ฎค็š„ๆœ‰ๆ•ˆๅญ—็ฌฆ้›†. */ protected static final BitSet DEFAULT_VALID_CHARS = new BitSet(128); static { DEFAULT_VALID_CHARS.set('_'); DEFAULT_VALID_CHARS.set('$'); for (int i = 'A'; i <= 'Z'; i++) { DEFAULT_VALID_CHARS.set(i); } for (int i = 'a'; i <= 'z'; i++) { DEFAULT_VALID_CHARS.set(i); } for (int i = '0'; i <= '9'; i++) { DEFAULT_VALID_CHARS.set(i); } } /** * ้ป˜่ฎค็š„ๆž„้€ ๅ‡ฝๆ•ฐ. <p> * ่ฝฌไน‰ๅญ—็ฌฆไธบ"$". */ public StringCoder() { this(8, '$', null); } /** * ไป…่ฎพ็ฝฎ่ฝฌไน‰ๅญ—็ฌฆ่ฟ›่กŒๆž„้€ . * * @param escapeChar ่ฝฌไน‰ๅญ—็ฌฆ */ public StringCoder(char escapeChar) { this(8, escapeChar, null); } /** * ้€š่ฟ‡่ฎพ็ฝฎ่ฝฌไน‰ๅญ—็ฌฆ็ญ‰ๅ‚ๆ•ฐ่ฟ›่กŒๆž„้€ . * * @param bufSize ๅฏ้ข„ๅ–ๆˆ–ๅ‘ๅ‰่ฏปๅ–ๅญ—็ฌฆ็š„ไธชๆ•ฐ * @param escapeChar ่ฝฌไน‰ๅญ—็ฌฆ * @param validChars ไธ้œ€่ฆ่ฝฌไน‰็š„ๅญ—็ฌฆ้›†, ๅฆ‚ๆžœไธบ<code>null</code>ๅฐ†ไฝฟ็”จ้ป˜่ฎค็š„ๅญ—็ฌฆ้›† */ public StringCoder(int bufSize, char escapeChar, BitSet validChars) { this.escapeChar = escapeChar; if (bufSize > 0) { if (bufSize > 128) { throw new IllegalArgumentException("Too large buf size [" + bufSize + "]."); } this.bufSize = bufSize; } else { this.bufSize = 0; } if (validChars == null) { validChars = DEFAULT_VALID_CHARS; } this.validChars = validChars; this.charBuf = new char[512]; this.outBuf = new char[128]; } /** * ๅฏนไธ€ไธชๅญ—็ฌฆไธฒ่ฟ›่กŒ็ผ–็ ๅค„็†, ๅนถ่ฟ”ๅ›ž็ผ–็ ๅŽ็š„ๅญ—็ฌฆไธฒ. */ public String encodeString(String str) { return this.encodeString(str, 0); } /** * ไปŽๆŒ‡ๅฎšไฝ็ฝฎๅผ€ๅง‹, ๅฏนไธ€ไธชๅญ—็ฌฆไธฒ่ฟ›่กŒ็ผ–็ ๅค„็†, ๅนถ่ฟ”ๅ›ž็ผ–็ ๅŽ็š„ๅญ—็ฌฆไธฒ. */ public String encodeString(String str, int begin) { if (begin > 0) { str = str.substring(begin); this.totalIndex = begin; } else { this.totalIndex = 0; } Reader in = new StringReader(str); Writer out = StringTool.createWriter(str.length() + 32); try { this.encode(in, out); } catch (IOException ex) { // ่ฟ™้‡ŒไธไผšๆŠ›ๅ‡บ่ฟ™ไธชๅผ‚ๅธธ throw new IllegalStateException(ex.getMessage()); } return out.toString(); } /** * ๅฏนไธ€ไธชๅญ—็ฌฆไธฒ่ฟ›่กŒ่งฃ็ ๅค„็†, ๅนถ่ฟ”ๅ›ž็ผ–็ ๅŽ็š„ๅญ—็ฌฆไธฒ. */ public String decodeString(String str) { return this.decodeString(str, 0); } /** * ไปŽๆŒ‡ๅฎšไฝ็ฝฎๅผ€ๅง‹, ๅฏนไธ€ไธชๅญ—็ฌฆไธฒ่ฟ›่กŒ่งฃ็ ๅค„็†, ๅนถ่ฟ”ๅ›ž็ผ–็ ๅŽ็š„ๅญ—็ฌฆไธฒ. */ public String decodeString(String str, int begin) { if (begin > 0) { str = str.substring(begin); this.totalIndex = begin; } else { this.totalIndex = 0; } Reader in = new StringReader(str); Writer out = StringTool.createWriter(str.length()); try { this.decode(in, out); } catch (IOException ex) { // ่ฟ™้‡ŒไธไผšๆŠ›ๅ‡บ่ฟ™ไธชๅผ‚ๅธธ throw new IllegalStateException(ex.getMessage()); } return out.toString(); } /** * ๅฏนๅญ—็ฌฆๆต่ฟ›่กŒ็ผ–็ ๅค„็†. */ public void encode(Reader in, Writer out) throws IOException { try { this.dealChars(in, out, false); } catch (RuntimeException ex) { if (ex == BREAK_FLAG) { this.flush(out); } else { throw ex; } } } /** * ๅฏนๅญ—็ฌฆๆต่ฟ›่กŒ่งฃ็ ๅค„็†. */ public void decode(Reader in, Writer out) throws IOException { try { this.dealChars(in, out, true); } catch (RuntimeException ex) { if (ex == BREAK_FLAG) { this.flush(out); } else { throw ex; } } } /** * ๅฏนๅญ—็ฌฆๆต่ฟ›่กŒๅค„็†. */ protected void dealChars(Reader in, Writer out, boolean doDecode) throws IOException { int tmpCount = in.read(this.charBuf); this.charCount = tmpCount; this.charIndex = 0; while (tmpCount >= 0) { if (tmpCount > 0) { if (doDecode) { this.decodeChar(out, this.charBuf[this.charIndex]); } else { this.encodeChar(out, this.charBuf[this.charIndex]); } this.totalIndex++; this.charIndex++; } if (this.charIndex >= this.charCount - this.bufSize) { int beginIndex = this.charIndex - this.bufSize; if (beginIndex > 0) { this.charIndex = this.bufSize; } else { // ๅ‰้ƒจ็ผ“ๅญ˜็š„ไธชๆ•ฐไธๅคŸ, ไธๆ›ดๆ–ฐๅญ—็ฌฆ็ดขๅผ• beginIndex = 0; } int length = this.charCount - beginIndex; if (length > 0) { System.arraycopy(this.charBuf, beginIndex, this.charBuf, 0, length); } tmpCount = in.read(this.charBuf, length, this.charBuf.length - length); this.charCount = (tmpCount > 0 ? tmpCount : 0) + length; } } for (; this.charIndex < this.charCount; this.charIndex++, this.totalIndex++) { if (doDecode) { this.decodeChar(out, this.charBuf[this.charIndex]); } else { this.encodeChar(out, this.charBuf[this.charIndex]); } } this.flush(out); } /** * ๅฏนไธ€ไธชๅญ—็ฌฆ่ฟ›่กŒ็ผ–็ ๅค„็†. */ protected void encodeChar(Writer out, char c) throws IOException { if (c == this.escapeChar || !this.validChars.get(c)) { this.writeChars(this.encodeChar(c), out, false); } else { this.writeChar(c, out, false); } } /** * ๅฏนไธ€ไธชๅญ—็ฌฆ่ฟ›่กŒ่งฃ็ ๅค„็†. */ protected void decodeChar(Writer out, char c) throws IOException { if (c == this.escapeChar) { this.writeChar(this.decodeChar(c), out, false); } else { this.writeChar(c, out, false); } } /** * ๅฏนไธ€ไธชๅญ—็ฌฆไฝฟ็”จ่ฝฌไน‰็ฌฆ่ฟ›่กŒ็ผ–็ . */ protected char[] encodeChar(char c) { if (c <= 0xff) { char[] buf = new char[4]; buf[0] = this.escapeChar; buf[1] = HEX_NUMS[(c >> 6) & 0x3]; buf[2] = HEX_NUMS[(c >> 3) & 0x7]; buf[3] = HEX_NUMS[c & 0x7]; return buf; } else { char[] buf = new char[6]; buf[0] = this.escapeChar; buf[1] = 'u'; buf[2] = HEX_NUMS[(c >> 12) & 0xf]; buf[3] = HEX_NUMS[(c >> 8) & 0xf]; buf[4] = HEX_NUMS[(c >> 4) & 0xf]; buf[5] = HEX_NUMS[c & 0xf]; return buf; } } /** * ๅฏนไธ€ไธช่ฝฌไน‰็ฌฆ่ฟ›่กŒ่งฃ็ . */ protected char decodeChar(char c) { int next = this.getChar(1, true); if (next == 'u') { int num = this.hexChar2Num(this.getChar(2, true)) << 12; num |= this.hexChar2Num(this.getChar(3, true)) << 8; num |= this.hexChar2Num(this.getChar(4, true)) << 4; num |= this.hexChar2Num(this.getChar(5, true)); // ๅค–ๅฑ‚ๅพช็Žฏ่ฟ˜ไผšๅŠ 1, ๆ‰€ไปฅ่ฟ™้‡Œ่ทณ่ฟ‡็š„ๅญ—็ฌฆ้œ€่ฆๅ‡1 this.skipChars(6 - 1); return (char) num; } else if (next >= '0' && next <= '7') { int num = this.hexChar2Num(next); int leftCount = 1; if (next <= '3' && next >= '0') { leftCount = 2; } int index = 2; while (leftCount > 0) { int tmp = this.getChar(index, false); if (tmp >= '0' && tmp <= '7') { num = (num << 3) | this.hexChar2Num(tmp); leftCount--; index++; } else { break; } } // ๅค–ๅฑ‚ๅพช็Žฏ่ฟ˜ไผšๅŠ 1, ๆ‰€ไปฅ่ฟ™้‡Œ่ทณ่ฟ‡็š„ๅญ—็ฌฆ้œ€่ฆๅ‡1 this.skipChars(index - 1); return (char) num; } else { this.skipChars(1); switch (next) { case 't': return '\t'; case 'f': return '\f'; case 'r': return '\r'; case 'n': return '\n'; case 'b': return '\b'; case '\\': return '\\'; case '\'': return '\''; case '\"': return '\"'; default: return (char) next; } } } /** * ๅฐ†16่ฟ›ๅˆถๅญ—็ฌฆ่ฝฌๆขๆˆๆ•ฐๅญ—. */ protected int hexChar2Num(int c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } throw new IllegalArgumentException("Error hex char [" + c + "]."); } /** * ่ทณ่ฟ‡ๆŒ‡ๅฎšไธชๆ•ฐ็š„ๅญ—็ฌฆ. */ protected boolean skipChars(int count) { if (count < 0 || count + this.charIndex >= this.charCount) { throw new IllegalArgumentException("Error skip count [" + count + "]."); } if (count > 0) { this.charIndex += count; this.totalIndex += count; } return true; } /** * ่Žทๅ–ไธ€ไธชๅญ—็ฌฆ. * * @param index ๅญ—็ฌฆๆ‰€ๅœจ็š„็ดขๅผ•ๅ€ผ * 0 ่กจ็คบ่Žทๅ–ๅฝ“ๅ‰ๅญ—็ฌฆ * ๆญฃๆ•ฐ ่กจ็คบ่Žทๅ–ไน‹ๅŽ็š„ๅญ—็ฌฆ * ่ดŸๆ•ฐ ่กจ็คบ่Žทๅ–ไน‹ๅ‰็š„ๅญ—็ฌฆ * @param checkBound ๆ˜ฏๅฆ้œ€่ฆๆฃ€ๆŸฅ่ถŠ็•Œ * @return ๆŒ‡ๅฎšไฝ็ฝฎ็š„ๅญ—็ฌฆ, -1 ่กจ็คบๅทฒ่ถ…ๅ‡บ่Œƒๅ›ด * @throws IllegalArgumentException ็ดขๅผ•ๅ€ผ่ถ…ๅ‡บ็ผ“ๅญ˜็š„ๅคงๅฐ */ protected int getChar(int index, boolean checkBound) throws IllegalArgumentException { if (Math.abs(index) > this.bufSize) { throw new IllegalArgumentException( "Error index [" + index + "] for buf size [" + this.bufSize + "]."); } int pos = index + this.charIndex; if (pos < 0 || pos >= this.charCount) { if (checkBound) { throw new IllegalStateException("Not found char in [" + index + "]."); } return -1; } return this.charBuf[pos]; } /** * ๅ†™ๅ…ฅไธ€ไธชๅญ—็ฌฆ. * * @param c ้œ€่ฆๅ†™ๅ…ฅ็š„ๅญ—็ฌฆ * @param out ๅญ—็ฌฆ็š„่พ“ๅ‡บๆต * @param flush ๆ˜ฏๅฆ้œ€่ฆๅฐ†็ผ“ๅญ˜็š„ๆ•ฐๆฎๅ…จ้ƒจๅˆทๅˆฐ่พ“ๅ‡บๆตไธญ */ protected void writeChar(char c, Writer out, boolean flush) throws IOException { if (1 + this.outIndex > this.outBuf.length) { out.write(this.outBuf, 0, this.outIndex); this.outIndex = 0; } this.outBuf[this.outIndex++] = c; if (flush) { this.flush(out); } } /** * ๅ†™ๅ…ฅไธ€ๆ‰นๅญ—็ฌฆ. * * @param chars ้œ€่ฆๅ†™ๅ…ฅ็š„ๅญ—็ฌฆๆ•ฐ็ป„ * @param out ๅญ—็ฌฆ็š„่พ“ๅ‡บๆต * @param flush ๆ˜ฏๅฆ้œ€่ฆๅฐ†็ผ“ๅญ˜็š„ๆ•ฐๆฎๅ…จ้ƒจๅˆทๅˆฐ่พ“ๅ‡บๆตไธญ */ protected void writeChars(char[] chars, Writer out, boolean flush) throws IOException { if (chars.length > this.outBuf.length) { if (this.outIndex > 0) { out.write(this.outBuf, 0, this.outIndex); this.outIndex = 0; } out.write(chars); if (flush) { out.flush(); } return; } if (chars.length + this.outIndex > this.outBuf.length) { out.write(this.outBuf, 0, this.outIndex); this.outIndex = 0; } System.arraycopy(chars, 0, this.outBuf, this.outIndex, chars.length); this.outIndex += chars.length; if (flush) { this.flush(out); } } protected void flush(Writer out) throws IOException { if (this.outIndex > 0) { out.write(this.outBuf, 0, this.outIndex); this.outIndex = 0; } out.flush(); } }
[ "micromagic@sina.com" ]
micromagic@sina.com
11ee04dcc75f2f0b2f5eeb00fe5431e3a81dcbca
3288027cb7fd455c614fc4a9d0c39d42565b995f
/src/main/java/com/rams/backend/controllers/TestController.java
cb5cb0f1fc2562ca7c4845da3e12cdb894830d65
[]
no_license
nhanspy/RAMS_BackEnd
b8f84e76492d9f10310b0fa222d590ae1764d335
e581eeceb80687c27e05f82c1c02dc78b21e6d44
refs/heads/main
2023-05-30T00:55:31.106155
2021-06-16T05:55:33
2021-06-16T05:55:33
352,842,022
0
0
null
2021-06-06T05:09:35
2021-03-30T02:08:56
Java
UTF-8
Java
false
false
1,027
java
package com.rams.backend.controllers; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @CrossOrigin(origins = "*", maxAge = 3600) @RestController @RequestMapping("/api/test") public class TestController { @GetMapping("/all") public String allAccess() { return "Public Content."; } @GetMapping("/user") @PreAuthorize("hasRole('USER') or hasRole('MODERATOR') or hasRole('ADMIN')") public String userAccess() { return "User Content."; } @GetMapping("/mod") @PreAuthorize("hasRole('MODERATOR')") public String moderatorAccess() { return "Moderator Board."; } @GetMapping("/admin") @PreAuthorize("hasRole('ADMIN')") public String adminAccess() { return "Admin Board."; } }
[ "nhan0095@gmail.com" ]
nhan0095@gmail.com
d54357c565dc097a60bcdfa71e9cd37380f06f9e
d98b039c6ad4cac02e74efaa2a2734fd8c6ea078
/app/src/main/java/in/komu/komu/Utils/ContestItemListAdapter.java
444e7c05a96d4485ffed2e98c383b6f6a06b581c
[]
no_license
VN0/Bingle
e1d6c3ebe2b687b12c9aeb18c58a00b3838e9dff
eeb3c49404f4b98b88a41e09dcac4afe4ce4d477
refs/heads/master
2021-05-26T20:41:51.807505
2020-03-14T05:39:04
2020-03-14T05:39:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,202
java
package in.komu.komu.Utils; import android.content.Context; import android.support.annotation.LayoutRes; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.request.RequestOptions; import java.util.ArrayList; import java.util.List; import in.komu.komu.Models.ContestDescription; import in.komu.komu.R; import in.komu.komu.share.NextActivity; public class ContestItemListAdapter extends ArrayAdapter<ContestDescription> { private static final String TAG = "ContestItemListAdapter"; private LayoutInflater mInflater; private int layoutResource; private Context mContext; public ContestItemListAdapter(@NonNull Context context, @LayoutRes int resource, List<ContestDescription> objects) { super(context, resource, objects); mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mContext = context; layoutResource = resource; } private static class ViewHolder{ TextView category, rewards, startDate, endDate; SquareImageView contestImage; } @NonNull @Override public View getView(final int position, @Nullable View convertView, @NonNull ViewGroup parent) { final ViewHolder holder; if(convertView == null){ convertView = mInflater.inflate(layoutResource, parent, false); holder = new ViewHolder(); // holder.category = (TextView) convertView.findViewById(R.id.category); holder.rewards = (TextView) convertView.findViewById(R.id.reward); holder.startDate = (TextView) convertView.findViewById(R.id.startDate); holder.endDate = (TextView) convertView.findViewById(R.id.endDate); holder.contestImage = (SquareImageView) convertView.findViewById(R.id.contestImage); convertView.setTag(holder); }else{ holder = (ViewHolder) convertView.getTag(); } ContestDescription description = getItem(position); Toast.makeText(mContext, "items "+ description, Toast.LENGTH_SHORT).show(); //set the comment holder.category.setText(description.getCategory()); holder.startDate.setText(description.getStart_date()); holder.endDate.setText(description.getEnd_date()); holder.rewards.setText(description.getReward()); Glide.with(getContext()) .load(mContext.getResources() .getIdentifier(description.getCover_image().replace("R.drawable.", ""), "drawable", mContext.getPackageName())) .apply(new RequestOptions() .placeholder(R.drawable.loading_image) .diskCacheStrategy(DiskCacheStrategy.ALL) .centerCrop() ) .into(holder.contestImage); return convertView; } }
[ "shrdprk34@gmail.com" ]
shrdprk34@gmail.com
ee83d7960c722421b820e4bdcce7c6410901cb43
aafd0979aa68e830ec90eb3502e7ce8dfce6c028
/app/src/main/java/com/cgwx/yyfwptz/lixiang/AQBP/view/activity/ProcessActivity.java
66bb46429d9e5b02b5755d5d82e64f9845c010f3
[]
no_license
lixxxiang/AQBP
23a8355ce3ad51fc6d818a494e72ae38b880553f
7b51126f687e5e75bcb6f5567c6fb4b72fdfe791
refs/heads/master
2021-01-22T21:07:24.997433
2017-08-18T06:36:32
2017-08-18T06:36:32
100,681,133
0
0
null
null
null
null
UTF-8
Java
false
false
22,486
java
package com.cgwx.yyfwptz.lixiang.AQBP.view.activity; import android.Manifest; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Color; import android.net.Uri; import android.os.Build; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.Window; import android.widget.AdapterView; import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.baidu.location.BDLocation; import com.baidu.location.BDLocationListener; import com.baidu.location.LocationClient; import com.baidu.location.LocationClientOption; import com.baidu.location.Poi; import com.baidu.mapapi.SDKInitializer; import com.baidu.mapapi.map.BaiduMap; import com.baidu.mapapi.map.BitmapDescriptor; import com.baidu.mapapi.map.BitmapDescriptorFactory; import com.baidu.mapapi.map.InfoWindow; import com.baidu.mapapi.map.MapStatus; import com.baidu.mapapi.map.MapStatusUpdate; import com.baidu.mapapi.map.MapStatusUpdateFactory; import com.baidu.mapapi.map.MapView; import com.baidu.mapapi.map.Marker; import com.baidu.mapapi.map.MarkerOptions; import com.baidu.mapapi.map.MyLocationConfiguration; import com.baidu.mapapi.map.MyLocationData; import com.baidu.mapapi.map.UiSettings; import com.baidu.mapapi.model.LatLng; import com.baidu.mapapi.navi.BaiduMapAppNotSupportNaviException; import com.baidu.mapapi.navi.BaiduMapNavigation; import com.baidu.mapapi.navi.NaviParaOption; import com.baidu.mapapi.search.core.RouteLine; import com.baidu.mapapi.search.core.SearchResult; import com.baidu.mapapi.search.route.BikingRouteResult; import com.baidu.mapapi.search.route.DrivingRouteResult; import com.baidu.mapapi.search.route.IndoorRouteResult; import com.baidu.mapapi.search.route.MassTransitRouteResult; import com.baidu.mapapi.search.route.OnGetRoutePlanResultListener; import com.baidu.mapapi.search.route.PlanNode; import com.baidu.mapapi.search.route.RoutePlanSearch; import com.baidu.mapapi.search.route.TransitRouteResult; import com.baidu.mapapi.search.route.WalkingRoutePlanOption; import com.baidu.mapapi.search.route.WalkingRouteResult; import com.baidu.mapapi.utils.OpenClientUtil; import com.cgwx.yyfwptz.lixiang.AQBP.R; import com.cgwx.yyfwptz.lixiang.AQBP.di.components.DaggerProcessComponent; import com.cgwx.yyfwptz.lixiang.AQBP.di.modules.ProcessModule; import com.cgwx.yyfwptz.lixiang.AQBP.model.entity.MyOrientationListener; import com.cgwx.yyfwptz.lixiang.AQBP.model.entity.OverlayManager; import com.cgwx.yyfwptz.lixiang.AQBP.model.entity.RouteLineAdapter; import com.cgwx.yyfwptz.lixiang.AQBP.model.entity.WalkingRouteOverlay; import com.cgwx.yyfwptz.lixiang.AQBP.presenter.ProcessContract; import com.cgwx.yyfwptz.lixiang.AQBP.presenter.ProcessPresenter; import com.githang.statusbar.StatusBarCompat; import com.google.gson.Gson; import java.util.List; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; import okhttp3.OkHttpClient; public class ProcessActivity extends AppCompatActivity implements OnGetRoutePlanResultListener, ProcessContract.View { @Inject ProcessPresenter presenter; @BindView(R.id.navi) Button navi; @BindView(R.id.donePo) Button donePo; @BindView(R.id.call) ImageView call; @BindView(R.id.poi) TextView poi; @BindView(R.id.address) TextView address; @BindView(R.id.distance) TextView distance; @BindView(R.id.mOrkm) TextView mOrkm; public static boolean index = false; boolean isFirstLoc = true; BitmapDescriptor start; BitmapDescriptor end; String infos[]; String reserved[]; private Marker mMarkerA; private Marker mMarkerB; int nodeIndex = -1; RouteLine route = null; OverlayManager routeOverlay = null; boolean useDefaultIcon = true; RoutePlanSearch mSearch = null; WalkingRouteResult nowResultwalk = null; private MapView mMapView = null; private BaiduMap mBaiduMap; private LocationClient mlocationClient; private MylocationListener mlistener; private Context context; private double mLatitude; private double mLongitude; private float mCurrentX; private BitmapDescriptor mIconLocation; private MyOrientationListener myOrientationListener; private MyLocationConfiguration.LocationMode locationMode; public static ProcessActivity pa; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SDKInitializer.initialize(getApplicationContext()); setContentView(R.layout.activity_process); StatusBarCompat.setStatusBarColor(this, Color.parseColor("#FFFFFF")); pa = this; ButterKnife.bind(this); DaggerProcessComponent.builder().processModule(new ProcessModule(this)) .build() .inject(this); this.context = this; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // Android M Permission check if (this.checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 1); } } call.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + infos[9])); startActivity(intent); } }); start = BitmapDescriptorFactory.fromResource(R.drawable.start); end = BitmapDescriptorFactory.fromResource(R.drawable.end); donePo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String policeid = ""; String alarmid = ""; if (infos == null) { policeid = reserved[8]; alarmid = reserved[7]; } else { policeid = infos[8]; alarmid = infos[7]; } presenter.completeAlarm(policeid, alarmid); } }); navi.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LatLng pt1; LatLng pt2; if (reserved == null) { System.out.println("this"); pt1 = new LatLng(Double.valueOf(infos[0]), Double.valueOf(infos[1])); pt2 = new LatLng(Double.valueOf(infos[2]), Double.valueOf(infos[3])); } else { System.out.println("that"); pt1 = new LatLng(Double.valueOf(reserved[0]), Double.valueOf(reserved[1])); pt2 = new LatLng(Double.valueOf(reserved[2]), Double.valueOf(reserved[3])); } NaviParaOption para = new NaviParaOption() .startPoint(pt2).endPoint(pt1) .startName("ๅคฉๅฎ‰้—จ").endName("็™พๅบฆๅคงๅŽฆ"); try { BaiduMapNavigation.openBaiduMapWalkNavi(para, ProcessActivity.this); } catch (BaiduMapAppNotSupportNaviException e) { e.printStackTrace(); showDialog(); // Toast.makeText(ProcessActivity.this, "ๆ‚จๅฐšๆœชๅฎ‰่ฃ…็™พๅบฆๅœฐๅ›พappๆˆ–app็‰ˆๆœฌ่ฟ‡ไฝŽ", Toast.LENGTH_SHORT).show(); } } }); initView(); initLocation(); Intent intent = getIntent(); Bundle bundle = intent.getExtras(); reserved = bundle.getStringArray("reserved"); infos = bundle.getStringArray("infos"); if (infos == null) { for (int i = 0; i < reserved.length; i++) Log.e("dddd", reserved[i]); initOverlay(reserved[0], reserved[1], reserved[2], reserved[3]); if (Double.valueOf(reserved[6]) > 1000) { distance.setText("" + Double.valueOf(reserved[6]) / 1000); mOrkm.setText("ๅƒ็ฑณ"); } else { distance.setText(reserved[6]); mOrkm.setText("็ฑณ"); } poi.setText(reserved[4]); String shortAddress = reserved[5]; if (reserved[5].contains("่‡ชๆฒปๅŒบ")) shortAddress = reserved[5].substring(reserved[5].indexOf("่‡ชๆฒปๅŒบ") + 1, reserved[5].length()); address.setText(" " + shortAddress); mSearch = RoutePlanSearch.newInstance(); mSearch.setOnGetRoutePlanResultListener(this); PlanNode stNode = PlanNode.withLocation(new LatLng(Double.valueOf(reserved[0]), Double.valueOf(reserved[1]))); PlanNode enNode = PlanNode.withLocation(new LatLng(Double.valueOf(reserved[2]), Double.valueOf(reserved[3]))); mSearch.walkingSearch((new WalkingRoutePlanOption()) .from(stNode).to(enNode)); } else { for (int i = 0; i < infos.length; i++) Log.e("dddd", infos[i]); initOverlay(infos[0], infos[1], infos[2], infos[3]); if (Double.valueOf(infos[6]) > 1000) { distance.setText("" + Double.valueOf(infos[6]) / 1000); mOrkm.setText("ๅƒ็ฑณ"); } else { distance.setText(infos[6]); mOrkm.setText("็ฑณ"); } poi.setText(infos[4]); String shortAddress = infos[5]; if (infos[5].contains("่‡ชๆฒปๅŒบ")) shortAddress = infos[5].substring(infos[5].indexOf("่‡ชๆฒปๅŒบ") + 1, infos[5].length()); address.setText(shortAddress); mSearch = RoutePlanSearch.newInstance(); mSearch.setOnGetRoutePlanResultListener(this); PlanNode stNode = PlanNode.withLocation(new LatLng(Double.valueOf(infos[0]), Double.valueOf(infos[1]))); PlanNode enNode = PlanNode.withLocation(new LatLng(Double.valueOf(infos[2]), Double.valueOf(infos[3]))); mSearch.walkingSearch((new WalkingRoutePlanOption()) .from(stNode).to(enNode)); } } private void initView() { mMapView = (MapView) findViewById(R.id.bmapView); mBaiduMap = mMapView.getMap(); MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(15.0f); mBaiduMap.setMapStatus(msu); getMyLocation(); mMapView.showScaleControl(false); mMapView.showZoomControls(false); } public void getMyLocation() { LatLng latLng = new LatLng(mLatitude, mLongitude); MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng); mBaiduMap.setMapStatus(msu); } @Override public void completeAlarmSuccess() { finish(); index = true; } public class MylocationListener implements BDLocationListener { private boolean isFirstIn = true; @Override public void onReceiveLocation(BDLocation bdLocation) { mLatitude = bdLocation.getLatitude(); mLongitude = bdLocation.getLongitude(); MyLocationData data = new MyLocationData.Builder() .direction(mCurrentX) .accuracy(bdLocation.getRadius()) .latitude(mLatitude) .longitude(mLongitude) .build(); mBaiduMap.setMyLocationData(data); MyLocationConfiguration configuration = new MyLocationConfiguration(locationMode, true, mIconLocation); mBaiduMap.setMyLocationConfigeration(configuration); if (isFirstIn) { LatLng latLng = new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude()); MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng); mBaiduMap.setMapStatus(msu); isFirstIn = false; } } } @Override protected void onStart() { super.onStart(); mBaiduMap.setMyLocationEnabled(true); if (!mlocationClient.isStarted()) { mlocationClient.start(); } myOrientationListener.start(); } @Override protected void onStop() { super.onStop(); mBaiduMap.setMyLocationEnabled(false); mlocationClient.stop(); myOrientationListener.stop(); } private void initLocation() { locationMode = MyLocationConfiguration.LocationMode.NORMAL; mlocationClient = new LocationClient(this); mlistener = new MylocationListener(); mlocationClient.registerLocationListener(mlistener); LocationClientOption mOption = new LocationClientOption(); mOption.setCoorType("bd09ll"); mOption.setIsNeedAddress(true); mOption.setOpenGps(true); int span = 1000; mOption.setScanSpan(span); mlocationClient.setLocOption(mOption); mIconLocation = BitmapDescriptorFactory .fromResource(R.drawable.move); myOrientationListener = new MyOrientationListener(context); myOrientationListener.setOnOrientationListener(new MyOrientationListener.OnOrientationListener() { @Override public void onOrientationChanged(float x) { mCurrentX = x; } }); } public void showDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("ๆ‚จๅฐšๆœชๅฎ‰่ฃ…็™พๅบฆๅœฐๅ›พappๆˆ–app็‰ˆๆœฌ่ฟ‡ไฝŽ๏ผŒ็‚นๅ‡ป็กฎ่ฎคๅฎ‰่ฃ…๏ผŸ"); builder.setTitle("ๆ็คบ"); builder.setPositiveButton("็กฎ่ฎค", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); OpenClientUtil.getLatestBaiduMapApp(ProcessActivity.this); } }); builder.setNegativeButton("ๅ–ๆถˆ", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); } public void initOverlay(String sa, String so, String ea, String eo) { LatLng startPo = new LatLng(Double.valueOf(sa), Double.valueOf(so)); LatLng endPo = new LatLng(Double.valueOf(ea), Double.valueOf(eo)); MarkerOptions startMarkerOptions = new MarkerOptions().position(startPo).icon(start) .zIndex(9).draggable(true); MarkerOptions endMarkerOptions = new MarkerOptions().position(endPo).icon(end) .zIndex(9).draggable(true); mMarkerA = (Marker) (mBaiduMap.addOverlay(startMarkerOptions)); mMarkerB = (Marker) (mBaiduMap.addOverlay(endMarkerOptions)); mBaiduMap.setOnMarkerDragListener(new BaiduMap.OnMarkerDragListener() { public void onMarkerDrag(Marker marker) { } public void onMarkerDragEnd(Marker marker) { Toast.makeText( ProcessActivity.this, "ๆ‹–ๆ‹ฝ็ป“ๆŸ๏ผŒๆ–ฐไฝ็ฝฎ๏ผš" + marker.getPosition().latitude + ", " + marker.getPosition().longitude, Toast.LENGTH_LONG).show(); } public void onMarkerDragStart(Marker marker) { } }); } @Override public void onGetWalkingRouteResult(WalkingRouteResult result) { if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) { Toast.makeText(ProcessActivity.this, "ๆŠฑๆญ‰๏ผŒๆœชๆ‰พๅˆฐ็ป“ๆžœ", Toast.LENGTH_SHORT).show(); } if (result.error == SearchResult.ERRORNO.AMBIGUOUS_ROURE_ADDR) { return; } if (result.error == SearchResult.ERRORNO.NO_ERROR) { nodeIndex = -1; if (result.getRouteLines().size() > 1) { nowResultwalk = result; MyTransitDlg myTransitDlg = new MyTransitDlg(ProcessActivity.this, result.getRouteLines(), RouteLineAdapter.Type.WALKING_ROUTE); myTransitDlg.setOnItemInDlgClickLinster(new OnItemInDlgClickListener() { public void onItemClick(int position) { route = nowResultwalk.getRouteLines().get(position); WalkingRouteOverlay overlay = new MyWalkingRouteOverlay(mBaiduMap); mBaiduMap.setOnMarkerClickListener(overlay); routeOverlay = overlay; overlay.setData(nowResultwalk.getRouteLines().get(position)); overlay.addToMap(); overlay.zoomToSpan(); } }); myTransitDlg.show(); } else if (result.getRouteLines().size() == 1) { // ็›ดๆŽฅๆ˜พ็คบ route = result.getRouteLines().get(0); WalkingRouteOverlay overlay = new MyWalkingRouteOverlay(mBaiduMap); mBaiduMap.setOnMarkerClickListener(overlay); routeOverlay = overlay; overlay.setData(result.getRouteLines().get(0)); overlay.addToMap(); overlay.zoomToSpan(); } else { Log.d("route result", "็ป“ๆžœๆ•ฐ<0"); return; } } } @Override public void onGetTransitRouteResult(TransitRouteResult transitRouteResult) { } @Override public void onGetMassTransitRouteResult(MassTransitRouteResult massTransitRouteResult) { } @Override public void onGetDrivingRouteResult(DrivingRouteResult drivingRouteResult) { } @Override public void onGetIndoorRouteResult(IndoorRouteResult indoorRouteResult) { } @Override public void onGetBikingRouteResult(BikingRouteResult bikingRouteResult) { } public class MyLocationListenner implements BDLocationListener { public double lati; public double longi; public String address; List<Poi> poi; @Override public void onReceiveLocation(BDLocation location) { // map view ้”€ๆฏๅŽไธๅœจๅค„็†ๆ–ฐๆŽฅๆ”ถ็š„ไฝ็ฝฎ if (location == null || mMapView == null) { return; } MyLocationData locData = new MyLocationData.Builder() .accuracy(0) .direction(0).latitude(location.getLatitude()) .longitude(location.getLongitude()).build(); lati = location.getLatitude(); longi = location.getLongitude(); address = location.getAddrStr(); poi = location.getPoiList(); mBaiduMap.setMyLocationData(locData); if (isFirstLoc) { isFirstLoc = false; LatLng ll = new LatLng(location.getLatitude(), location.getLongitude()); MapStatus.Builder builder = new MapStatus.Builder(); builder.target(ll).zoom(18.0f); mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); } } } private class MyWalkingRouteOverlay extends WalkingRouteOverlay { public MyWalkingRouteOverlay(BaiduMap baiduMap) { super(baiduMap); } @Override public BitmapDescriptor getStartMarker() { if (useDefaultIcon) { return BitmapDescriptorFactory.fromResource(R.drawable.start); } return null; } @Override public BitmapDescriptor getTerminalMarker() { if (useDefaultIcon) { return BitmapDescriptorFactory.fromResource(R.drawable.end); } return null; } } interface OnItemInDlgClickListener { public void onItemClick(int position); } // ไพ›่ทฏ็บฟ้€‰ๆ‹ฉ็š„Dialog class MyTransitDlg extends Dialog { private List<? extends RouteLine> mtransitRouteLines; private ListView transitRouteList; private RouteLineAdapter mTransitAdapter; OnItemInDlgClickListener onItemInDlgClickListener; public MyTransitDlg(Context context, int theme) { super(context, theme); } public MyTransitDlg(Context context, List<? extends RouteLine> transitRouteLines, RouteLineAdapter.Type type) { this(context, 0); mtransitRouteLines = transitRouteLines; mTransitAdapter = new RouteLineAdapter(context, mtransitRouteLines, type); requestWindowFeature(Window.FEATURE_NO_TITLE); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_transit_dialog); transitRouteList = (ListView) findViewById(R.id.transitList); transitRouteList.setAdapter(mTransitAdapter); transitRouteList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { onItemInDlgClickListener.onItemClick(position); dismiss(); } }); } public void setOnItemInDlgClickLinster(OnItemInDlgClickListener itemListener) { onItemInDlgClickListener = itemListener; } } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) { Toast.makeText(getApplicationContext(), "่ฏทไธ่ฆ้€€ๅ‡บ่ฏฅ้กต้ข๏ผŒ่‹ฅๆŽฅ่ญฆๅฎŒๆˆ๏ผŒ่ฏท็‚นๅ‡ปโ€œๅฎŒๆˆๆœฌๆฌกๅ‡บ่ญฆโ€่ฟ”ๅ›žใ€‚", Toast.LENGTH_SHORT).show(); return true; } return super.onKeyDown(keyCode, event); } }
[ "13051744716@163.com" ]
13051744716@163.com
20e8a9ea6abf36c5750e9915fbb79d3665b64922
011fef4695dbd44c60acc730fc7dbafe110ca7f1
/src/main/java/fi/vaasa/dnguyen/repository/AuthorityRepository.java
f940be3abf2d703c82928efb91a02c8e359c1763
[]
no_license
duy0611/jhipster_gravahal_game
439dc824863f0771efbfda42e67418f8d1797652
5b4df1a5cf0317b2806ed1ac82189961ab23f01b
refs/heads/master
2021-01-18T23:30:24.011494
2016-07-29T21:51:37
2016-07-29T21:51:37
39,862,396
1
0
null
null
null
null
UTF-8
Java
false
false
289
java
package fi.vaasa.dnguyen.repository; import fi.vaasa.dnguyen.domain.Authority; import org.springframework.data.jpa.repository.JpaRepository; /** * Spring Data JPA repository for the Authority entity. */ public interface AuthorityRepository extends JpaRepository<Authority, String> { }
[ "yourfriends1988@gmail.com" ]
yourfriends1988@gmail.com
56dc9b8d19884be2765ac8476a223669538a33dd
cf6774acb497b6152be257027f5555810b0df441
/Yummy Nepali Kitchen/app/src/main/java/com/deepak/yummynepalikitchen/Fragments/CartFragment.java
270e077911586346863005a8fa68312b3942d00a
[]
no_license
deepakgyawali/Android-App-Online-Food-Order
49639548764afaed460e468609c49f183f7a3d04
4fb927d30741dc0cc72c8dd9522f941c619817ab
refs/heads/master
2020-03-13T00:12:35.969790
2018-04-24T16:56:45
2018-04-24T16:56:45
130,638,093
0
0
null
null
null
null
UTF-8
Java
false
false
10,302
java
package com.deepak.yummynepalikitchen.Fragments; import android.content.SharedPreferences; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.amigold.fundapter.BindDictionary; import com.amigold.fundapter.FunDapter; import com.amigold.fundapter.extractors.StringExtractor; import com.amigold.fundapter.interfaces.DynamicImageLoader; import com.amigold.fundapter.interfaces.ItemClickListener; import com.kosalgeek.android.json.JsonConverter; import com.kosalgeek.genasync12.AsyncResponse; import com.kosalgeek.genasync12.PostResponseAsyncTask; import com.nostra13.universalimageloader.core.ImageLoader; import com.deepak.yummynepalikitchen.Interfaces.Cart; import com.deepak.yummynepalikitchen.Interfaces.UILConfig; import com.deepak.yummynepalikitchen.R; import java.util.ArrayList; import java.util.HashMap; /** * A simple {@link Fragment} subclass. */ /* * Created by www.deepakgyawali.com.np on 28/11/2017. */ public class CartFragment extends Fragment implements AdapterView.OnItemClickListener, AsyncResponse{ public static final String PREFS = "prefFile"; final String LOG = "CartFragment"; final static String url = "http://www.deepakgyawali.com.np/db_con/cart_retrieve.php"; View view; /* * Created by www.deepakgyawali.com.np on 28/11/2017. */ private ArrayList<Cart> itemList; private ListView lv; FunDapter<Cart> adapter; Button btnCheckout; public CartFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment view = inflater.inflate(R.layout.fragment_cart, container, false); ImageLoader.getInstance().init(UILConfig.config(CartFragment.this.getActivity())); btnCheckout = (Button)view.findViewById(R.id.btnCheckout); SharedPreferences preferences = CartFragment.this.getActivity().getSharedPreferences(PREFS, 0); String customer = preferences.getString("username", null); HashMap postData = new HashMap(); postData.put("txtUsername", customer); PostResponseAsyncTask taskRead = new PostResponseAsyncTask(CartFragment.this.getActivity(), postData, this); taskRead.execute(url); return view; } @Override public void processFinish(String s) { itemList = new JsonConverter<Cart>().toArrayList(s, Cart.class); BindDictionary dic = new BindDictionary(); dic.addStringField(R.id.tvName, new StringExtractor<Cart>() { @Override public String getStringValue(Cart item, int position) { return item.orderName; } }); dic.addStringField(R.id.tvDesc, new StringExtractor<Cart>() { @Override public String getStringValue(Cart item, int position) { return item.description; } }).visibilityIfNull(View.GONE); dic.addStringField(R.id.edQty, new StringExtractor<Cart>() { @Override public String getStringValue(Cart item, int position) { return ""+ item.quantity; } }); dic.addStringField(R.id.tvPrice, new StringExtractor<Cart>() { @Override public String getStringValue(Cart item, int position) { double price = item.price; int qty = item.quantity; price = price * qty; String s = String.format("%.2f",price); return s; } }); dic.addDynamicImageField(R.id.ivImage, new StringExtractor<Cart>() { @Override public String getStringValue(Cart item, int position) { return item.img_url; } }, new DynamicImageLoader() { @Override public void loadImage(String url, ImageView img) { //Set image ImageLoader.getInstance().displayImage(url, img); } }); //Remove Item from the basket dic.addBaseField(R.id.btnRemove).onClick(new ItemClickListener() { @Override public void onClick(Object item, int position, View view) { final Cart selectedItem = itemList.get(position); HashMap postData = new HashMap(); postData.put("pid", ""+ selectedItem.id); PostResponseAsyncTask taskRemove = new PostResponseAsyncTask(CartFragment.this.getActivity(), postData, new AsyncResponse() { @Override public void processFinish(String s) { Log.d(LOG, s); if(s.contains("success")) { itemList.remove(selectedItem); lv.refreshDrawableState(); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.detach(CartFragment.this).attach(CartFragment.this).commit(); adapter.notifyDataSetChanged(); Toast.makeText(CartFragment.this.getActivity(), "Item Removed", Toast.LENGTH_SHORT).show(); } } }); taskRemove.execute("http://www.deepakgyawali.com.np/db_con/cart_remove.php"); } }); //increase the item quantity dic.addBaseField(R.id.qty_increase).onClick(new ItemClickListener() { @Override public void onClick(Object item, int position, final View view) { final Cart selectedItem = itemList.get(position); HashMap postData = new HashMap(); postData.put("txtPid", ""+ selectedItem.id); postData.put("mobile", "android"); final PostResponseAsyncTask incTask = new PostResponseAsyncTask(CartFragment.this.getActivity(), postData, new AsyncResponse() { @Override public void processFinish(String s) { if(s.contains("success")) { FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.detach(CartFragment.this).attach(CartFragment.this).commit(); adapter.notifyDataSetChanged(); } } }); incTask.execute("http://www.deepakgyawali.com.np/db_con/cart_qty_inc.php"); } }); //Decrease the item quantity dic.addBaseField(R.id.qty_decrease).onClick(new ItemClickListener() { @Override public void onClick(Object item, int position, final View view) { final Cart selectedItem = itemList.get(position); HashMap postData = new HashMap(); int qty = selectedItem.quantity; postData.put("txtPid", ""+ selectedItem.id); postData.put("mobile", "android"); if(qty > 1) { final PostResponseAsyncTask incTask = new PostResponseAsyncTask(CartFragment.this.getActivity(), postData, new AsyncResponse() { @Override public void processFinish(String s) { if(s.contains("success")) { FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.detach(CartFragment.this).attach(CartFragment.this).commit(); adapter.notifyDataSetChanged(); } } }); incTask.execute("http://www.deepakgyawali.com.np/db_con/cart_qty_dec.php"); } } }); adapter = new FunDapter<>(CartFragment.this.getActivity(), itemList, R.layout.cart_row, dic); lv = (ListView)view.findViewById(R.id.lvCart); lv.setAdapter(adapter); lv.setOnItemClickListener(this); if(lv.getCount() == 0) { TextView total = (TextView)view.findViewById(R.id.tvTotal); TextView empty = (TextView)view.findViewById(R.id.tvEmpty); btnCheckout.setVisibility(View.GONE); total.setVisibility(View.GONE); empty.setVisibility(View.VISIBLE); } totalPrice(lv); btnCheckout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { PaymentFragment paymentFragment = new PaymentFragment(); FragmentManager manager = getFragmentManager(); manager.beginTransaction().replace(R.id.content_main, paymentFragment) .addToBackStack("Payment").commit(); } }); } private double totalPrice(ListView listView) { double sum = 0; TextView total = (TextView)view.findViewById(R.id.tvTotal); int count = listView.getCount(); for(int i = 0; i < count; i++) { View v = listView.getAdapter().getView(i, null, null); TextView tv = (TextView) v.findViewById(R.id.tvPrice); sum = sum + Double.parseDouble(tv.getText().toString()); } String s = String.format("%.2f",sum); total.setText("Sub Total: " +s); return sum; } @Override public void onItemClick(AdapterView<?> parent, View view, final int position, long id) { } }
[ "deepakgyawali@gmail.com" ]
deepakgyawali@gmail.com
51924f0be445eda55c53effb572fd6cd86cfb0c8
a4c072b49fda53c13e56523688dae8b0469ec504
/SpringMvc/src/entity/Address.java
2e7657cac52e786ce2656cd47a1538e94af605fb
[]
no_license
doddd-col/Spring-Mybatis
4cd6adf20aaf637ac1af15e971230a37b237a575
7c3b0dd3f4bc09e448458c128dd5f862f8fce811
refs/heads/master
2020-08-28T20:33:35.628149
2019-11-22T07:43:37
2019-11-22T07:43:37
217,813,406
0
0
null
2020-01-08T17:36:20
2019-10-27T06:17:30
Java
UTF-8
Java
false
false
864
java
package entity; public class Address { private String homeaddress; private String schooladdress; @Override public String toString() { return "Address{" + "homeaddress='" + homeaddress + '\'' + ", schooladdress='" + schooladdress + '\'' + '}'; } public Address() { } public Address(String homeaddress, String schooladdress) { this.homeaddress = homeaddress; this.schooladdress = schooladdress; } public String getHomeaddress() { return homeaddress; } public void setHomeaddress(String homeaddress) { this.homeaddress = homeaddress; } public String getSchooladdress() { return schooladdress; } public void setSchooladdress(String schooladdress) { this.schooladdress = schooladdress; } }
[ "761123576@qq.com" ]
761123576@qq.com
da7c14163f0826b240c67acf0e8e84b3db024f2b
2763039d4efe7054b2ba7410b3d4686e98fb8a70
/src/main/java/io/vp/projects/repository/DayRepository.java
6426969f43bd1c5b2a8450ea507616782f9879a2
[]
no_license
ivarun13/Appointment-Mgmt-App
c6b0ee28876d0d0e784c69ac95112439ff3f9e0e
5b16cef8146a387322a0ba14c787460e7eab7b9d
refs/heads/master
2022-05-29T03:45:28.750220
2017-06-07T00:58:00
2017-06-07T00:58:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package io.vp.projects.repository; import io.vp.projects.domain.Day; import org.springframework.data.jpa.repository.*; import java.util.List; /** * Spring Data JPA repository for the Day entity. */ @SuppressWarnings("unused") public interface DayRepository extends JpaRepository<Day,Long> { }
[ "varun@Varuns-MacBook-Pro.local" ]
varun@Varuns-MacBook-Pro.local
7e0c6b25da5d085dda599c802865ba793c396653
35abecc6e81b2ac72db23858edfe875512cc5493
/0100/src/Solution3.java
2a47a014748207af4fba405e217ab70d1a31879c
[]
no_license
YonghShan/leetcode-problems
59f16797a4addf91eeb9d56301294fe619cd721d
a854350f9f8916a60982ab3b778cabe039e2643b
refs/heads/main
2023-08-27T20:05:35.688923
2021-10-30T21:55:16
2021-10-30T21:55:16
358,486,877
0
0
null
null
null
null
UTF-8
Java
false
false
1,757
java
import java.util.ArrayDeque; import java.util.Deque; /** * @author YonghShan * @date 3/18/21 - 22:11 */ public class Solution3 { // Iteration: BFS /* Runtime: 0ms O(n) Memory: 36.4MB O(log n) in the best case of completely balanced tree and O(n) in the worst case of completely unbalanced tree, to keep a deque. */ public boolean isSameTree(TreeNode p, TreeNode q) { if (p == null) return q == null; if (q == null) return false; if (p.val != q.val) return false; Deque<TreeNode> stackP = new ArrayDeque<>(); Deque<TreeNode> stackQ = new ArrayDeque<>(); stackP.addFirst(p); stackQ.addFirst(q); while (!stackP.isEmpty() && !stackQ.isEmpty()) { TreeNode tmpP = stackP.poll(); TreeNode tmpQ = stackQ.poll(); if (tmpP.val != tmpQ.val) return false; // ๅˆฉ็”จLinkedListๅฎž็Žฐ็š„Dequeๅ…่ฎธๆ’ๅ…ฅnull๏ผšๅ’ŒSolution2็›ธๅŒ๏ผŒๅชๆ˜ฏๆŠŠqueueๆ”นไธบdequeๅณๅฏ // ๅˆฉ็”จArrayDequeๅฎž็Žฐ็š„Dequeไธๅ…่ฎธๆ’ๅ…ฅnull // ๆ‰€ไปฅ๏ผŒๅ…ˆๅˆคๆ–ญtmpPๅ’ŒtmpQ็š„left/rightๆƒ…ๅ†ต๏ผš if ((tmpP.left == null && tmpQ.left != null) || (tmpP.left != null && tmpQ.left == null)) return false; if ((tmpP.right == null && tmpQ.right != null) || (tmpP.right != null && tmpQ.right == null)) return false; // ๆญคๆ—ถ๏ผŒtmpP/Q็š„left/right้ƒฝไธไธบnullๆˆ–้ƒฝไธบnull๏ผŒ่ฟ˜ๆ˜ฏ่ฆ็ปง็ปญๅˆคๆ–ญ if (tmpP.left != null) stackP.addFirst(tmpP.left); if (tmpP.right != null) stackP.addFirst(tmpP.right); if (tmpQ.left != null) stackQ.addFirst(tmpQ.left); if (tmpQ.right != null) stackQ.addFirst(tmpQ.right); } return true; } }
[ "ys3986@nyu.edu" ]
ys3986@nyu.edu
23127a5c3b7b47344e07657f87fce5b819efde99
20fd51115d0295f60975e269c7321b6e08f24c46
/app/src/main/java/com/example/swjtu/databaseexpriment/basicManagerUI/BookRefNameActivity.java
0a2c8cc31080b6456ed7dcfa4d5a4965e1350f75
[]
no_license
MorePainMoreGainByTP/DatabaseExpriment
94762df6a9ffaadafefb8ff2665f8805af1c4b47
54fc70b52f0fe648245824d21b57cf64ab9b7792
refs/heads/master
2021-01-19T08:48:23.362020
2017-06-21T07:03:06
2017-06-21T07:03:06
87,680,637
0
0
null
null
null
null
UTF-8
Java
false
false
8,637
java
package com.example.swjtu.databaseexpriment.basicManagerUI; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.Toast; import com.example.swjtu.databaseexpriment.R; import com.example.swjtu.databaseexpriment.adapter.BookRefNameAdapter; import com.example.swjtu.databaseexpriment.entity.BjsWithUse; import com.example.swjtu.databaseexpriment.entity.BookRefName; import com.example.swjtu.databaseexpriment.entity.BookType; import org.litepal.crud.DataSupport; import java.util.ArrayList; import java.util.List; import static android.view.View.GONE; /** * Created by tangpeng on 2017/4/27. */ public class BookRefNameActivity extends AppCompatActivity { public RecyclerView recyclerView; private ActionBar actionBar; public LinearLayout addNewLayout, deleteLayout; private EditText editShuM; private Spinner spinnerBjs, spinnerBookType; private BookRefNameAdapter bookRefNameAdapter; private List<BookRefName> bookRefNameList; public int selectedCount = 0; private int allCount = 0; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_book_ref_name); setActionBar(); getViews(); initData(); } private void setActionBar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } } private void getViews() { recyclerView = (RecyclerView) findViewById(R.id.recyclerSimpleTable); recyclerView.setLayoutManager(new LinearLayoutManager(this)); editShuM = (EditText) findViewById(R.id.editShuM); spinnerBjs = (Spinner) findViewById(R.id.spinnerBjs); spinnerBookType = (Spinner) findViewById(R.id.spinnerBookType); deleteLayout = (LinearLayout) findViewById(R.id.deleteLayout); addNewLayout = (LinearLayout) findViewById(R.id.addNewLayout); deleteLayout.setVisibility(GONE); } private void initData() { bookRefNameList = DataSupport.findAll(BookRefName.class); bookRefNameAdapter = new BookRefNameAdapter(bookRefNameList); recyclerView.setAdapter(bookRefNameAdapter); allCount = bookRefNameList.size(); initSpinner(); updateAllCount(); } private void initSpinner() { List<BjsWithUse> bjsWithUses = DataSupport.select("*").where("isUse = ?", "ๆ˜ฏ").find(BjsWithUse.class); List<String> shuMs = new ArrayList<String>(); for (BjsWithUse bjsWithUse : bjsWithUses) { shuMs.add(bjsWithUse.getBjsName()); } spinnerBjs.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, shuMs)); List<BookType> bookTypes = DataSupport.findAll(BookType.class); List<String> bookType = new ArrayList<String>(); for (BookType bookType1 : bookTypes) { bookType.add(bookType1.getBookType()); } spinnerBookType.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, bookType)); } public void refreshRecycler() { bookRefNameList.clear(); bookRefNameList = DataSupport.findAll(BookRefName.class); bookRefNameAdapter = new BookRefNameAdapter(bookRefNameList); recyclerView.setAdapter(bookRefNameAdapter); allCount = bookRefNameList.size(); } /** * @param v ๆทปๅŠ ๆ–ฐ็š„ไนฆๅ */ public void onAddNewRight(View v) { String shuM = editShuM.getText().toString().trim(); String bjsName = (String) spinnerBjs.getSelectedItem(); String bookTpeStr = (String) spinnerBookType.getSelectedItem(); if (!TextUtils.isEmpty(shuM)) { List<BookRefName> bookRefNames = DataSupport.select("*").where("shuM = ?", shuM).find(BookRefName.class); if (bookRefNames.size() > 0) { Toast.makeText(this, "ไนฆๅๅทฒๅญ˜ๅœจ", Toast.LENGTH_SHORT).show(); } else { BookRefName bookRefName = new BookRefName(); bookRefName.setBjsName(bjsName); bookRefName.setBookType(bookTpeStr); bookRefName.setShuM(shuM); bookRefName.save(); editShuM.setText(""); bookRefNameAdapter.checked.add(false); bookRefNameList.add(bookRefName); bookRefNameAdapter.notifyItemInserted(bookRefNameList.size() - 1); recyclerView.scrollToPosition(bookRefNameList.size() - 1); allCount = bookRefNameList.size(); updateAllCount(); } } else { Toast.makeText(this, "ไนฆๅไธ่ƒฝไธบ็ฉบ", Toast.LENGTH_SHORT).show(); } } /** * @param v ๅˆ ้™คๆ‰€้€‰ไนฆๅ */ public void onDeleteRights(View v) { if (selectedCount == 0) { Toast.makeText(this, "ๆ— ้€‰ไธญ้กน", Toast.LENGTH_SHORT).show(); } else { for (int i = bookRefNameAdapter.checked.size() - 1; i >= 0; i--) { if (bookRefNameAdapter.checked.get(i)) { String shuM = bookRefNameList.get(i).getShuM(); int id = bookRefNameList.get(i).getId(); DataSupport.deleteAll(BookRefName.class, "shuM = ? and id = ?", shuM, "" + id); bookRefNameAdapter.checked.remove(i); bookRefNameList.remove(i); } } bookRefNameAdapter.notifyDataSetChanged(); selectedCount = 0; updateSelectedCount(); } } /** * @param v ๅ–ๆถˆๅˆ ้™คไนฆๅ */ public void onCancelDelete(View v) { RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); LinearLayoutManager linearManager = (LinearLayoutManager) layoutManager; int position = linearManager.findLastVisibleItemPosition(); refreshRecycler(); recyclerView.scrollToPosition(position); addNewLayout.setVisibility(View.VISIBLE); deleteLayout.setVisibility(View.GONE); updateAllCount(); } private void updateAllCount() { actionBar.setTitle("ๆ€ปๅ…ฑๆœ‰" + allCount + "้กน"); } public void updateSelectedCount() { actionBar.setTitle("ๅทฒ้€‰ไธญ" + selectedCount + "้กน"); } private void showCheckBox() { for (int i = 0; i < allCount; i++) { View view = recyclerView.getChildAt(i); if (view != null) view.findViewById(R.id.checkbox_delete).setVisibility(View.VISIBLE); } } private void clearSelected() { for (int i = 0; i < bookRefNameAdapter.checked.size(); i++) { bookRefNameAdapter.checked.set(i, false); } selectedCount = 0; } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_delete, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); break; case R.id.delete: if (deleteLayout.getVisibility() == View.VISIBLE) break; clearSelected(); updateSelectedCount(); addNewLayout.setVisibility(View.GONE); deleteLayout.setVisibility(View.VISIBLE); showCheckBox(); break; } return true; } //้š่—่ฝฏ้”ฎ็›˜ private void hideKeyboard() { View view = getCurrentFocus(); if (view != null) { ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)). hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } } }
[ "1084165470@qq.com" ]
1084165470@qq.com
6c6ff06204ad7dc7e5175724ebf3e9fedd940f66
92dd6bc0a9435c359593a1f9b309bb58d3e3f103
/src/yelpInterview/_LL25ReverseLLSizeK.java
e5ca98d170ce4636be50a3466ea068fcfaff3590
[ "MIT" ]
permissive
darshanhs90/Java-Coding
bfb2eb84153a8a8a9429efc2833c47f6680f03f4
da76ccd7851f102712f7d8dfa4659901c5de7a76
refs/heads/master
2023-05-27T03:17:45.055811
2021-06-16T06:18:08
2021-06-16T06:18:08
36,981,580
3
3
null
null
null
null
UTF-8
Java
false
false
1,409
java
package yelpInterview; import java.util.Stack; public class _LL25ReverseLLSizeK { static class Node{ int value; Node next; public Node(int value) { this.value=value; } } public static void main(String a[]){ Node n=new Node(1); n.next=new Node(2); n.next.next=new Node(3); n.next.next.next=new Node(4); n.next.next.next.next=new Node(5); n.next.next.next.next.next=new Node(6); n.next.next.next.next.next.next=new Node(7); n.next.next.next.next.next.next.next=new Node(8); n.next.next.next.next.next.next.next.next=new Node(9); n=reverseLL(n,3); print(n); } private static Node reverseLL(Node n,int k) { Node outputNode=new Node(-1); Node ptr=outputNode; boolean flag=false; while(n!=null) { if(!flag){ Stack<Integer> stack=new Stack<>(); for (int i = 0; i < k; i++) { if(n!=null) stack.push(n.value); else break; n=n.next; } while(!stack.isEmpty()) { outputNode.next=new Node(stack.pop()); outputNode=outputNode.next; } } else{ for (int i = 0; i < k; i++) { if(n!=null){ outputNode.next=new Node(n.value); outputNode=outputNode.next; } else break; n=n.next; } } flag=!flag; } return ptr.next; } private static void print(Node n) { while(n!=null) { System.out.print(n.value+"/"); n=n.next; } } }
[ "hsdars@gmail.com" ]
hsdars@gmail.com
413e029c48d22bb6d5045620d43fe89923be28a0
0da7ad0492a9fcc093e12d438e12c3078545bd34
/zhiu-webapp-api/webapp-indoor-nav/src/main/java/cn/zhiu/webapp/api/indoornav/dao/UserDao.java
5755b08b38c77d59908a5f0a002f37fb0e678c7a
[]
no_license
Spirit0719/JavaMicroService
5f2f8c16dead572a4643a72e8b2335a64105bb51
6adea8f3b2991f51383713cc8833f9f7cdd4a81a
refs/heads/master
2022-07-06T22:00:43.140844
2020-04-06T08:04:08
2020-04-06T08:04:08
253,432,104
0
0
null
2022-06-29T18:03:27
2020-04-06T07:57:20
Java
UTF-8
Java
false
false
364
java
package cn.zhiu.webapp.api.indoornav.dao; import cn.zhiu.framework.base.api.core.request.ApiRequest; import cn.zhiu.framework.bean.core.dao.BaseDao; import cn.zhiu.webapp.api.indoornav.entity.UserEntity; /** * (User)่กจๆ•ฐๆฎๅบ“่ฎฟ้—ฎๅฑ‚ * * @author Spirit0719 * @since 2020-03-25 16:25:28 */ public interface UserDao extends BaseDao<UserEntity, Long> { }
[ "863121318@qq.com" ]
863121318@qq.com
3e73534c533c68ae528a720e8dd9db3b6ddf07b1
3a38511a515f0389ed92f6f7264fc0e9c94bdaf7
/src/java/IntoRoman.java
e35255aa50b6981834672319f615e9a1048fbec5
[]
no_license
byrEE/algorithm_cases
e201633de3fa66b933616da592456f01315173e8
1d9434c7021d9aba1b5b9168b652aeec611c5a81
refs/heads/master
2020-11-30T15:01:13.996260
2016-08-21T14:18:25
2016-08-21T14:18:25
66,202,042
0
0
null
null
null
null
UTF-8
Java
false
false
1,014
java
public class IntoRoman { public String intToRoman(int num) { String[] RomanTable={"I","V","X","L","C","D","M"}; int n=0,k=0; String apd[]={"","","",""}; while(num>0){ int a=num%10; System.out.println(a); if(a<4) apd[k]=ins(apd[k],a,RomanTable[n]); else if(a==4) apd[k]=RomanTable[n]+RomanTable[n+1]; else if(a<9){ apd[k]=ins(apd[k],a-5,RomanTable[n]); apd[k]=RomanTable[n+1]+apd[k]; } else apd[k]=RomanTable[n]+RomanTable[n+2]; System.out.println(k+" : "+apd[k]); num/=10; System.out.println(num); n+=2; k+=1; } return apd[3]+apd[2]+apd[1]+apd[0]; } public String ins(String s,int n,String m){ while(n>0){ s+=m; n--; } return s; } public static void main(String[] args) { // TODO Auto-generated method stub IntoRoman a=new IntoRoman(); System.out.println(a.intToRoman(7)); } }
[ "paul13011307@gmail.com" ]
paul13011307@gmail.com
728fbc015a20c265de0f7750c93c498a599adc08
6d82f06048d330216b17c19790f29075e62e47d5
/snapshot/runtime/util/i18n/src/java/org/apache/avalon/util/i18n/ResourceManager.java
56dab609a5fe20d64c62dc8077c25e4719c59d5b
[]
no_license
IdelsTak/dpml-svn
7d1fc3f1ff56ef2f45ca5f7f3ae88b1ace459b79
9f9bdcf0198566ddcee7befac4a3b2c693631df5
refs/heads/master
2022-03-19T15:50:45.872930
2009-11-23T08:45:39
2009-11-23T08:45:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,448
java
/* * 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.avalon.util.i18n; import java.lang.ref.WeakReference; import java.util.HashMap; /** * Manager for resources. * * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> */ public class ResourceManager { /** * Permission needed to clear complete cache. */ private static final RuntimePermission CLEAR_CACHE_PERMISSION = new RuntimePermission( "i18n.clearCompleteCache" ); private static final HashMap c_resources = new HashMap(); /** * Retrieve resource with specified basename. * * @param baseName the basename * @return the Resources */ public static final Resources getBaseResources( final String baseName ) { return getBaseResources( baseName, null ); } /** * Retrieve resource with specified basename. * * @param baseName the basename * @param classLoader the classLoader to load resources from * @return the Resources */ public synchronized static final Resources getBaseResources( final String baseName, final ClassLoader classLoader ) { Resources resources = getCachedResource( baseName ); if( null == resources ) { resources = new Resources( baseName, classLoader ); putCachedResource( baseName, resources ); } return resources; } /** * Clear the cache of all resources currently loaded into the * system. This method is useful if you need to dump the complete * cache and because part of the application is reloading and * thus the resources may need to be reloaded. * * <p>Note that the caller must have been granted the * "i18n.clearCompleteCache" {@link RuntimePermission} or * else a security exception will be thrown.</p> * * @throws SecurityException if the caller does not have * permission to clear cache */ public synchronized static final void clearResourceCache() throws SecurityException { final SecurityManager sm = System.getSecurityManager(); if( null != sm ) { sm.checkPermission( CLEAR_CACHE_PERMISSION ); } c_resources.clear(); } /** * Cache specified resource in weak reference. * * @param baseName the resource key * @param resources the resources object */ private synchronized static final void putCachedResource( final String baseName, final Resources resources ) { c_resources.put( baseName, new WeakReference( resources ) ); } /** * Retrieve cached resource. * * @param baseName the resource key * @return resources the resources object */ private synchronized static final Resources getCachedResource( final String baseName ) { final WeakReference weakReference = (WeakReference)c_resources.get( baseName ); if( null == weakReference ) { return null; } else { return (Resources)weakReference.get(); } } /** * Retrieve resource for specified name. * The basename is determined by name postfixed with ".Resources". * * @param name the name to use when looking up resources * @return the Resources */ public static final Resources getResources( final String name ) { return getBaseResources( name + ".Resources" ); } /** * Retrieve resource for specified Classes package. * The basename is determined by name of classes package * postfixed with ".Resources". * * @param clazz the Class * @return the Resources */ public static final Resources getPackageResources( final Class clazz ) { return getBaseResources( getPackageResourcesBaseName( clazz ), clazz.getClassLoader() ); } /** * Retrieve resource for specified Class. * The basename is determined by name of Class * postfixed with "Resources". * * @param clazz the Class * @return the Resources */ public static final Resources getClassResources( final Class clazz ) { return getBaseResources( getClassResourcesBaseName( clazz ), clazz.getClassLoader() ); } /** * Retrieve resource basename for specified Classes package. * The basename is determined by name of classes package * postfixed with ".Resources". * * @param clazz the Class * @return the resource basename */ public static final String getPackageResourcesBaseName( final Class clazz ) { final Package pkg = clazz.getPackage(); String baseName; if( null == pkg ) { final String name = clazz.getName(); if( -1 == name.lastIndexOf( "." ) ) { baseName = "Resources"; } else { baseName = name.substring( 0, name.lastIndexOf( "." ) ) + ".Resources"; } } else { baseName = pkg.getName() + ".Resources"; } return baseName; } /** * Retrieve resource basename for specified Class. * The basename is determined by name of Class * postfixed with "Resources". * * @param clazz the Class * @return the resource basename */ public static final String getClassResourcesBaseName( final Class clazz ) { return clazz.getName() + "Resources"; } /** * Private Constructor to block instantiation. */ private ResourceManager() { } }
[ "niclas@00579e91-1ffa-0310-aa18-b241b61564ef" ]
niclas@00579e91-1ffa-0310-aa18-b241b61564ef
9a641c6c2b0042b243cb9cf57e515af7c7a7f245
7be474fd5fe86bcc960349a3876660c3dd6f9669
/src/com/sitechecker/service/mobile/impl/MobileLoginServiceImpl.java
bfb5461b2fe1bab8441288986e5f08223f6ae345
[]
no_license
qq1320020962/sitechecker_web
c0f61b8cc1ec7862a1ea71733a475a1a32b6c18b
a454b158a2a29b6b9fc5138193f1c2474d9cd83c
refs/heads/master
2021-01-10T04:47:49.222788
2016-03-11T16:21:14
2016-03-11T16:21:14
53,108,235
0
0
null
null
null
null
UTF-8
Java
false
false
627
java
package com.sitechecker.service.mobile.impl; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.sitechecker.domain.form.LoginForm; import com.sitechecker.service.LoginService; import com.sitechecker.service.mobile.MobileLoginService; import com.sitechecker.service.result.LoginResult; @Service("mobileLoginService") public class MobileLoginServiceImpl implements MobileLoginService { @Resource(name="loginService") private LoginService loginService; @Override public LoginResult validateLogin(LoginForm loginForm) { return this.loginService.validateLogin(loginForm); } }
[ "feng_orz@163.com" ]
feng_orz@163.com
604907fc07d52005e8ceb974c1747eb7a840fb46
72a42cacac22f091b793e61af896246727eb4bb2
/src/main/java/com/hqgl/service/impl/ptServiceImpl.java
5646181c87ccf653f611c712b9f7d8814cd036ec
[]
no_license
feipenghou/hqgl
34f843dd6760212cd6be950f738df0d435a1e81d
ac0c37a18ff2edc37925088b8655679e7934f7c5
refs/heads/master
2023-04-04T22:06:34.006141
2021-03-30T12:11:02
2021-03-30T12:11:02
349,024,272
1
0
null
null
null
null
GB18030
Java
false
false
1,416
java
package com.hqgl.service.impl; import com.hqgl.hib.dao.ptDao; import com.hqgl.hib.po.Dingdan; import com.hqgl.hib.po.Kehu; import com.hqgl.service.ptService; import java.util.List; public class ptServiceImpl implements ptService { private ptDao ptdao; public ptDao getPtdao() { return ptdao; } public void setPtdao(ptDao ptdao) { this.ptdao = ptdao; } //ๆ นๆฎIDๆŸฅ็œ‹ไธ€ๆกไฟกๆฏ public List pt_id(String id){ return this.getPtdao().pt_id(id); } public List gg() { return this.getPtdao().gg(); } //ๆ นๆฎidๆŸฅ็œ‹ไธ€ๆกๅ…ฌๅ‘Š public List ptnotice_id(String id){ return this.getPtdao().ptnotice_id(id); } //ๆŸฅ็œ‹ๅ…จ้ƒจ็คผๆœ public List ptfuzhuang_display(){ return this.getPtdao().ptfuzhuang_display(); } //ๆ นๆฎidๆŸฅ็œ‹ไธ€ๆก็คผๆœไฟกๆฏ public List ptfuzhuang_id(String id){ return this.getPtdao().ptfuzhuang_id(id); } //่Šฑ่ฝฆๆœๅŠก public List ptcar(){ return this.getPtdao().ptcar(); } public List ptcar_id(String id){ return this.getPtdao().ptcar_id(id); } /*ๆทปๅŠ ๅฎขๆˆทไฟกๆฏ*/ public List ptaddkehuid(){ return this.getPtdao().ptaddkehuid(); } public boolean ptaddkehu(Kehu kehu){ return this.getPtdao().ptaddkehu(kehu); } //ๆทปๅŠ ่ฎขๅ• public List pttianjiadingdan(){ return this.getPtdao().pttianjiadingdan(); } public boolean pttianjia(Dingdan dingdan){ return this.getPtdao().pttianjia(dingdan); } }
[ "houpf@autoai.com" ]
houpf@autoai.com
11a197553fdc7a23909310ff8e8420fbc887e8ca
b726c287bbc921ef130601d6239ee2b1604539f0
/web-shop/main/java/ua/nure/kopaniev/bean/EmailType.java
028102c6ed498e37f0633a8b676e0f839db7de87
[]
no_license
VladKopanev/web-shop
d0354176814c202c85fd104baa876d72dbd86109
19002bd2ccb5d1ad9b49fbe8297c27a06cbb691e
refs/heads/master
2021-01-18T21:17:17.368417
2016-06-07T06:48:47
2016-06-07T06:48:47
50,282,240
0
0
null
null
null
null
UTF-8
Java
false
false
695
java
package ua.nure.kopaniev.bean; public enum EmailType { CUSTOMER_MAIL(1, "customer"), MANAGER_MAIL(2, "manager"); private final int id; private final String name; EmailType(int id, String name) { this.id = id; this.name = name; } public int getId() { return id; } public String getName() { return name; } public static EmailType getTypeByName(String resourceName) { for (EmailType emailType : values()) { if (emailType.name.equalsIgnoreCase(resourceName)) { return emailType; } } throw new IllegalArgumentException("Wrong email type name."); } }
[ "ivengo53@gmail.com" ]
ivengo53@gmail.com
2e5330d2dd4a02e3cdd13a6677701d42248f79fb
4d490754183a5a0f0c73703954561ccdadfb8698
/src/net/dzikoysk/funnyguilds/util/configuration/ConfigurationParser.java
ba653328242bb2049e27381df3a91361f55f4ba3
[]
no_license
miki226/FunnyGuilds
1e85671d7314faf8cb80275caaf90c0dce0d37ca
cbbe878b7d70c591c7068b53fda6c8c51531bac7
refs/heads/master
2021-01-21T09:06:13.194197
2014-11-17T21:24:02
2014-11-17T21:24:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,118
java
package net.dzikoysk.funnyguilds.util.configuration; import java.util.Map; import java.util.Stack; public class ConfigurationParser { private final String[] code; private Map<String, ConfigurationObject> result; public ConfigurationParser(String[] code){ this.code = code; this.run(); } public void run(){ //Stack<String> keys = new Stack<>(); //Stack<String> elements = new Stack<>(); Stack<Character> operators = new Stack<>(); StringBuilder chars = new StringBuilder(); for(String line : code){ if(line == null || line.isEmpty()) continue; boolean whitespace = true; for(char c : line.toCharArray()){ switch(c){ case ' ': if(whitespace) continue; case ':': operators.push(c); case '-': operators.push(c); default: chars.append(c); } whitespace = false; } String string = chars.toString(); if(string.isEmpty()) continue; /* * key: value * key: value * * list: * - value * - value * */ } } public Map<String, ConfigurationObject> getResult(){ return this.result; } }
[ "dzikoysk@dzikoysk.net" ]
dzikoysk@dzikoysk.net
13f3066b721645d0e0ca69fa7a4bea7370dd9f5c
8a84c5fd7e52b21238304dd7be001712141883f4
/src/main/java/com/wmes/appserver/domain/enumeration/TermsType.java
96ddab35e1246a96e03bd1524c8c9b4ad654f467
[]
no_license
busandiego/JHipster-Login-Starter_MES
b671bed7dbbb32f44ed7c6657dfc1d58f7c4d1a3
e60af313319b713d0ea82cffa838533361069e02
refs/heads/master
2023-03-19T22:32:52.411734
2021-03-09T03:01:29
2021-03-09T03:01:29
344,386,652
0
0
null
null
null
null
UTF-8
Java
false
false
173
java
package com.wmes.appserver.domain.enumeration; /** * The TermsType enumeration. */ public enum TermsType { SERIVCE, PERSNALINFO, GPSINFO, FINANCEINFO, YOUTHPROTECT }
[ "silee@weedscomm.com" ]
silee@weedscomm.com
e80aaa58aff01a02ea13e4306a639dabfc9bd91d
11bc2c26ba2c3e8cfb58e5dd7ab430ec0e16a375
/ACORD_PC_JAXB/src/org/acord/standards/pc_surety/acord1/xml/PersInlandMarineLineBusinessType.java
1d6eac445dfae92a8ec1a2cf2bfd3c10993e171c
[]
no_license
TimothyDH/neanderthal
b295b3e3401ab403fb89950f354c83f3690fae38
1444b21035e3a846d85ea1bf32638a1e535bca67
refs/heads/master
2021-05-04T10:25:54.675556
2019-09-05T13:49:14
2019-09-05T13:49:14
45,859,747
0
0
null
null
null
null
UTF-8
Java
false
false
8,092
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.2-147 // 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: 2010.02.24 at 10:20:12 PM EST // package org.acord.standards.pc_surety.acord1.xml; import java.util.ArrayList; import java.util.List; 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 PersInlandMarineLineBusiness_Type complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="PersInlandMarineLineBusiness_Type"> * &lt;complexContent> * &lt;extension base="{http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/}PCLINEBUSINESS"> * &lt;sequence> * &lt;element ref="{http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/}Coverage" maxOccurs="unbounded" minOccurs="0"/> * &lt;element ref="{http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/}SafeVaultCharacteristics" maxOccurs="unbounded" minOccurs="0"/> * &lt;element ref="{http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/}AlarmAndSecurity" maxOccurs="unbounded" minOccurs="0"/> * &lt;element ref="{http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/}PropertySchedule" maxOccurs="unbounded"/> * &lt;element ref="{http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/}Dwell" maxOccurs="unbounded" minOccurs="0"/> * &lt;element ref="{http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/}QuestionAnswer" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "PersInlandMarineLineBusiness_Type", propOrder = { "coverage", "safeVaultCharacteristics", "alarmAndSecurity", "propertySchedule", "dwell", "questionAnswer" }) public class PersInlandMarineLineBusinessType extends PCLINEBUSINESS { @XmlElement(name = "Coverage") protected List<CoverageType> coverage; @XmlElement(name = "SafeVaultCharacteristics") protected List<SafeVaultCharacteristicsType> safeVaultCharacteristics; @XmlElement(name = "AlarmAndSecurity") protected List<AlarmAndSecurityType> alarmAndSecurity; @XmlElement(name = "PropertySchedule", required = true) protected List<PropertyScheduleType> propertySchedule; @XmlElement(name = "Dwell") protected List<DwellType> dwell; @XmlElement(name = "QuestionAnswer") protected List<QuestionAnswerType> questionAnswer; /** * Gets the value of the coverage property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the coverage property. * * <p> * For example, to add a new item, do as follows: * <pre> * getCoverage().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link CoverageType } * * */ public List<CoverageType> getCoverage() { if (coverage == null) { coverage = new ArrayList<CoverageType>(); } return this.coverage; } /** * Gets the value of the safeVaultCharacteristics property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the safeVaultCharacteristics property. * * <p> * For example, to add a new item, do as follows: * <pre> * getSafeVaultCharacteristics().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link SafeVaultCharacteristicsType } * * */ public List<SafeVaultCharacteristicsType> getSafeVaultCharacteristics() { if (safeVaultCharacteristics == null) { safeVaultCharacteristics = new ArrayList<SafeVaultCharacteristicsType>(); } return this.safeVaultCharacteristics; } /** * Gets the value of the alarmAndSecurity property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the alarmAndSecurity property. * * <p> * For example, to add a new item, do as follows: * <pre> * getAlarmAndSecurity().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link AlarmAndSecurityType } * * */ public List<AlarmAndSecurityType> getAlarmAndSecurity() { if (alarmAndSecurity == null) { alarmAndSecurity = new ArrayList<AlarmAndSecurityType>(); } return this.alarmAndSecurity; } /** * Gets the value of the propertySchedule property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the propertySchedule property. * * <p> * For example, to add a new item, do as follows: * <pre> * getPropertySchedule().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link PropertyScheduleType } * * */ public List<PropertyScheduleType> getPropertySchedule() { if (propertySchedule == null) { propertySchedule = new ArrayList<PropertyScheduleType>(); } return this.propertySchedule; } /** * Gets the value of the dwell property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the dwell property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDwell().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link DwellType } * * */ public List<DwellType> getDwell() { if (dwell == null) { dwell = new ArrayList<DwellType>(); } return this.dwell; } /** * Gets the value of the questionAnswer property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the questionAnswer property. * * <p> * For example, to add a new item, do as follows: * <pre> * getQuestionAnswer().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link QuestionAnswerType } * * */ public List<QuestionAnswerType> getQuestionAnswer() { if (questionAnswer == null) { questionAnswer = new ArrayList<QuestionAnswerType>(); } return this.questionAnswer; } }
[ "Bryan.Bringle@3f59fb54-24d0-11df-be41-57e7d1eefd51" ]
Bryan.Bringle@3f59fb54-24d0-11df-be41-57e7d1eefd51
b0c1a14922eda07489e7cb41e053b42e206d8056
dd48a157b02321c50d37a6d2ab04d606f04615be
/gen/com/bia/privybrowser/R.java
89e4f334b13d97b4f56b93b46c3b3a494d766dd6
[]
no_license
intesar/PrivyBrowser
2b340313e5113960e9275970dd227555eaedafa6
ed2bcf140b756c788e5c5405bd99c3217afecf2d
refs/heads/master
2016-09-05T22:21:18.690185
2012-05-01T04:59:34
2012-05-01T04:59:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
761
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.bia.privybrowser; public final class R { public static final class attr { } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int go=0x7f050001; public static final int page=0x7f050002; public static final int url=0x7f050000; } public static final class layout { public static final int main=0x7f030000; } public static final class string { public static final int app_name=0x7f040000; } }
[ "mdshannan@gmail.com" ]
mdshannan@gmail.com
a1a3d5f30441ebff93790ad976515268765857e7
a84b0eee1c771d7c542e286a8b25608785d3ca7a
/app/src/main/java/com/guohua/sdk/common/permission/PermissionManager.java
e31ca2be7e8422addd73e1c06f68344140ec52fd
[]
no_license
eraare/AndroidDemo
87e74914b32e4d85a6e61c9ed44535a1f2d15672
45a57e0b142ca7e8d7cf3f52e903876da2e0254a
refs/heads/master
2021-06-21T00:33:34.419060
2017-08-17T09:19:13
2017-08-17T09:19:13
100,583,755
1
0
null
null
null
null
UTF-8
Java
false
false
6,547
java
package com.guohua.sdk.common.permission; import android.app.Activity; import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * ๆƒ้™็ฎก็† * * @author * @class PermissionManager * @date 2016-3-25 ไธ‹ๅˆ3:54:14 */ public class PermissionManager { private Object mObject; private String[] mPermissions; private int mRequestCode; private PermissionListener mListener; // ็”จๆˆทๆ˜ฏๅฆ็กฎ่ฎคไบ†่งฃ้‡Šๆก†็š„ private boolean mIsPositive = false; public static PermissionManager with(Activity activity) { return new PermissionManager(activity); } public static PermissionManager with(Fragment fragment) { return new PermissionManager(fragment); } public PermissionManager permissions(String... permissions) { this.mPermissions = permissions; return this; } public PermissionManager addRequestCode(int requestCode) { this.mRequestCode = requestCode; return this; } public PermissionManager setPermissionsListener(PermissionListener listener) { this.mListener = listener; return this; } public PermissionManager(Object object) { this.mObject = object; } /** * ่ฏทๆฑ‚ๆƒ้™ * * @return PermissionManager */ public PermissionManager request() { request(mObject, mPermissions, mRequestCode); return this; } private void request(Object object, String[] permissions, int requestCode) { // ๆ นๆฎๆƒ้™้›†ๅˆๅŽปๆŸฅๆ‰พๆ˜ฏๅฆๅทฒ็ปๆŽˆๆƒ่ฟ‡ Map<String, List<String>> map = findDeniedPermissions(getActivity(object), permissions); List<String> deniedPermissions = map.get("deny"); List<String> rationales = map.get("rationale"); if (deniedPermissions.size() > 0) { // ็ฌฌไธ€ๆฌก็‚นๅ‡ปdenyๆ‰่ฐƒ็”จ๏ผŒmIsPositiveๆ˜ฏไธบไบ†้˜ฒๆญข็‚น็กฎ่ฎค่งฃ้‡Šๆก†ๅŽ่ฐƒrequest()้€’ๅฝ’่ฐƒonShowRationale if (rationales.size() > 0 && mIsPositive == false) { if (mListener != null) { mListener.onShowRationale(rationales.toArray(new String[rationales.size()])); } return; } if (object instanceof Activity) { ActivityCompat.requestPermissions((Activity) object, deniedPermissions.toArray(new String[deniedPermissions.size()]), requestCode); } else if (object instanceof Fragment) { ((Fragment) object).requestPermissions(deniedPermissions.toArray(new String[deniedPermissions.size()]), requestCode); } else { throw new IllegalArgumentException(object.getClass().getName() + " is not supported"); } } else { if (mListener != null) { mListener.onGranted(); } } } /** * ๆ นๆฎrequestCodeๅค„็†ๅ“ๅบ”็š„ๆƒ้™ * * @param permissions * @param results */ public void onPermissionResult(String[] permissions, int[] results) { List<String> deniedPermissions = new ArrayList<String>(); for (int i = 0; i < results.length; i++) { if (results[i] != PackageManager.PERMISSION_GRANTED) {//ๆœชๆŽˆๆƒ deniedPermissions.add(permissions[i]); } } if (deniedPermissions.size() > 0) { if (mListener != null) { mListener.onDenied(); } } else { if (mListener != null) { mListener.onGranted(); } } } private Map<String, List<String>> findDeniedPermissions(Activity activity, String... permissions) { Map<String, List<String>> map = new HashMap<String, List<String>>(); List<String> denyList = new ArrayList<String>();//ๆœชๆŽˆๆƒ็š„ๆƒ้™ List<String> rationaleList = new ArrayList<String>();//้œ€่ฆๆ˜พ็คบๆ็คบๆก†็š„ๆƒ้™ for (String value : permissions) { if (ContextCompat.checkSelfPermission(activity, value) != PackageManager.PERMISSION_GRANTED) { denyList.add(value); if (shouldShowRequestPermissionRationale(value)) { rationaleList.add(value); } } } map.put("deny", denyList); map.put("rationale", rationaleList); return map; } private Activity getActivity(Object object) { if (object instanceof Fragment) { return ((Fragment) object).getActivity(); } else if (object instanceof Activity) { return (Activity) object; } return null; } /** * ๅฝ“็”จๆˆทๆ‹’็ปๆŸๆƒ้™ๆ—ถๅนถ็‚นๅ‡ปๅฐฑไธๅ†ๆ้†’็š„ๆŒ‰้’ฎๆ—ถ๏ผŒไธ‹ๆฌกๅบ”็”จๅ†่ฏทๆฑ‚่ฏฅๆƒ้™ๆ—ถ๏ผŒ้œ€่ฆ็ป™ๅ‡บๅˆ้€‚็š„ๅ“ๅบ”๏ผˆๆฏ”ๅฆ‚็ป™ไธชๅฑ•็คบๅฏน่ฏๆก†๏ผ‰ * * @param permission */ private boolean shouldShowRequestPermissionRationale(String permission) { if (mObject instanceof Activity) { return ActivityCompat.shouldShowRequestPermissionRationale((Activity) mObject, permission); } else if (mObject instanceof Fragment) { return ((Fragment) mObject).shouldShowRequestPermissionRationale(permission); } else { throw new IllegalArgumentException(mObject.getClass().getName() + " is not supported"); } } public void setIsPositive(boolean isPositive) { this.mIsPositive = isPositive; } /** * ๆŸฅ็œ‹็ณป็ปŸๆ˜ฏๅฆๅ…ทๆœ‰ๆƒ้™ * * @param context * @param permission * @return */ public static boolean hasPermission(Context context, String permission) { System.out.println("sdk_int" + isMarshmallow()); System.out.println("granted" + isGranted(context, permission)); return !isMarshmallow() || isGranted(context, permission); } private static boolean isMarshmallow() { /*ๆ˜ฏไธๆ˜ฏAndroid 6.0*/ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M; } /*ๆŽˆๆƒไบ†ไธ*/ private static boolean isGranted(Context context, String permission) { int checkSelfPermission = ContextCompat.checkSelfPermission(context, permission); return checkSelfPermission == PackageManager.PERMISSION_GRANTED; } }
[ "r00kie@126.com" ]
r00kie@126.com
abf8f2d3582b0fe2a53f970e3397110a485975ff
f13e2382359691b6245f8574573fd3126c2f0a90
/hst/components/core/src/main/java/org/hippoecm/hst/configuration/cache/HstEventConsumer.java
f0f898ffb266d8fe8f3ad8f164d0997033215c41
[ "Apache-2.0" ]
permissive
CapeSepias/hippo-1
cd8cbbf2b0f6cd89806a3861c0214d72ac5ee80f
3a7a97ec2740d0e3745859f7067666fdafe58a64
refs/heads/master
2023-04-27T21:04:19.976319
2013-12-13T13:01:51
2013-12-13T13:01:51
306,922,672
0
0
NOASSERTION
2023-04-17T17:42:23
2020-10-24T16:17:22
null
UTF-8
Java
false
false
855
java
/* * Copyright 2013 Hippo B.V. (http://www.onehippo.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.hippoecm.hst.configuration.cache; import java.util.Set; public interface HstEventConsumer { /** * @param hstEvents an immutable Set of events */ void handleEvents(Set<HstEvent> hstEvents); }
[ "m.denburger@onehippo.com" ]
m.denburger@onehippo.com
325a18468e8a3c466977e707c6b0cf9d0548dc54
14dae02fd2c29fac14428c071ab2f4b9af4c67a5
/src/main/java/SingletonPeselList.java
10792b4b5766d5bf7abdd4fed32a908561532c3c
[]
no_license
DStrama/TestingJava
fc2bbba49e7ad3ee791878e895853e059586dd6e
ade7bb9baf9249eb1febb3d31910be69bfb76549
refs/heads/master
2020-05-07T17:55:29.134197
2019-04-11T08:21:43
2019-04-11T08:21:43
180,747,254
1
0
null
null
null
null
UTF-8
Java
false
false
441
java
import java.util.ArrayList; public class SingletonPeselList { private ArrayList<String> peselList; private static SingletonPeselList ourInstance = new SingletonPeselList(); public static SingletonPeselList getInstance() { return ourInstance; } private SingletonPeselList() { peselList = new ArrayList<String>(); } public ArrayList<String> getPeselList() { return peselList; } }
[ "dominikstrama@MacBook-Air-Dominik.local" ]
dominikstrama@MacBook-Air-Dominik.local
d6a59463a1f9cade62327e1400573c38741c0dac
3c9c83e228ad7e8fd187116cef18bb4e1ad58546
/ArtupaWeb/src/artupa/bd/BdOperaciones.java
618f24db5722638220be731c3aa43f1f50ba9da5
[]
no_license
GorkaPA/cursoweb
0c2dbd83b0962bcafc6b4d7e50fec0a1c697c2eb
258f24880faee86a953a826d67ff49c895b67847
refs/heads/master
2021-01-01T15:29:22.470512
2017-09-24T16:13:51
2017-09-24T16:13:51
97,631,925
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
8,402
java
/* * Created on 26-abr-2006 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package artupa.bd; import java.sql.*; import java.util.ArrayList; import java.util.List; import artupa.beans.*; /** * @author Administrador * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class BdOperaciones extends BdBase { /** * */ public BdOperaciones() { super(); // TODO Auto-generated constructor stub } public boolean validarUsuario(String user, String password) { boolean correcto = true; try { String sentenciaSql = "select usuario,password from usuarios where" + " usuario='" + user + "' and password='" + password + "'"; System.out.println(sentenciaSql); Statement stmt = conexion.createStatement(); ResultSet rs = stmt.executeQuery(sentenciaSql); correcto = rs.next(); rs.close(); stmt.close(); } catch (Exception e) { e.printStackTrace(); System.out.println("Validaciรณn de usuario no efectuada correctamente"); correcto = false; } return correcto; } public List<Cliente> getClientes() { List<Cliente> clientes = new ArrayList<Cliente>(); try { String sentenciaSql = "select dni,nombre,apellido,edad from clientes"; System.out.println(sentenciaSql); Statement stmt = conexion.createStatement(); ResultSet rs = stmt.executeQuery(sentenciaSql); boolean hayMas = rs.next(); Cliente cliente = null; while (hayMas) { cliente = new Cliente(); cliente.setDni(rs.getString(1)); cliente.setNombre(rs.getString(2)); cliente.setApellido(rs.getString(3)); cliente.setEdad(rs.getInt(4)); clientes.add(cliente); hayMas = rs.next(); } rs.close(); stmt.close(); } catch (Exception e) { e.printStackTrace(); System.out.println("Consulta de clientes no efectuada correctamente"); } return clientes; } public Cliente getCliente(String dni) { Cliente cliente = null; try { String sentenciaSql = "select dni,nombre,apellido,edad,direccion,codPostal,localidad,telefono from clientes " + "where dni='" + dni + "'"; System.out.println(sentenciaSql); Statement stmt = conexion.createStatement(); ResultSet rs = stmt.executeQuery(sentenciaSql); boolean hayMas = rs.next(); if (hayMas) { cliente = new Cliente(); cliente.setDni(rs.getString(1)); cliente.setNombre(rs.getString(2)); cliente.setApellido(rs.getString(3)); cliente.setEdad(rs.getInt(4)); cliente.setDireccion(rs.getString(5)); cliente.setCodPostal(rs.getInt(6)); cliente.setLocalidad(rs.getString(7)); cliente.setTelefono(rs.getInt(8)); hayMas = rs.next(); } rs.close(); stmt.close(); } catch (Exception e) { e.printStackTrace(); System.out.println("Consulta de clientes no efectuada correctamente"); } return cliente; } public boolean eliminarCliente(String dni) { boolean correcto = true; try { String sentenciaSql = "delete from clientes where dni='" + dni + "'"; System.out.println(sentenciaSql); Statement stmt = conexion.createStatement(); stmt.execute(sentenciaSql); stmt.close(); } catch (Exception e) { e.printStackTrace(); System.out.println("Borrado de cliente no efectuado correctamente"); correcto = false; } return correcto; } public boolean insertarCliente(Cliente cliente) { boolean correcto = true; try { String sentenciaSql = "insert into clientes(dni,nombre,apellido,edad,direccion,codPostal,localidad,telefono) values ('" + cliente.getDni() + "','" + cliente.getNombre() + "','" + cliente.getApellido() + "'," + cliente.getEdad() + ",'" + cliente.getDireccion() + "'," + cliente.getCodPostal() + ",'" + cliente.getLocalidad() + "'," + cliente.getTelefono() + ")"; System.out.println(sentenciaSql); Statement stmt = conexion.createStatement(); stmt.execute(sentenciaSql); stmt.close(); } catch (Exception e) { e.printStackTrace(); System.out.println("Inserciรณn de cliente no efectuada correctamente"); correcto = false; } return correcto; } public boolean modificarCliente(Cliente cliente) { boolean correcto = true; try { String sentenciaSql = "update clientes set " + "nombre='" + cliente.getNombre() + "', " + "apellido='" + cliente.getApellido() + "', " + "edad=" + cliente.getEdad() + ", " + "direccion='" + cliente.getDireccion() + "', " + "codPostal=" + cliente.getCodPostal() + ", " + "localidad='" + cliente.getLocalidad() + "', " + "telefono=" + cliente.getTelefono() + " where dni = '" + cliente.getDni() + "'"; System.out.println(sentenciaSql); Statement stmt = conexion.createStatement(); stmt.execute(sentenciaSql); stmt.close(); } catch (Exception e) { e.printStackTrace(); System.out.println("Inserciรณn de cliente no efectuada correctamente"); correcto = false; } return correcto; } public List<Pedido> getPedidos() { List<Pedido> pedidos = new ArrayList<Pedido>(); try { String sentenciaSql = "select dni,numpedido,detallepedido from pedidos"; System.out.println(sentenciaSql); Statement stmt = conexion.createStatement(); ResultSet rs = stmt.executeQuery(sentenciaSql); boolean hayMas = rs.next(); Pedido pedido = null; while (hayMas) { pedido = new Pedido(); pedido.setDni(rs.getString(1)); pedido.setNumPedido(rs.getInt(2)); pedido.setDetallePedido(rs.getString(3)); pedidos.add(pedido); hayMas = rs.next(); } rs.close(); stmt.close(); } catch (Exception e) { e.printStackTrace(); System.out.println("Consulta de pedidos no efectuada correctamente"); } return pedidos; } public Pedido getPedido(int numPedido) { Pedido pedido = null; try { String sentenciaSql = "select dni,numpedido,detallepedido from pedidos " + "where numpedido=" + numPedido; System.out.println(sentenciaSql); Statement stmt = conexion.createStatement(); ResultSet rs = stmt.executeQuery(sentenciaSql); boolean hayMas = rs.next(); if (hayMas) { pedido = new Pedido(); pedido.setDni(rs.getString(1)); pedido.setNumPedido(rs.getInt(2)); pedido.setDetallePedido(rs.getString(3)); hayMas = rs.next(); } rs.close(); stmt.close(); } catch (Exception e) { e.printStackTrace(); System.out.println("Consulta de pedidos no efectuada correctamente"); } return pedido; } public boolean eliminarPedido(int numPedido) { boolean correcto = true; try { String sentenciaSql = "delete from pedidos where numpedido=" + numPedido; System.out.println(sentenciaSql); Statement stmt = conexion.createStatement(); stmt.execute(sentenciaSql); stmt.close(); } catch (Exception e) { e.printStackTrace(); System.out.println("Borrado de pedido no efectuado correctamente"); correcto = false; } return correcto; } public boolean insertarPedido(Pedido pedido) { boolean correcto = true; try { String sentenciaSql = "insert into pedidos(dni,numpedido,detallepedido) " + "values ('" + pedido.getDni() + "'," + pedido.getNumPedido() + ",'" + pedido.getDetallePedido() + "'" + ")"; System.out.println(sentenciaSql); Statement stmt = conexion.createStatement(); stmt.execute(sentenciaSql); stmt.close(); } catch (Exception e) { e.printStackTrace(); System.out.println("Inserciรณn de cliente no efectuada correctamente"); correcto = false; } return correcto; } public boolean modificarPedido(Pedido pedido) { boolean correcto = true; try { String sentenciaSql = "update pedidos set " + "detallepedido ='" + pedido.getDetallePedido() + "' " + " where numPedido = " + pedido.getNumPedido(); System.out.println(sentenciaSql); Statement stmt = conexion.createStatement(); stmt.execute(sentenciaSql); stmt.close(); } catch (Exception e) { e.printStackTrace(); System.out.println("Inserciรณn de cliente no efectuada correctamente"); correcto = false; } return correcto; } }
[ "gorkitap@hotmail.com" ]
gorkitap@hotmail.com
c3f3bbb6b22c4848db02348803cfb60094289a6f
8b1608a5cc1bca6cf241bfddd97dd7f19aef4448
/JavaCrashCourse/src/javaTutorials/LinkedHashSetExample.java
7f1a8c8817a4ad1b9d324f31144aac4003f5b69d
[]
no_license
sudhag85/JavaCollections
78a84b24f46ad7e634ba705b09b26745a9348d72
ca9405d8cdb336d7872c6a4283b2fa6448b3cd6d
refs/heads/master
2021-05-26T15:46:39.087089
2020-04-08T15:32:13
2020-04-08T15:32:13
254,127,223
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package javaTutorials; import java.util.LinkedHashSet; import java.util.Set; public class LinkedHashSetExample { //LinkedHashSet //LinkedHashSet is implementation class for Set //duplicate values are not allowed //insertion order is maintained //Can insert heterogeneous object if generics is not used //Null elements are allowed. //Underlying DS is Hash table + linked list //Implements serializable and cloneable interfaces //Data is stored based on hashcode, so search is very effective //Fill ratio or load factor is 75% //default capacity is 16 public void basicExample() { Set<String> lhs = new LinkedHashSet<String>(); lhs.add("Selenium"); lhs.add("UFT"); lhs.add("API"); lhs.add("Appium"); lhs.add("UFT"); //NO duplication System.out.println(lhs);//[Selenium, UFT, API, Appium] System.out.println(lhs.size());//4 lhs.remove("Appium"); System.out.println(lhs);//[Selenium, UFT, API] } public static void main(String[] args) { LinkedHashSetExample lhs = new LinkedHashSetExample(); lhs.basicExample(); } }
[ "sudhasathy@gmail.com" ]
sudhasathy@gmail.com
482a6c9425a46eff40ebe3d5ad2cd628d0261cfb
e84bdaeba7bec51ff01463b1bc5cbefb195ad44b
/app/src/main/java/com/example/tuquyet/javaproject/chapter/StoryChapterActivity.java
61eb474b35bb0926d419b1c99087cb3c253197d1
[]
no_license
tuquyet2709/JavaProject
3893242f891fb797903209849edbbe3994e13306
8ea98be70e61e9d9618db8ffce36939b932a13d9
refs/heads/master
2020-12-30T13:46:19.929612
2017-07-14T07:16:16
2017-07-14T07:16:16
90,019,550
0
0
null
null
null
null
UTF-8
Java
false
false
6,277
java
package com.example.tuquyet.javaproject.chapter; import android.app.ProgressDialog; import android.content.ActivityNotFoundException; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.speech.RecognizerIntent; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.example.tuquyet.javaproject.R; import com.example.tuquyet.javaproject.database.SQLiteStoryChapter; import java.util.ArrayList; import java.util.List; import java.util.Locale; import static com.example.tuquyet.javaproject.search.Search.search; public class StoryChapterActivity extends AppCompatActivity { ArrayList<ChapterItem> mChapterLists = new ArrayList<>(); private RecyclerView mChapterRecyclerView; private ChapterAdapter mChapterAdapter; private TextView mStoryNameInChapter; private ImageView img_micro; private ImageView img_search; private EditText text; private String searchTextInput; private final int REQ_CODE_SPEECH_OUTPUT = 143; public ProgressDialog dialog; public final String TAG = "MY_TAG"; List<List<String>> result = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_story_chapter_main); Intent intent1 = getIntent(); Bundle bundle1 = intent1.getBundleExtra("bundle1"); final int idStory = bundle1.getInt("ID2", 0); final String storyName = bundle1.getString("StoryName"); //Lay danh sach chapter tu idStory gui tu Descreption getStoryChapter(idStory); findViewById(); mStoryNameInChapter.setText(storyName); mChapterRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mChapterAdapter = new ChapterAdapter(mChapterLists, getApplicationContext()); mChapterRecyclerView.setAdapter(mChapterAdapter); //Bat giong noi img_micro.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { imgToOpenMic(); } }); //Search img_search.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { result.clear(); imgToSearch(); } }); } private void findViewById() { img_micro = (ImageView) findViewById(R.id.imageview_micro); img_search = (ImageView) findViewById(R.id.imageview_search); text = (EditText) findViewById(R.id.edittext_text); mStoryNameInChapter = (TextView) findViewById(R.id.textview_storyname_chapterlist); mChapterRecyclerView = (RecyclerView) findViewById(R.id.chapter_recyclerview); } private void imgToOpenMic() { Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault()); intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Nhแบญp giแปng nรณi sau tiแบฟng *beep*...."); try { startActivityForResult(intent, REQ_CODE_SPEECH_OUTPUT); } catch (ActivityNotFoundException tim) { Toast.makeText(this, "Lแป—i! Bแบกn chฦฐa cร i ฤ‘แบทt Speech to text cแปงa Google", Toast.LENGTH_SHORT).show(); } } private void imgToSearch() { // TODO: 14/05/2017 searchTextInput = text.getText().toString(); searchTextInput = searchTextInput.trim(); runOnUiThread(new Runnable() { @Override public void run() { new SearchInChapter().execute(); } }); } private void getStoryChapter(int id) { SQLiteStoryChapter storyChapterSQL = new SQLiteStoryChapter(getApplicationContext()); mChapterLists = storyChapterSQL.getStoryChapters(id); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case REQ_CODE_SPEECH_OUTPUT: { if (resultCode == RESULT_OK && null != data) { ArrayList<String> voiceInText = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); text.setText(voiceInText.get(0)); } break; } } } public class SearchInChapter extends AsyncTask<String, ChapterItem, String> { @Override protected void onPreExecute() { super.onPreExecute(); dialog = ProgressDialog.show(StoryChapterActivity.this, "Tรฌm kiแบฟm tแปซ khรณa", "ฤang tรฌm kiแบฟm", true); dialog.show(); } @Override protected String doInBackground(String... params) { // tim kiem tu nhap vao trong moi chapter for (int i = 0; i < mChapterLists.size(); i++) { String deContent = ChapterContent.removeHtmlTag(mChapterLists.get(i).getDecontent()); deContent = deContent.replaceAll("\\W", " "); searchTextInput = searchTextInput.toLowerCase() ; //chuyen thanh chu thuong h mChapterLists.get(i).setResultTmp(search(deContent, searchTextInput)); result.add(mChapterLists.get(i).getResultTmp()); } return null; } @Override protected void onProgressUpdate(ChapterItem... values) { super.onProgressUpdate(values); } @Override protected void onPostExecute(String s) { super.onPostExecute(s); mChapterAdapter.notifyDataSetChanged(); dialog.dismiss(); Toast.makeText(StoryChapterActivity.this, "Tรฌm kiแบฟm xong !", Toast.LENGTH_SHORT).show(); } } }
[ "goldenlightning1252@gmail.com" ]
goldenlightning1252@gmail.com
807ab0c32ff5a562c1b10daa282e4474b6fcf4d1
96f94ad16746de41a6abd94b5edf578113caf422
/process-engine-api/.svn/pristine/80/807ab0c32ff5a562c1b10daa282e4474b6fcf4d1.svn-base
52b76f15737e8b63a3b0c604a890666dc315e7ae
[]
no_license
das-fbk/process-engine
b0132bcd99f8d6760013dc88be86feef627be3ba
9ffbf46bf3774ceb870c312492fd9f0a0fd38828
refs/heads/master
2020-12-31T07:17:26.148941
2017-02-01T11:02:15
2017-02-01T11:02:15
80,611,951
0
0
null
null
null
null
UTF-8
Java
false
false
362
package eu.fbk.das.process.engine.api.composition.element.exceptions; /** * This exception is thrown when current state for a service to be added to the composition * problem is null * @author Heorhi * */ public class ServiceCurrentStateNullException extends Exception { /** * */ private static final long serialVersionUID = 1L; }
[ "Martina@Minion" ]
Martina@Minion
56744d8c39b4d908a3439e99725f57d5e35d198e
224e341a82aa1b282c801e842d6937be77fd6391
/method1.java
94738a75a84c4d941b720eda457d9d781f3ac68f
[]
no_license
Shashikant2002/Java-Practice-Set-
7655d9791bef14865ab9ebabfd277edfb34c6fa7
f2aec86a19a4e436c5003cc2e03e91e1fd3d7c17
refs/heads/main
2023-08-13T08:00:52.359940
2021-10-19T05:44:50
2021-10-19T05:44:50
395,931,321
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
public class method1 { int logic(int x, int y){ int z; z=x+y; return z; } public static void main(String[] args) { int b=5; int c=5; method1 obj = new method1(); int a = obj.logic(b,c); System.out.println(a); } }
[ "shashikantprajapti17@gmail.om" ]
shashikantprajapti17@gmail.om
d6ba361cf7d54cbca8cb637cc11a5b77753886eb
d4f85845d058d4c7fa3d86a50e631d82f2f1cbfd
/src/main/java/dp/Shortest_Common_Supersequence_1092.java
d0cbe5491a840811d80f028ffb73c6acbbf36e71
[]
no_license
whotakekajibu/leetcode
eb419e7d8ec07a4987dc15a4e08c3f12cd25d5f5
ccaab808d1e252b0c8276b5576096e7c45608d5e
refs/heads/master
2021-07-10T23:37:21.886920
2020-08-23T13:15:53
2020-08-23T13:15:53
177,048,097
0
0
null
null
null
null
UTF-8
Java
false
false
2,136
java
package dp; import Utils.Utils; /** * @Description * @Date 2020/5/20 0:02 **/ public class Shortest_Common_Supersequence_1092 { public static void main(String[] args) { String str1 = "abac", str2 = "cab"; System.out.println(shortestCommonSupersequence(str1, str2)); } public static String shortestCommonSupersequence(String str1, String str2) { String common = longestCommonSubsequence(str1, str2); StringBuilder sb = new StringBuilder(); int i = 0, j = 0, k = 0; while (i < common.length() || j < str1.length() || k < str2.length()) { char c = '0'; if (i < common.length()) { c = common.charAt(i++); } while (j < str1.length() && c != str1.charAt(j)) { sb.append(str1.charAt(j++)); } while (k < str2.length() && c != str2.charAt(k)) { sb.append(str2.charAt(k++)); } j++; k++; if (c != '0') { sb.append(c); } } return sb.toString(); } public static String longestCommonSubsequence(String s1, String s2) { int[][] dp = new int[s1.length() + 1][s2.length() + 1]; for (int i = s1.length() - 1; i >= 0; i--) { for (int j = s2.length() - 1; j >= 0; j--) { if (s1.charAt(i) == s2.charAt(j)) { dp[i][j] = 1 + dp[i + 1][j + 1]; } else { dp[i][j] = Math.max(dp[i + 1][j], dp[i][j + 1]); } } } StringBuilder sb = new StringBuilder(); int i = 0, j = 0; Utils.printTwoDimensionalArray(dp); while (i < s1.length() && j < s2.length()) { if (s1.charAt(i) == s2.charAt(j)) { sb.append(s1.charAt(i)); i++; j++; } else { if (dp[i + 1][j] > dp[i][j + 1]) { i++; } else { j++; } } } return sb.toString(); } }
[ "ericning@wezhuiyi.com" ]
ericning@wezhuiyi.com
e1654ed99d969d17b02d2ed5fb884fd149a41227
79ba56485636fc42026c81ef7bc4df73bb6d47d9
/JAVA/Work/JavaApplication/src/main/java/java99/library/IServiceRent.java
ebb7c37c4dc57ac5f6ece4607d3aed55f551dd9e
[]
no_license
parkkobum/ThejoeunLecture
fc2eb3094920cba9a3bcdc882bfcab70901c2f38
74235501d775c8e866c0069f0417d2cf99e6bbc4
refs/heads/master
2021-08-15T03:56:45.929813
2017-11-17T09:03:21
2017-11-17T09:03:21
103,627,981
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package java99.library; import java.sql.ResultSet; import java.sql.SQLException; public interface IServiceRent extends IRent { //์ถ”๊ฐ€๋˜๋Š” ๋ฉ”์„œ๋“œ. Service ๋ ˆ์ด์–ด์—์„œ๋งŒ ์‚ฌ์šฉ๋˜๋Š” ๋ฉ”์„œ๋“œ. public int transCommit(ModelRent b1, ModelRent b2); public int TransRollback(ModelRent b1, ModelRent b2); ResultSet selectLike(ModelRent rent) throws SQLException; }
[ "bako1218@gmail.com" ]
bako1218@gmail.com
c970a84d02ac6d44638f81237b615a4156dc2d01
5a61ca45c5d46a31e3523d03c80eba4ecc310458
/mybatis/src/main/java/info/xiaomo/mybatis/controller/MybatisUserController.java
305af114c1c047873a15dea66b0bcb52620e20fa
[]
no_license
MrVanGogh/xiaomo-info-java
29cab13907fffe39078cc81928113b57ed6e0beb
2114d9c020c4968765d288b1363dcc28d047e60a
refs/heads/master
2021-01-12T02:39:06.380814
2016-12-26T06:25:23
2016-12-26T06:25:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,184
java
package info.xiaomo.mybatis.controller; import info.xiaomo.core.controller.Result; import info.xiaomo.mybatis.domain.User; import info.xiaomo.mybatis.mapper.UserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * ๆŠŠไปŠๅคฉๆœ€ๅฅฝ็š„่กจ็Žฐๅฝ“ไฝœๆ˜Žๅคฉๆœ€ๆ–ฐ็š„่ตท็‚น๏ผŽ๏ผŽ๏ฝž * ใ„ใพ ๆœ€้ซ˜ใฎ่กจ็พ ใจใ—ใฆ ๆ˜Žๆ—ฅๆœ€ๆ–ฐใฎๅง‹็™บ๏ผŽ๏ผŽ๏ฝž * Today the best performance as tomorrow newest starter! * Created by IntelliJ IDEA. * * @author: xiaomo * @github: https://github.com/qq83387856 * @email: hupengbest@163.com * @QQ_NO: 83387856 * @Date: 2016/11/16 9:41 * @Description: ็”จๆˆทๅฎžไฝ“็ฑป * @Copyright(ยฉ) 2015 by xiaomo. **/ @RestController public class MybatisUserController { private final UserMapper userMapper; @Autowired public MybatisUserController(UserMapper userMapper) { this.userMapper = userMapper; } @RequestMapping("findAll") public Result findAll() { List<User> all = userMapper.findAll(); return new Result(all); } }
[ "83387856@qq.com" ]
83387856@qq.com
e17bfe35f0486646a6f51706d4437cbd1b589764
d5b0820ad2686374659690edf6c9aea0ff62af83
/app/src/main/java/com/josenaves/android/pb/restful/view/MainActivity.java
45028b64d03bb33c408bc2e9b60d0211175bdb37
[]
no_license
josenaves/android-pb-restful
2ae91b1019d69da96f943f348732836cd7e166dd
af9abe2c3ce384d5efca3f016c0e8e8dcdae7db9
refs/heads/master
2021-01-17T12:39:28.792036
2016-06-15T17:25:30
2016-06-15T17:25:30
59,488,165
0
0
null
2016-06-14T20:31:59
2016-05-23T14:10:43
Java
UTF-8
Java
false
false
20,959
java
package com.josenaves.android.pb.restful.view; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.view.Menu; import android.view.MenuItem; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.afollestad.materialdialogs.MaterialDialog; import com.josenaves.android.pb.restful.Image; import com.josenaves.android.pb.restful.ImageBase64; import com.josenaves.android.pb.restful.api.UploadAPI; import com.josenaves.android.pb.restful.utils.ByteUtils; import com.josenaves.android.pb.restful.utils.PreferencesUtils; import com.josenaves.android.pb.restful.R; import com.josenaves.android.pb.restful.api.ImageAPI; import com.josenaves.android.pb.restful.api.ImageBase64API; import com.josenaves.android.pb.restful.api.SocketListener; import com.josenaves.android.pb.restful.api.WebSocketService; import com.josenaves.android.pb.restful.data.ImagesDataSource; import java.io.IOException; import java.io.InputStream; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.UUID; import java.util.concurrent.TimeoutException; import okio.ByteString; public class MainActivity extends AppCompatActivity { private static final String TAG = MainActivity.class.getSimpleName(); private static final int MAX_REQUESTS = 1; private ImagesDataSource dataSource; private TextView textId; private TextView textName; private TextView textDate; private TextView textSize; private WebSocketService webSocketAPI; private MaterialDialog wsDialog; class Benchmark { long totalDatabase = 0; long totalAPI = 0; long startTime = 0; long totalResponses = 0; } final Benchmark benchmark = new Benchmark(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); refreshActionbarTitle(); // prepare database to use dataSource = new ImagesDataSource(getContext()); textId = (TextView)findViewById(R.id.text_id); textName = (TextView)findViewById(R.id.text_name); textDate = (TextView)findViewById(R.id.text_date); textSize = (TextView)findViewById(R.id.text_size); Button buttonBatch64 = (Button) findViewById(R.id.button_base64_batch); buttonBatch64.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "::: Benchmark Batch Base64"); Log.d(TAG, "Get tree image from server (500 times)..."); final ImageBase64API imageBase64API = new ImageBase64API(getContext()); final MaterialDialog dialog = showProgressDialog("Benchmarking JSON with Base64"); new Thread(new Runnable() { @Override public void run() { long totalApi = 0, totalDatabase = 0; long ini, end; ImageBase64 image; for (int i = 0; i < MAX_REQUESTS; i++) { ini = Calendar.getInstance().getTimeInMillis(); try { image = imageBase64API.getTreeBase64Image(); end = Calendar.getInstance().getTimeInMillis(); totalApi += end - ini; ini = Calendar.getInstance().getTimeInMillis(); save(image); end = Calendar.getInstance().getTimeInMillis(); totalDatabase += end - ini; } catch (Exception e) { runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, "Timeout !", Toast.LENGTH_SHORT).show(); dialog.dismiss(); } }); return; } } dialog.dismiss(); long totalTime = totalApi + totalDatabase; Log.i(TAG, ":::::::::::: Benchmark Base64"); Log.i(TAG, ":::::::::::: Total time = " + totalTime + " milliseconds"); Log.i(TAG, ":::::::::::: Total API = " + totalApi + " milliseconds"); Log.i(TAG, ":::::::::::: Total DB = " + totalDatabase + " milliseconds"); final String content = String.format( "Total time : %s milliseconds\n" + "Total JSON Base64 : %s milliseconds\n" + "Total database : %s milliseconds", totalTime, totalApi, totalDatabase); runOnUiThread(new Runnable() { @Override public void run() { showResultsDialog("JSON with Base64 results", content); } }); } }).start(); } }); Button buttonBatchProtocolBuffers = (Button) findViewById(R.id.button_pb_batch); buttonBatchProtocolBuffers.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "::: Benchmark Batch Protocol Buffers"); Log.d(TAG, "Get tree image from server (500 times)..."); final ImageAPI imageAPI = new ImageAPI(getContext()); final MaterialDialog dialog = showProgressDialog("Benchmarking Protocol Buffers"); new Thread(new Runnable() { @Override public void run() { long totalApi = 0, totalDatabase = 0; long ini, end; Image image; for (int i = 0; i < MAX_REQUESTS; i++) { ini = Calendar.getInstance().getTimeInMillis(); try { image = imageAPI.getTreeImage(); end = Calendar.getInstance().getTimeInMillis(); totalApi += end - ini; ini = Calendar.getInstance().getTimeInMillis(); save(image); end = Calendar.getInstance().getTimeInMillis(); totalDatabase += end - ini; } catch (Exception e) { runOnUiThread(new Runnable() { @Override public void run() { dialog.dismiss(); Toast.makeText(MainActivity.this, "Timeout !", Toast.LENGTH_SHORT).show(); } }); return; } } dialog.dismiss(); long totalTime = totalApi + totalDatabase; Log.i(TAG, ":::::::::::: Benchmark Protocol Buffers"); Log.i(TAG, ":::::::::::: Total time = " + totalTime + " milliseconds"); Log.i(TAG, ":::::::::::: Total API = " + totalApi + " milliseconds"); Log.i(TAG, ":::::::::::: Total DB = " + totalDatabase + " milliseconds"); final String content = String.format( "Total time : %s milliseconds\n" + "Total ProtocolBuffers : %s milliseconds\n" + "Total database : %s milliseconds", totalTime, totalApi, totalDatabase); runOnUiThread(new Runnable() { @Override public void run() { showResultsDialog("Protocol Buffers over HTTP results", content); } }); } }).start(); } }); Button buttonBatchWebSocket = (Button) findViewById(R.id.button_websocket_batch); buttonBatchWebSocket.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "::: Benchmark Batch WebSockets"); Log.d(TAG, "Get florianopolis image from server (500 times)..."); wsDialog = showProgressDialog("Benchmarking Protocol Buffers over Websockets"); benchmark.startTime = Calendar.getInstance().getTimeInMillis(); benchmark.totalResponses = 0; new Thread(new Runnable() { @Override public void run() { Log.d(TAG, "Making a new websocket request - " + benchmark.totalResponses); webSocketAPI.request(); } }).start(); } }); Button buttonBatchUploadPB = (Button) findViewById(R.id.button_upload_batch); buttonBatchUploadPB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "::: Benchmark Batch Upload PB"); Log.d(TAG, "Upload tree image to server (500 times)..."); final UploadAPI api = new UploadAPI(getContext()); final MaterialDialog dialog = showProgressDialog("Benchmarking Upload PB"); new Thread(new Runnable() { @Override public void run() { long totalApi = 0; long ini, end; Image image; for (int i = 0; i < MAX_REQUESTS; i++) { //for (int i = 0; i < 1; i++) { ini = Calendar.getInstance().getTimeInMillis(); try { InputStream inStream = getContext().getResources().openRawResource(R.raw.tree); byte[] imageBytes = new byte[inStream.available()]; imageBytes = ByteUtils.convertStreamToByteArray(inStream); inStream.close(); String id = UUID.randomUUID().toString(); Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss:S"); String date = sdf.format(cal.getTime()); ByteString bs = ByteString.of(imageBytes); Log.d(TAG, "size of bytes:" + imageBytes.length); Log.d(TAG, "size of ByteString:" + bs.size()); image = new Image(id, id + "-tree.jpg", date, bs); api.uploadImage(image); end = Calendar.getInstance().getTimeInMillis(); totalApi += end - ini; } catch (Exception e) { runOnUiThread(new Runnable() { @Override public void run() { dialog.dismiss(); Toast.makeText(MainActivity.this, "Timeout !", Toast.LENGTH_SHORT).show(); } }); return; } } dialog.dismiss(); long average = totalApi/MAX_REQUESTS; Log.i(TAG, ":::::::::::: Benchmark Batch Upload PB"); Log.i(TAG, ":::::::::::: Total time = " + totalApi + " milliseconds"); Log.i(TAG, ":::::::::::: Average = " + average + " milliseconds"); final String content = String.format( "Total time : %s milliseconds\n" + "Average: %s milliseconds", totalApi, average); runOnUiThread(new Runnable() { @Override public void run() { showResultsDialog("Upload image results", content); } }); } }).start(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { Intent prefsIntent = new Intent(this, SettingsActivity.class); startActivity(prefsIntent); return true; } return super.onOptionsItemSelected(item); } private void save(final Image image) { // persist the image dataSource.open(); dataSource.createImage(image); dataSource.close(); runOnUiThread(new Runnable() { @Override public void run() { textId.setText("ID: " + image.id); textName.setText("Name: " + image.name); textDate.setText("Date: " + image.date); textSize.setText("Size: " + image.image_data.size() + " bytes"); } }); } private void save(final ImageBase64 image) { // persist the image dataSource.open(); dataSource.createImageBase64(image); dataSource.close(); runOnUiThread(new Runnable() { @Override public void run() { textId.setText("ID: " + image.id); textName.setText("Name: " + image.name); textDate.setText("Date: " + image.datetime); textSize.setText("Size: " + image.image_data.length() + " bytes"); } }); } private MaterialDialog showProgressDialog(String title) { return new MaterialDialog.Builder(MainActivity.this) .title(title) .content(R.string.please_wait) .progress(true, 0) .progressIndeterminateStyle(true) .show(); } private void showResultsDialog(final String title, final String content) { new MaterialDialog.Builder(MainActivity.this) .title(title) .content(content) .positiveText("Dismiss") .autoDismiss(true) .show(); } private SocketListener mainSocketListener = new SocketListener() { @Override public void onTimeout(TimeoutException e) { Log.e(TAG, "WebSocket - timeout error:" + e.getMessage()); runOnUiThread(new Runnable() { @Override public void run() { wsDialog.dismiss(); Toast.makeText(MainActivity.this, "Timeout !", Toast.LENGTH_SHORT).show(); } }); } @Override public void onException(Exception e) { Log.e(TAG, "WebSocket - error:" + e.getMessage()); runOnUiThread(new Runnable() { @Override public void run() { wsDialog.dismiss(); Toast.makeText(MainActivity.this, "Error with websockets!", Toast.LENGTH_SHORT).show(); } }); } @Override public void onResponse(byte[] response) { Log.d(TAG, "WS packet size: " + response.length); try { final Image image = Image.ADAPTER.decode(response); long ini = Calendar.getInstance().getTimeInMillis(); save(image); long end = Calendar.getInstance().getTimeInMillis(); benchmark.totalDatabase = benchmark.totalDatabase + (end - ini); } catch (IOException io) { final String msg = "Error decoding message from websocket server"; Log.e(TAG, msg + " - " + io.getMessage()); runOnUiThread(new Runnable() { @Override public void run() { wsDialog.dismiss(); Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show(); } }); } benchmark.totalResponses += 1; if (benchmark.totalResponses == MAX_REQUESTS) { long endTime = Calendar.getInstance().getTimeInMillis(); long totalTime = endTime - benchmark.startTime; wsDialog.dismiss(); benchmark.totalAPI = totalTime - benchmark.totalDatabase; Log.i(TAG, ":::::::::::: Benchmark WebSockets"); Log.i(TAG, ":::::::::::: Total time = " + totalTime + " milliseconds"); Log.i(TAG, ":::::::::::: Total API = " + benchmark.totalAPI + " milliseconds"); Log.i(TAG, ":::::::::::: Total DB = " + benchmark.totalDatabase + " milliseconds"); final String content = String.format( "Total time : %s milliseconds\n" + "Total ProtocolBuffers WS: %s milliseconds\n" + "Total database : %s milliseconds", totalTime, benchmark.totalAPI , benchmark.totalDatabase ); runOnUiThread(new Runnable() { @Override public void run() { showResultsDialog("Protocol Buffers over Websockets results", content); } }); } } }; private SocketListener requestSocketListener = new SocketListener() { @Override public void onResponse(byte[] response) { if (benchmark.totalResponses < MAX_REQUESTS) { Log.d(TAG, "Making a new websocket request - " + benchmark.totalResponses); webSocketAPI.request(); } } @Override public void onTimeout(TimeoutException e) { Log.d(TAG, "TimeoutException on requestSocketListener!"); } @Override public void onException(Exception e) { Log.d(TAG, "Exception on requestSocketListener!"); } }; public Context getContext() { return this.getApplicationContext(); } public void refreshActionbarTitle() { if (getSupportActionBar() != null) { getSupportActionBar().setTitle( getResources().getString(R.string.app_name) + " - server : " + PreferencesUtils.getHost(this)); } } @Override protected void onResume() { super.onResume(); refreshActionbarTitle(); webSocketAPI = new WebSocketService(getContext()); webSocketAPI.registerListener(mainSocketListener); webSocketAPI.registerListener(requestSocketListener); } @Override protected void onPause() { super.onPause(); webSocketAPI.unregisterListener(mainSocketListener); webSocketAPI.unregisterListener(requestSocketListener); webSocketAPI = null; } }
[ "josenaves@gmail.com" ]
josenaves@gmail.com
291aa199926685a1d93ce15c87c7298507d3a144
9091574605cd9c404e143a5cb91af3d5a705ff0d
/src/main/java/com/skytech/api/model/base/BaseTMailToExample.java
3fb80c4b27b384ad77e2aeb94c89745a26c90c33
[]
no_license
leevivi/skytech-api
9858f8bfb1a50980cf33a7b4f21a94372b9d930f
07d2e37900e63120880cc70232708932ea580a85
refs/heads/master
2020-05-16T08:31:43.229101
2019-04-24T10:55:41
2019-04-24T10:55:41
182,912,925
1
0
null
null
null
null
UTF-8
Java
false
false
12,940
java
package com.skytech.api.model.base; import com.skytech.api.core.model.BaseModelExample; import java.util.ArrayList; import java.util.List; public class BaseTMailToExample extends BaseModelExample{ protected List<Criteria> oredCriteria; public BaseTMailToExample() { oredCriteria = new ArrayList<Criteria>(); } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Integer value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Integer value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Integer value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Integer value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Integer value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Integer value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Integer> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Integer> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Integer value1, Integer value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Integer value1, Integer value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andMailidIsNull() { addCriterion("mailId is null"); return (Criteria) this; } public Criteria andMailidIsNotNull() { addCriterion("mailId is not null"); return (Criteria) this; } public Criteria andMailidEqualTo(Integer value) { addCriterion("mailId =", value, "mailid"); return (Criteria) this; } public Criteria andMailidNotEqualTo(Integer value) { addCriterion("mailId <>", value, "mailid"); return (Criteria) this; } public Criteria andMailidGreaterThan(Integer value) { addCriterion("mailId >", value, "mailid"); return (Criteria) this; } public Criteria andMailidGreaterThanOrEqualTo(Integer value) { addCriterion("mailId >=", value, "mailid"); return (Criteria) this; } public Criteria andMailidLessThan(Integer value) { addCriterion("mailId <", value, "mailid"); return (Criteria) this; } public Criteria andMailidLessThanOrEqualTo(Integer value) { addCriterion("mailId <=", value, "mailid"); return (Criteria) this; } public Criteria andMailidIn(List<Integer> values) { addCriterion("mailId in", values, "mailid"); return (Criteria) this; } public Criteria andMailidNotIn(List<Integer> values) { addCriterion("mailId not in", values, "mailid"); return (Criteria) this; } public Criteria andMailidBetween(Integer value1, Integer value2) { addCriterion("mailId between", value1, value2, "mailid"); return (Criteria) this; } public Criteria andMailidNotBetween(Integer value1, Integer value2) { addCriterion("mailId not between", value1, value2, "mailid"); return (Criteria) this; } public Criteria andTouserIsNull() { addCriterion("toUser is null"); return (Criteria) this; } public Criteria andTouserIsNotNull() { addCriterion("toUser is not null"); return (Criteria) this; } public Criteria andTouserEqualTo(String value) { addCriterion("toUser =", value, "touser"); return (Criteria) this; } public Criteria andTouserNotEqualTo(String value) { addCriterion("toUser <>", value, "touser"); return (Criteria) this; } public Criteria andTouserGreaterThan(String value) { addCriterion("toUser >", value, "touser"); return (Criteria) this; } public Criteria andTouserGreaterThanOrEqualTo(String value) { addCriterion("toUser >=", value, "touser"); return (Criteria) this; } public Criteria andTouserLessThan(String value) { addCriterion("toUser <", value, "touser"); return (Criteria) this; } public Criteria andTouserLessThanOrEqualTo(String value) { addCriterion("toUser <=", value, "touser"); return (Criteria) this; } public Criteria andTouserLike(String value) { addCriterion("toUser like", value, "touser"); return (Criteria) this; } public Criteria andTouserNotLike(String value) { addCriterion("toUser not like", value, "touser"); return (Criteria) this; } public Criteria andTouserIn(List<String> values) { addCriterion("toUser in", values, "touser"); return (Criteria) this; } public Criteria andTouserNotIn(List<String> values) { addCriterion("toUser not in", values, "touser"); return (Criteria) this; } public Criteria andTouserBetween(String value1, String value2) { addCriterion("toUser between", value1, value2, "touser"); return (Criteria) this; } public Criteria andTouserNotBetween(String value1, String value2) { addCriterion("toUser not between", value1, value2, "touser"); return (Criteria) this; } public Criteria andStatusIsNull() { addCriterion("status is null"); return (Criteria) this; } public Criteria andStatusIsNotNull() { addCriterion("status is not null"); return (Criteria) this; } public Criteria andStatusEqualTo(Boolean value) { addCriterion("status =", value, "status"); return (Criteria) this; } public Criteria andStatusNotEqualTo(Boolean value) { addCriterion("status <>", value, "status"); return (Criteria) this; } public Criteria andStatusGreaterThan(Boolean value) { addCriterion("status >", value, "status"); return (Criteria) this; } public Criteria andStatusGreaterThanOrEqualTo(Boolean value) { addCriterion("status >=", value, "status"); return (Criteria) this; } public Criteria andStatusLessThan(Boolean value) { addCriterion("status <", value, "status"); return (Criteria) this; } public Criteria andStatusLessThanOrEqualTo(Boolean value) { addCriterion("status <=", value, "status"); return (Criteria) this; } public Criteria andStatusIn(List<Boolean> values) { addCriterion("status in", values, "status"); return (Criteria) this; } public Criteria andStatusNotIn(List<Boolean> values) { addCriterion("status not in", values, "status"); return (Criteria) this; } public Criteria andStatusBetween(Boolean value1, Boolean value2) { addCriterion("status between", value1, value2, "status"); return (Criteria) this; } public Criteria andStatusNotBetween(Boolean value1, Boolean value2) { addCriterion("status not between", value1, value2, "status"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
[ "leeyahweh@163.com" ]
leeyahweh@163.com
aad885b8a87b52ea084c5803dd24b186af26285f
7562b513dab66a4e37010004bd54f2c2b13a9156
/src/main/java/com/kpn/model/Movies.java
2067d079dfc3b6a66b54a301445150abb3ea8f90
[]
no_license
gvnldeveloper/movies
083e50e570c58ac39f01d134de0609c8949b01b7
483bc1e5ea33423d9c956b0dea32820f58b62a45
refs/heads/master
2022-05-18T04:15:19.588972
2020-04-24T10:55:34
2020-04-24T10:55:34
258,118,565
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
package com.kpn.model; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "movies") @XmlAccessorType(XmlAccessType.FIELD) public class Movies { @XmlElement(name = "movie") private List<Movie> movie; public List<Movie> getMovie() { return movie; } public void setMovie(ArrayList<Movie> movie) { this.movie = movie; } @Override public String toString() { return "Movies [movies=" + movie + "]"; } }
[ "gaurav.vats@sogeti.com" ]
gaurav.vats@sogeti.com
d52286b5127ec694f39360e77c31c28ede1b8217
3df9ef1780c508595ee7587275c50f518ec42cac
/code/awe-pay-sdk/src/main/java/com/awe/pay/sdk/response/ChannelResponse.java
5676bfda755f7612bc847a25c6772767998ee596
[]
no_license
soa4java/o2omall
2a5b03cc1d9fc484d5ab5896bb67d413de40a5a8
03f89b322aafab6e03a9c3dcac6872a14d37845e
refs/heads/master
2021-01-15T17:59:14.088029
2015-02-11T02:19:17
2015-02-11T02:19:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
package com.awe.pay.sdk.response; import com.hbird.common.sdk.api.response.HbirdResponse; import com.awe.pay.sdk.response.dto.ChannelResponseDto; /** * ChannelResponse๏ผšๆ”ฏไป˜้€š้“่ฟ”ๅ›žๅฏน่ฑก<br/> * ๆไพ›restๆŽฅๅฃๆ—ถๆ–นๆณ•็š„่ฟ”ๅ›žๅฏน่ฑก * * @author ljz * @version 2014-12-23 10:06:28 * */ public class ChannelResponse extends HbirdResponse<ChannelResponseDto> { /** ๅบๅˆ—ๅŒ–ๆ ‡่ฏ† */ private static final long serialVersionUID = 1L; }
[ "zhong-lj@163.com" ]
zhong-lj@163.com
d1f20e13694d0d547b79b8994b610f07685f7e49
9dadd9ae01e963ff7a103069776e83053fc6a6f6
/src/main/java/es/upcnet/domain/Authority.java
f4c0ece319cfa66bbed1dcb533d7206c21d14cb8
[]
no_license
aplaza74/jhipsterSampleApplication
0866f78618720570a21e16e14d267d065b364496
07c8827f7597570ceaa35075561acc5e7c8d7925
refs/heads/master
2021-09-01T19:10:52.950091
2017-12-28T10:56:58
2017-12-28T10:56:58
115,614,520
0
0
null
null
null
null
UTF-8
Java
false
false
1,447
java
package es.upcnet.domain; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Column; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import java.io.Serializable; /** * An authority (a security role) used by Spring Security. */ @Entity @Table(name = "jhi_authority") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class Authority implements Serializable { private static final long serialVersionUID = 1L; @NotNull @Size(max = 50) @Id @Column(length = 50) private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Authority authority = (Authority) o; return !(name != null ? !name.equals(authority.name) : authority.name != null); } @Override public int hashCode() { return name != null ? name.hashCode() : 0; } @Override public String toString() { return "Authority{" + "name='" + name + '\'' + "}"; } }
[ "jhipster-bot@users.noreply.github.com" ]
jhipster-bot@users.noreply.github.com
d8548ccf3f0fda7e53074aae3ad3bbc458bab39e
94f1598a03241d10bd735a45918ea259d4faf1ba
/leyou/ly-item/leyou-item-service/src/main/java/com/leyou/item/controller/BrandController.java
577686c43374ec0c96dd77d63f53e48f42379032
[]
no_license
wangzhen-wz/leyou
6f9cbfc709f6be1ec21677f3e44cb9ea64645921
226defe6d1c9bb152589b689ab1d5728ba27b261
refs/heads/master
2022-12-10T23:20:42.130295
2019-08-29T07:29:04
2019-08-29T07:29:04
205,058,924
0
0
null
2022-11-15T23:47:54
2019-08-29T01:55:36
Java
UTF-8
Java
false
false
4,408
java
package com.leyou.item.controller; import com.leyou.common.PageResult; import com.leyou.item.pojo.Brand; import com.leyou.item.service.BrandService; import com.leyou.parameter.BrandQueryByPageParameter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("brand") public class BrandController { @Autowired private BrandService brandService; /** * ๅˆ†้กตๆŸฅ่ฏขๅ“็‰Œ * @param page * @param rows * @param sortBy * @param desc * @param key * @return */ @GetMapping("page") public ResponseEntity<PageResult<Brand>> queryBrandByPage(@RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "rows", defaultValue = "5") Integer rows, @RequestParam(value = "sortBy", required = false) String sortBy, @RequestParam(value = "desc", defaultValue = "false") Boolean desc, @RequestParam(value = "key", required = false) String key){ BrandQueryByPageParameter brandQueryByPageParameter=new BrandQueryByPageParameter(page,rows,sortBy,desc,key); PageResult<Brand> result = this.brandService.queryBrandByPage(brandQueryByPageParameter); if(result == null){ return ResponseEntity.status( HttpStatus.NOT_FOUND).body(null); } return ResponseEntity.ok(result); } /** * ๅ“็‰Œๆ–ฐๅขž * @param brand * @param categories * @return */ @PostMapping public ResponseEntity<Void> saveBrand(Brand brand, @RequestParam("categories") List<Long> categories){ System.out.println(brand); this.brandService.saveBrand(brand, categories); return ResponseEntity.status(HttpStatus.CREATED).build(); } /** * ๅ“็‰Œไฟฎๆ”น * @param brand * @param categories * @return */ @PutMapping public ResponseEntity<Void> updateBrand(Brand brand,@RequestParam("categories") List<Long> categories){ this.brandService.updateBrand(brand,categories); return ResponseEntity.status(HttpStatus.ACCEPTED).build(); } /** * ๅˆ ้™คtb_category_brandไธญ็š„ๆ•ฐๆฎ * @param bid * @return */ @DeleteMapping("cid_bid/{bid}") public ResponseEntity<Void> deleteByBrandIdInCategoryBrand(@PathVariable("bid") Long bid){ //System.out.println("ๅˆ ้™คไธญ้—ด่กจ"); this.brandService.deleteByBrandIdInCategoryBrand(bid); return ResponseEntity.status(HttpStatus.OK).build(); } /** * ๅˆ ้™คtb_brandไธญ็š„ๆ•ฐๆฎ,ๅ•ไธชๅˆ ้™คใ€ๅคšไธชๅˆ ้™คไบŒๅˆไธ€ * @param bid * @return */ @DeleteMapping("bid/{bid}") public ResponseEntity<Void> deleteBrand(@PathVariable("bid") String bid){ String separator="-"; if(bid.contains(separator)){ String[] ids=bid.split(separator); for (String id:ids){ this.brandService.deleteBrand(Long.parseLong(id)); } } else { this.brandService.deleteBrand(Long.parseLong(bid)); } return ResponseEntity.status(HttpStatus.OK).build(); } /** * ๆ นๆฎcategory็š„idๆŸฅ่ฏขๅ“็‰Œไฟกๆฏ * @param cid * @return */ @GetMapping("cid/{cid}") public ResponseEntity<List<Brand>> queryBrandByCategoryId(@PathVariable("cid") Long cid){ List<Brand> list = this.brandService.queryBrandByCategoryId(cid); if (list == null){ return ResponseEntity.status(HttpStatus.NOT_FOUND).build(); } return ResponseEntity.ok(list); } /** * ๆ นๆฎๅ“็‰Œid็ป“ๅˆ๏ผŒๆŸฅ่ฏขๅ“็‰Œไฟกๆฏ * @param ids * @return */ @GetMapping("list") public ResponseEntity<List<Brand>> queryBrandByIds(@RequestParam("ids") List<Long> ids){ List<Brand> list = this.brandService.queryBrandByBrandIds(ids); if (list == null){ return ResponseEntity.status(HttpStatus.NOT_FOUND).build(); } return ResponseEntity.ok(list); } }
[ "984299167@qq.com" ]
984299167@qq.com
1b25d8c5abab22f9ad1812c80742e239c8676360
99ff1259387df568c256ae7835996ba7073299ca
/src/Latihan4/TestShape.java
9fbaccc91fa3dd3cafd9155b04f2fae666b15e95
[]
no_license
tiararahmania/MODUL-4-
0204e162458a47b26786fdad851887e117748247
64e94471ea8f580c120822979d671b8ac9a2b42b
refs/heads/master
2021-07-06T06:46:20.787776
2017-09-29T05:18:46
2017-09-29T05:18:46
105,228,227
0
0
null
null
null
null
UTF-8
Java
false
false
621
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 Latihan4; /** * * @author Umi Tiara */ public class TestShape { public static void main(String[] args) { Shape s1 = new Rectangle ("red", 4, 5); System.out.println(s1); System.out.println("Area is " + s1.getArea()); Shape s2 = new Rectangle ("blue", 4, 5); System.out.println(s2); System.out.println("Area is " + s2.getArea()); } }
[ "Umi Tiara@192.168.1.11" ]
Umi Tiara@192.168.1.11
a6596538e1173b80e440223f35a32c5320e14e1f
2f127dccc421c352da1bbab4386dce3a7283418e
/settingsservice/src/main/java/com/example/settingsservice/model/StringDTO.java
a5bd6d9e8fd4f4c6759f8276d60feb1f64328aa3
[]
no_license
dankalalic/NistagramXWS
285c671a7ef7b9082fbf08ae758b9d86b3c74bae
595c40239ed8bc2b4096635cf61e2b9bf7c50526
refs/heads/master
2023-06-07T01:22:02.804892
2021-07-09T00:28:58
2021-07-09T00:28:58
377,233,652
0
0
null
null
null
null
UTF-8
Java
false
false
348
java
package com.example.settingsservice.model; public class StringDTO { private String string; public String getString() { return string; } public void setString(String string) { this.string = string; } public StringDTO() { } public StringDTO(String string) { this.string = string; } }
[ "bbc.vanja@gmail.com" ]
bbc.vanja@gmail.com
9ec35d6164a2eb6340d8409a462bb7b0e9e0ddb6
000e9ddd9b77e93ccb8f1e38c1822951bba84fa9
/java/classes2/com/megvii/zhimasdk/d/b.java
ef86a8e5fde1dec162050e3f84c84bcf2dbd6905
[ "Apache-2.0" ]
permissive
Paladin1412/house
2bb7d591990c58bd7e8a9bf933481eb46901b3ed
b9e63db1a4975b614c422fed3b5b33ee57ea23fd
refs/heads/master
2021-09-17T03:37:48.576781
2018-06-27T12:39:38
2018-06-27T12:41:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,962
java
package com.megvii.zhimasdk.d; import android.content.Context; import android.content.res.Resources; import android.util.Base64; import com.megvii.zhimasdk.R.raw; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Collection; import java.util.Iterator; import java.util.UUID; public class b { public static double a(Collection<Double> paramCollection) { paramCollection = paramCollection.iterator(); for (double d = 0.0D; paramCollection.hasNext(); d = ((Double)paramCollection.next()).doubleValue() + d) {} return d; } public static final String a(byte[] paramArrayOfByte) { try { Object localObject = MessageDigest.getInstance("SHA-1"); ((MessageDigest)localObject).update(paramArrayOfByte); localObject = ((MessageDigest)localObject).digest(); StringBuilder localStringBuilder = new StringBuilder(); int j = localObject.length; int i = 0; while (i < j) { for (paramArrayOfByte = Integer.toHexString(localObject[i] & 0xFF); paramArrayOfByte.length() < 2; paramArrayOfByte = "0" + paramArrayOfByte) {} localStringBuilder.append(paramArrayOfByte); i += 1; } paramArrayOfByte = localStringBuilder.toString(); return paramArrayOfByte; } catch (NoSuchAlgorithmException paramArrayOfByte) { paramArrayOfByte.printStackTrace(); } return ""; } public static byte[] a(Context paramContext) { localObject = null; Context localContext = null; ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream(); byte[] arrayOfByte = new byte['ะ€']; try { paramContext = paramContext.getResources().openRawResource(R.raw.livenessmodel); for (;;) { localContext = paramContext; localObject = paramContext; int i = paramContext.read(arrayOfByte); if (i == -1) { break; } localContext = paramContext; localObject = paramContext; localByteArrayOutputStream.write(arrayOfByte, 0, i); } try { ((InputStream)localObject).close(); throw paramContext; } catch (IOException localIOException) { for (;;) { localIOException.printStackTrace(); } } } catch (IOException paramContext) { localObject = localContext; paramContext.printStackTrace(); if (localContext != null) {} try { localContext.close(); for (;;) { return localByteArrayOutputStream.toByteArray(); localContext = paramContext; localObject = paramContext; localByteArrayOutputStream.close(); if (paramContext != null) { try { paramContext.close(); } catch (IOException paramContext) { paramContext.printStackTrace(); } } } } catch (IOException paramContext) { for (;;) { paramContext.printStackTrace(); } } } finally { if (localObject == null) {} } } public static String b(Context paramContext) { n localn = new n(paramContext); String str = localn.a("key_uuid"); if (str != null) { return str; } if (str != null) { paramContext = str; if (str.trim().length() != 0) {} } else { paramContext = Base64.encodeToString(UUID.randomUUID().toString().getBytes(), 0); } localn.a("key_uuid", paramContext); return paramContext; } } /* Location: /Users/gaoht/Downloads/zirom/classes2-dex2jar.jar!/com/megvii/zhimasdk/d/b.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "ght163988@autonavi.com" ]
ght163988@autonavi.com
1be338641b2109d0dfcc3196715e00178d337c5b
7f43112458558361dade0fb7781dd7659162f883
/Inheritance/src/main/java/com/subConstructors/instruments/Instrument.java
35ed4375632d418c39e34cfa6d7f20da368391b7
[]
no_license
SakshiGauro/JavaCodes
640c79ba51eedfff902caca1c5c9374a3b664d7d
88f26770676bcefc574dc6c4b8e1720ad3426789
refs/heads/main
2023-03-22T15:50:33.669768
2021-03-13T15:06:05
2021-03-13T15:06:05
311,232,925
2
0
null
null
null
null
UTF-8
Java
false
false
667
java
package com.subConstructors.instruments; public class Instrument { private String name; private String family; public Instrument(String name, String family) { this.name = name; this.family = family; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getFamily() { return family; } public void setFamily(String family) { this.family = family; } public String toString() { return name + " is a member of the " + family + " family."; } }
[ "gaurosakshi113@gmail.com" ]
gaurosakshi113@gmail.com
2c3b9bd213b9e6183682c42f1b307d30e871824e
01d1b40592982e978e195c451d5d45c4126e3550
/evcache-server-spring-cloud-autoconfigure/src/main/java/com/github/aafwu00/evcache/server/spring/cloud/MemcachedReactiveHealthIndicator.java
6da7893287a8632a353d6979271f48fc02e5e032
[ "Apache-2.0" ]
permissive
maisonarmani/netflix-evcache-spring
296ddcd61584692eea8f3fc4ca4cdc7e8d9ae125
ec4cf05b8c323cbf69d8dec5df5e063f8645df2f
refs/heads/master
2022-04-14T09:34:37.407834
2020-04-11T04:07:28
2020-04-11T04:07:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,615
java
/* * Copyright 2017-2020 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 com.github.aafwu00.evcache.server.spring.cloud; import net.spy.memcached.MemcachedClient; import org.springframework.boot.actuate.health.AbstractReactiveHealthIndicator; import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.ReactiveHealthIndicator; import reactor.core.publisher.Mono; import static com.github.aafwu00.evcache.server.spring.cloud.MemcachedHealthIndicator.DURATION; import static com.github.aafwu00.evcache.server.spring.cloud.MemcachedHealthIndicator.EXPIRATION; import static com.github.aafwu00.evcache.server.spring.cloud.MemcachedHealthIndicator.KEY; import static com.github.aafwu00.evcache.server.spring.cloud.MemcachedHealthIndicator.VALUE; import static java.util.Objects.requireNonNull; import static java.util.concurrent.TimeUnit.SECONDS; /** * Simple implementation of a {@link ReactiveHealthIndicator} returning status information for Memcached. * * @author Taeho Kim */ public class MemcachedReactiveHealthIndicator extends AbstractReactiveHealthIndicator { private final MemcachedClient client; public MemcachedReactiveHealthIndicator(final MemcachedClient client) { super(); this.client = requireNonNull(client); } @Override protected Mono<Health> doHealthCheck(final Health.Builder builder) { return trySetOperation().zipWith(tryGetOperation(), this::isSuccess) .map(success -> success ? builder.up().build() : builder.outOfService().build()); } private Mono<Boolean> tryGetOperation() { return Mono.fromCallable(() -> client.asyncGet(KEY).get(DURATION, SECONDS)) .map(VALUE::equals); } private Mono<Boolean> trySetOperation() { return Mono.fromCallable(() -> client.set(KEY, EXPIRATION, VALUE).get(DURATION, SECONDS)); } private Boolean isSuccess(final Boolean isSuccessSet, final Boolean isSuccessGet) { return isSuccessSet && isSuccessGet; } }
[ "aafwu00@gmail.com" ]
aafwu00@gmail.com
c6d7e1a292381a0fd4dfac6c2b0b7b6f93402ab7
5c947e3e8cf3411b9864618512176f62c33ab261
/app/src/main/java/com/panwrona/myportfolio/customviews/skills_level_view/entities/Skills.java
631968dd37d72c39565040c1c3158884bd7944be
[]
no_license
morristech/MyPortfolio
ca16e1ab5908657cb74e9d664158005b6b1f5765
dacb438d166bf20ed868ab9cd6040d7e5e10ff82
refs/heads/master
2020-05-19T00:10:41.856878
2016-04-07T19:54:49
2016-04-07T19:54:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package com.panwrona.myportfolio.customviews.skills_level_view.entities; import java.util.List; class Skills { private List<Skill> skillList; private int scale; public int getScale() { return scale; } public void setScale(int scale) { this.scale = scale; } public List<Skill> getSkillList() { return skillList; } public void setSkillList(List<Skill> skillList) { this.skillList = skillList; } }
[ "mariusz.brona@droidsonroids.pl" ]
mariusz.brona@droidsonroids.pl
290eeef54a1db416a35ef204631c59030b7c2b33
590cebae4483121569983808da1f91563254efed
/Router/eps2-src/balancer/src/main/java/ru/acs/fts/eps2/balancer/dispatch/IMessageDispatcher.java
6100c786ee266d606e75d87a6005d51ed44567b7
[]
no_license
ke-kontur/eps
8b00f9c7a5f92edeaac2f04146bf0676a3a78e27
7f0580cd82022d36d99fb846c4025e5950b0c103
refs/heads/master
2020-05-16T23:53:03.163443
2014-11-26T07:00:34
2014-11-26T07:01:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
314
java
package ru.acs.fts.eps2.balancer.dispatch; import javax.jms.Message; import ru.acs.fts.eps2.balancer.exceptions.MessageDispatchException; public interface IMessageDispatcher { void dispatch( Message message ) throws MessageDispatchException; void discard( Message message ) throws MessageDispatchException; }
[ "m@brel.me" ]
m@brel.me
88ec8de4f56d29c8126f26d08499a7b8281c5f8b
1f9885882a7851125f83695dfba4c41fce2538b8
/src/main/java/com/ypc/forthVerticle/service/UserService.java
546ecb9f1eb1642430bc4a787caf8771c7a5f92d
[]
no_license
ypcfly/forthVerticle
efd190642b41fe341cdfd9f0d54ce5087920881c
3e05b18f3c04d4ab67b1c8a2b1aa1b189c9e963b
refs/heads/master
2020-03-27T19:31:27.399133
2018-09-01T12:00:58
2018-09-01T12:00:58
146,994,527
1
0
null
null
null
null
UTF-8
Java
false
false
914
java
package com.ypc.forthVerticle.service; import io.vertx.codegen.annotations.Fluent; import io.vertx.codegen.annotations.ProxyGen; import io.vertx.core.AsyncResult; import io.vertx.core.Handler; import io.vertx.core.Vertx; import io.vertx.core.json.JsonObject; import io.vertx.ext.jdbc.JDBCClient; import java.util.List; @ProxyGen public interface UserService { @Fluent UserService selectUserById(Integer id,Handler<AsyncResult<JsonObject>> resultHandler); @Fluent UserService selectUserConditional(String address,Integer age,Handler<AsyncResult<List<JsonObject>>> resultHandler); static UserService create(JDBCClient jdbcClient,Handler<AsyncResult<UserService>> readyHandler){ return new UserServiceImpl(jdbcClient,readyHandler); } static UserServiceVertxEBProxy createProxy(Vertx vertx,String address){ return new UserServiceVertxEBProxy(vertx,address); } }
[ "ypcfly02@gmail.com" ]
ypcfly02@gmail.com