blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
a4f043ebc916795b645a1ec5b1abe54b60d489fd
c5a4a03707569461757257d8837f70cdffb20ac8
/app/src/main/java/com/example/administrator/textdemo/ContactUtils.java
493c117615d6b196166be6d114c3e77fd2a84bf3
[]
no_license
AonoCandal/SomeUtils
c97f9b601dffa79c3b15645c8ce5b41d35eb9298
22465eeea803dda4d4bcf8761c9c7c38a202b8db
refs/heads/master
2021-04-09T11:22:25.651058
2018-03-30T06:48:43
2018-03-30T06:48:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,717
java
package com.example.administrator.textdemo; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Email; import android.provider.ContactsContract.CommonDataKinds.Im; import android.provider.ContactsContract.CommonDataKinds.Note; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.Photo; import android.provider.ContactsContract.CommonDataKinds.StructuredName; import android.provider.ContactsContract.RawContacts.Data; import android.support.annotation.DrawableRes; import android.text.TextUtils; import java.io.ByteArrayOutputStream; /** * Created by Aono on 2017-08-09. * package_name: com.leley.app.utils * project_name: leley_android */ public class ContactUtils { public static boolean addContact(Context context, ContactEntity contact, @DrawableRes int resId) { try { ContentValues values = new ContentValues(); // 下面的操作会根据RawContacts表中已有的rawContactId使用情况自动生成新联系人的rawContactId Uri rawContactUri = context.getContentResolver().insert( ContactsContract.RawContacts.CONTENT_URI, values); long rawContactId = ContentUris.parseId(rawContactUri); // 向data表插入姓名数据 String name = contact.getName(); if (!TextUtils.isEmpty(name)) { values.clear(); values.put(Data.RAW_CONTACT_ID, rawContactId); values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE); values.put(StructuredName.GIVEN_NAME, name); context.getContentResolver().insert( ContactsContract.Data.CONTENT_URI, values); } // 向data表插入电话数据 // String mobile_number = contact.getPhone().get(0); for (String mobile_number : contact.getPhone()) { if (!TextUtils.isEmpty(mobile_number)) { values.clear(); values.put(Data.RAW_CONTACT_ID, rawContactId); values.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE); values.put(Phone.NUMBER, mobile_number); values.put(Phone.TYPE, Phone.TYPE_MOBILE); context.getContentResolver().insert( ContactsContract.Data.CONTENT_URI, values); } } // 向data表插入Email数据 String email = contact.getEmail(); if (!TextUtils.isEmpty(email)) { values.clear(); values.put(Data.RAW_CONTACT_ID, rawContactId); values.put(Data.MIMETYPE, Email.CONTENT_ITEM_TYPE); values.put(Email.DATA, email); values.put(Email.TYPE, Email.TYPE_WORK); context.getContentResolver().insert( ContactsContract.Data.CONTENT_URI, values); } // 向data表插入QQ数据 String qq = contact.getQq(); if (!TextUtils.isEmpty(qq)) { values.clear(); values.put(Data.RAW_CONTACT_ID, rawContactId); values.put(Data.MIMETYPE, Im.CONTENT_ITEM_TYPE); values.put(Im.DATA, qq); values.put(Im.PROTOCOL, Im.PROTOCOL_QQ); context.getContentResolver().insert( ContactsContract.Data.CONTENT_URI, values); } // 向data表插入备注信息 String describe = contact.getDescribe(); if (!TextUtils.isEmpty(describe)) { values.clear(); values.put(Data.RAW_CONTACT_ID, rawContactId); values.put(Data.MIMETYPE, Note.CONTENT_ITEM_TYPE); values.put(Note.NOTE, describe); context.getContentResolver().insert( ContactsContract.Data.CONTENT_URI, values); } // 向data表插入头像数据 Bitmap sourceBitmap = BitmapFactory.decodeResource( context.getResources(), resId); final ByteArrayOutputStream os = new ByteArrayOutputStream(); // 将Bitmap压缩成PNG编码,质量为100%存储 sourceBitmap.compress(Bitmap.CompressFormat.PNG, 100, os); byte[] avatar = os.toByteArray(); values.put(Data.RAW_CONTACT_ID, rawContactId); values.put(Data.MIMETYPE, Photo.CONTENT_ITEM_TYPE); values.put(Photo.PHOTO, avatar); context.getContentResolver().insert( ContactsContract.Data.CONTENT_URI, values); } catch (Exception e) { return false; } return true; } public static boolean hasContactFromPhoneBook(Context context, String phoneNum, String leleyName) { String contactName; ContentResolver cr = context.getContentResolver(); Cursor pCur = cr.query( Phone.CONTENT_URI, null, Phone.NUMBER + " = ?", new String[] { phoneNum }, null); if (pCur != null && pCur.moveToFirst()) { contactName = pCur.getString(pCur.getColumnIndex(Phone.DISPLAY_NAME)); pCur.close(); return leleyName.equals(contactName.trim()); } return false; } }
[ "lijg@leleyuntech.com" ]
lijg@leleyuntech.com
e8546644ba8223169e9c25a205bb9ce973020c4f
911e1e17409de712dcfca466d22269c32fc48719
/JavaCore/src/com/ddb/javacore/mutithread/CriticalStack.java
097fa153b5451a71c4b95923fe473ca122a7e47a
[]
no_license
1797890817/Java6
3a7446b21d11c0c6ef8a5e2d678a3fd5b19528e3
782f74e230221b08df54b166c18671b99dec5fe6
refs/heads/master
2021-01-19T01:11:09.002828
2017-12-18T07:28:03
2017-12-18T07:28:03
100,571,249
0
14
null
null
null
null
UTF-8
Java
false
false
723
java
package com.ddb.javacore.mutithread; /** * 线程安全测试 */ public class CriticalStack { int index = 0; char[] data = new char[10]; public void push(char c) { // 模拟压栈操作 data[index] = c; System.out.println("压入:" + c); try { Thread.sleep(100); // 故意让它出现不正确的 } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } index++; System.out.println("压入后指针上移。"); } public char pop() { // 模拟出栈操作 index--; // 之所以相减是因为上一个方法,先加了1 System.out.println("弹出前指针下移"); char c = data[index]; System.out.println("弹出:" + c); return c; } }
[ "1797890817@qq.com" ]
1797890817@qq.com
f35a9fa336074931a4891d706bd2510b65468a4d
987f174a131259a1f3175c810973aa5c06fbe007
/src/main/java/co/hrsquare/bindad/model/employee/HoursForDay.java
3bfaf29dc124cf0eb26b3ac2470cd0f1d4d036ad
[ "MIT" ]
permissive
bindad/bindad-server
bb70bfb9840b5aa126e293367d9ffd5531b4b074
69568bb07ede8e911296c940b100804ea618a5c2
refs/heads/master
2023-02-16T08:59:54.757919
2021-01-03T18:49:00
2021-01-03T18:49:00
323,620,837
0
0
MIT
2021-01-03T18:49:01
2020-12-22T12:33:09
Java
UTF-8
Java
false
false
400
java
package co.hrsquare.bindad.model.employee; import lombok.Data; import lombok.NoArgsConstructor; import java.time.LocalTime; @Data @NoArgsConstructor public class HoursForDay { private LocalTime amStart; private LocalTime amEnd; private LocalTime lunchStart; private LocalTime lunchEnd; private LocalTime pmStart; private LocalTime pmEnd; private boolean lunchPaid; }
[ "anurag@hrsquare.co" ]
anurag@hrsquare.co
1bdc3b75a5a7b847cf835cc84834df26a0ebf572
6dd6e4c833b4d20b673350f85d5238f388266a66
/Ian Fabricio/atividadeHibernete/src/bean/ClienteBean.java
1d77c14f836c74b93e96c723e4cc701faecd02e0
[]
no_license
tmenegaz/dev_sysII_dendezeiros
3ba3ff6bd529eda8e6c48314be619ac5c654208c
85d2f66b5aa7e1d2c414598c92b8ed6ba56d5855
refs/heads/master
2021-01-23T08:33:53.988956
2017-12-19T21:50:54
2017-12-19T21:50:54
102,534,645
0
15
null
2017-12-20T02:32:05
2017-09-05T22:12:26
Java
UTF-8
Java
false
false
1,247
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 bean; import java.io.Serializable; import java.util.Set; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; /** * * @author Marcos */ @Entity @Table(name="cliente") public class ClienteBean implements Serializable { @Id @GeneratedValue private int id_Cliente; private String nomeC; @OneToMany(mappedBy = "clientes") private Set<VendaBean> vendas; public int getId_Cliente() { return id_Cliente; } public void setId_Cliente(int id_Cliente) { this.id_Cliente = id_Cliente; } public String getNomeC() { return nomeC; } public void setNomeC(String nomeC) { this.nomeC = nomeC; } public Set<VendaBean> getVendas() { return vendas; } public void setVendas(Set<VendaBean> vendas) { this.vendas = vendas; } }
[ "noreply@github.com" ]
noreply@github.com
f8f1c4e9252e5a0ccb2795a41d84d2e1d319171c
e1c60a2b353b9a76157e8daf881ada97b81dcf81
/tanhua/tanhua-dubbo/tanhua-dubbo-interface/src/main/java/com/tanhua/dubbo/api/mongo/UserLocationApi.java
9fd96fda3c20d5a0c00121994e766dca1e07950b
[]
no_license
caiciji/tanhua
a38a97cc192999a06b92b266d9454125ba155c1f
382c73e4bbe14fe2c21f7c19fd66e6bd93c185e3
refs/heads/master
2023-07-13T23:31:49.056318
2021-08-04T00:17:58
2021-08-04T00:17:58
391,252,990
0
0
null
null
null
null
UTF-8
Java
false
false
319
java
package com.tanhua.dubbo.api.mongo; import com.tanhua.domain.mongo.UserLocation; public interface UserLocationApi { /** * 上传地理位置信息 * @param userLocation * @param longitude * @param latitude */ void save(UserLocation userLocation, Double longitude, Double latitude); }
[ "1531461943@qq.com" ]
1531461943@qq.com
00a05130feb185b1858f7cb409048930abe0d6ba
8e8e4b70dbe255a5896f104342d9dee43f42e4dd
/app/src/main/java/com/example/englishquiz/AnimalActivity.java
cf4af1ee46a6429b781e6cc5d73b80c2bed2ba10
[]
no_license
iwayankurniawan/LearnEnglishApp
97c225f3ce5bdff976e2c39a4adb9fca50c75abc
31f128d7adf31eaaa94c98cd1c92bc686dfa99ce
refs/heads/master
2021-01-01T04:03:42.338758
2017-07-13T11:36:55
2017-07-13T11:36:55
97,115,746
0
0
null
null
null
null
UTF-8
Java
false
false
3,551
java
package com.example.englishquiz; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ListView; import java.util.ArrayList; public class AnimalActivity extends AppCompatActivity { ListView simpleList; ArrayList<Item> animalList=new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.animal_category_activity_main); init(); simpleList = (ListView) findViewById(R.id.simpleListView); animalList.add(new Item("Butterfly",R.drawable.butterfly,R.raw.butterfly)); animalList.add(new Item("Camel",R.drawable.camel,R.raw.camel)); animalList.add(new Item("Cat",R.drawable.cat,R.raw.cat)); animalList.add(new Item("Chicken",R.drawable.chicken,R.raw.chicken)); animalList.add(new Item("Cow",R.drawable.cow,R.raw.cow)); animalList.add(new Item("Deer",R.drawable.deer,R.raw.deer)); animalList.add(new Item("Dog",R.drawable.dog,R.raw.dog)); animalList.add(new Item("Dolphin",R.drawable.dolphin,R.raw.dolphin)); animalList.add(new Item("Elephant",R.drawable.elephant,R.raw.elephant)); animalList.add(new Item("Frog",R.drawable.frog,R.raw.frog)); animalList.add(new Item("Giraffe",R.drawable.giraffe,R.raw.giraffe)); animalList.add(new Item("Gorilla",R.drawable.gorilla,R.raw.gorilla)); animalList.add(new Item("Kangaroo",R.drawable.kangaroo,R.raw.kangaroo)); animalList.add(new Item("Mosquito",R.drawable.mosquito,R.raw.mosquito)); animalList.add(new Item("Rabbit",R.drawable.rabbit,R.raw.rabbit)); animalList.add(new Item("Spider",R.drawable.spider,R.raw.spider)); animalList.add(new Item("Squirrel",R.drawable.squirrel,R.raw.squirrel)); animalList.add(new Item("Starfish",R.drawable.starfish,R.raw.starfish)); animalList.add(new Item("Tiger",R.drawable.tiger,R.raw.tiger)); animalList.add(new Item("Turtle",R.drawable.turtle,R.raw.turtle)); animalList.add(new Item("Zebra",R.drawable.zebra,R.raw.zebra)); MyAdapter myAdapter=new MyAdapter(this,R.layout.list_view_items,animalList); simpleList.setAdapter(myAdapter); } public Button but0; public void init() { but0 = (Button) findViewById(R.id.animaldictionary); but0.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent toy = new Intent(AnimalActivity.this,DictionaryAnimalActivity.class); startActivity(toy); } }); } @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(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "kurniawanadityawardana@gmail.com" ]
kurniawanadityawardana@gmail.com
1031ea0decc2189a47726e991db52d5173d2faf8
097e9db7fd431a143a1bdaf44ea5ac1e3662b449
/backend/impl/src/main/java/com/google/code/arida/business/impl/EventServiceBean.java
2d28414cd7c86f1f05bd67a6e9ccde1595f5c9bb
[]
no_license
lexxy23/arida
19f6c209cab1a2f9fe1fa534290b209d23bdc3d8
226c2979e2907783d494668b7d145c19fcc1ed96
refs/heads/master
2021-01-10T08:39:50.040881
2013-04-01T17:25:45
2013-04-01T17:28:21
51,913,482
0
0
null
null
null
null
UTF-8
Java
false
false
2,509
java
/** * Arida Raid and Clan Management * Copyright (C) 2009,2010 Dirk Strauss * * 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 com.google.code.arida.business.impl; import java.util.Date; import java.util.List; import javax.ejb.Stateless; import com.google.code.arida.common.api.Event; import com.google.code.arida.common.api.EventTarget; import com.google.code.arida.common.api.PlayerCharacter; import com.google.code.arida.common.api.service.EventService; /** * @author kaeto23 * */ @Stateless(name = "EventService") public class EventServiceBean implements EventService { /** * */ public EventServiceBean() { // TODO Auto-generated constructor stub } /* * (non-Javadoc) * * @see * com.google.code.arida.common.api.service.EventService#createEvent(java * .util.Date, java.util.Date, * com.google.code.arida.common.api.PlayerCharacter, * com.google.code.arida.common.api.EventTarget, java.lang.String) */ @Override public Event createEvent(Date start, Date end, PlayerCharacter leader, EventTarget t, String descr) { // TODO Auto-generated method stub return null; } /* * (non-Javadoc) * * @see * com.google.code.arida.common.api.service.EventService#deleteEvent(long) */ @Override public boolean deleteEvent(long eventId) { // TODO Auto-generated method stub return false; } /* * (non-Javadoc) * * @see * com.google.code.arida.common.api.service.EventService#findByCriteria( * java.util.Date, long) */ @Override public List<Event> findByCriteria(Date startDate, long raidId) { // TODO Auto-generated method stub return null; } /* * (non-Javadoc) * * @see * com.google.code.arida.common.api.service.EventService#updateEvent(com * .google.code.arida.common.api.Event) */ @Override public boolean updateEvent(Event e) { // TODO Auto-generated method stub return false; } }
[ "lexxy23@gmail.com" ]
lexxy23@gmail.com
127ab417667d12d75af7f169bacb2484d7259dd9
ddd38972d2e73c464ee77024f6ba4d6e11aac97b
/platform/arcus-prodcat/src/test/java/com/iris/prodcat/customization/TestCustomizationCatalog.java
08a15342d8c913696b0cb6f6c620e32a1e590332
[ "Apache-2.0" ]
permissive
arcus-smart-home/arcusplatform
bc5a3bde6dc4268b9aaf9082c75482e6599dfb16
a2293efa1cd8e884e6bedbe9c51bf29832ba8652
refs/heads/master
2022-04-27T02:58:20.720270
2021-09-05T01:36:12
2021-09-05T01:36:12
168,190,985
104
50
Apache-2.0
2022-03-10T01:33:34
2019-01-29T16:49:10
Java
UTF-8
Java
false
false
1,065
java
/* * Copyright 2019 Arcus Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.iris.prodcat.customization; import java.io.InputStream; import org.junit.Test; import com.iris.prodcat.TestProductCatalog; import com.iris.prodcat.parser.Parser; public class TestCustomizationCatalog { @Test public void testParsePairingCatalog() throws Exception { try(InputStream is = TestProductCatalog.class.getResourceAsStream("/pairing_catalog.xml")) { Parser parser = new Parser(); parser.parse(is); } } }
[ "b@yoyo.com" ]
b@yoyo.com
9059b9b90a9aca9242ebe8fa2e92825038292ef9
ef9e876d033ba9cfd80d4539d57337094d3e302e
/src/main/java/com/initmrd/aliddns/DDNS.java
8752ba881de20298eacecbfcb0ad22cdb81eba7b
[ "MIT" ]
permissive
initMrD/aliddns
d339c4917c6d3357697e8ead8e54a460c8d967d6
e0f55728e2c249ba6689b2e68fe3c6ffa277eb86
refs/heads/master
2022-12-02T02:42:09.572666
2020-08-08T09:22:50
2020-08-08T09:22:50
285,983,210
0
0
null
null
null
null
UTF-8
Java
false
false
6,344
java
package com.initmrd.aliddns; import com.aliyuncs.DefaultAcsClient; import com.aliyuncs.IAcsClient; import com.aliyuncs.alidns.model.v20150109.DescribeSubDomainRecordsRequest; import com.aliyuncs.alidns.model.v20150109.DescribeSubDomainRecordsResponse; import com.aliyuncs.alidns.model.v20150109.UpdateDomainRecordRequest; import com.aliyuncs.alidns.model.v20150109.UpdateDomainRecordResponse; import com.aliyuncs.exceptions.ClientException; import com.aliyuncs.profile.DefaultProfile; import com.google.gson.Gson; import org.springframework.beans.factory.annotation.Value; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class DDNS { /** * 获取主域名的所有解析记录列表 */ private DescribeSubDomainRecordsResponse describeSubDomainRecords(DescribeSubDomainRecordsRequest request, IAcsClient client) { try { // 调用SDK发送请求 return client.getAcsResponse(request); } catch (ClientException e) { e.printStackTrace(); // 发生调用错误,抛出运行时异常 throw new RuntimeException(); } } /** * 获取当前主机公网IP */ private String getCurrenHostIP() { // 这里使用jsonip.com第三方接口获取本地IP String jsonip = "http://members.3322.org/dyndns/getip"; // 接口返回结果 String result = ""; BufferedReader in = null; try { // 使用HttpURLConnection网络请求第三方接口 URL url = new URL(jsonip); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestMethod("GET"); urlConnection.connect(); in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); String line; while ((line = in.readLine()) != null) { result += line; } } catch (Exception e) { e.printStackTrace(); } // 使用finally块来关闭输入流 finally { try { if (in != null) { in.close(); } } catch (Exception e2) { e2.printStackTrace(); } } // 正则表达式,提取xxx.xxx.xxx.xxx,将IP地址从接口返回结果中提取出来 String rexp = "(\\d{1,3}\\.){3}\\d{1,3}"; Pattern pat = Pattern.compile(rexp); Matcher mat = pat.matcher(result); String res = ""; while (mat.find()) { res = mat.group(); break; } return res; } /** * 修改解析记录 */ private UpdateDomainRecordResponse updateDomainRecord(UpdateDomainRecordRequest request, IAcsClient client) { try { // 调用SDK发送请求 return client.getAcsResponse(request); } catch (ClientException e) { e.printStackTrace(); // 发生调用错误,抛出运行时异常 throw new RuntimeException(); } } private static void log_print(String functionName, Object result) { Gson gson = new Gson(); System.out.println("-------------------------------" + functionName + "-------------------------------"); System.out.println(gson.toJson(result)); } public void run(String domain, String accessKeyId, String accessKeySecret) { System.out.println("-------------------------------" + "domain:" + domain + "-------------------------------"); System.out.println("-------------------------------" + "accessKeyId:" + accessKeyId + "-------------------------------"); System.out.println("-------------------------------" + "accessKeySecret:" + accessKeySecret + "-------------------------------"); // 设置鉴权参数,初始化客户端 DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou",// 地域ID accessKeyId,// 您的AccessKey ID accessKeySecret);// 您的AccessKey Secret IAcsClient client = new DefaultAcsClient(profile); DDNS ddns = new DDNS(); //查询指定二级域名的最新解析记录 DescribeSubDomainRecordsRequest describeSubDomainRecordsRequest = new DescribeSubDomainRecordsRequest(); describeSubDomainRecordsRequest.setSubDomain(domain); DescribeSubDomainRecordsResponse describeSubDomainRecordsResponse = ddns.describeSubDomainRecords(describeSubDomainRecordsRequest, client); log_print("describeSubDomainRecords", describeSubDomainRecordsResponse); List<DescribeSubDomainRecordsResponse.Record> domainRecords = describeSubDomainRecordsResponse.getDomainRecords(); //最新的一条解析记录 if (domainRecords.size() != 0) { DescribeSubDomainRecordsResponse.Record record = domainRecords.get(0); // 记录ID String recordId = record.getRecordId(); // 记录值 String recordsValue = record.getValue(); // 当前主机公网IP String currentHostIP = ddns.getCurrenHostIP(); System.out.println("-------------------------------当前主机公网IP为:" + currentHostIP + "-------------------------------"); if (!currentHostIP.equals(recordsValue)) { // 修改解析记录 UpdateDomainRecordRequest updateDomainRecordRequest = new UpdateDomainRecordRequest(); // 主机记录 updateDomainRecordRequest.setRR("@"); // 记录ID updateDomainRecordRequest.setRecordId(recordId); // 将主机记录值改为当前主机IP updateDomainRecordRequest.setValue(currentHostIP); // 解析记录类型 updateDomainRecordRequest.setType("A"); UpdateDomainRecordResponse updateDomainRecordResponse = ddns.updateDomainRecord(updateDomainRecordRequest, client); log_print("updateDomainRecord", updateDomainRecordResponse); } } } }
[ "initmrd@gmail.com" ]
initmrd@gmail.com
3ba8ea42613e844453da10062ffd33efbc4d2090
4b6e957893ac220a453bcfeb770d9707016bafe9
/idea/testData/quickfix/migration/deprecatedStaticField/companionObjectOfClass_const.after.java
b80b5299c59dab81ccd90386e8d39d73d7d7cc53
[ "Apache-2.0" ]
permissive
ItsPriyesh/kotlin
3600731f809747aad956ccfe3532707b04299c29
3c07bc3df7f97afb14937d6b951a39f8803945d0
refs/heads/master
2021-01-18T13:36:09.234239
2015-10-23T13:07:38
2015-10-23T19:07:52
44,854,854
1
0
null
2015-10-24T06:19:49
2015-10-24T06:19:48
null
UTF-8
Java
false
false
176
java
// "Add 'const' modifier to a property" "true" import a.A; class B { void bar() { A a = A.property; A a2 = a.A.property; A a3 = A.property; } }
[ "talanov.pavel@gmail.com" ]
talanov.pavel@gmail.com
5b37851758d0f09ab703f7e3fd149389aa0ba90b
4480278d0ea9faf916bd7c6c193feb7ad8d653ed
/chapter_three/SetOfStacks.java
6aecac6b87592152b2ba41599e2add58039bb680
[]
no_license
ayeganov/Cracking
1b7c11102a41a522b09f31503d991fac0f6a4e1f
42ef5926f669259e17790fdd043b8e32a3c707c5
refs/heads/master
2021-01-22T07:13:56.005963
2015-11-02T16:47:29
2015-11-02T16:47:29
25,358,137
0
0
null
null
null
null
UTF-8
Java
false
false
3,092
java
package chapter_three; import java.util.ArrayList; import java.util.EmptyStackException; import java.util.List; import java.util.Stack; public class SetOfStacks<E> { private int m_capacity; private List<Stack<E>> m_stacks; /** * Creates an empty SetOfStacks. */ public SetOfStacks(int capacity) { m_capacity = capacity; m_stacks = new ArrayList<>(); m_stacks.add(new Stack<E>()); } private Stack<E> getTopStack() { return m_stacks.get(m_stacks.size()-1); } private void removeTopStack() { if(m_stacks.size() > 1) { m_stacks.remove(m_stacks.size()-1); } } /** * Looks at the object at the top of this stack without removing it * from the stack. * * @return the object at the top of this stack (the last item * of the <tt>Vector</tt> object). * @throws EmptyStackException if this stack is empty. */ public E peek() { Stack<E> top = getTopStack(); return top.peek(); } public void push(E e) { Stack<E> top = getTopStack(); if(top.size() >= m_capacity) { top = new Stack<>(); top.add(e); m_stacks.add(top); } else { top.add(e); } } public E pop() { Stack<E> top = getTopStack(); E value = null; if(top.size() <= 0) { throw new IndexOutOfBoundsException("Can't pop items from an empty stack."); } value = top.pop(); if(top.isEmpty()) { removeTopStack(); } return value; } public E popAt(int idx) { if(idx >= m_stacks.size() || idx < 0) { throw new IndexOutOfBoundsException("Stack index is invalid."); } // Get the value first Stack<E> stack = m_stacks.get(idx); E val = stack.pop(); Stack<E> prev = stack; // Now balance the stacks in front of the popped one for(int i = idx + 1; i < m_stacks.size(); i++) { Stack<E> next = m_stacks.get(i); E bottom = next.get(0); next.remove(0); prev.push(bottom); prev = next; } // check last stack is not empty Stack<E> top = getTopStack(); if(top.isEmpty()) { removeTopStack(); } return val; } public int size() { int max_size = m_stacks.size() * m_capacity; return max_size + getTopStack().size() - m_capacity; } /** * Test if this stack has any elements in it. * * @return True if stack is empty, False otherwise */ public boolean isEmpty() { Stack<E> top = getTopStack(); return m_stacks.size() == 1 && top.size() == 0; } /** * Returns number of stacks in this set. * * @return number of stacks */ public int numStacks() { return m_stacks.size(); } }
[ "ayeganov@gnubio.com" ]
ayeganov@gnubio.com
4544caf32fa155f6956700fc177b59b817d8f332
e19ef39a0fb62244e819d815571deb94e959f3fe
/JavaPop/src/com/novusradix/JavaPop/Effects/BatholithEffect.java
690b8aea4c87f0c965c93eadf50ffd914a7d9d79
[]
no_license
psikosen/javapop
a5d8c1e1e40365f2b671b4bbbb850d920afc2b0b
6a2313b512b0a503983ae1a2e28ad9312214fbd1
refs/heads/master
2021-01-10T04:45:33.238547
2011-02-18T04:30:40
2011-02-18T04:30:40
49,759,362
0
0
null
null
null
null
UTF-8
Java
false
false
1,148
java
package com.novusradix.JavaPop.Effects; import com.novusradix.JavaPop.Server.ServerGame; import com.novusradix.JavaPop.Tile; import java.awt.Point; import java.util.Random; import javax.media.opengl.GL; /** * * @author gef */ public class BatholithEffect extends Effect { Point target; int age = 0; Random r; public BatholithEffect(Point target) { this.target = target; r = new Random(); } @Override public void execute(ServerGame g) { if (age % 2 == 0) { int px, py; px = target.x + r.nextInt(9) - 4; py = target.y + r.nextInt(9) - 4; if (g.heightMap.inBounds(px, py)) { g.heightMap.up(px, py); } } if (age % 5 == 0) { int px, py; px = target.x + r.nextInt(9) - 4; py = target.y + r.nextInt(9) - 4; if (g.heightMap.tileInBounds(px, py)) { g.heightMap.setTile(px, py, Tile.ROCK); } } age++; } @Override public void display(GL gl, float time, com.novusradix.JavaPop.Client.Game g) { } }
[ "gef.howie@b891f10e-93ca-11dd-82de-256c8af877fa" ]
gef.howie@b891f10e-93ca-11dd-82de-256c8af877fa
bacf7eec6d09e3734c78d84ea9813c063e39df51
302a68df251036adcf3a768ca6d5f150c649aab3
/src/main/java/sky/god/service/ThingService.java
c76e0bbc8ae9ed9e54ef95e92ef5edf6ec87c78d
[]
no_license
trunglk16/codegym-java-GodMaking
317bc5d1a779f2d46456c2276afd14e3dec98701
2790f39dddbf4a0d9f58e661d3a53d189479ce6d
refs/heads/master
2020-04-15T16:35:08.810447
2019-01-09T10:32:03
2019-01-09T10:32:03
164,842,074
0
0
null
null
null
null
UTF-8
Java
false
false
287
java
package sky.god.service; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import sky.god.model.Thing; public interface ThingService { Page<Thing> findAll(Pageable pageable); void save(Thing thing); Thing findById(Long id); }
[ "trungnguyenlk16@gmail.com" ]
trungnguyenlk16@gmail.com
4027416c1581766e4a17755497ac0e533ad6a327
acecbf47fa0f9535426327831f3252547df91e6d
/Interface2.java
cbab9c728612fdf64876dc08de182ab0b2faec02
[]
no_license
randikavishwajith/POS-Stock-Control-System
7a5344c667642b9925390536d8d665bdc4713313
48f3ab2dfb38290611724160945b4b689ea13c7b
refs/heads/master
2020-08-01T16:15:09.013412
2019-09-26T08:55:56
2019-09-26T08:55:56
211,043,500
1
0
null
null
null
null
UTF-8
Java
false
false
13,616
java
package inura.aiya; import java.awt.Toolkit; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; public class Interface2 extends javax.swing.JFrame { Connection conn = null; PreparedStatement pst = null; ResultSet rs = null; public Interface2() { setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("POS.png"))); initComponents(); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jTextField1 = new javax.swing.JTextField(); jPasswordField1 = new javax.swing.JPasswordField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setUndecorated(true); jPanel1.setBackground(new java.awt.Color(0, 204, 204)); jPanel2.setBackground(new java.awt.Color(0, 204, 204)); jLabel1.setFont(new java.awt.Font("Microsoft New Tai Lue", 1, 36)); // NOI18N jLabel1.setForeground(new java.awt.Color(102, 102, 102)); jLabel1.setText(" H & E TECHNOLOGIES"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(38, 38, 38) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 779, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(83, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); jPanel3.setBackground(new java.awt.Color(255, 255, 255)); jLabel2.setBackground(new java.awt.Color(0, 0, 0)); jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 36)); // NOI18N jLabel2.setForeground(new java.awt.Color(0, 0, 0)); jLabel2.setText("LOGIN"); jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N jLabel3.setText("USER NAME"); jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N jLabel4.setText("PASSWORD"); jButton2.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N jButton2.setText("Next"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N jButton3.setText("Back"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jTextField1.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N jPasswordField1.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(236, 236, 236) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup() .addGap(45, 45, 45) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(46, 46, 46) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel2) .addGap(373, 373, 373)) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(34, 34, 34) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(62, 62, 62) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(58, 58, 58) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPasswordField1)) .addGap(98, 98, 98) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(136, Short.MAX_VALUE)) ); jTextField1.getAccessibleContext().setAccessibleName("jTextField1"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(26, 26, 26)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); setSize(new java.awt.Dimension(900, 721)); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed Interface1 obj1 = new Interface1(); obj1.setVisible(true); this.dispose(); }//GEN-LAST:event_jButton3ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed conn = DBConnection1.ConnectDB(); try { String sql = "SELECT USERNAME,PASSWORD from LOGIN"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); String x = null; String y = null; while (rs.next()) { x = rs.getString("Username"); y = rs.getString("Password"); } if (x.equals(jTextField1.getText()) && y.equals(jPasswordField1.getText())) { JOptionPane.showMessageDialog(null, " Login Successful!"); Interface3 obj2 = new Interface3(); obj2.setVisible(true); this.dispose(); } else if ("".equals(jTextField1.getText()) && "".equals(jPasswordField1.getText())) { JOptionPane.showMessageDialog(null, "Please Enter Your Username and Password!"); } else if (!x.equals(jTextField1.getText()) && !y.equals(jPasswordField1.getText())) { JOptionPane.showMessageDialog(null, " Invalid Login Details!"); } else if (!x.equals(jTextField1.getText())) { JOptionPane.showMessageDialog(null, " Invalid Username!"); } else { JOptionPane.showMessageDialog(null, " Invalid password!"); } } catch (SQLException e) { JOptionPane.showMessageDialog(null, "System Error!\nPlease contact system administrator!"); Logger.getLogger(DBConnection1.class.getName()).log(Level.SEVERE, null, e); } }//GEN-LAST:event_jButton2ActionPerformed public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Interface2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Interface2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Interface2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Interface2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Interface2().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPasswordField jPasswordField1; private javax.swing.JTextField jTextField1; // End of variables declaration//GEN-END:variables }
[ "noreply@github.com" ]
noreply@github.com
fdc1dcd67e71bbf02c349d9c7e91491f84a51cbf
0af8bbc2f84d73b890b769fbe1bacf689293ac4f
/FirstProject/src/org/cn/vo/ArrayDemo.java
8703f525515ba1b4a46ac3cbeb63dbdfe7f83a3b
[]
no_license
liurongdev/javaTestProject
430b4311ab826420f77930bc8b4d678a3a3f2d6d
92708f7e59676acfc8be217e48196acea792d798
refs/heads/master
2021-08-16T15:32:14.036160
2017-11-20T02:49:37
2017-11-20T02:49:37
111,353,636
0
0
null
null
null
null
UTF-8
Java
false
false
336
java
package org.cn.vo; class Demo<T>{} public class ArrayDemo { private static Demo<Integer>[] demo; private static final int SIZE=100; public static void main(String[] args){ demo=(Demo<Integer>[])new Demo[SIZE]; System.out.println(demo.getClass().getSimpleName()); demo[0]=new Demo<Integer>(); //demo[1]=new Object(); } }
[ "1069919773@qq.com" ]
1069919773@qq.com
a863ba0e738e8e7881e93f1a9ec3bab38543e7b3
6fd918fcf4532ccb31922aec766d80928fc6204d
/springboot-03-elastic/src/main/java/com/atguigu/elastic/bean/Article.java
7e458738c32eb57952c82a92bd0dc5f43b0a5ab6
[]
no_license
goldstine/SpringbootCore
04000f2e53551fa9d00b6b0855e5c9ebab8dab9d
1b7d0ae258d6a450837f284401cd115fe3ba956d
refs/heads/master
2023-07-04T02:32:57.473535
2021-08-06T14:48:24
2021-08-06T14:48:24
392,603,869
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package com.atguigu.elastic.bean; import io.searchbox.annotations.JestId; import lombok.Data; @Data public class Article { @JestId //表示JestId注解,表示这是一个主键 private Integer id; private String author; private String title; private String content; }
[ "15797899690@163.com" ]
15797899690@163.com
8c07ff1f1e47c57ac0dabf08e0bad7af47252e10
e8737e187577225790f379f7f543aa5b6f18d403
/csx-bsf-demo/src/main/java/com/yh/csx/bsf/demo/redis/RedisApplication.java
4f203753f8356fda6572fa9d9804ab81e80fd0b8
[ "Apache-2.0" ]
permissive
yinian/csx-bsf-all
fc8864bc14b0485e3f19d540f068d36d03ea3c81
5c3e8394930a53efda0119df50cf550050b65230
refs/heads/master
2023-07-03T23:06:15.413599
2019-12-31T16:40:42
2019-12-31T16:40:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,348
java
package com.yh.csx.bsf.demo.redis; import com.alibaba.fastjson.TypeReference; import com.yh.csx.bsf.redis.RedisProvider; import com.yh.csx.bsf.redis.annotation.RedisCache; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * @author Huang Zhaoping */ @RestController @SpringBootApplication public class RedisApplication { @Autowired(required = false) private RedisProvider redisProvider; @GetMapping("/get") public String get(String key) { return redisProvider.get(key); } @GetMapping("/set") public void set(String key, String value, int timeout) { redisProvider.set(key, value, timeout); } @GetMapping("/call") @RedisCache(timeout = 60) public String call() { return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); } @GetMapping("/callVoid") @RedisCache(timeout = 60) public void callVoid() { System.out.println("call"); } @GetMapping("/callList") @RedisCache(timeout = 60) public List<String> callList() { return Arrays.asList("1", "2", String.valueOf(Math.random())); } @GetMapping("/callArray") @RedisCache(timeout = 60) public String[] callArray(int length) { System.out.println("call"); if (length != 10) { throw new IllegalArgumentException("length != 10"); } return new String[length]; } @GetMapping("/callComplex") @RedisCache(key = "'user-'+#userId", timeout = 60) public User callComplex(long userId) { return new User(userId, "hello: " + System.currentTimeMillis(), Arrays.asList(new User.Job(userId + "001", "haha"))); } @GetMapping("/callComplexList") @RedisCache(key = "'list-user-'+#userId", timeout = 60) public List<User> callComplexList(long userId) { return Arrays.asList(new User(userId, "hello: " + System.currentTimeMillis(), Arrays.asList(new User.Job(userId + "001", "haha")))); } @GetMapping("/callComplexMap") @RedisCache(key = "'map-user-'+#userId", timeout = 60) public Map<Integer, User> callComplexMap(long userId) { Map<Integer, User> values = new HashMap<>(); values.put((int) userId, new User(userId, "hello: " + userId, Arrays.asList(new User.Job(userId + "001", "haha")))); return values; } @GetMapping("/callback") public List<User> callback(long userId) { List<User> list = redisProvider.cache("user-" + userId, 60, () -> Arrays.asList(new User(userId, "hello: " + userId, Arrays.asList(new User.Job(userId + "001", "haha")))), new TypeReference<List<User>>() { }.getType()); System.out.println(list); return list; } @GetMapping("/callbackMap") public Map<Integer, User> callbackMap(long userId) { Map<Integer, User> map = redisProvider.cache("user-" + userId, 60, () -> { Map<Integer, User> values = new HashMap<>(); values.put((int) userId, new User(userId, "hello: " + userId, Arrays.asList(new User.Job(userId + "001", "haha")))); return values; }, new TypeReference<Map<Integer, User>>() { }.getType()); return map; } @GetMapping("/testHm") public List<User> testHm() { return redisProvider.get("hello", Arrays.asList("11", "22"), User.class); } @GetMapping("/callBiz") public User callBiz(long userId) throws Exception { if (userId != 10) { throw new IllegalArgumentException("你大爷的错误了"); } return new User(userId, "hello: " + userId, Arrays.asList(new User.Job(userId + "001", null))); } @GetMapping("/callError") public User callError(long userId) throws Exception { if (userId != 10) { throw new IllegalArgumentException("你大爷的错误了"); } return new User(userId, "hello: " + userId, Arrays.asList(new User.Job(userId + "001", null))); } @GetMapping("/getList") public List<User> getList() throws Exception { List<User> list = Arrays.asList(new User(1L, "hello: 1", Arrays.asList(new User.Job("001", null))), new User(2L, "hello: 2", Arrays.asList(new User.Job("002", null)))); redisProvider.set("getList", list); list = redisProvider.getList("getList", User.class); System.out.println(list); return list; } @GetMapping("/lock") public List<User> lock(String key, int timeout, int type, int sleep) throws Exception { List<User> list = Arrays.asList(new User(1L, "hello: 1", Arrays.asList(new User.Job("001", null))), new User(2L, "hello: 2", Arrays.asList(new User.Job("002", null)))); Callable<List<User>> callable = () -> { System.out.println("start run... "); Thread.sleep(sleep * 1000); System.out.println("run finished..."); return list; }; if (type == 1) { redisProvider.lock(key, timeout, () -> { try { callable.call(); } catch (Exception e) { e.printStackTrace(); } }); } else if (type == 2) { boolean result = redisProvider.tryLock(key, timeout, () -> { try { callable.call(); } catch (Exception e) { e.printStackTrace(); } }); System.out.println(result); } else if (type == 3) { return redisProvider.lock(key, timeout, callable); } else if (type == 4) { return redisProvider.tryLock(key, timeout, callable); } return null; } @GetMapping("/testLock") public String testBatch(int threads, int times) { ExecutorService service = Executors.newCachedThreadPool(); CountDownLatch count = new CountDownLatch(threads); for (int i = 0; i < threads; i++) { final String key = "lock-" + (i % 10); service.submit(() -> { for (int j = 0; j < times; j++) { redisProvider.lock(key, 60, () -> { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } }); System.out.println(j); } count.countDown(); }); } try { count.await(); } catch (InterruptedException e) { } return "done"; } public static void main(String[] args) { SpringApplication.run(RedisApplication.class, args); } }
[ "472790378@qq.com" ]
472790378@qq.com
718b7a261a1898047d6028dec17e299a02d72167
9947a4849851b3890ca0e72f2e1be9c46127213f
/src/main/java/net/ys/BootApiApplication.java
edf29d31fb2b95c3c98b9c7bf8ce3e0764988510
[]
no_license
qinlingchengxin/boot-api
6e1d9572ecda0df48342fe853051d6862074098e
82a57aed3f62046aee4ea10369c0ea3c8a3511a3
refs/heads/master
2021-06-23T20:54:54.561973
2019-11-08T11:15:10
2019-11-08T11:15:10
219,439,140
0
0
null
2021-04-26T19:40:46
2019-11-04T07:11:05
Java
UTF-8
Java
false
false
590
java
package net.ys; import org.springframework.amqp.rabbit.annotation.EnableRabbit; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; @EnableRabbit @Controller @SpringBootApplication public class BootApiApplication { public static void main(String[] args) { SpringApplication.run(BootApiApplication.class, args); } @GetMapping("/") public String doGet() { return "login"; } }
[ "529726271@qq.com" ]
529726271@qq.com
8d8057f22b32db6c37ab036dda954203f7f90870
cf2d290708847bca80a1ddef8a40912922a1cc82
/src/main/java/com/example/classbean/Schedule.java
3ef6291444fb442f9624387aa9d2cac686f4521d
[]
no_license
RebornNDT/SpringOpenWeatherMap
893355e93324e61071250967fb5f55ac29cbc553
a5023c0a46312b1a385fe6907abec46260b518cc
refs/heads/master
2022-11-13T00:16:49.965848
2020-07-12T11:44:33
2020-07-12T11:44:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
166
java
package com.example.classbean; public class Schedule { public static int fixedRate = 3 * 60 * 60 * 1000; //sét tự động post mặc định mỗi 3 tiếng! }
[ "50323429+Zedination@users.noreply.github.com" ]
50323429+Zedination@users.noreply.github.com
52972b8035cc4fc6d389235e646ec7c3b789ec9c
9228160c597613808133290845429f62bec462b2
/src/ra/RaFactory.java
b82ff71c058b7ad61ff37d2f1b94eac1d9de06b6
[]
no_license
Chrisaxell/StudyPrograms
ebb48322d105d61a8b301b7b4a78915415a14606
eb3379553d64fb41c23a087b9726cb8e6d3f35e2
refs/heads/master
2022-12-13T11:49:46.477995
2020-09-13T21:48:47
2020-09-13T21:48:47
295,241,450
0
0
null
null
null
null
UTF-8
Java
false
false
2,319
java
/** */ package ra; import org.eclipse.emf.ecore.EFactory; /** * <!-- begin-user-doc --> * The <b>Factory</b> for the model. * It provides a create method for each non-abstract class of the model. * <!-- end-user-doc --> * @see ra.RaPackage * @generated */ public interface RaFactory extends EFactory { /** * The singleton instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ RaFactory eINSTANCE = ra.impl.RaFactoryImpl.init(); /** * Returns a new object of class '<em>Department</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Department</em>'. * @generated */ Department createDepartment(); /** * Returns a new object of class '<em>Programme</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Programme</em>'. * @generated */ Programme createProgramme(); /** * Returns a new object of class '<em>Specialisation</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Specialisation</em>'. * @generated */ Specialisation createSpecialisation(); /** * Returns a new object of class '<em>Course List</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Course List</em>'. * @generated */ CourseList createCourseList(); /** * Returns a new object of class '<em>Semester</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Semester</em>'. * @generated */ Semester createSemester(); /** * Returns a new object of class '<em>Semester Course List</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Semester Course List</em>'. * @generated */ SemesterCourseList createSemesterCourseList(); /** * Returns a new object of class '<em>Course</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return a new object of class '<em>Course</em>'. * @generated */ Course createCourse(); /** * Returns the package supported by this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the package supported by this factory. * @generated */ RaPackage getRaPackage(); } //RaFactory
[ "31619201+Chrisaxell@users.noreply.github.com" ]
31619201+Chrisaxell@users.noreply.github.com
77c96073034cbf70a701b39643b8af180122e169
738ee0fc5310c14195f2dbf1da4cc9cff60a213a
/src/main/java/com/github/HarshitDawar55/Kafka/Producers/FirstProducerWithKeysAndCallbacks.java
e1621411e0050d1818aee25c039f892215563326
[ "MIT" ]
permissive
HarshitDawar55/Apache-Kafka
b12fb8aa006b18bf05ea190d1c5fe6f924d4f5a0
76b47ee6a57d2f3be90ebff4ec58201fabdbca5a
refs/heads/main
2023-07-22T17:01:51.023295
2021-09-11T13:00:53
2021-09-11T13:00:53
401,666,936
1
0
null
null
null
null
UTF-8
Java
false
false
2,594
java
package com.github.HarshitDawar55.Kafka.Producers; import org.apache.kafka.clients.producer.*; import org.apache.kafka.common.serialization.StringSerializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Properties; import java.util.concurrent.ExecutionException; public class FirstProducerWithKeysAndCallbacks { public static void main(String[] args) throws ExecutionException, InterruptedException { // Creating Required Variables String BootStrap_Servers = "localhost:9092"; Logger logger = LoggerFactory.getLogger(FirstProducerWithKeysAndCallbacks.class); // Setting Producer Required Properties using the best way instead of old way by using the exact names in strings Properties properties = new Properties(); properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, BootStrap_Servers); properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); // Creating Kafka Producer KafkaProducer<String, String> producer = new KafkaProducer<String, String>(properties); for(int i = 0; i < 10; i++){ String key = "id_" + i; // Creating a Producer Record to send! ProducerRecord<String, String> record = new ProducerRecord<String, String>("First-Topic", key, "First Message from the Producer!" + i); logger.info("Key: " + key); // Sending the Data producer.send(record, new Callback() { @Override public void onCompletion(RecordMetadata recordMetadata, Exception e) { // This code will execute when a record is sent successfully or an exception is thrown if (e == null){ logger.info("New MetaData received " + "\n" + "Topic: " + recordMetadata.topic() + "\n" + "Partition" + recordMetadata.partition() + "\n" + "Offset" + recordMetadata.offset() + "\n" + "Timestamp" + recordMetadata.timestamp() ); } else { logger.error(String.valueOf(e)); } } }).get(); } // Flushing the Data & then closing the Producer! producer.flush(); producer.close(); } }
[ "harshit.dawar55@gmail.com" ]
harshit.dawar55@gmail.com
0d958fdee6b88b5f83f41e69e0e9ade28cb601de
65ba25d392607950e7d17f71a5d13980b4289350
/src/policies/MLMS.java
a905564c0dbded4d17bfa68295c46c11f13858ef
[]
no_license
AngelGCL/Best-Waiting-Policy
c84821c31f87f16c68a878ddbeb412a92d543fae
29ed29c37c8371c6c17ae502368a82f115a26dce
refs/heads/master
2020-03-31T22:23:45.089462
2018-10-11T16:07:59
2018-10-11T16:07:59
152,616,657
0
0
null
null
null
null
UTF-8
Java
false
false
8,384
java
package policies; import java.util.ArrayList; import dataManagement.Client; import policies.MLMSBLL.Clerks; import useful_classes.Queue; import useful_classes.SLLQueue; /** * Multiple Lines Multiple Servers waiting policy * * Each service post has its own waiting line (one line per server). * Once a person enters a waiting line, that person cannot transfer to another line, * even if one becomes empty. When a new person arrives looking for service, the person will * choose the first line that has minimum number of persons waiting, * as per the indexes identifying the corresponding service posts. If a line becomes empty, * then the server there remains idle until a new customer arrives and selects that particular line. * * @author Angel G. Carrillo Laguna * */ public class MLMS { private Clerks[] servers; protected int time;//Current time unit private float avgWaitT; private int overpassClients; private SLLQueue<Client> arrivalQueue; private ArrayList<Client> terminatedList; /** * Constructor method. * @param serverNum number of server posts. * @param file {@link Queue} created from a file that has been read. */ public MLMS(int serverNum, Queue<Client> file){ servers = new Clerks[serverNum]; time = 0; avgWaitT = 0.00f; try { arrivalQueue = ((SLLQueue<Client>) file).copy(); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } setClerks(); terminatedList = new ArrayList<Client>(); overpassClients = 0; } /** * Initializes and assigns a line for the {@link Clerks} inside the {@code servers} array. */ public void setClerks() { for(int i=0; i<servers.length; i++) { servers[i] = new Clerks(new SLLQueue<Client>(), null); } } /** * Helper Method used by the {@code isIdle()} method to determine if there is any available {@link Clerks}. * @return {@link Integer} between -1 and {@code (servers.length - 1)}. If -1, then there is no {@link Clerks} available. */ public int getAvailable(){ for (int i=0; i<servers.length; i++) { if(servers[i].isAvailable()) return i; } return -1; } /** * Boolean Method to determine if there is an available {@linkplain Clerks}. * @return True if there is an available Clerk, false otherwise. */ public boolean isIdle() { if(getAvailable() == -1) return false; return true; } /** * Helper method to find all the available {@link Clerks}. * @return {@link ArrayList} with the indexes of the available Clerks. */ public ArrayList<Integer> getAllAvailables(){ ArrayList<Integer> indexes = new ArrayList<Integer>(); for(int i=0; i<servers.length; i++) { if(servers[i].isAvailable()) indexes.add(i); } return indexes; } /** * Boolean method to determine if all lines are empty. * @return True if all lines are empty, false otherwise. */ public boolean allLinesEmpty() { for(int i=0; i<servers.length; i++) { if(!servers[i].getCurrentLine().isEmpty()) return false; } return true; } /** * Method to start giving service to a first {@link Client} in a line whenever possible. */ public void getAttended() { ArrayList<Integer> index = getAllAvailables(); while(!index.isEmpty()) { int server = index.get(0); if(!servers[server].getCurrentLine().isEmpty()) { Client jb = servers[server].getCurrentLine().dequeue(); jb.isAttended(time);//saves waiting time of client avgWaitT += jb.getWaitingTime(); jb.setDepartureTime(time); terminatedList.add(jb);//this will be used to calculate the over-passing clients. No matter what order of arrival servers[server].setCurrentClient(jb); } index.remove(0); } } /** * Helper method for when {@link Clerks} complete a service. * @param server index of the clerk that completed a service. */ public void completeServ(int server) { servers[server].setCurrentClient(null); } /** * Iterates over all the {@link Clerks} and checks if they have completed a service. */ public void checkCompleted() { for(int i=0; i<servers.length; i++) { if(servers[i].getCurrentClient() != null) if(servers[i].getCurrentClient().getDepartureTime() == time) completeServ(i); } } /** * Helper method for when a {@link Client} arrives, this will lead him into a line according to the this policy. * @param client {@link Client} that arrived. */ public void arrive(Client client) { int min = servers[0].getCurrentLine().size(); int index = 0; if(servers.length > 1) { for(int i=1; i<servers.length; i++) { if(servers[i].getCurrentLine().size() < min) { min = servers[i].getCurrentLine().size(); index = i; } } } servers[index].getCurrentLine().enqueue(client); } /** * Boolean method to determine if ALL {@link Clerks} are available. * @return True if ALL clerks are available, false otherwise. */ public boolean serversEmpty() { for(int i = 0; i<servers.length; i++) { if(!servers[i].isAvailable()) return false; } return true; } /** * Checks if there are possible arrivals, if so then lets the clients arrive. */ public void checkArrival() { int size = arrivalQueue.size(); for(int i=0; i<size; i++) if(arrivalQueue.first().getArrivalTime() == time) arrive(arrivalQueue.dequeue()); else return; } public int getTime() { return time; } /** * Sets the total number of clients that arriver after a certain client but completed their service earlier. */ public void setOverpassingClients() { for(int i=0; i<terminatedList.size() - 1; i++) { for(int j=i+1; j<terminatedList.size(); j++) { if(terminatedList.get(i).getArrivalTime() > terminatedList.get(j).getArrivalTime()) overpassClients += 1; } } } /** * Boolean method to determine if the process has been finished. * @return True if all statements are true. */ public boolean done() { if(!arrivalQueue.isEmpty()) { return false; } else if(!allLinesEmpty()) { return false; } else if(!serversEmpty()) { return false; } else return true; } /** * Skips time units when there is nothing to be done from unit t1 to unit t2. */ public void timeSkip() { int min = time; if(!arrivalQueue.isEmpty()) { min = arrivalQueue.first().getArrivalTime(); } for(int i=0; i<servers.length; i++) { if(servers[i].getCurrentClient() != null && min > servers[i].getCurrentClient().getDepartureTime()) { min = servers[i].getCurrentClient().getDepartureTime(); } } if(time < min) time = min; } /** * Method used to process the data according to the waiting policy. * @return String with calculated statistics. */ public String process() { while (!done()) { checkCompleted(); if(isIdle()) { getAttended();//always happens since they're in line } checkArrival(); time++; timeSkip(); } int clients = terminatedList.size();//total number of clients float avgWaitperClient = (avgWaitT/clients); //avg waiting time per client setOverpassingClients();//ovrpass total return "MLMS " + servers.length + ": " + (time-1) + " " + String.format("%.2f",avgWaitperClient) + " " + overpassClients; } /** * Clerk Class made to facilitate the accessing and arrangement of data. * @author Angel G. Carrillo Laguna * */ protected class Clerks { private SLLQueue<Client> currentLine; private Client currentClient; public Clerks(Queue<Client> line, Client client){ this.currentClient = client; this.currentLine = (SLLQueue<Client>) line; } public SLLQueue<Client> getCurrentLine() { return currentLine; } public void setCurrentLine(Queue<Client> currentLine) { this.currentLine = (SLLQueue<Client>) currentLine; } public Client getCurrentClient() { return currentClient; } public void setCurrentClient(Client currentClient) { this.currentClient = currentClient; } public boolean isAvailable() { if(getCurrentClient() == null) return true; return false; } } }
[ "noreply@github.com" ]
noreply@github.com
83d80055e34297be2e641136efdd9fbbc68428ff
98b97677f4f3ca691f8b35564d40fc9b8ed51891
/src/main/java/com/example/bicycleshop/backend/services/implementations/ProductServiceImpl.java
4bbd244fd590634349a88abbf294ee5e5f033a07
[]
no_license
AndrzejKarolczak/bicycle-shop
df50553dd7bc44fa56a0865c1e121c62ae21f441
a192850188500c13ba9ab23d1c5a6b705e7ad75a
refs/heads/master
2023-03-05T21:37:59.446568
2021-02-21T17:48:46
2021-02-21T17:48:46
338,638,687
0
0
null
null
null
null
UTF-8
Java
false
false
1,174
java
package com.example.bicycleshop.backend.services.implementations; import com.example.bicycleshop.backend.entities.Product; import com.example.bicycleshop.backend.repositories.ProductRepository; import com.example.bicycleshop.backend.services.ProductService; import com.example.bicycleshop.exceptions.NotFoundException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service @Transactional class ProductServiceImpl implements ProductService { private final ProductRepository productRepository; @Autowired public ProductServiceImpl(ProductRepository productRepository) { this.productRepository = productRepository; } public List<Product> getProducts() { return productRepository.findAll(); } @Override public List<Product> getProductType(Class<?> productType) { return productRepository.getProductsByProductType(productType); } @Override public Product getProductsById(Long id) { return productRepository.getProductsById(id).orElseThrow(() -> new NotFoundException(Product.class, id)); } }
[ "andrzej.karolczak@gmail.com" ]
andrzej.karolczak@gmail.com
8cc2271400156c44afd8ea1a4c14a3bfe9736406
c59595ed3e142591f6668d6cf68267ee6378bf58
/android/src/main/java/android/support/v4/view/accessibility/AccessibilityEventCompat.java
ccddfb1d54f834929c135af078714bcfb308fc7f
[]
no_license
BBPL/ardrone
4c713a2e4808ddc54ae23c3bcaa4252d0f7b4b36
712c277850477b1115d5245885a4c5a6de3d57dc
refs/heads/master
2021-04-30T05:08:05.372486
2018-02-13T16:46:48
2018-02-13T16:46:48
121,408,031
1
1
null
null
null
null
UTF-8
Java
false
false
3,465
java
package android.support.v4.view.accessibility; import android.os.Build.VERSION; import android.view.accessibility.AccessibilityEvent; public class AccessibilityEventCompat { private static final AccessibilityEventVersionImpl IMPL; public static final int TYPES_ALL_MASK = -1; public static final int TYPE_ANNOUNCEMENT = 16384; public static final int TYPE_GESTURE_DETECTION_END = 524288; public static final int TYPE_GESTURE_DETECTION_START = 262144; public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END = 1024; public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START = 512; public static final int TYPE_TOUCH_INTERACTION_END = 2097152; public static final int TYPE_TOUCH_INTERACTION_START = 1048576; public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED = 32768; public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED = 65536; public static final int TYPE_VIEW_HOVER_ENTER = 128; public static final int TYPE_VIEW_HOVER_EXIT = 256; public static final int TYPE_VIEW_SCROLLED = 4096; public static final int TYPE_VIEW_TEXT_SELECTION_CHANGED = 8192; public static final int TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY = 131072; public static final int TYPE_WINDOW_CONTENT_CHANGED = 2048; interface AccessibilityEventVersionImpl { void appendRecord(AccessibilityEvent accessibilityEvent, Object obj); Object getRecord(AccessibilityEvent accessibilityEvent, int i); int getRecordCount(AccessibilityEvent accessibilityEvent); } static class AccessibilityEventStubImpl implements AccessibilityEventVersionImpl { AccessibilityEventStubImpl() { } public void appendRecord(AccessibilityEvent accessibilityEvent, Object obj) { } public Object getRecord(AccessibilityEvent accessibilityEvent, int i) { return null; } public int getRecordCount(AccessibilityEvent accessibilityEvent) { return 0; } } static class AccessibilityEventIcsImpl extends AccessibilityEventStubImpl { AccessibilityEventIcsImpl() { } public void appendRecord(AccessibilityEvent accessibilityEvent, Object obj) { AccessibilityEventCompatIcs.appendRecord(accessibilityEvent, obj); } public Object getRecord(AccessibilityEvent accessibilityEvent, int i) { return AccessibilityEventCompatIcs.getRecord(accessibilityEvent, i); } public int getRecordCount(AccessibilityEvent accessibilityEvent) { return AccessibilityEventCompatIcs.getRecordCount(accessibilityEvent); } } static { if (VERSION.SDK_INT >= 14) { IMPL = new AccessibilityEventIcsImpl(); } else { IMPL = new AccessibilityEventStubImpl(); } } private AccessibilityEventCompat() { } public static void appendRecord(AccessibilityEvent accessibilityEvent, AccessibilityRecordCompat accessibilityRecordCompat) { IMPL.appendRecord(accessibilityEvent, accessibilityRecordCompat.getImpl()); } public static AccessibilityRecordCompat getRecord(AccessibilityEvent accessibilityEvent, int i) { return new AccessibilityRecordCompat(IMPL.getRecord(accessibilityEvent, i)); } public static int getRecordCount(AccessibilityEvent accessibilityEvent) { return IMPL.getRecordCount(accessibilityEvent); } }
[ "feber.sm@gmail.com" ]
feber.sm@gmail.com
a29669c023b198eb49a76a06e33d8643e2f3f167
f3a19804c4e07391f91b63d57bfa05f548c42660
/src/main/java/com/ereceipt/demo/domain/Prescription.java
5cd0a0578d737e0d8c21fcb9f5b89694807ab7b7
[]
no_license
ruslan-kononov/eReceipt-project
fa56db5aa20bf1675b54b55130a33dfc7974e026
7df2a7b40b87bd383338f9e292544224af24f0af
refs/heads/master
2022-12-07T14:20:35.411352
2020-08-09T12:43:03
2020-08-09T12:43:03
286,232,780
0
0
null
null
null
null
UTF-8
Java
false
false
2,552
java
package com.ereceipt.demo.domain; import org.hibernate.annotations.GenericGenerator; import javax.persistence.*; import java.util.Date; import java.util.Objects; import java.util.UUID; @Entity @Table(name = "prescriptions") public class Prescription { @Id @GeneratedValue private Long prescrId; @ManyToOne @JoinColumn(name="patient_id", nullable=false) private Patient patient; @ManyToOne @JoinColumn(name="doctor_id", nullable=false) private Doctor doctor; private String medicineName; private String prescrText; @Temporal(TemporalType.TIMESTAMP) private Date utilDate; public Prescription(Patient patient, Doctor doctor, String medicineName, String prescrText) { this.patient = patient; this.doctor = doctor; this.medicineName = medicineName; this.prescrText = prescrText; } public Prescription() { } public Long getPrescrId() { return prescrId; } public void setPrescrId(Long prescrId) { this.prescrId = prescrId; } public Patient getPatient() { return patient; } public void setPatient(Patient patient) { this.patient = patient; } public Doctor getDoctor() { return doctor; } public void setDoctor(Doctor doctor) { this.doctor = doctor; } public String getMedicineName() { return medicineName; } public void setMedicineName(String medicineName) { this.medicineName = medicineName; } public String getPrescrText() { return prescrText; } public void setPrescrText(String prescrText) { this.prescrText = prescrText; } public Date getUtilDate() { return utilDate; } public void setUtilDate(Date utilDate) { this.utilDate = utilDate; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Prescription that = (Prescription) o; return Objects.equals(prescrId, that.prescrId) && Objects.equals(patient, that.patient) && Objects.equals(doctor, that.doctor) && Objects.equals(medicineName, that.medicineName) && Objects.equals(prescrText, that.prescrText) && Objects.equals(utilDate, that.utilDate); } @Override public int hashCode() { return Objects.hash(prescrId, patient, doctor, medicineName, prescrText, utilDate); } }
[ "rukono@ttu.ee" ]
rukono@ttu.ee
2274abfabc1257c9289bb4bf0274c9a28bcb2e7a
e9858819aec1fec053b7ccc18e99bb520d809201
/src/main/java/edu/upc/eetac/dsa/ejerciciosJAVA/MediaAritmetica.java
e283f52abec2f5a4c117a8054b1f74fae30984d8
[]
no_license
alberto-gonzalez/ejerciciosJAVA
c8cbc980a994f00a00dee8ab2ac2dd694af1a24a
fbdaef6cb44eebb6e67bfa451c7e3bd6a0b7cdbf
refs/heads/master
2021-01-22T06:58:48.223402
2015-03-02T17:28:09
2015-03-02T17:28:36
31,551,465
0
0
null
null
null
null
UTF-8
Java
false
false
1,120
java
package edu.upc.eetac.dsa.ejerciciosJAVA; import java.io.BufferedReader; //import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class MediaAritmetica { public final static double average(String file) throws FileParsingException, BigNumberException { double counter = 0d; double sum = 0d; BufferedReader reader = null; try { reader = new BufferedReader(new FileReader("numeros.txt")); String line = null; while ((line = reader.readLine()) != null) { try { int number = Integer.parseInt(line); if (number > 1000) throw new BigNumberException("Number greater than 1000 at line " + (int) (++counter)); sum += number; counter++; } catch (NumberFormatException e) { throw new FileParsingException(e.getMessage()); } } } catch (java.io.IOException e) { throw new FileParsingException(e.getMessage()); } finally { try { reader.close(); } catch (IOException e) { System.err.println("warning: can not close file."); } } return sum / counter; } }
[ "albertito@hotmail.com" ]
albertito@hotmail.com
bd106b98562ac54b85728d632ce52120b35082ea
f33077797257c7df5b3befdeff81b941c17409e1
/src/expEval/StringParser.java
22c7e5dd585240486f1e6d804c9d42874ce1e493
[]
no_license
anuradhawick/SpreadSheet
8cce03b34687c577d1cbcd3948bc2877931ddfe8
6c6c456772e3d17e1e80193956000c04e942541b
refs/heads/master
2016-09-05T21:16:55.874357
2015-05-17T03:59:12
2015-05-17T03:59:12
35,751,178
1
0
null
null
null
null
UTF-8
Java
false
false
15,688
java
package expEval; //~--- JDK imports ------------------------------------------------------------ import java.text.*; import java.util.*; public class StringParser { private StringParser() {} /* * this class does not allow creating objects and only allows the use of the static method getList * it returns a list containing datatype,formatted data string and actual data */ public static List<String> getList(String parseIt) { String type; List<String> sections = new ArrayList<String>(); try { sections.clear(); int DD, MM, YYYY, hh, mm, ss; String string = parseIt, temp[], marid, returnString = ""; String booltype = ".*?(((=?[<>])|(!=)|([<>]=?)|<>|><)|==|=).*?"; String currency = "[A-Za-z$]{1,2}[ .]?[0-9][0-9]*[.]?[0-9]*"; String time12hr = "(1[012]|[1-9]):[0-5][0-9]?[:]?[0-5][0-9]?(am|AM|pm|PM)"; String time24hr = "(2[0-4]|1[0-9]|[0-9]):[0-5][0-9]?[:]?[0-5][0-9]?"; String integer = "[-]?[0-9]*"; String floating = "[-]?[0-9]*[.][0-9]*"; String dateformatSL = "[0-9]{2,4}[/-](1[012]|0?[0-9])[/-](1[0-9]|0?[0-9]|2[0-9]|3[01])"; String dateformatINTL = "(1[0-9]|0?[0-9]|2[0-9]|3[01])[/-](1[012]|0?[0-9])[/-][0-9]{2,4}"; String tempStr, currType = ""; // looks for a boolean expression if (string.matches(booltype) && (string.charAt(0) == '=')) { string = string.substring(1); string = cleanBool(string); temp = string.split("(((=?[<>]=?)|(!=)|<>|><)|==|=)"); if (!(string.toUpperCase().equals(string.toLowerCase())) || (temp.length != 2)) { type = "Text"; sections.add(type); sections.add(string); sections.add("=" + string); return sections; } else { sections.add("Boolean"); String left = temp[0]; String right = temp[1]; double leftVal = Double.parseDouble(expressions.giveAnswer(left)); double rightVal = Double.parseDouble(expressions.giveAnswer(right)); // comparing the values with the comparator if (string.contains(">") && (leftVal > rightVal)) { sections.add("True"); } else if ((string.contains(">=") || string.contains("=>")) && (leftVal >= rightVal)) { sections.add("True"); } else if ((string.contains("<=") || string.contains("=<")) && (leftVal <= rightVal)) { sections.add("True"); } else if ((string.contains("<=") || string.contains("=<")) && (leftVal <= rightVal)) { sections.add("True"); } else if (string.contains("<") && (leftVal < rightVal)) { sections.add("True"); } else if (string.contains(">") && (leftVal > rightVal)) { sections.add("True"); } else if ((string.contains("=") || string.contains("==")) && (leftVal == rightVal)) { sections.add("True"); } else if ((string.contains("=") || string.contains("==")) && (leftVal == rightVal)) { sections.add("True"); } else if ((string.contains("!=") || string.contains("<>") || string.contains("><")) && (leftVal != rightVal)) { sections.add("True"); } else { sections.add("False"); } sections.add("=" + string); return sections; } } // looks for a date else if (string.matches(dateformatINTL)) { boolean DateValid; DateFormat D = new SimpleDateFormat("dd/MM/yyyy"); // checking if the entered data is precise (leap year and date month correlation) try { D.setLenient(false); D.parse(string); DateValid = true; } catch (ParseException e) { DateValid = false; } if (DateValid) { temp = string.split("[/-]"); // DD = Integer.parseInt(temp[0]); // MM = Integer.parseInt(temp[1]); // YYYY = Integer.parseInt(temp[2]); type = "Date"; // creating the date in the proper format if (temp[0].length() == 1) { returnString += "0" + temp[0]; } else { returnString += temp[0]; } returnString += "/"; if (temp[1].length() == 1) { returnString += "0" + temp[1]; } else { returnString += temp[1]; } returnString += "/"; returnString += temp[2]; sections.add(type); sections.add(returnString); sections.add(string); // sections.add(DD); // sections.add(MM); // sections.add(YYYY); } else { type = "Text"; sections.add(type); sections.add(string); sections.add(string); } } // looks for date in local format else if (string.matches(dateformatSL)) { boolean DateValid; DateFormat D = new SimpleDateFormat("yyyy/MM/dd"); try { D.setLenient(false); D.parse(string); DateValid = true; } catch (ParseException e) { DateValid = false; } // checking for the valifity of the date if (DateValid) { temp = string.split("[/-]"); DD = Integer.parseInt(temp[2]); MM = Integer.parseInt(temp[1]); YYYY = Integer.parseInt(temp[0]); // creating the date in the proper format if (temp[2].length() == 1) { returnString += "0" + temp[2]; } else { returnString += temp[2]; } returnString += "/"; if (temp[1].length() == 1) { returnString += "0" + temp[1]; } else { returnString += temp[1]; } returnString += "/"; returnString += temp[0]; type = "Date"; sections.add(type); sections.add(returnString); sections.add(string); // sections.add(DD); // sections.add(MM); // sections.add(YYYY); } // if date is not a real value the input will be assigned to a text as in excel else { type = "Text"; sections.add(type); sections.add(string); sections.add(string); } } // looks for time 24hrs else if (string.matches(time24hr)) { temp = string.split("[:]"); hh = Integer.parseInt(temp[0]); mm = Integer.parseInt(temp[1]); if (temp.length == 3) { ss = Integer.parseInt(temp[2]); if (temp[2].length() == 1) { returnString = "0" + temp[2]; } returnString = temp[2]; } else { returnString = "00"; ss = 0; } if (temp[1].length() == 1) { returnString = "0" + temp[1] + ":" + returnString; } returnString = temp[1] + ":" + returnString; returnString = temp[0] + ":" + returnString; type = "Time 24H"; sections.add(type); sections.add(returnString); sections.add(string); // sections.add(hh); // sections.add(mm); // sections.add(ss); marid = "t24"; // sections.add(marid); } // looks for time 12hrs else if (string.matches(time12hr)) { tempStr = ""; marid = ""; for (int i = 0; i < string.length(); i++) { if ((string.charAt(i) == 'a') || (string.charAt(i) == 'A')) { marid = "am"; break; } if ((string.charAt(i) == 'p') || (string.charAt(i) == 'P')) { marid = "pm"; break; } else { tempStr += string.charAt(i); } } temp = tempStr.split("[:]"); hh = Integer.parseInt(temp[0]); mm = Integer.parseInt(temp[1]); if (temp.length == 3) { ss = Integer.parseInt(temp[2]); if (temp[2].length() == 1) { returnString = "0" + temp[2]; } returnString = temp[2]; } else { returnString = "00"; ss = 0; } if (temp[1].length() == 1) { returnString = "0" + temp[1] + ":" + returnString; } returnString = temp[1] + ":" + returnString; returnString = temp[0] + ":" + returnString; type = "Time 12H"; sections.add(type); sections.add(returnString + marid); sections.add(string); // sections.add(hh); // sections.add(mm); // sections.add(ss); // sections.add(marid); } // checking for the integer values else if (string.matches(integer)) { // intVal = Integer.parseInt(string); type = "Integer"; sections.add(type); sections.add(string); sections.add(string); } // checking for the floating point values else if (string.matches(floating)) { if ((int) Double.parseDouble(string) == Double.parseDouble(string)) { type = "Integer"; sections.add(type); sections.add(String.valueOf((int) Double.parseDouble(string))); sections.add(string); } else { type = "Float"; sections.add(type); sections.add(string); sections.add(string); } } // checking the match for a currency type // only currency with two Symbolic expressions with be taken else if (string.matches(currency)) { tempStr = ""; temp = string.split("[. ]"); // case of user giving $.50.36 if (temp.length == 3) { // re building the floating point value if (string.contains(".")) { tempStr = temp[1] + '.' + temp[2]; currType = temp[0]; } } // case of the currency being dollars (special ASCII other than A-Za-z regex) else if (temp.length == 2) { if (string.charAt(0) == '$') { currType = "$"; for (int i = 1; i < string.length(); i++) { if (string.charAt(i) != ' ') { tempStr += string.charAt(i); } } } else { // building up the currency code for (int i = 0; i < 2; i++) { currType += string.charAt(i); } // building up the final amount of currency for (int i = 2; i < string.length(); i++) { if (string.charAt(i) != ' ') { tempStr += string.charAt(i); } } } } else { // in case the user has given in format $ 50.69 if (string.charAt(0) == '$') { currType = "$"; for (int i = 1; i < string.length(); i++) { if (string.charAt(i) != ' ') { tempStr += string.charAt(i); } } } // in case the user has given in format Rs 50.69 else { for (int i = 0; i < 2; i++) { currType += string.charAt(i); } for (int i = 2; i < string.length(); i++) { // avoids any additional white spaces if (string.charAt(i) != ' ') { tempStr += string.charAt(i); } } } } type = "Currency"; returnString = currType + " " + tempStr; sections.add(type); sections.add(returnString); sections.add(string); sections.add(tempStr); // sections.add(currType); } else { type = "Text"; sections.add(type); sections.add(string); sections.add(string); } // handles the exception if the user inputs a blankspace } catch (NullPointerException e) { type = ""; sections.add(type); sections.add(parseIt); sections.add(parseIt); } catch (NumberFormatException e) { type = "Text"; sections.add(type); sections.add(parseIt); sections.add(parseIt); } return sections; } public static String cleanBool(String in) { in = in.replace("=>=", ">="); in = in.replace("=<=", "<="); in = in.replace("<<", "<"); in = in.replace(">>", ">"); return in; } } //~ Formatted by Jindent --- http://www.jindent.com
[ "anuradhawick@gmail.com" ]
anuradhawick@gmail.com
82ec749fdff6ecd00ebc48af40a176e28c6720f8
129f58086770fc74c171e9c1edfd63b4257210f3
/src/testcases/CWE190_Integer_Overflow/CWE190_Integer_Overflow__int_getParameter_Servlet_multiply_21.java
5e3999cecb2d91f0fb2684607c3908adde272549
[]
no_license
glopezGitHub/Android23
1bd0b6a6c7ce3c7439a74f1e4dcef2c4c0fac4ba
6215d0684c4fbdc7217ccfbedfccfca69824cc5e
refs/heads/master
2023-03-07T15:14:59.447795
2023-02-06T13:59:49
2023-02-06T13:59:49
6,856,387
0
3
null
2023-02-06T18:38:17
2012-11-25T22:04:23
Java
UTF-8
Java
false
false
9,099
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__int_getParameter_Servlet_multiply_21.java Label Definition File: CWE190_Integer_Overflow__int.label.xml Template File: sources-sinks-21.tmpl.java */ /* * @description * CWE: 190 Integer Overflow * BadSource: getParameter_Servlet Read data from a querystring using getParameter() * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: multiply * GoodSink: Ensure there will not be an overflow before multiplying data by 2 * BadSink : If data is positive, multiply by 2, which can cause an overflow * Flow Variant: 21 Control flow: Flow controlled by value of a private variable. All functions contained in one file. * * */ package testcases.CWE190_Integer_Overflow; import testcasesupport.*; import java.sql.*; import javax.servlet.http.*; import javax.servlet.http.*; import java.util.logging.Level; import java.util.logging.Logger; public class CWE190_Integer_Overflow__int_getParameter_Servlet_multiply_21 extends AbstractTestCaseServlet { /* The variable below is used to drive control flow in the sink function */ private boolean bad_private = false; public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable { int data; data = Integer.MIN_VALUE; /* Initialize data */ /* POTENTIAL FLAW: Read data from a querystring using getParameter() */ { String s_data = request.getParameter("name"); try { data = Integer.parseInt(s_data.trim()); } catch(NumberFormatException nfe) { IO.logger.log(Level.WARNING, "Number format exception reading data from parameter 'name'", nfe); } } bad_private = true; bad_sink(data , request, response); } private void bad_sink(int data , HttpServletRequest request, HttpServletResponse response) throws Throwable { if(bad_private) { if(data > 0) /* ensure we won't have an underflow */ { /* POTENTIAL FLAW: if (data*2) > Integer.MAX_VALUE, this will overflow */ int result = (int)(data * 2); IO.writeLine("result: " + result); } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ if(data > 0) /* ensure we won't have an underflow */ { /* FIX: Add a check to prevent an overflow from occurring */ if (data < (Integer.MAX_VALUE/2)) { int result = (int)(data * 2); IO.writeLine("result: " + result); } else { IO.writeLine("data value is too large to perform multiplication."); } } } } /* The variables below are used to drive control flow in the sink functions. */ private boolean goodB2G1_private = false; private boolean goodB2G2_private = false; private boolean goodG2B_private = false; public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable { goodB2G1(request, response); goodB2G2(request, response); goodG2B(request, response); } /* goodB2G1() - use BadSource and GoodSink by setting the variable to false instead of true */ private void goodB2G1(HttpServletRequest request, HttpServletResponse response) throws Throwable { int data; data = Integer.MIN_VALUE; /* Initialize data */ /* POTENTIAL FLAW: Read data from a querystring using getParameter() */ { String s_data = request.getParameter("name"); try { data = Integer.parseInt(s_data.trim()); } catch(NumberFormatException nfe) { IO.logger.log(Level.WARNING, "Number format exception reading data from parameter 'name'", nfe); } } goodB2G1_private = false; goodB2G1_sink(data , request, response); } private void goodB2G1_sink(int data , HttpServletRequest request, HttpServletResponse response) throws Throwable { if(goodB2G1_private) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ if(data > 0) /* ensure we won't have an underflow */ { /* POTENTIAL FLAW: if (data*2) > Integer.MAX_VALUE, this will overflow */ int result = (int)(data * 2); IO.writeLine("result: " + result); } } else { if(data > 0) /* ensure we won't have an underflow */ { /* FIX: Add a check to prevent an overflow from occurring */ if (data < (Integer.MAX_VALUE/2)) { int result = (int)(data * 2); IO.writeLine("result: " + result); } else { IO.writeLine("data value is too large to perform multiplication."); } } } } /* goodB2G2() - use BadSource and GoodSink by reversing the blocks in the if in the sink function */ private void goodB2G2(HttpServletRequest request, HttpServletResponse response) throws Throwable { int data; data = Integer.MIN_VALUE; /* Initialize data */ /* POTENTIAL FLAW: Read data from a querystring using getParameter() */ { String s_data = request.getParameter("name"); try { data = Integer.parseInt(s_data.trim()); } catch(NumberFormatException nfe) { IO.logger.log(Level.WARNING, "Number format exception reading data from parameter 'name'", nfe); } } goodB2G2_private = true; goodB2G2_sink(data , request, response); } private void goodB2G2_sink(int data , HttpServletRequest request, HttpServletResponse response) throws Throwable { if(goodB2G2_private) { if(data > 0) /* ensure we won't have an underflow */ { /* FIX: Add a check to prevent an overflow from occurring */ if (data < (Integer.MAX_VALUE/2)) { int result = (int)(data * 2); IO.writeLine("result: " + result); } else { IO.writeLine("data value is too large to perform multiplication."); } } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ if(data > 0) /* ensure we won't have an underflow */ { /* POTENTIAL FLAW: if (data*2) > Integer.MAX_VALUE, this will overflow */ int result = (int)(data * 2); IO.writeLine("result: " + result); } } } /* goodG2B() - use GoodSource and BadSink */ private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable { int data; /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ data = 2; goodG2B_private = true; goodG2B_sink(data , request, response); } private void goodG2B_sink(int data , HttpServletRequest request, HttpServletResponse response) throws Throwable { if(goodG2B_private) { if(data > 0) /* ensure we won't have an underflow */ { /* POTENTIAL FLAW: if (data*2) > Integer.MAX_VALUE, this will overflow */ int result = (int)(data * 2); IO.writeLine("result: " + result); } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ if(data > 0) /* ensure we won't have an underflow */ { /* FIX: Add a check to prevent an overflow from occurring */ if (data < (Integer.MAX_VALUE/2)) { int result = (int)(data * 2); IO.writeLine("result: " + result); } else { IO.writeLine("data value is too large to perform multiplication."); } } } } /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
[ "guillermo.pando@gmail.com" ]
guillermo.pando@gmail.com
2f4ff1960e856b88ecd35bff7f58a40505dd36f1
f69a8fa22d28e3f078c98c4a737516cf8bc172a4
/src/shalom/bible/hymn/cion/util/AlertUtil.java
731a74b30946a8446ed04d54db02aba052c0fc2c
[]
no_license
cion49235/BibleHymn_cion
b91d82a6e8f45971d2799ddb7f09215295290950
b4e173f1d2a4aa6b8ef904f922a15fcd5e7c7d96
refs/heads/master
2021-05-06T11:43:52.100147
2018-06-25T08:38:45
2018-06-25T08:38:45
113,341,737
0
0
null
null
null
null
UTF-8
Java
false
false
1,582
java
package shalom.bible.hymn.cion.util; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import shalom.bible.hymn.cion.R; import shalom.bible.hymn.cion.db.helper.DBopenHelper_podcast_download; public class AlertUtil { public static void AlertShow(String msg, final Context context, final String title, final String enclosure, final int position, final String description_title, final DBopenHelper_podcast_download down_mydb, final String provider, final String image, final String pubDate, final String old_title) { AlertDialog.Builder alert_internet_status = new AlertDialog.Builder(context); alert_internet_status.setCancelable(false); alert_internet_status.setMessage(msg); alert_internet_status.setPositiveButton(context.getString(R.string.activity_podcast_09), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { DownloadAsync downloadAsync = new DownloadAsync(context, title, enclosure,position, description_title, down_mydb, provider, image, pubDate, old_title); downloadAsync.execute(); dialog.dismiss(); } }); alert_internet_status.setNegativeButton(context.getString(R.string.activity_podcast_10), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alert_internet_status.show(); } }
[ "cion49235@nate.com" ]
cion49235@nate.com
b32a17ce6b3025e84a9fcc817bf317fc2d663b09
ccc07ae77b4924b4c94f39d655dcc8617f176f03
/bin/scriptella/scriptella-src-ide/scriptella/core/IfInterceptor.java
beba7d33e5843f63cd4b4f436ef70f616ef61552
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
mac2394q/fts-servicios-migracion-vas
230125012c2118032a3d13659e176e7127889475
1717eec62ae504f52f81638c1979655f8a84a9a3
refs/heads/main
2023-01-24T17:18:11.126334
2020-12-09T01:33:06
2020-12-09T01:33:06
319,808,016
0
0
null
null
null
null
UTF-8
Java
false
false
2,984
java
/* * Copyright 2006-2009 The Scriptella Project Team. * * 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 scriptella.core; import scriptella.configuration.Location; import scriptella.configuration.ScriptingElement; import scriptella.expression.Expression; import java.util.LinkedHashSet; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; /** * Handles if expressions specified by if attribute on query/script elements. * * @author Fyodor Kupolov * @version 1.0 * @see scriptella.expression.JexlExpression */ public final class IfInterceptor extends ElementInterceptor { private static final Logger LOG = Logger.getLogger(IfInterceptor.class.getName()); private static final Set<CharSequence> trueStrs = new LinkedHashSet<CharSequence>(); static { trueStrs.add("true"); trueStrs.add("yes"); trueStrs.add("1"); trueStrs.add("on"); } private Expression expression; private Location location; public IfInterceptor(ExecutableElement next, ScriptingElement scr) { super(next); expression = Expression.compile(scr.getIf()); location = scr.getLocation(); } public void execute(final DynamicContext ctx) { boolean ok = false; try { final Object res = expression.evaluate(ctx); if (res != null) { if (res instanceof Boolean) { ok = (Boolean) res; } else if (trueStrs.contains(String.valueOf(res))) { ok = true; } } } catch (Expression.EvaluationException e) { LOG.log(Level.WARNING, "Unable to evaluate if condition \"" + expression.getExpression() + "\" for script " + location + ": " + e.getMessage(), e); } if (ok) { //if expr evaluated to true executeNext(ctx); } else { if (LOG.isLoggable(Level.FINE)) { LOG.fine("if=\""+expression.getExpression()+"\" is false, element body is skipped."); } } } public static ExecutableElement prepare( final ExecutableElement next, final ScriptingElement s) { final String ifExpr = s.getIf(); if ((ifExpr == null) || (ifExpr.length() == 0)) { return next; } return new IfInterceptor(next, s); } }
[ "mac2394q@gmail.com" ]
mac2394q@gmail.com
47708aefdafa2f7bcdf2c4cbebf458d622092b0d
b26d6637c93870c87ecfcf8ae39e5c8618d4b7ad
/app/src/main/java/com/example/otowatertech/islemBugday.java
0d6aa711cc7236f89b5de42ab8d1e0576fb8d93b
[]
no_license
burakbakar/OtoWaterTech
c151e8f1bc47157e1a9b9a262531aaed4722c99c
89358b4a1d696d73074c86a18196a3930fa626d6
refs/heads/master
2022-11-23T06:56:01.487581
2020-07-26T23:28:54
2020-07-26T23:28:54
282,750,555
0
0
null
null
null
null
UTF-8
Java
false
false
2,295
java
package com.example.otowatertech; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; public class islemBugday extends AppCompatActivity { TextView urunSonucText; TextView alanText; TextView uzunlukText; TextView maliyetText; TextView adetText; TextView sicaklikText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_islem_bugday); alanText = findViewById(R.id.alanText); uzunlukText = findViewById(R.id.uzunlukText); maliyetText = findViewById(R.id.maliyetText); adetText = findViewById(R.id.adetText); sicaklikText = findViewById(R.id.sicaklikText); Intent i = getIntent(); String sonuc2 = i.getStringExtra("Alan :"); //int sonuc2 = Integer.parseInt(alanText.getText().toString()); alanText.setText(sonuc2); Intent i2 = getIntent(); String sonucUzunluk = i2.getStringExtra("Uzunluk :"); uzunlukText.setText(sonucUzunluk); Intent i3 = getIntent(); String sonucMaliyet = i3.getStringExtra("Maliyet :"); maliyetText.setText(sonucMaliyet); Intent i4 = getIntent(); String sonucAdet = i4.getStringExtra("Adet :"); adetText.setText(sonucAdet); //maliyetText = findViewById(R.id.maliyetText); //urunSonucText = findViewById(R.id.urunSonucText); //Intent i = getIntent(); //String UrunText = i.getStringExtra("Urun :"); //urunSonucText.setText(UrunText); //String sonuc = i.getStringExtra("Alan :"); //alanText.setText(sonuc); //Intent inn = getIntent(); //String sonucMaliyet2 = inn.getStringExtra("Maliyet :"); //maliyetText.setText(sonucMaliyet2); } public void havaDurumu(View view) { Intent i = new Intent(getBaseContext(), HavaDurumu.class); startActivity(i); } public void sonucHesapBugday(View view){ Intent i = new Intent(getBaseContext(), sonucBugday.class); i.putExtra("Sicaklik :",sicaklikText.getText().toString()); startActivity(i); } }
[ "buraakbakar@gmail.com" ]
buraakbakar@gmail.com
66ddda47eb9b0c93e75e54dfcf49087fde9ca1c5
c5ecc84656746fafb9def3d67b48467438f5f7ca
/app/src/test/java/in/co/kingmaker/android/example/fruits_problem/domain/FruitsSeparationExceptionTest.java
8c2f2299ba9696c67f40e6926f887eee0aa3d48a
[]
no_license
kingmaker-agm/fruit-problem-android-example
3964d43b868af9882ca0dd4f92caadf1a1e65c26
65917d50bb8226566e9add084d6cc2a0df379c46
refs/heads/master
2023-01-05T08:17:01.798777
2020-10-31T17:24:18
2020-10-31T17:26:56
306,427,708
0
0
null
null
null
null
UTF-8
Java
false
false
1,357
java
package in.co.kingmaker.android.example.fruits_problem.domain; import junit.framework.TestCase; import org.junit.Before; import org.junit.Test; import in.co.kingmaker.android.example.fruits_problem.domain.dto.FruitsSeparationSolution; import in.co.kingmaker.android.example.fruits_problem.domain.dto.SeparationDTO; import static org.junit.Assert.*; public class FruitsSeparationExceptionTest { private FruitsSeparationSolution stub; @Before public void setupSolutionStub() { stub = new FruitsSeparationSolution(); stub.addNextSeparation(new SeparationDTO(21,20)); stub.addNextSeparation(new SeparationDTO(11,9)); } @Test public void it_accepts_intermediate_solution_as_an_constructor_argument() { FruitsSeparationException sut = new FruitsSeparationException(stub, "test exception"); assertEquals(stub, sut.intermediateSolution); FruitsSeparationException sut2 = new FruitsSeparationException(2, stub, "test exception"); assertEquals(stub, sut2.intermediateSolution); } @Test public void it_accepts_only_intermediate_solution_and_calculates_error_level_from_intermediate_solution() { FruitsSeparationException sut = new FruitsSeparationException(stub, "test exception"); assertEquals(stub.getTotalLevels() + 1, sut.exceptionsLevel); } }
[ "b.g.pratheep.cool@gmail.com" ]
b.g.pratheep.cool@gmail.com
d5a6df033bb4fdab37e572584e46443082108c19
f1b73bf635beea91b5dfc0cb2319063f7be0f085
/ElectroSystem/src/presentacion/controlador/ControladorSC.java
64d2a2014e2de08ec01264796ce107b7f8dcdb1f
[]
no_license
jonalv86/ElectroSystem
88395d5ce49d0688197bfb172fc9ad1f89d6cb4b
b6d26ef8dac600d7a87283a2eb2ffdb762a00aea
refs/heads/master
2020-03-11T03:05:47.385837
2018-04-16T12:14:32
2018-04-16T12:14:32
129,736,795
0
0
null
null
null
null
ISO-8859-1
Java
false
false
18,831
java
package presentacion.controlador; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import dto.ItemDTO; import dto.MarcaDTO; import dto.PiezaDTO; import dto.PrecioPiezaDTO; import dto.ProveedorDTO; import dto.SolicitudCompraDTO; import dto.UsuarioDTO; import modelo.Modelo; import presentacion.controlador.button.column.ButtonColumn; import presentacion.ventanas.mail.VentanaMail; import presentacion.ventanas.sc.VentanaNuevaSC; public class ControladorSC implements ActionListener, ItemListener { private VentanaNuevaSC ventana; private Modelo modelo; private List<ProveedorDTO> proveedores; private List<MarcaDTO> marcas; private List<ItemDTO> piezasSolicitud; private DefaultTableModel tabla_de_items; private SolicitudCompraDTO solicitud_a_editar; private float preciototal = 0; private int cantidadPiezas = 0; private VentanaMail ventanaMail; private UsuarioDTO usuario; public ControladorSC(VentanaNuevaSC ventana, Modelo modelo, UsuarioDTO usuario) { this.setVentana(ventana); this.setModelo(modelo); this.usuario = usuario; try { cargarCboProveedores(); } catch (Exception e) { e.printStackTrace(); } this.piezasSolicitud = new ArrayList<ItemDTO>(); iniciarSolicitud(); } public ControladorSC(VentanaNuevaSC ventana, Modelo modelo, SolicitudCompraDTO sc, boolean editar, UsuarioDTO usuario) { this.setVentana(ventana); this.setModelo(modelo); this.usuario = usuario; this.marcas = sc.getProveedor().getMarcas(); this.solicitud_a_editar = sc; this.piezasSolicitud = solicitud_a_editar.getPiezas(); String nombreEstado = solicitud_a_editar.getEstado().getNombre(); this.ventana.getCboProveedores().addItem(this.solicitud_a_editar.getProveedor()); this.ventana.getBtnCancelar().addActionListener(this); if (!editar) { verSolicitud(); } else { if (nombreEstado.equals("Ingresada")) { iniciarEdicionSolicitud(); } else if (nombreEstado.equals("Enviada")) { iniciarProcesarSolicitud(); } /* * else iniciarInmodificableSolicitud(); */ } } /* * private void iniciarInmodificableSolicitud() { * * this.ventana.setTitle("Procesar solicitud nro.: " + * this.solicitud_a_editar.getId()); JButton btnSolicitar = * this.ventana.getBtnSolicitar(); btnSolicitar.setVisible(false); * this.ventana.getCbMarca().setEnabled(false); * this.ventana.getCbPiezas().setEnabled(false); * this.ventana.getCboProveedores().setEnabled(false); * this.ventana.getBtnEnviar().setVisible(false); * this.ventana.getBtnAgregarPiezas().setEnabled(false); * this.ventana.getTfCantidad().setEnabled(false); * preparedView(btnSolicitar); * * } */ private void verSolicitud() { this.ventana.setTitle("Solicitud de Compra Nº " + this.solicitud_a_editar.getId()); this.ventana.getTxtUsuario().setText(usuario.toString()); this.ventana.getBtnAgregarPiezas().setVisible(false); this.ventana.getBtnEnviar().setVisible(false); this.ventana.getBtnCancelar().setText("OK"); this.ventana.getBtnEnviar().setVisible(false); this.ventana.getBtnSolicitar().setVisible(false); this.ventana.getCboProveedores().setVisible(false); this.ventana.setTxtProveedor(solicitud_a_editar.getProveedor().getNombre()); this.ventana.getTxtProveedor().setVisible(true); this.ventana.getLblPieza().setVisible(false); this.ventana.getCbMarca().setVisible(false); this.ventana.getCbPiezas().setVisible(false); this.ventana.getTfCantidad().setVisible(false); cargarItems(); getCantidadPiezas(this.solicitud_a_editar); this.ventana.setVisible(true); } private void iniciarProcesarSolicitud() { this.ventana.setTitle("Procesar solicitud nro.: " + this.solicitud_a_editar.getId()); this.ventana.getTxtUsuario().setText(usuario.toString()); getCantidadPiezas(this.solicitud_a_editar); JButton btnSolicitar = this.ventana.getBtnSolicitar(); btnSolicitar.setText("Procesar"); // this.ventana.getCbMarca().setEnabled(false); // this.ventana.getCboProveedores().setEnabled(false); // this.ventana.getCbPiezas().setEnabled(false); // this.ventana.getBtnAgregarPiezas().setEnabled(false); // this.ventana.getTfCantidad().setEnabled(false); this.ventana.getBtnEnviar().setVisible(false); this.ventana.getBtnAgregarPiezas().addActionListener(this); preparedView(btnSolicitar); } private void preparedView(JButton btnSolicitar) { btnSolicitar.addActionListener(this); this.ventana.getBtnCancelar().addActionListener(this); this.ventana.getBtnAgregarPiezas().addActionListener(this); this.ventana.getCbMarca().addItemListener(this); this.ventana.getCboProveedores().addItemListener(this); this.ventana.getBtnEnviar().addActionListener(this); try { cargarCombosMarcas(); } catch (Exception e) { e.printStackTrace(); } crearTabla(); llenarPiezas(); this.ventana.setVisible(true); } private void llenarPiezas() { for (ItemDTO entry : piezasSolicitud) { PiezaDTO piezaItem = entry.getPieza(); Object marcaItem = piezaItem.getMarca(); int cantidadFloat = entry.getCantidadPiezas(); float precioTotal = piezaItem.getPrecio_venta() * cantidadFloat; Object[] fila = { marcaItem, piezaItem, cantidadFloat, piezaItem.getPrecio_venta(), precioTotal, "QUITAR" }; tabla_de_items.addRow(fila); preciototal += precioTotal; } this.ventana.setLblPrecioTotal(preciototal); } private void iniciarSolicitud() { this.ventana.setTitle("Nueva Solicitud de compra"); this.ventana.getTxtUsuario().setText(usuario.toString()); this.ventana.getBtnSolicitar().addActionListener(this); this.ventana.getBtnCancelar().addActionListener(this); this.ventana.getBtnAgregarPiezas().addActionListener(this); this.ventana.getCbMarca().addItemListener(this); this.ventana.getCboProveedores().addItemListener(this); this.ventana.getBtnEnviar().setVisible(false); this.ventana.getBtnEnviar().addActionListener(this); try { cargarCboProveedores(); cargarCombosMarcas(); } catch (Exception e) { e.printStackTrace(); } crearTabla(); this.ventana.setVisible(true); } private void iniciarEdicionSolicitud() { this.ventana.setTitle("Editar solicitud nro.: " + this.solicitud_a_editar.getId()); this.ventana.getTxtUsuario().setText(usuario.toString()); getCantidadPiezas(this.solicitud_a_editar); JButton btnSolicitar = this.ventana.getBtnSolicitar(); btnSolicitar.setText("Modificar"); preparedView(btnSolicitar); } private void getCantidadPiezas(SolicitudCompraDTO s) { if (s.getId() == 0) { this.ventana.setLblCantidadTotal(cantidadPiezas); } else { for (int i = 0; i < s.getPiezas().size(); i++) { this.cantidadPiezas += solicitud_a_editar.getPiezas().get(i).getCantidadPiezas(); } } this.ventana.setLblCantidadTotal(cantidadPiezas); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == this.ventana.getBtnCancelar()) { ventana.dispose(); } else { JButton btnSolicitar = this.ventana.getBtnSolicitar(); if (e.getSource() == btnSolicitar) { if (this.ventana.getCboProveedores() != null) { // if (btnSolicitar.getText().equals("Modificar") || // btnSolicitar.getText().equals("Solicitar")) { if (btnSolicitar.getText().equals("Modificar")) { if (this.tabla_de_items.getRowCount() != 0) { try { crearSC(); ventana.dispose(); } catch (Exception e1) { JOptionPane.showMessageDialog(null, "No se ha podido modificar la solicitud de compra.", "¡Atención!", JOptionPane.ERROR_MESSAGE); ventana.dispose(); } JOptionPane.showMessageDialog(null, "Se modificó la solicitud de la orden de compra"); } else { JOptionPane.showMessageDialog(null, "No se han agregado piezas a la solicitud.", "¡Atención!", JOptionPane.ERROR_MESSAGE); } } else if (btnSolicitar.getText().equals("Solicitar")) { if (this.tabla_de_items.getRowCount() != 0) { try { crearSC(); ventana.dispose(); } catch (Exception e1) { JOptionPane.showMessageDialog(null, "No se ha podido crear la solicitud de compra.", "¡Atención!", JOptionPane.ERROR_MESSAGE); ventana.dispose(); } JOptionPane.showMessageDialog(null, "Se realizó la solicitud de la orden de compra"); } else { JOptionPane.showMessageDialog(null, "No se han agregado piezas a la solicitud.", "¡Atención!", JOptionPane.ERROR_MESSAGE); } } else if (btnSolicitar.getText().equals("Procesar")) { try { this.modelo.procesarSolicitud(solicitud_a_editar); ventana.dispose(); } catch (Exception e1) { JOptionPane.showMessageDialog(null, "No se ha podido procesar la solicitud de compra.", "¡Atención!", JOptionPane.ERROR_MESSAGE); ventana.dispose(); } JOptionPane.showMessageDialog(null, "Se proceso la solicitud de la orden de compra"); ventana.dispose(); } } else { JOptionPane.showMessageDialog(null, "No se ha seleccionado ningun proveedor.", "¡Atención!", JOptionPane.ERROR_MESSAGE); } } else if (e.getSource() == this.ventana.getBtnAgregarPiezas()) { String cantidad = this.ventana.getTfCantidad().getValue().toString(); int valorCantidad = Integer.parseInt(cantidad); if (valorCantidad > 0 && this.ventana.getCbMarca().getSelectedItem() != null && this.ventana.getCbPiezas().getSelectedItem() != null) { agregarItem(); } } else if (e.getSource() == this.ventana.getBtnEnviar()) { try { this.ventanaMail = new VentanaMail(this.ventana); ControladorMail controladorMail = new ControladorMail(ventanaMail, this.modelo, solicitud_a_editar); // arreglo a lo indio, no me juzgen D: - Dario Rick // Thread.sleep(10); if (controladorMail.fueEnviado()) { modelo.cambiarEstado(solicitud_a_editar, 2); JOptionPane.showMessageDialog(null, "Se ha enviado la solicitud de compra satisfactoriamente.", "¡Exito!", JOptionPane.INFORMATION_MESSAGE); ventana.dispose(); } else JOptionPane.showMessageDialog(null, "No se ha podido enviar la solicitud de compra.", "¡Atención!", JOptionPane.ERROR_MESSAGE); } catch (Exception e1) { e1.printStackTrace(); } } } } @Override public void itemStateChanged(ItemEvent e) { JComboBox<MarcaDTO> cbMarca = this.ventana.getCbMarca(); JComboBox<ProveedorDTO> cbProveedores = this.ventana.getCboProveedores(); if (e.getSource() == cbMarca && cbMarca.getSelectedItem() != null) { ProveedorDTO proveedor = (ProveedorDTO) cbProveedores.getSelectedItem(); MarcaDTO marca = (MarcaDTO) cbMarca.getSelectedItem(); try { cargarComboPiezas(proveedor.getIdProveedor(), marca.getIdMarca()); } catch (Exception e1) { e1.printStackTrace(); } } else if (e.getSource() == cbProveedores && cbProveedores.getSelectedItem() != null) { cargarCombosMarcas((ProveedorDTO) cbProveedores.getSelectedItem()); } } private void crearSC() throws Exception { SolicitudCompraDTO solicitudCompra = new SolicitudCompraDTO(0, (ProveedorDTO) this.ventana.getCboProveedores().getSelectedItem(), null, piezasSolicitud); if (solicitud_a_editar != null) { solicitud_a_editar.setPiezas(piezasSolicitud); this.modelo.actualizarSolicitud(solicitud_a_editar); } else this.modelo.agregarSolicitud(solicitudCompra); } private void agregarItem() { PrecioPiezaDTO piezaItem = (PrecioPiezaDTO) this.ventana.getCbPiezas().getSelectedItem(); int cantidadXU = 0; cantidadXU = this.ventana.getCantidad(); ItemDTO item = new ItemDTO(piezaItem.getPieza(), cantidadXU, null, null); if (!piezasSolicitud.contains(item) || cantidadPiezas == 0) agregar(piezaItem, item); else modificar(piezaItem, item); } public void agregar(PrecioPiezaDTO piezaItem, ItemDTO item) { Object marcaItem = this.ventana.getCbMarca().getSelectedItem(); float precioTotal = piezaItem.getPrecio() * item.getCantidadPiezas(); Object[] fila = { marcaItem, piezaItem.getPieza(), item.getCantidadPiezas(), piezaItem.getPrecio(), precioTotal, "QUITAR" }; tabla_de_items.addRow(fila); preciototal += precioTotal; this.ventana.setLblPrecioTotal(preciototal); this.ventana.getTfCantidad().setValue(1); piezasSolicitud.add(item); int cantidadPiezasNuevas = 0; cantidadPiezasNuevas = item.getCantidadPiezas(); cantidadPiezas += cantidadPiezasNuevas; this.ventana.setLblCantidadTotal(cantidadPiezas); } public void modificar(PrecioPiezaDTO piezaItem, ItemDTO item) { int fila = 0; for (int i = 0; i < this.ventana.getTable().getRowCount(); i++) { if (this.ventana.getTable().getValueAt(i, 1).toString() .equals(String.valueOf(item.getPieza().getIdUnico()))) { fila = i; } } preciototal -= Float.parseFloat(ventana.getTable().getValueAt(fila, 4).toString()); cantidadPiezas -= Integer.parseInt(ventana.getTable().getValueAt(fila, 2).toString()); tabla_de_items.removeRow(fila); piezasSolicitud.remove(item); float precioTotal = piezaItem.getPrecio() * item.getCantidadPiezas(); Object[] data = { this.ventana.getCbMarca().getSelectedItem(), piezaItem.getPieza(), item.getCantidadPiezas(), piezaItem.getPrecio(), precioTotal, "QUITAR" }; tabla_de_items.addRow(data); piezasSolicitud.add(item); preciototal += precioTotal; this.ventana.setLblPrecioTotal(preciototal); cantidadPiezas += item.getCantidadPiezas(); this.ventana.setLblCantidadTotal(cantidadPiezas); // clean spinner this.ventana.getTfCantidad().setValue(1); } private void cargarCboProveedores() throws Exception { try { JComboBox<ProveedorDTO> cboProveedores = this.ventana.getCboProveedores(); cboProveedores.removeAllItems(); this.proveedores = modelo.obtenerProveedores(); for (ProveedorDTO p : proveedores) { cboProveedores.addItem(p); } } catch (Exception e) { throw e; } } private void cargarCombosMarcas() { cargarCombosMarcas(null); } private void cargarCombosMarcas(ProveedorDTO proveedor) { try { JComboBox<MarcaDTO> cbMarca = this.ventana.getCbMarca(); cbMarca.removeAllItems(); if (this.marcas == null || proveedor != null) this.marcas = modelo.obtenerMarcasProveedor(proveedor.getIdProveedor()); for (MarcaDTO marca : marcas) { cbMarca.addItem(marca); } } catch (Exception e) { e.printStackTrace(); } } private void cargarComboPiezas(int idProveedor, int idMarca) throws Exception { JComboBox<PrecioPiezaDTO> cbPiezas = this.ventana.getCbPiezas(); cbPiezas.removeAllItems(); List<PrecioPiezaDTO> pieza = modelo.obtenerPrecioCompraItems(idProveedor, idMarca); for (PrecioPiezaDTO precioPieza : pieza) { cbPiezas.addItem(precioPieza); } } @SuppressWarnings("serial") private void crearTabla() { String[] columns = { "Marca", "Producto", "Cantidad", "Precio x U", "Total Items", "" }; tabla_de_items = new DefaultTableModel(null, columns) { @Override public boolean isCellEditable(int row, int column) { if (column == 5) { /* * String nombre = * solicitud_a_editar.getEstado().getNombre(); if * (solicitud_a_editar != null && * (nombre.equals("Procesada") || * nombre.equals("Cancelada"))) */ return true; } return false; } }; tabla_de_items.setColumnIdentifiers(columns); this.ventana.getTable().setModel(tabla_de_items); new ButtonColumn(this.ventana.getTable(), quitarItem(), 5); } private void cargarItems() { String[] columns = { "Marca", "Producto", "Cantidad", "Precio X U", "Total item" }; tabla_de_items = new DefaultTableModel(null, columns); tabla_de_items.setColumnIdentifiers(columns); this.ventana.getTable().setModel(tabla_de_items); for (ItemDTO entry : piezasSolicitud) { PiezaDTO piezaItem = entry.getPieza(); Object marcaItem = piezaItem.getMarca(); int cantidadFloat = entry.getCantidadPiezas(); float precioTotal = piezaItem.getPrecio_venta() * cantidadFloat; Object[] fila = { marcaItem, piezaItem, cantidadFloat, piezaItem.getPrecio_venta(), precioTotal }; tabla_de_items.addRow(fila); preciototal += precioTotal; } this.ventana.setLblPrecioTotal(preciototal); } @SuppressWarnings("serial") private Action quitarItem() { Action quitar = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { int rowAEliminar = ventana.getTable().getSelectedRow(); try { int respuesta = JOptionPane.showConfirmDialog(ventana, "¿Está seguro que desea eliminar la pieza?", null, JOptionPane.YES_NO_OPTION); if (respuesta == JOptionPane.YES_OPTION) { PiezaDTO piezaTable = (PiezaDTO) tabla_de_items.getValueAt(ventana.getTable().getSelectedRow(), 1); for (ItemDTO itemDTO : piezasSolicitud) { if (itemDTO.getPieza().getIdProdPieza() == piezaTable.getIdProdPieza()) { piezasSolicitud.remove(itemDTO); break; } } String valorString = tabla_de_items.getValueAt(rowAEliminar, 4).toString(); Float precioARestar = Float.valueOf(valorString); preciototal -= precioARestar; ventana.setLblPrecioTotal(preciototal); int cantidadRestar = 0; cantidadRestar = (int) tabla_de_items.getValueAt(ventana.getTable().getSelectedRow(), 2); cantidadPiezas -= cantidadRestar; ventana.setLblCantidadTotal(cantidadPiezas); tabla_de_items.removeRow(ventana.getTable().getSelectedRow()); ventana.getTable().setModel(tabla_de_items); } } catch (Exception e1) { e1.printStackTrace(); } } }; return quitar; } private void setModelo(Modelo modelo) { this.modelo = modelo; } private void setVentana(VentanaNuevaSC ventana) { this.ventana = ventana; } public Modelo getModelo() { return modelo; } }
[ "jony.alv.dev@outlook.com" ]
jony.alv.dev@outlook.com
6a01679c8c06a28770472d042a39c11684bbdf45
25945b4c9c27db7a0c2af1232c3df590a7f27a28
/src/sample/Emulator/MyTalonSRX.java
9ffa000454b618bf8c36149f2b16f7ed04b4beb5
[]
no_license
ForrestFire0/RobotSim
f17798e8019114ef36ce3b14fa5677b01f359f4b
68194f9b89fa5a51243c35d35c3eaa9bd63c7cb4
refs/heads/master
2020-11-29T15:57:30.614854
2019-12-30T18:51:13
2019-12-30T18:51:13
230,158,822
0
0
null
2019-12-25T22:30:37
2019-12-25T22:10:36
Java
UTF-8
Java
false
false
2,053
java
package sample.Emulator; import java.util.ArrayList; public class MyTalonSRX { int port; double throttle; MyTalonSRX leader; boolean hasEncoder; boolean isFollower; static ArrayList<MyTalonSRX> talonSRXES = new ArrayList<>(); static ArrayList<Integer> encoders = new ArrayList<>(); public MyTalonSRX(int port) { talonSRXES.add(this); } public void set(ControlMode controlMode, double x) { switch (controlMode) { case PercentOutput: throttle = x; break; case Follower: try { throw new Exception("Change to either percent or smthin else."); } catch (Exception e) { e.printStackTrace(); } break; default: try { throw new Exception("Unrecognized control Mode."); } catch (Exception e) { e.printStackTrace(); } break; } } public void set(ControlMode controlMode, MyTalonSRX myTalonSRX) { if(controlMode == ControlMode.Follower) { leader = myTalonSRX; isFollower = true; } else try { throw new Exception("You have to set it to follower control mode."); } catch (Exception e) { e.printStackTrace(); } } public double getThrottle() { return throttle; } public int getPort() { return port; } public static ArrayList<MyTalonSRX> getTalonSRXES() { return talonSRXES; } public static void setEncoders(ArrayList<Integer> encoders) { MyTalonSRX.encoders = encoders; } public MyTalonSRX getDeviceID() { return this; } public void configSelectedFeedbackSensor(FeedbackDevice x) { hasEncoder = false; } public int getSelectedSensorVelocity() { if(hasEncoder) return encoders.get(port); else return 0; } }
[ "fmilner@zoom456.com" ]
fmilner@zoom456.com
ee1f8cae5beb43126c238d3076b9e7bec80dc9fd
d749c687f426a56b44f8a84231b9c89dbbda3161
/src/exceptionsHandling/ElementNotClickableAtPointException_Demo.java
9927b5fdadd701f4a9ce5ea9c5601d59fdc8cf01
[]
no_license
SandbhorSarjerao/SeleniumPractice
72760a16f1dff8c4f1e2610fd73b60d57eb90019
ac122b3dc2987fec7de41448b792024817b532ce
refs/heads/master
2023-01-23T04:44:34.878892
2020-12-08T07:24:39
2020-12-08T07:24:39
284,062,432
0
0
null
null
null
null
UTF-8
Java
false
false
1,440
java
package exceptionsHandling; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class ElementNotClickableAtPointException_Demo { public static WebDriver driver; @BeforeMethod public void setUp() { System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "\\Drivers\\chromedriver.exe"); driver = new ChromeDriver(); driver.manage().window().maximize(); } @Test public void elementNotClickableAtPointExceptionDemo() { driver.get("https://www.freecrm.com/index.html"); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); WebDriverWait wait = new WebDriverWait(driver,10); driver.findElement(By.xpath("//span[contains(text(),'Log In')]")).click(); // driver.findElement(By.name("email")).sendKeys("testing"); wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("email"))).sendKeys("testing"); driver.findElement(By.xpath("//*[contains(text(),'Login')]")).click(); } @AfterMethod public void tearDown() throws InterruptedException { Thread.sleep(3000); if (driver != null) { driver.quit(); } } }
[ "sandbhorsarjerao@gmail.com" ]
sandbhorsarjerao@gmail.com
422510bcca2e6eb4693dbce8e1d259d8d014b9f6
0415c756cfd2bf100c3b4e7b651def65e3cabe78
/registrationNumbers.java
5385813810893215b80301700ead828f0892de27
[]
no_license
deathm1/VITOLDSA
191dd93a26118513071e4de18b921e4377df19ff
7ea273a0bf1fc2e131353628fcd89e015e82af15
refs/heads/master
2022-06-08T01:11:20.869792
2020-05-06T10:38:55
2020-05-06T10:38:55
261,555,560
0
0
null
null
null
null
UTF-8
Java
false
false
2,188
java
//Digital Assignment DSA VITOL //Author : Harsh Handoo //RegNo : 17BEC0217 //GitHub : death_m1 //Students of a Programming class arrive to submit assignments. // Their register numbers are stored in a LIFO list in the order // in which the assignments are submitted. Write a program using // array to display the register number of the ten students who // submitted first. Register number of the ten students who submitted // first will be at the bottom of the LIFO list. Hence pop out the // required number of elements from the top so as to retrieve and // display the first 10 students. //https://github.com/deathm1/VITOLDSA/blob/master/registrationNumbers.java import java.util.Scanner; public class regnos { String[] digitalAssignmentSubmissions; public void parentArray(int i){ //This function is going to generate the array //of all the students who submitted the assignment. Scanner sc = new Scanner(System.in); if(i>10){ digitalAssignmentSubmissions = new String[i]; System.out.println("Enter alpha numeric registration number of "+ i + " students : "); for (int x=0; x<digitalAssignmentSubmissions.length; x++){ digitalAssignmentSubmissions[x] = sc.nextLine(); } } else{ System.out.println("This input doesn't satisfy program requirements."); } } public void pop10Students(){ //This function is going to pop out students in "last in first out" manner. for (int i=digitalAssignmentSubmissions.length-1; i!=9; i--){ System.out.println("Student Assignment popped (" + i +") :" + digitalAssignmentSubmissions[i]); } System.out.println(" "); for (int i=9; i!=-1; i--){ System.out.println("Student Assignment Token (" + i +") :" + digitalAssignmentSubmissions[i]); } } public static void main (String[] args){ regnos myClass = new regnos(); Scanner sc = new Scanner(System.in); System.out.println("Please Enter at least 11 students : "); myClass.parentArray(sc.nextInt()); myClass.pop10Students(); } }
[ "noreply@github.com" ]
noreply@github.com
dbce0cc7bf4fe471047fef9cc257e4744ba0fe12
f352cef73f0c98bb2e76c66fde1a3e0884ae1374
/app/src/main/java/com/example/btl_music4b/Service/APIService.java
8eeea8c1a13e6beaed57e2c7be074812f7e97051
[]
no_license
CuongTech47/CDPLAYER_APP
21c0ae9a63b44ae24715271572bd5d07a05bdd5c
4450d0c742a3fa2e0a547a2ad4ed7321b50547ca
refs/heads/master
2023-04-26T17:19:16.440090
2021-05-28T20:32:47
2021-05-28T20:32:47
371,236,730
1
0
null
null
null
null
UTF-8
Java
false
false
296
java
package com.example.btl_music4b.Service; public class APIService { private static String base_url = "https://musicapp8247.000webhostapp.com//Server/"; public static Dataservice getService(){ return APIRetrofitClient.getClient(base_url).create(Dataservice.class); } }
[ "cuongtech47@gmail.com" ]
cuongtech47@gmail.com
04b0e20935dab994cc79918a677495d3c03aa543
5d77abfba31d2f0a5cb2f92f937904859785e7ff
/Java/java_examples Hyd/BASICS/mmdatatypes/mmshort.java
0f719540e622bdeb38d0fe94afc1cb829fbc9017
[]
no_license
thinkpavan/artefacts
d93a1c0be0b6158cb0976aae9af9c6a016ebfdae
04bcf95450243dfe2f4fa8f09d96274034428e4d
refs/heads/master
2020-04-01T20:24:34.142409
2016-07-07T16:27:47
2016-07-07T16:27:47
62,716,135
0
0
null
null
null
null
UTF-8
Java
false
false
502
java
/* This Program is a simple java Application which uses minimum and maximum values for short data type Author : Team - J Version: 1.0*/ class mmshort { public static void main(String args[]){ short s1 = -32768 ; short s2 = 32767 ; System.out.println(" s1 = " + s1); System.out.println(" s2 = " + s2); s1--; s2++; System.out.println(" s1 = " + s1); System.out.println(" s2 = " + s2); /* try to assign -32769 to b1 and check what happens when you compile your program*/ } }
[ "lazygeeks.in@gmail.com" ]
lazygeeks.in@gmail.com
634fed265077e97f2bec3467af64659826de5f83
54274e153d5e80893203362d9950ee9f8a1a0b69
/3-java/05-mvc/src/main/java/com/revature/App.java
169ce9b61173dea0395b624b07422a7a5247a960
[ "MIT" ]
permissive
AdamDKing/training-code
d56962ec61f8705b0dc68fbd4dbc2ef91b575622
827e1db6273a4b38e096bb8f558b86d12027d51f
refs/heads/master
2020-08-06T07:52:00.875373
2019-04-01T16:17:10
2019-04-01T16:17:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,012
java
package com.revature; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import com.revature.sandwich.Sandwich; import com.revature.sandwich.SandwichFactory; public class App { public static void main(String[] args) { Sandwich sandwich = SandwichFactory.getInstance().build("ingredients.txt"); System.out.println(sandwich.toString()); String url = "jdbc:postgresql://postgres.cvoui7q38caj.us-east-2.rds.amazonaws.com:5432/postgres"; String username = "postgres"; String password = "postgres"; try (Connection connection = DriverManager.getConnection(url, username, password)) { Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery("select * from sandwich"); while (rs.next()) { System.out.println(rs.getString("id")); System.out.println(rs.getString("name")); } rs.close(); } catch (SQLException e) { e.printStackTrace(); } } }
[ "mehrab.rahman@revature.com" ]
mehrab.rahman@revature.com
d82aca83efa68bb1cb6d6fc1936f54cbe1dcf9c9
c8c9581bed9cc9102a20124cea69ac75d94b4849
/turios/src/main/java/com/turios/activities/display/DisplayPagerAdapter.java
91fbedbdcbe024d003818f1891ea15028234300b
[]
no_license
cyrixmorten/turios-android
1a1991f56acaba72ead9430107326e97efe4a0f0
a2ff7b3b5d27132be704fb7b551d6d9db49da3aa
refs/heads/master
2022-08-07T03:14:35.762734
2017-05-29T07:58:30
2017-05-29T07:58:30
63,005,497
0
0
null
null
null
null
UTF-8
Java
false
false
3,037
java
package com.turios.activities.display; import android.content.Context; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentStatePagerAdapter; import android.util.Log; import android.util.SparseArray; import android.view.ViewGroup; import com.turios.R; import com.turios.activities.fragments.DisplayFragment; import com.turios.modules.core.DisplayCoreModule; public class DisplayPagerAdapter extends FragmentStatePagerAdapter { private static final String TAG = "DisplayPagerAdapter"; SparseArray<DisplayFragment> registeredFragments = new SparseArray<DisplayFragment>(); private final Context context; private final DisplayCoreModule display; private final FragmentManager fm; private boolean isAddOrRemoving; public DisplayPagerAdapter(Context context, FragmentManager fm, DisplayCoreModule display) { super(fm); this.context = context; this.display = display; this.fm = fm; Log.d(TAG, "pages " + display.getPagesCount()); } public void notifySizeChangingDataSetChange() { isAddOrRemoving = true; notifyDataSetChanged(); isAddOrRemoving = false; } @Override public int getCount() { int count = (display != null && display.getPagesCount() > 0) ? display .getPagesCount() : 1; return count; } @Override public int getItemPosition(Object object) { DisplayFragment frag = (DisplayFragment) object; if (!display.containsPageId(frag.getPageId())) { // this will update the 'no information' page with id -1 return POSITION_NONE; } if (isAddOrRemoving) { // recreate all for simplicity return POSITION_NONE; } return POSITION_UNCHANGED; } @Override public Fragment getItem(int position) { Log.d(TAG, "getItem " + position); return DisplayFragment.newInstance(position); } @Override public CharSequence getPageTitle(int position) { if (display != null && display.getPagesCount() > 0) { return context.getString(R.string.page) + " " + (position + 1); } else { return super.getPageTitle(position); } } @Override public Object instantiateItem(ViewGroup container, int position) { Log.d(TAG, "instantiateItem " + position); DisplayFragment fragment = (DisplayFragment) super.instantiateItem( container, position); registeredFragments.put(position, fragment); return fragment; } @Override public void destroyItem(ViewGroup container, int position, Object object) { Log.d(TAG, "destroyItem " + position); registeredFragments.remove(position); super.destroyItem(container, position, object); } public Fragment getRegisteredFragment(int position) { return registeredFragments.get(position); } public SparseArray<DisplayFragment> getRegisteredFragments() { return registeredFragments; } }
[ "cyrixmorten@gmail.com" ]
cyrixmorten@gmail.com
a2e0030e1a3fd37230ab034081bc580af1c473f7
32d2154e57047b6c9ce73139c64d1ff97440d228
/src/main/java/org/launchcode/models/data/CategoryDao.java
4a158bb8dcf779da21100d5723859b969bc48bae
[]
no_license
eragonarya/cheese-mvc-persistent
423b5f145a43d8037a98cc19090f368c93a7f2d1
469822bd06a774472a30187eab114c431542ee82
refs/heads/master
2021-01-21T21:22:09.572963
2017-06-23T00:18:07
2017-06-23T00:18:07
94,827,875
0
0
null
2017-06-19T22:58:56
2017-06-19T22:58:56
null
UTF-8
Java
false
false
370
java
package org.launchcode.models.data; import org.launchcode.models.Category; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import javax.transaction.Transactional; /** * Created by Cody on 6/19/2017. */ @Repository @Transactional public interface CategoryDao extends CrudRepository<Category, Integer> { }
[ "krutilcody@yahoo.com" ]
krutilcody@yahoo.com
a3cc65675e2673efc9790e9623cbe878ea857ad7
3f83c341539e701fa91111e1c81340337178e27d
/incheck-project/trunk/modules/insite-server/src/main/java/com/inchecktech/dpm/network/parser/DamMessage.java
b0f7bca679a6dfa9a7e500be6b5e06ea3df5bfb5
[]
no_license
bkm71A/liechtenstein
ed79d360de1e414e0e9308d894a7a84a450d219b
854139a97a7ecca7b62367176d09c9f4b8de57c9
refs/heads/master
2021-01-20T22:10:21.491382
2016-08-02T12:32:28
2016-08-02T12:32:28
64,294,474
0
0
null
null
null
null
UTF-8
Java
false
false
850
java
package com.inchecktech.dpm.network.parser; import com.inchecktech.dpm.network.parser.JsonFieldNameConstants.DAM_MESSAGE_TYPE; public abstract class DamMessage { private int protocolVersion; private String deviceId; private long timeStamp; public int getProtocolVersion() { return protocolVersion; } public void setProtocolVersion(int protocolVersion) { this.protocolVersion = protocolVersion; } public String getDeviceId() { return deviceId; } public void setDeviceId(String deviceId) { this.deviceId = deviceId; } public long getTimeStamp() { return timeStamp; } public void setTimeStamp(long timeStamp) { this.timeStamp = timeStamp; } public abstract DAM_MESSAGE_TYPE getDamMessageType(); }
[ "bkm71@hotmail.com" ]
bkm71@hotmail.com
4d674d2bb45af6676dc3c3bc539d46300411323e
b490353fac0dc62d362beb4b80d5610e192b02a7
/rxmaterialdialogs/src/main/java/com/ivianuu/rxmaterialdialogs/Preconditions.java
30ac8c12d50ba43fc496a3a35ceeed9b8875f8c6
[]
no_license
IVIanuu/rx-material-dialogs
7c801cd9f7e50771eb18c966f2de9aef85074b5d
047333d76dc0406ced9c5ea32e40d090d28dea7d
refs/heads/master
2021-09-06T12:21:15.849903
2018-02-06T13:38:33
2018-02-06T13:38:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,079
java
/* * Copyright 2017 Manuel Wrage * * 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.ivianuu.rxmaterialdialogs; import android.support.annotation.NonNull; import android.support.annotation.Nullable; /** * Preconditions */ public final class Preconditions { private Preconditions() { // no instances } /** * Throws a npe if the object is null */ public static void checkNotNull(@Nullable Object o, @NonNull String message) { if (o == null) { throw new NullPointerException(message); } } }
[ "IVIanuu@gmail.com" ]
IVIanuu@gmail.com
046eca137cc6e9688c9cfc8d2f4e3cc1ddb4e8ee
ac7962b2dbe406167ca804348866a6dfe6f81bdc
/Java/Mixed/results/FIX/GhC5d29b63cfa98a15d7734798c5b29a43658d7f112_2.java
612e1fa261356a2d340b3ae5d0eb6c9b09db1af0
[]
no_license
viertel/SecurityCodeRepository
78de69eb481e888a8f188bd7e8a2e36a54bf025b
8f0973cca7d923d46d24b90152d2262eae51adf8
refs/heads/master
2022-11-17T00:00:15.246999
2020-07-04T12:22:48
2020-07-04T12:22:48
277,093,791
0
0
null
null
null
null
UTF-8
Java
false
false
2,196
java
class GhC5d29b63cfa98a15d7734798c5b29a43658d7f112_2{ public String rebootVM(final Connect conn, final String vmName) { Domain dm = null; String msg = null; try { dm = conn.domainLookupByName(vmName); // Get XML Dump including the secure information such as VNC password // By passing 1, or VIR_DOMAIN_XML_SECURE flag // https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainXMLFlags String vmDef = dm.getXMLDesc(1); final LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser(); parser.parseDomainXML(vmDef); for (final InterfaceDef nic : parser.getInterfaces()) { if (nic.getNetType() == GuestNetType.BRIDGE && nic.getBrName().startsWith("cloudVirBr")) { try { final int vnetId = Integer.parseInt(nic.getBrName().replaceFirst("cloudVirBr", "")); final String pifName = getPif(_guestBridgeName); final String newBrName = "br" + pifName + "-" + vnetId; vmDef = vmDef.replaceAll("'" + nic.getBrName() + "'", "'" + newBrName + "'"); s_logger.debug("VM bridge name is changed from " + nic.getBrName() + " to " + newBrName); } catch (final NumberFormatException e) { continue; } } } s_logger.debug(vmDef); msg = stopVM(conn, vmName); msg = startVM(conn, vmName, vmDef); return null; } catch (final LibvirtException e) { s_logger.warn("Failed to create vm", e); msg = e.getMessage(); } catch (final InternalErrorException e) { s_logger.warn("Failed to create vm", e); msg = e.getMessage(); } finally { try { if (dm != null) { dm.free(); } } catch (final LibvirtException e) { s_logger.trace("Ignoring libvirt error.", e); } } return msg; } }
[ "fabien.viertel@inf.uni-hannover.de" ]
fabien.viertel@inf.uni-hannover.de
9b05d15a454e53f32da1f60d41df0b53ffd8e70d
0d3d2bc67b018e1e8972f9dd39964a0078562c33
/src/main/java/com/mobilelive/holidayweb/Application.java
215a0137d3ab7948fcb1cbd462dc061c16ff5ab9
[]
no_license
syediqbal95/HolidayWeb
847a75df9d4cbf438e5a5b65c1294f82603d2b8f
67411ea3b1ac11398b7b8d65a1abc5aedf64ba4b
refs/heads/master
2021-01-01T18:53:39.425428
2017-07-26T20:08:28
2017-07-26T20:08:28
98,461,808
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package com.mobilelive.holidayweb; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /* * 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. */ /** * * @author syediqbal */ @SpringBootApplication public class Application { public static void main(String[] args){ SpringApplication.run(Application.class, args); } }
[ "syed.iqbal@mobilelive.ca" ]
syed.iqbal@mobilelive.ca
90abf74b9b9c2c3d8e8489ebfb55083b037d561e
d8674aed5b1b20236ee28154f87e7a713d9aa939
/src/Controller/Controller.java
6ca7c05d8eb9429bdefc5d0721a2ec9d09a65a6f
[]
no_license
WalterJuarez/Proyecto_2
accbc0a42321ed99be22503070375af0698b3211
64a60f86ac945dfb3e7943405b7d1d89665e2a04
refs/heads/master
2022-12-27T11:08:25.046141
2020-10-06T21:11:12
2020-10-06T21:11:12
295,783,704
0
0
null
null
null
null
UTF-8
Java
false
false
1,470
java
package Controller; import javafx.event.ActionEvent; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.control.TextField; import javafx.scene.control.PasswordField; import javafx.scene.layout.Pane; import javafx.stage.Stage; import javax.swing.*; public class Controller { public TextField txtUsuario; public PasswordField pwfPassword; public void ValidarUsuario(ActionEvent actionEvent) { try { if (txtUsuario.getText().equals("chis") && pwfPassword.getText().equals("1234")) { //JOptionPane.showMessageDialog(null, "Ingreso Correcto"); //Visualizar menu principal FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("../View/MenuPrincipal.fxml")); Pane root = (Pane) fxmlLoader.load(); //Estructura FX Scene scene = new Scene(root, 900, 800); Stage stage = new Stage(); stage.setTitle("Sistema de Ventas"); stage.setScene(scene); stage.show(); Stage stageLogin = (Stage)txtUsuario.getScene().getWindow(); stageLogin.close(); } else { JOptionPane.showMessageDialog(null, "Ingreso Invalido"); txtUsuario.setText(""); pwfPassword.setText(""); } } catch (Exception e) { e.printStackTrace(); } } }
[ "68527309+WalterJuarez@users.noreply.github.com" ]
68527309+WalterJuarez@users.noreply.github.com
efdeb0bb998cf240cb9ce2e1df2a823539bcf7bc
1ee5dde1646754ffe198def3bc184c104c1eb3ff
/analysis/emotion/code/src/TrainSurprise.java
4125fd2c8f138d6f8dc25b2cdf023303fe079551
[ "MIT" ]
permissive
xpendous/sandiego
2f72eb6ed53f938fed2bf8c3a007a41dea49c975
78b87481d2bae5c7454fbf79cee6cd83787d3bda
refs/heads/master
2020-06-11T03:30:05.926570
2016-03-21T05:04:31
2016-03-21T05:04:31
54,360,856
0
0
null
null
null
null
UTF-8
Java
false
false
4,078
java
import java.awt.List; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.json.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import com.google.gson.Gson; import com.opencsv.CSVReader; public class TrainSurprise{ String filename=""; private static String deleteCharAt(String strValue, int index) { return strValue.substring(0, index) + strValue.substring(index + 1); } public TrainSurprise(String f) { // TODO Auto-generated constructor stub filename=f; } public Classifier<String,String> ExecuteTraining(Classifier<String,String> bayes){ ArrayList<String> WordsSurprise = new ArrayList<String>(); ArrayList<String> TweetList = new ArrayList<String>(); ArrayList<String> Word = new ArrayList<String>(); ArrayList<Float> Weight = new ArrayList<Float>(); WordsSurprise.add("omg"); WordsSurprise.add("oh my go(d|sh)"); WordsSurprise.add("i (can'*t|cannot) believe"); WordsSurprise.add("=o"); WordsSurprise.add(":o"); BufferedReader rd = null; try { rd = new BufferedReader(new FileReader(new File(filename))); //CSVReader reader = new CSVReader(new FileReader(filename)); String req="\"\"text\"\":\"\"(.*?)\"\",\"\""; //JSONObject obj = null; String inputLine = null; Gson gson = new Gson(); while((inputLine = rd.readLine()) != null){ //obj = (JSONObject)parser.parse(inputLine); inputLine = deleteCharAt(inputLine,0); inputLine = deleteCharAt(inputLine, inputLine.length()-1); String patternString = req; Pattern pattern = Pattern.compile(patternString); Matcher matcher = pattern.matcher(inputLine); int entrou = 0; String tweet=""; while(matcher.find()){ entrou++; if(entrou==1){ tweet = matcher.group(0).substring(11); tweet = tweet.substring(0,tweet.length()-5); tweet = tweet.toLowerCase(); } } int entrou2=0; int count=0; Pattern p2 = Pattern.compile("[^\\s]+"); Matcher m2 = p2.matcher(tweet); for(int i =0; i<WordsSurprise.size();i++){ Pattern p = Pattern.compile(WordsSurprise.get(i)); Matcher m = p.matcher(tweet); while(m.find()){ //look if matches the Happy Statements entrou2++; } if(entrou2 ==1){ entrou2++; while(m2.find()){ count++; } } } Pattern p3 = Pattern.compile("[^\\s]+"); Matcher m3 = p2.matcher(tweet); if(count!=0){ String[] text = tweet.split("\\s"); bayes.learn("surprise",Arrays.asList(text)); int exist=0; for(int i=0;i<TweetList.size();i++){ if(TweetList.get(i).equals(tweet))exist=1; } if(exist==0){ TweetList.add(tweet); while(m3.find()){ //System.out.println(m3.group()); int exist2=0; for(int i=0;i<Word.size();i++) if(Word.get(i).equals(m3.group())){ exist2=1; Weight.set(i,Weight.get(i)+(float)1/count); } if(exist2==0){ Word.add(m3.group()); //System.out.println((float)1/count); Weight.add((float)1/count); } } } } //DataObject obj = gson.fromJson(inputLine, this.class); //System.out.println(inputLine); //System.out.println(obj); } FileWriter arq = new FileWriter("/home/lucas/Documents/WordsSurprise.txt"); PrintWriter gravarArq = new PrintWriter(arq); for(int i=0;i<Weight.size();i++){ //System.out.println(Word.size()); gravarArq.printf("%s %f\n",Word.get(i),Weight.get(i)); } arq.close(); return bayes; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } } }
[ "vidaspace@gmail.com" ]
vidaspace@gmail.com
a746c7691d8b275b953ca414b3de1e7c23fa2c31
84f2a4485e6feb19f7e868013ed841399311f876
/app/src/main/java/com/radenmas/peminjamanperalatan/user/FragAccountUser.java
e6b7c824ccc9b1a13cb5d9a89e87779869e1175b
[]
no_license
RadenMas6699/PeminjamanPeralatan
ba79f69f815d189a44dbfd5e79de6b170f67b4f6
d337c9d955902945e7c2525332e9ed0bd156a9b8
refs/heads/master
2023-05-31T17:15:36.814102
2021-06-17T13:13:45
2021-06-17T13:13:45
375,091,932
0
5
null
null
null
null
UTF-8
Java
false
false
10,696
java
package com.radenmas.peminjamanperalatan.user; import android.annotation.SuppressLint; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.Fragment; import android.os.Handler; import android.provider.MediaStore; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.android.material.button.MaterialButton; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; 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.Query; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.radenmas.peminjamanperalatan.About; import com.radenmas.peminjamanperalatan.CircleTransform; import com.radenmas.peminjamanperalatan.Login; import com.radenmas.peminjamanperalatan.R; import com.radenmas.peminjamanperalatan.admin.AdminDetailBioMhs; import com.squareup.picasso.Picasso; import java.io.IOException; import java.util.HashMap; import java.util.Map; public class FragAccountUser extends Fragment implements View.OnClickListener { private static final int RESULT_OK = -1; private ImageView img_user; private TextView name_user, nim_user, nim_user_desc, kelas_user_desc, kelompok_user_desc, email_user_desc, phone_user_desc, deleteAccount; private DatabaseReference reference; private Uri filePath; private String kelas; private String uid; private FirebaseUser user; public FragAccountUser() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.user_frag_account, container, false); img_user = view.findViewById(R.id.img_user); ImageView info_app = view.findViewById(R.id.info_app); ImageView change_profil = view.findViewById(R.id.change_profil); name_user = view.findViewById(R.id.name_user); nim_user = view.findViewById(R.id.status_user); deleteAccount = view.findViewById(R.id.deleteAccount); MaterialButton btn_logout = view.findViewById(R.id.btn_logout); nim_user_desc = view.findViewById(R.id.nim_user_desc); kelas_user_desc = view.findViewById(R.id.kelas_user_desc); kelompok_user_desc = view.findViewById(R.id.kelompok_user_desc); email_user_desc = view.findViewById(R.id.email_user_desc); phone_user_desc = view.findViewById(R.id.phone_user_desc); reference = FirebaseDatabase.getInstance().getReference(); user = FirebaseAuth.getInstance().getCurrentUser(); uid = user.getUid(); getDataUser(uid); info_app.setOnClickListener(this); btn_logout.setOnClickListener(this); change_profil.setOnClickListener(this); deleteAccount.setOnClickListener(this); return view; } private void getDataUser(String uid) { reference.child("User").child(uid).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { String user = (String) snapshot.child("name").getValue(); String nim = (String) snapshot.child("nim").getValue(); kelas = (String) snapshot.child("nama_kelas").getValue(); String kelompok = (String) snapshot.child("kelompok").getValue(); String email = (String) snapshot.child("email").getValue(); String phone = (String) snapshot.child("phone").getValue(); String img_profil = (String) snapshot.child("img_profil").getValue(); Picasso.get().load(img_profil).error(R.drawable.ic_user_circle_black).transform(new CircleTransform()).into(img_user); name_user.setText(user); nim_user_desc.setText(nim); kelas_user_desc.setText(kelas); kelompok_user_desc.setText(kelompok); email_user_desc.setText(email); phone_user_desc.setText(phone); } @Override public void onCancelled(@NonNull DatabaseError error) { } }); } @SuppressLint("NonConstantResourceId") @Override public void onClick(View view) { switch (view.getId()) { case R.id.info_app: startActivity(new Intent(getContext(), About.class)); break; case R.id.change_profil: ChooseFoto(); break; case R.id.btn_logout: new AlertDialog.Builder(getActivity()) .setMessage("Apakah anda yakin untuk keluar?") .setPositiveButton("Ya", (dialogInterface, i) -> { logout(); deletePref(); moveLogin(); }) .setNegativeButton("Tidak", (dialogInterface, i) -> dialogInterface.dismiss()) .show(); break; case R.id.deleteAccount: new AlertDialog.Builder(getActivity()) .setMessage("Apakah anda yakin akan menghapus akun ?") .setPositiveButton("Ya", (dialogInterface, i) -> { DeleteAccount(); }) .setNegativeButton("Tidak", (dialogInterface, i) -> dialogInterface.dismiss()) .show(); break; } } private void DeleteAccount() { //delete account from firebase user.delete() .addOnCompleteListener(task -> { if (task.isSuccessful()) { Toast.makeText(getContext(), "Akun berhasil dihapus", Toast.LENGTH_SHORT).show(); logout(); deletePref(); //pindah activity new Handler().postDelayed(() -> { moveLogin(); //hapus storage profil FirebaseStorage.getInstance().getReference("User").child(uid).child(uid).delete(); //hapus realtime database user dikelas FirebaseDatabase.getInstance().getReference(kelas).child(uid).removeValue(); //hapus realtime database user FirebaseDatabase.getInstance().getReference("User").child(uid).removeValue(); }, 500); } }); } private void moveLogin() { //pindah activity startActivity(new Intent(getActivity(), Login.class)); getActivity().finish(); } private void deletePref() { //hapus data Shared Preference SharedPreferences myaccount = getActivity().getSharedPreferences("myAccount", Context.MODE_PRIVATE); SharedPreferences.Editor editor = myaccount.edit(); editor.clear(); editor.apply(); } private void logout() { //log out from firebase FirebaseAuth.getInstance().signOut(); } private void ChooseFoto() { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Pilih Gambar"), 71); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == 71 && resultCode == RESULT_OK && data != null && data.getData() != null) { filePath = data.getData(); UploadFoto(); } } private void UploadFoto() { StorageReference storageReference = FirebaseStorage.getInstance().getReference("User").child(uid); if (filePath != null) { final ProgressDialog progressDialog = new ProgressDialog(getContext()); progressDialog.setTitle("Uploading..."); progressDialog.show(); StorageReference ref = storageReference.child(uid); ref.putFile(filePath) .addOnSuccessListener(taskSnapshot -> { DatabaseReference dbUploadImg = FirebaseDatabase.getInstance().getReference("User").child(uid); DatabaseReference dbUploadKelas = FirebaseDatabase.getInstance().getReference(kelas).child(uid); progressDialog.dismiss(); ref.getDownloadUrl().addOnSuccessListener(uri -> { Map<String, Object> profilUser = new HashMap<>(); profilUser.put("img_profil", String.valueOf(uri)); dbUploadImg.updateChildren(profilUser); dbUploadKelas.updateChildren(profilUser); }); Toast.makeText(getActivity(), "Foto profil berhasil diubah", Toast.LENGTH_LONG).show(); }) .addOnFailureListener(e -> { progressDialog.dismiss(); Toast.makeText(getActivity(), "Failed " + e.getMessage(), Toast.LENGTH_SHORT).show(); }) .addOnProgressListener(taskSnapshot -> { double progress = (100.0 * taskSnapshot.getBytesTransferred() / taskSnapshot .getTotalByteCount()); progressDialog.setMessage("Uploaded " + (int) progress + "%"); }); } else { Toast.makeText(getActivity(), "Gambar belum dipilih", Toast.LENGTH_SHORT).show(); } } }
[ "75772604+radenmasdev@users.noreply.github.com" ]
75772604+radenmasdev@users.noreply.github.com
28beec72bad53eb76b980cd491361f2c092c123d
8ecf9fed02240dcf2f95172226727bf5c74ca1e8
/edu.buffalo.cse.greenest/src/edu/buffalo/cse/greenest/JavaModelListener.java
879f9f6d4590a3b2982421b7db328774688eb6e4
[]
no_license
wulibing/Green-UML-project
886b457019b565015093c7600a35e740e3bc2bcd
b0e7dab95a5f77dfb603dc499959c4802f66d6ea
refs/heads/master
2021-01-17T11:39:14.783939
2014-10-06T06:38:26
2014-10-06T06:38:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,385
java
package edu.buffalo.cse.greenest; import static org.eclipse.jdt.core.IJavaElementDelta.ADDED; import static org.eclipse.jdt.core.IJavaElementDelta.REMOVED; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.eclipse.jdt.core.ElementChangedEvent; import org.eclipse.jdt.core.IElementChangedListener; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaElementDelta; import org.eclipse.jdt.internal.core.CompilationUnit; import org.eclipse.jdt.internal.core.JavaProject; import org.eclipse.jdt.internal.core.PackageFragment; import org.eclipse.jdt.internal.core.SourceField; import org.eclipse.jdt.internal.core.SourceMethod; import org.eclipse.jdt.internal.core.SourceType; //import edu.buffalo.cse.green.CompilationUnitRefactorHandler; //import edu.buffalo.cse.green.FieldRefactorHandler; //import edu.buffalo.cse.green.JavaModelListener; //import edu.buffalo.cse.green.MethodRefactorHandler; //import edu.buffalo.cse.green.PackageRefactorHandler; //import edu.buffalo.cse.green.ProjectRefactorHandler; //import edu.buffalo.cse.green.RefactorHandler; //import edu.buffalo.cse.green.TypeRefactorHandler; //import edu.buffalo.cse.green.editor.model.RootModel; //import edu.buffalo.cse.green.GreenException; //import edu.buffalo.cse.green.TypeRefactorHandler; //import edu.buffalo.cse.green.editor.DiagramEditor; //import edu.buffalo.cse.green.editor.model.RootModel; public class JavaModelListener implements IElementChangedListener { private static JavaModelListener _listener = new JavaModelListener(); private static Map<Class, RefactorHandler> map; static { // // add the elements to consider changes for to a list map = new HashMap<Class, RefactorHandler>(); // map.put(JavaProject.class, ProjectRefactorHandler.instance()); // map.put(PackageFragment.class, PackageRefactorHandler.instance()); // map.put(CompilationUnit.class, // CompilationUnitRefactorHandler.instance()); // map.put(SourceType.class, TypeRefactorHandler.instance()); // map.put(SourceField.class, FieldRefactorHandler.instance()); // map.put(SourceMethod.class, MethodRefactorHandler.instance()); } public void elementChanged(ElementChangedEvent event) { try { /* Goes through these classes looking for any that are added, moved * or removed. Calls methods that updates the editor to reflect any * changes found. */ for (Class type : map.keySet()) { List<IJavaElementDelta> added = findAddedElements(event.getDelta(), type); List<IJavaElementDelta> removed = findRemovedElements(event.getDelta(), type); List<IJavaElementDelta> changed = findChangedElements(event.getDelta(), type); HashMap<IJavaElement, IJavaElement> moved = extractMovedElements(added, removed); // ignore updating the editors if no changes occurred if (added.size() == 0 && removed.size() == 0 && moved.size() == 0 && changed.size() == 0) { continue; } //We need to put in the list of editors we have once thats implemented. List<DiagramEditor> editors = new ArrayList<DiagramEditor>(DiagramEditor.getEditors()); // handle changes for (DiagramEditor editor : editors) { RootModel root = editor.getRootModel(); // handle moves for (IJavaElement sourceElement : moved.keySet()) { IJavaElement targetElement = moved.get(sourceElement); map.get(sourceElement.getClass()).handleMove( root, sourceElement, targetElement); } // handle removes for (IJavaElementDelta removedElement : removed) { map.get(removedElement.getElement().getClass()) .handleRemove(root, removedElement.getElement()); } // handle adds for (IJavaElementDelta addedElement : added) { map.get(addedElement.getElement().getClass()).handleAdd( root, addedElement.getElement()); } // handle changes (to modifiers, etc.) for (IJavaElementDelta changedElement : changed) { handleElementChange(changedElement); } editor.forceRefreshRelationships(); } } } catch (Throwable t) { //TODO Incremental exploration throws Null Pointer GreenException.critical(t); } finally { //TypeRefactorHandler.REMOVED_TYPE = null; } } private HashMap<IJavaElement, IJavaElement> extractMovedElements( List<IJavaElementDelta> added, List<IJavaElementDelta> removed) { // TODO Auto-generated method stub return null; } private void handleElementChange(IJavaElementDelta changedElement) { // This requres so many other classes that haven't been implemented. } private List<IJavaElementDelta> findChangedElements( IJavaElementDelta parentDelta, Class type) { IJavaElementDelta delta; List<IJavaElementDelta> changes = new ArrayList<IJavaElementDelta>(); // adds deltas representing the removed elements of // the specified type to the list of changes for (int i = 0; i < parentDelta.getChangedChildren().length; i++) { delta = parentDelta.getChangedChildren()[i]; if (type.isInstance(delta.getElement())) { if (delta.getChangedChildren().length == 0) { changes.add(delta); } } } // traverse all changed branches // this code shouldn't need altering for (int i = 0; i < parentDelta.getChangedChildren().length; i++) { delta = parentDelta.getChangedChildren()[i]; changes.addAll(findChangedElements(delta, type)); } return changes; // TODO Auto-generated method stub return null; } private List<IJavaElementDelta> findRemovedElements( IJavaElementDelta parentDelta, Class type) { List<IJavaElementDelta> changes = new ArrayList<IJavaElementDelta>(); // check for removed element if (parentDelta.getKind() == REMOVED) { if (type.isInstance(parentDelta.getElement())) { changes.add(parentDelta); } } // traverse all changed branches // this code shouldn't need altering for (IJavaElementDelta delta : parentDelta.getAffectedChildren()) { changes.addAll(findRemovedElements(delta, type)); } return changes; } @SuppressWarnings("unused") private List<IJavaElementDelta> findAddedElements( IJavaElementDelta parentDelta, Class type) { List<IJavaElementDelta> changes = new ArrayList<IJavaElementDelta>(); // check for added element if (parentDelta.getKind() == ADDED) { if (type.isInstance(parentDelta.getElement())) { changes.add(parentDelta); } } // traverse all changed branches // this code shouldn't need altering for (IJavaElementDelta delta : parentDelta.getAffectedChildren()) { changes.addAll(findAddedElements(delta, type)); } return changes; } //This requires RootModel interface RefactorHandler<E extends IJavaElement> { /** * Handles the addition of an <code>IJavaElement</code> to the workspace. * * @param root * @param element */ public void handleAdd(RootModel root, E element); /** * Handles movement of an <code>IJavaElement</code> within the workspace. * * @param root * @param sourceElement * @param targetElement */ public void handleMove(RootModel root, E sourceElement, E targetElement); /** * Handles the removal of an <code>IJavaElement</code> from the workspace. * * @param root * @param element */ public void handleRemove(RootModel root, E element); } }
[ "wulibing94@gmail.com" ]
wulibing94@gmail.com
2b815205503db209fa0efa2081972579b4b55880
9fb579252ee75773d6e28beafb58fb6496e49ed8
/spring-rest-demo/src/main/java/com/arbalax/springdemo/rest/DemoRestController.java
62b071f69c77d411036c0daf01d2b5b5a55447fd
[]
no_license
Arbalax/spring-hibernate_udemy-course
dfc0b417b5003fd3e0e2aa6828af8069189cfd30
9cf9bfcb23e23a087aa2b9d9baa7232a9313cf93
refs/heads/master
2023-05-03T09:43:02.851830
2021-05-27T20:29:11
2021-05-27T20:29:11
371,496,450
0
0
null
null
null
null
UTF-8
Java
false
false
397
java
package com.arbalax.springdemo.rest; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/test") public class DemoRestController { @GetMapping("/hello") public String sayHello() { return "Hello world!"; } }
[ "maus393939@gmail.com" ]
maus393939@gmail.com
efd017bd3a7d2b3fbf7e31a5cb7ac38df5d51695
20e85bfed8ff3ad271473c05a386b4233831a9a2
/transit-app/src/main/java/com/win/transitapp/Model/Geometry.java
8dd17ecdb99c1ff86cae303ca59ec125ecac7235
[]
no_license
AabhaKhandwala/Spring-Boot-Marta-Project
17932687e856797eae9e50cc0819309c4235a534
f51384490de9f25c4394f5bdc9cb64cfbf8d78a4
refs/heads/master
2022-11-27T09:36:57.424779
2020-08-05T04:02:50
2020-08-05T04:02:50
285,031,088
0
0
null
null
null
null
UTF-8
Java
false
false
90
java
package com.win.transitapp.Model; public class Geometry { public Location location; }
[ "aabha.khandwala@gmail.com" ]
aabha.khandwala@gmail.com
c76ad30c962f589674e2bc018107ece476fb3198
e8b63e52387ee1d74506c0cab3481050f26f56f9
/src/main/java/transmitter/view/RealTimeTransmitter.java
99de5b3ec862db38b9653e107b168835e3c4d232
[ "MIT" ]
permissive
budougumi0617/DesignPatternJava
b7f9f2dcfedbeca54ff023c44efcf92d97c80a0d
4fb22589d6151993619e0d154fecf66877e6b569
refs/heads/master
2020-09-21T04:45:16.091283
2016-11-04T09:34:22
2016-11-04T09:34:22
66,760,009
0
0
null
2016-11-04T09:34:22
2016-08-28T09:24:59
Java
UTF-8
Java
false
false
1,601
java
/** * @file 2016/10/13 */ package transmitter.view; import javax.swing.JButton; import javax.swing.JFrame; /** * シリアルデータリアルタイム送信GUIを生成するクラス * * @author ema195y * */ public class RealTimeTransmitter extends JFrame implements Transmitter { private JButton applyButton = new JButton("適用"); // 適用ボタン /** * コンストラクタ */ public RealTimeTransmitter() { setTitle("Arduinoシリアルデータ送信アプリ"); setBounds(100, 100, 586, 287); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.initMember(); } /** * コンポーネント初期設定 * */ private void initMember() { getContentPane().setLayout(null); textField.setBounds(12, 171, 546, 20); getContentPane().add(textField); textField.setColumns(16); applyButton.setBounds(411, 111, 91, 21); getContentPane().add(applyButton); panelComPort.setBounds(12, 32, 250, 60); getContentPane().add(panelComPort); panelBaudRate.setBounds(274, 32, 280, 60); getContentPane().add(panelBaudRate); // 適用ボタンアクション /* * applyButton.addActionListener(new ActionListener() { public void * actionPerformed(ActionEvent e) { * action.applyButtonAction(panelComPort.getContent(),panelBaudRate. * getContent()); } }); * */ // ボタンアクション /* * addDocumentListener(new ActionListener() { public void * actionPerformed(ActionEvent e) { * action.sendButtonAction(panelComPort.getContent(), * panelBaudRate.getContent(),textField.getText()); } }); * */ } }
[ "yuka.yoshikawa@jrits.ricoh.co.jp" ]
yuka.yoshikawa@jrits.ricoh.co.jp
fbbb503dcece3c6c14d1c4f2c2729f386896a587
fb6506bf65f3cefe75a4f0f8e99162b495f78eae
/src/tekrarlarDigerKaynaklar/ArrayElemanVererekOlusturma.java
34f94a00818845840b5684b8b26368ee387f5d6a
[]
no_license
iskendernuori/SuleymanHocaJava
b63e487b0188a53afd59899495d4a727f8fd80ff
eb9d32ac141bf46aafa3db5289665b309af5bc9a
refs/heads/master
2022-11-11T11:30:57.165102
2020-07-08T00:05:03
2020-07-08T00:05:03
277,947,947
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
package tekrarlarDigerKaynaklar; import java.util.Scanner; public class ArrayElemanVererekOlusturma { public static void main(String[] args) { // 0 1 2 3 4 5 6 Scanner scan= new Scanner(System.in); int gun; System.out.println("Bir gun giriniz :"); gun =scan.nextInt(); String [] gunler = {"Pazartesi","Salı", "Carsamba","Persembe","Cuma","Cumartesi", "Pazar"}; if(gun>=0 && gun<7) { System.out.println(gunler[gun-1]);// neden -1 dedik. cunku index 0 dan başlıyor }else { System.out.println("Girdiğiniz gun doğru degil"); } // System.out.println(gunler[3]); // // gunler[3]= "Nisan "; // 3. indexi degiştirdik // System.out.println(gunler[3]); //for(int i=0; i<7;i++) { // // System.out.println(gunler[i]); //} scan.close(); } }
[ "isknuori@gmail.com" ]
isknuori@gmail.com
55f3d458ee8fcff0563036c37365cdeac301c553
2bdc1755eea29fdd18f205d9886f4e39e099ab87
/java-8-lambda/src/com/dev/app/supplier/SupplierClass4.java
09435cc1319aa67332c749050e4a6e84d599a8f5
[ "Apache-2.0" ]
permissive
frsknalexis/java-8-programacion-funcional
bc0d4c55c6d58e261bcc85f01563fadfaa9da959
080cf5ed447a436a9fb79243876eb1d2577c560a
refs/heads/master
2022-05-21T15:27:13.156677
2020-04-24T19:04:09
2020-04-24T19:04:09
255,808,864
0
0
Apache-2.0
2020-04-24T19:04:10
2020-04-15T04:55:15
null
UTF-8
Java
false
false
983
java
package com.dev.app.supplier; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Supplier; public class SupplierClass4 { public static void main(String[] args) { Supplier<String> simpleString = () -> "Hello Basic Supplier"; System.out.println(simpleString.get()); Map<Integer, String> personaMap = new HashMap<Integer, String>(); personaMap.put(19, "Isha"); personaMap.put(43, "Guarangee"); personaMap.put(4, "Yashika"); Supplier<Map<Integer, String>> supplierMap = () -> personaMap; printValue(supplierMap); List<String> studentsNames = new ArrayList<String>(); studentsNames.add("Yogi"); studentsNames.add("Yash"); studentsNames.add("Yashika"); studentsNames.add("Pulkit"); studentsNames.stream() .forEach((s) -> { printValue(() -> s); }); } static <T> void printValue(Supplier<T> supplier) { System.out.println(supplier.get()); } }
[ "alexisgutierrezf.1997@gmail.com" ]
alexisgutierrezf.1997@gmail.com
b7919dc7249c68bcf7a3fd580953fe5d96d31fb2
658d4031108d77a5da697e6a5dbc54190ee693cf
/zircon.jvm.swing/src/test/java/org/codetome/zircon/examples/GraphicTilesetExample.java
48b3374a60a0147a5d96e89bb253bc736e81085a
[ "MIT" ]
permissive
mdr0id/zircon
5bce5be307678551282c575f49f1ac77cb43e7ba
58cade5b8ecb2663d6880d3220db70f6e7bb6f91
refs/heads/master
2020-03-24T05:44:52.734056
2018-07-26T20:13:32
2018-07-26T20:13:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,956
java
package org.codetome.zircon.examples; import org.codetome.zircon.TerminalUtils; import org.codetome.zircon.api.Size; import org.codetome.zircon.api.interop.Positions; import org.codetome.zircon.api.interop.Sizes; import org.codetome.zircon.api.interop.TextCharacters; import org.codetome.zircon.api.resource.GraphicTilesetResource; import org.codetome.zircon.api.terminal.Terminal; import org.codetome.zircon.internal.font.impl.PickRandomMetaStrategy; import java.util.Random; public class GraphicTilesetExample { private static final int TERMINAL_WIDTH = 50; private static final int TERMINAL_HEIGHT = 24; private static final Size SIZE = Sizes.create(TERMINAL_WIDTH, TERMINAL_HEIGHT); private static final PickRandomMetaStrategy RANDOM_STRATEGY = new PickRandomMetaStrategy(); private static final GraphicTilesetResource FONT = GraphicTilesetResource.NETHACK_16X16; private static final char[] CHARS = new char[]{'a', 'b', 'c'}; private static final Random RANDOM = new Random(); public static void main(String[] args) { // for this example we only need a default terminal (no extra config) final Terminal terminal = TerminalUtils.fetchTerminalBuilder(args) .font(FONT.toFont(RANDOM_STRATEGY)) .initialTerminalSize(SIZE) .build(); terminal.setCursorVisibility(false); // we don't want the cursor right now for (int row = 0; row < TERMINAL_HEIGHT; row++) { for (int col = 0; col < TERMINAL_WIDTH; col++) { final char c = CHARS[RANDOM.nextInt(CHARS.length)]; terminal.setCharacterAt(Positions.create(col, row), TextCharacters.newBuilder() .character(c) .tags(RANDOM_STRATEGY.pickMetadata(terminal.getCurrentFont().fetchMetadataForChar(c)).getTags()) .build()); } } terminal.flush(); } }
[ "arold.adam@gmail.com" ]
arold.adam@gmail.com
483213ca55d9eb3041fe2a1a1aebbe22017f8e49
360aa5f842aff3e19ac2c4e1300872f3adcc5d54
/src/AllCinemaController.java
371a6e9a356da78583dbc685748af76aed7a1563
[]
no_license
SimoneStura/screenings
fdeeeffec509a21fc705386af1180a53788b8a0b
96b290bf20fee3780f59482d2bbf4a9a647ffd41
refs/heads/master
2020-03-23T02:06:32.620535
2018-08-14T23:36:11
2018-08-14T23:36:11
140,956,371
0
0
null
null
null
null
UTF-8
Java
false
false
3,704
java
import java.io.IOException; import java.util.*; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.*; import javafx.scene.control.*; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.stage.*; public class AllCinemaController { private FilmFestival ff; private List<Cinema> cinemaList; private static final int buttonsInARow = 3; @FXML private Label explainLabel; @FXML private GridPane distanceGrid; @FXML private VBox cinemaBox; private Button cinemaModify[]; public AllCinemaController(FilmFestival ff) { this.ff = ff; cinemaList = ff.getCinemas(); } private void initGrids() { if(cinemaList.size() == 0) { explainLabel.setVisible(false); return; } if(cinemaList.size() > 3) { ((Stage) explainLabel.getScene().getWindow()).setWidth(600); ((Stage) explainLabel.getScene().getWindow()).setHeight(450); } if(cinemaList.size() > 9) { ((Stage) explainLabel.getScene().getWindow()).setWidth(800); ((Stage) explainLabel.getScene().getWindow()).setHeight(600); } cinemaModify = new Button[cinemaList.size()]; for(int i = 0; i < cinemaList.size(); i++) { Cinema c = cinemaList.get(i); addCinemaButton(i, c); if(i > 0 || cinemaList.size() > 1) addGridRow(i, c); } } private void addCinemaButton(int index, Cinema c) { HBox hb = new HBox(20); if(index % buttonsInARow == 0) { hb.setAlignment(Pos.CENTER); cinemaBox.getChildren().add(hb); } else hb = (HBox) cinemaBox.getChildren().get(cinemaBox.getChildren().size() - 1); cinemaModify[index] = new Button(c.getName()); cinemaModify[index].setMinWidth(70.); hb.getChildren().add(cinemaModify[index]); } private void addGridRow(int rowIndex, Cinema c) { if(rowIndex == 0) { distanceGrid.add(new HBox(), rowIndex, 0); int columnIndex = 1; for(Cinema other : cinemaList.subList(1, cinemaList.size())) { HBox hb = new HBox(new Label(other.getName())); hb.setAlignment(Pos.CENTER); distanceGrid.add(hb, rowIndex, columnIndex++); } } if(rowIndex == cinemaList.size() - 1) return; HBox firstColumn = new HBox(new Label(c.getName())); firstColumn.setAlignment(Pos.CENTER); distanceGrid.add(firstColumn, rowIndex+1, 0); int columnIndex = 1; for(Cinema other : cinemaList.subList(1, cinemaList.size())) { HBox hb = new HBox(new Label(Integer.toString(c.getDistance(other)))); hb.setAlignment(Pos.CENTER); hb.setPadding(new Insets(5.0)); distanceGrid.add(hb, rowIndex+1, columnIndex++); } } @FXML private void handleCancel() { System.out.println("AllCinema->Cancel"); ((Stage) explainLabel.getScene().getWindow()).close(); } @FXML private void handleAddCinema() { System.out.println("AllCinema->AddCinema"); AddCinemaController.display("Nuovo Cinema", ff); AllCinemaController.display(ff); ((Stage) explainLabel.getScene().getWindow()).close(); } public static void display(FilmFestival ff) { AllCinemaController controller = new AllCinemaController(ff); try { FXMLLoader loader = new FXMLLoader(controller.getClass().getResource("AllCinemaView.fxml")); loader.setController(controller); Stage window = new Stage(); window.setScene(new Scene(loader.load())); window.initModality(Modality.APPLICATION_MODAL); window.setTitle("Cinema del Film Festival"); window.setOnCloseRequest((WindowEvent event) -> {controller.handleCancel();}); controller.initGrids(); window.show(); } catch(IOException e) {e.printStackTrace();} } }
[ "simone23.stura@gmail.com" ]
simone23.stura@gmail.com
7c875f041efbf89eca53c07da99d4aea7112b828
f5630ded174f2a01d84228a93213068ad9800142
/list-demo/src/main/java/com/spi/RegexTest.java
295f7d079415fff19c2000dbaaf9c45a34ca3e6b
[]
no_license
thebigdipperbdx/SpringBootList
0e20709f73e3226e6e4b5a46df482fb711524691
4b51d81e0355e433ffba78bf99b8bcbfbe7db3bf
refs/heads/master
2022-07-07T14:31:45.496960
2020-06-04T02:44:17
2020-06-04T02:44:17
206,746,443
0
0
null
2022-06-17T02:36:27
2019-09-06T08:13:29
Java
UTF-8
Java
false
false
586
java
package com.spi; import com.alibaba.fastjson.JSON; /** * @author yanyugang * @description 正则表达式校验 * @date 2019-10-31 13:34 */ public class RegexTest { public static void main(String[] args) { String str = "{\"age\":\"12\"}"; MyDto parse = (MyDto) JSON.parseObject(str, MyDto.class); System.out.println(parse.getAge()); //测试 Java 正则表达式 String regex = "^(33).*|(37).*|(773).*"; String billNo = "3300000000000"; boolean flag = billNo.matches(regex); System.out.println(flag); } }
[ "thebigdipperbdx@126.com" ]
thebigdipperbdx@126.com
c99344d22938daa96fe1d14342e42711e4815245
3c1deb7b3b4f4cc1ef2aa81c81db0b0826cc48e8
/spring/demo_login/src/main/java/com/example/demo_login/utils/CookieUtils.java
f0058f023121dea9d762a979cbee74bc28f2f396
[]
no_license
shinchan79/ljava1909
68acf3b08a302257800202dfdc61744e7657539d
0c5aaf0f4f75c1463a379daa430008045809cd08
refs/heads/master
2022-11-19T02:48:54.854864
2020-07-09T13:06:15
2020-07-09T13:06:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,904
java
package com.example.demo_login.utils; import org.springframework.util.SerializationUtils; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Base64; import java.util.Optional; public class CookieUtils { public static Optional<Cookie> getCookie(HttpServletRequest request, String name) { Cookie[] cookies = request.getCookies(); if (cookies != null && cookies.length > 0) { for (Cookie cookie : cookies) { if (cookie.getName().equals(name)) { return Optional.of(cookie); } } } return Optional.empty(); } public static void addCookie(HttpServletResponse response, String name, String value, int maxAge) { Cookie cookie = new Cookie(name, value); cookie.setPath("/"); cookie.setHttpOnly(true); cookie.setMaxAge(maxAge); response.addCookie(cookie); } public static void deleteCookie(HttpServletRequest request, HttpServletResponse response, String name) { Cookie[] cookies = request.getCookies(); if (cookies != null && cookies.length > 0) { for (Cookie cookie: cookies) { if (cookie.getName().equals(name)) { cookie.setValue(""); cookie.setPath("/"); cookie.setMaxAge(0); response.addCookie(cookie); } } } } public static String serialize(Object object) { return Base64.getUrlEncoder() .encodeToString(SerializationUtils.serialize(object)); } public static <T> T deserialize(Cookie cookie, Class<T> cls) { return cls.cast(SerializationUtils.deserialize( Base64.getUrlDecoder().decode(cookie.getValue()))); } }
[ "hoanghiep8921@gmail.com" ]
hoanghiep8921@gmail.com
6e67fdf86fd63b51fa9222ab3bbd3bb9cd89e9b9
c3a08dfaa78605eccd99652673fe95316a839773
/a4/src/PostingTreeTest.java
a086e38acbd1c8e10911b120f24beb1b35c76d51
[]
no_license
maspin22/JavaObjectOriented
ee8ac7ca0986c126baaa4e1f6715bfda23462cc8
9bdd8e210bb3958f119c05d39c337562281aff38
refs/heads/master
2022-11-12T19:05:00.204652
2020-07-05T19:41:19
2020-07-05T19:41:19
277,370,418
0
0
null
null
null
null
UTF-8
Java
false
false
12,418
java
import static org.junit.Assert.*; import static common.JUnitUtil.*; import java.util.Arrays; import java.util.List; import java.util.function.Function; import org.junit.BeforeClass; import org.junit.Test; public class PostingTreeTest { private static Network n; private static Person[] people; private static Person personA; private static Person personB; private static Person personC; private static Person personD; private static Person personE; private static Person personF; private static Person personG; private static Person personH; private static Person personI; private static Person personJ; private static Person personK; private static Person personL; @BeforeClass public static void setup() { n= new Network(); people= new Person[]{new Person("A", n, 0), new Person("B", n, 0), new Person("C", n, 0), new Person("D", n, 0), new Person("E", n, 0), new Person("F", n, 0), new Person("G", n, 0), new Person("H", n, 0), new Person("I", n, 0), new Person("J", n, 0), new Person("K", n, 0), new Person("L", n, 0) }; personA= people[0]; personB= people[1]; personC= people[2]; personD= people[3]; personE= people[4]; personF= people[5]; personG= people[6]; personH= people[7]; personI= people[8]; personJ= people[9]; personK= people[10]; personL= people[11]; } @Test public void testBuiltInGetters() { PostingTree st= new PostingTree(personB); assertEquals("B", toStringBrief(st)); } /** Create a PostingTree with structure A[B[D E F[G[H[I]]]] C] * Doesn't rely on method add(..) of PostingTree. */ private PostingTree makeTree1() { PostingTree dt = new PostingTree(personA); // A dt.insert(personB, personA); // A, B dt.insert(personC, personA); // A, C dt.insert(personD, personB); // B, D dt.insert(personE, personB); // B, E dt.insert(personF, personB); // B, F dt.insert(personG, personF); // F, G dt.insert(personH, personG); // G, H dt.insert(personI, personH); // H, I return new PostingTree(dt); } @Test public void testMakeTree1() { PostingTree dt= makeTree1(); assertEquals("A[B[D E F[G[H[I]]]] C]", toStringBrief(dt)); } @Test public void testgetSharedAncestor() { PostingTree st= makeTree1(); // A.testSharedAncestorOf(A, A) is A assertEquals(personA, st.getSharedAncestor(personA, personA)); // A.testSharedAncestorOf(A, B) is B assertEquals(personA, st.getSharedAncestor(personA, personB)); // A.testSharedAncestorOf(E, B) is E assertEquals(personE, st.getSharedAncestor(personE, personE)); // A.testSharedAncestorOf(D, I) is B assertEquals(personB, st.getSharedAncestor(personD, personI)); // A.testSharedAncestorOf(I, D) is B assertEquals(personB, st.getSharedAncestor(personI, personD)); } @Test public void test1Insert() { PostingTree st= new PostingTree(personB); //Test add to root PostingTree dt2= st.insert(personC, personB); assertEquals("B[C]", toStringBrief(st)); // test tree assertEquals(people[2], dt2.getRoot()); // test return value //Test add to non-root PostingTree dt3= st.insert(personD, personC); assertEquals("B[C[D]]", toStringBrief(st)); // test tree assertEquals(people[3], dt3.getRoot()); // test return value //Test add second child PostingTree dt0= st.insert(personA, personC); assertEquals("B[C[A D]]", toStringBrief(st)); // test tree assertEquals(personA, dt0.getRoot()); // test return value //Test add child to child's child PostingTree dt6= st.insert(personG, personA); assertEquals("B[C[A[G] D]]", toStringBrief(st)); // test tree assertEquals(personG, dt6.getRoot()); // test return value assertEquals(null, st.getPostingRoute(personH)); assertEquals(null, st.getSharedAncestor(personD, personH)); //assertEquals(null, st.getSharedAncestor(personD, null)); //Test add to child's tree PostingTree dt7= st.insert(personH, personG); assertEquals("B[C[A[G[H]] D]]", toStringBrief(st)); // test tree assertEquals(people[7], dt7.getRoot()); // test return value assertEquals(4, st.depth(personH)); assertEquals(1, st.widthAtDepth(4)); assertEquals("[B, C, A, G, H]", getNames(st.getPostingRoute(personH))); } @Test public void test2Size() { PostingTree st= new PostingTree(personB); PostingTree dt2= st.insert(personC, personB); assertEquals(2, st.size()); } @Test public void test3Depth() { PostingTree st= new PostingTree(personB); PostingTree dt2= st.insert(personC, personB); assertEquals(1, st.depth(personC)); } @Test public void test4WidthAtDepth() { PostingTree st= new PostingTree(personB); PostingTree dt2= st.insert(personC, personB); assertEquals(1, st.widthAtDepth(1)); } @Test public void test5getPostingRoute() { PostingTree st= new PostingTree(personB); PostingTree dt2= st.insert(personC, personB); List route= st.getPostingRoute(personC); assertEquals("[B, C]", getNames(route)); //Test add to non-root PostingTree dt3= st.insert(personD, personC); assertEquals("B[C[D]]", toStringBrief(st)); // test tree assertEquals(people[3], dt3.getRoot()); // test return value //Test add second child PostingTree dt0= st.insert(personA, personC); assertEquals("B[C[A D]]", toStringBrief(st)); // test tree assertEquals(personA, dt0.getRoot()); // test return value //Test add child to child's child PostingTree dt6= st.insert(personG, personA); assertEquals("B[C[A[G] D]]", toStringBrief(st)); // test tree assertEquals(personG, dt6.getRoot()); // test return value assertEquals(null, st.getPostingRoute(personH)); assertEquals(null, st.getSharedAncestor(personD, personH)); //assertEquals(null, st.getSharedAncestor(personD, null)); //Test add to child's tree PostingTree dt7= st.insert(personH, personG); assertEquals("B[C[A[G[H]] D]]", toStringBrief(st)); // test tree assertEquals(people[7], dt7.getRoot()); // test return value assertEquals(4, st.depth(personH)); assertEquals(1, st.widthAtDepth(4)); assertEquals("[B, C, A, G, H]", getNames(st.getPostingRoute(personH))); } /** Return the names of Persons in sp, separated by ", " and delimited by [ ]. * Precondition: No name is the empty string. */ private String getNames(List<Person> sp) { String res= "["; for (Person p : sp) { if (res.length() > 1) res= res + ", "; res= res + p.getName(); } return res + "]"; } @Test public void test6getSharedAncestor() { PostingTree st= new PostingTree(personB); PostingTree dt2= st.insert(personC, personB); Person p= st.getSharedAncestor(personC, personC); assertEquals(personC, p); //Test add to non-root PostingTree dt3= st.insert(personD, personC); assertEquals("B[C[D]]", toStringBrief(st)); // test tree assertEquals(people[3], dt3.getRoot()); // test return value //Test add second child PostingTree dt0= st.insert(personA, personC); assertEquals("B[C[A D]]", toStringBrief(st)); // test tree assertEquals(personA, dt0.getRoot()); // test return value //Test add child to child's child PostingTree dt6= st.insert(personG, personA); assertEquals("B[C[A[G] D]]", toStringBrief(st)); // test tree assertEquals(personG, dt6.getRoot()); // test return value assertEquals(null, st.getPostingRoute(personH)); assertEquals(null, st.getSharedAncestor(personD, personH)); //assertEquals(null, st.getSharedAncestor(personD, null)); //Test add to child's tree PostingTree dt7= st.insert(personH, personG); assertEquals("B[C[A[G[H]] D]]", toStringBrief(st)); // test tree assertEquals(people[7], dt7.getRoot()); // test return value assertEquals(4, st.depth(personH)); assertEquals(1, st.widthAtDepth(4)); assertEquals("[B, C, A, G, H]", getNames(st.getPostingRoute(personH))); } @Test public void test7equals() { PostingTree st= new PostingTree(personB); PostingTree zt= new PostingTree(personB); assertEquals(true, st.equals(zt)); //Test add to root st.insert(personC, personB); zt.insert(personC, personB); //Test add to non-root st.insert(personD, personC); zt.insert(personA, personC); //Test add second child st.insert(personA, personC); zt.insert(personD, personC); //Test add child to child's child st.insert(personG, personA); zt.insert(personG, personA); assertEquals("B[C[A[G] D]]", toStringBrief(st)); // test tree assertEquals("B[C[A[G] D]]", toStringBrief(zt)); /* System.out.println(st); System.out.println(zt);*/ assertEquals(true, st.equals(zt)); //Test add to child's tree st.insert(personH, personG); assertEquals("B[C[A[G[H]] D]]", toStringBrief(st)); // test tree assertEquals(false, st.equals(zt)); zt.insert(personH, personG); assertEquals(true, st.equals(zt)); zt.insert(personK, personC); assertEquals(false, st.equals(zt)); assertEquals(false, st.equals(null)); assertEquals(false, st.equals(new PostingTree(personL))); } /** Return a representation of this tree. This representation is: * (1) the name of the Person at the root, followed by * (2) the representations of the children (in alphabetical * order of the children's names). * There are two cases concerning the children. * * No children? Their representation is the empty string. * Children? Their representation is the representation of each child, with * a blank between adjacent ones and delimited by "[" and "]". * Examples: * One-node tree: "A" * root A with children B, C, D: "A[B C D]" * root A with children B, C, D and B has a child F: "A[B[F] C D]" */ public static String toStringBrief(PostingTree t) { String res= t.getRoot().getName(); Object[] childs= t.getChildren().toArray(); if (childs.length == 0) return res; res= res + "["; selectionSort1(childs); for (int k= 0; k < childs.length; k= k+1) { if (k > 0) res= res + " "; res= res + toStringBrief(((PostingTree)childs[k])); } return res + "]"; } /** Sort b --put its elements in ascending order. * Sort on the name of the Person at the root of each SharingTree * Throw a cast-class exception if b's elements are not SharingTrees */ public static void selectionSort1(Object[] b) { int j= 0; // {inv P: b[0..j-1] is sorted and b[0..j-1] <= b[j..]} // 0---------------j--------------- b.length // inv : b | sorted, <= | >= | // -------------------------------- while (j != b.length) { // Put into p the index of smallest element in b[j..] int p= j; for (int i= j+1; i != b.length; i++) { String bi= ((PostingTree)b[i]).getRoot().getName(); String bp= ((PostingTree)b[p]).getRoot().getName(); if (bi.compareTo(bp) < 0) { p= i; } } // Swap b[j] and b[p] Object t= b[j]; b[j]= b[p]; b[p]= t; j= j+1; } } }
[ "mia27@cornell.edu" ]
mia27@cornell.edu
715e04a14737e43ba0dc4e817cd806636fad713b
5183c9e8060ef77f8c01f683474ddae381d0a86f
/Ch12Ex08/Student.java
baddcfbdbd301347932fb125e1ba7785b9240dd8
[]
no_license
mgkaiser/java
7d4fdf6f0fae62380c41074a89e2330f9fadbabf
d2c40e853c6493a7435e5ffa776b55b5c3f802df
refs/heads/master
2020-08-02T20:27:52.891116
2019-10-11T01:52:00
2019-10-11T01:52:00
211,497,385
0
0
null
null
null
null
UTF-8
Java
false
false
495
java
// Author: Michael Kaiser // Class: COM-209-OL01 public class Student { private String _studentId; private double _score; public Student(String studentId) { _studentId = studentId; } public String getStudentId() { return _studentId; } public double getScore() { return _score; } public void setScore(double value) throws ScoreException { if (value >=0 && value <=100) { _score = value; } else { _score = 0; throw new ScoreException(); } } }
[ "mkaiser@incomm.com" ]
mkaiser@incomm.com
5623102bdec1c4e219fb9cbcffe70ffe3e3630b5
d7c65b653172039f8972e6faceb34c9538541b62
/app/src/main/java/com/example/android/placesearch/model/Geometry.java
86f66188016f02a0badd320b14dc4eb614b63c27
[]
no_license
bharathpsd/PlaceSearch
eadce8408d390dcf6a72b4e409c0d5307773b6b0
8320bf1f0808dd11c7adebeac97db036f981ef14
refs/heads/master
2020-03-11T12:13:30.770951
2018-05-02T20:32:13
2018-05-02T20:32:13
129,991,351
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
package com.example.android.placesearch.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Geometry { @SerializedName("location") @Expose private Location location; public Location getLocation() { return this.location; } public void setLocation(Location location) { this.location = location; } }
[ "bharathpsd@users.noreply.github.com" ]
bharathpsd@users.noreply.github.com
fdfae795cf0ca6fa8a8bd1aa43845ca78ef07574
2281fcc7a68309d1d10bdb2684887ac060e4440f
/binding/xml/src/main/java/pt/com/broker/codec/xml/soap/SoapHeader.java
29de21a1ab3dbf0c0716b3b742c5969c99b4504d
[]
no_license
danifbento/sapo-broker
aef315d9f7ae579ac349fce9481113b896b0b04b
4becd08403d77196b4d80d139b54f5ae0d44988a
refs/heads/master
2020-12-11T04:01:28.048370
2015-04-22T16:01:04
2015-04-22T16:01:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,077
java
package pt.com.broker.codec.xml.soap; import pt.com.broker.codec.xml.EndPointReference; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; public class SoapHeader { // wsa* -> ws-addressing fields; @XmlElement(name = "MessageID" , namespace = "http://www.w3.org/2005/08/addressing") public String wsaMessageID; @XmlElement(name = "RelatesTo" , namespace = "http://www.w3.org/2005/08/addressing") public String wsaRelatesTo; @XmlElement(name = "To" , namespace = "http://www.w3.org/2005/08/addressing") public String wsaTo; @XmlElement(name = "Action" , namespace = "http://www.w3.org/2005/08/addressing") public String wsaAction; @XmlElement(name = "From" , namespace = "http://www.w3.org/2005/08/addressing") public EndPointReference wsaFrom; @XmlElement(name = "ReplyTo" , namespace = "http://www.w3.org/2005/08/addressing") public EndPointReference wsaReplyTo; @XmlElement(name = "FaultTo" , namespace = "http://www.w3.org/2005/08/addressing") public EndPointReference wsaFaultTo; }
[ "luis.santos@telecom.pt" ]
luis.santos@telecom.pt
1046614b1ee7ec2da7cd58d7872f8fd24e7ac96b
026e5b9931189c054bc71b0e1f6b47d2e9898c45
/app/src/main/java/oz/veriparkapp/Utils/UITools.java
04978a650e5c3bb988c14d567e344a1ced883dd4
[]
no_license
024N/veripark
95194bc57e706a706379190c69c637143bcfb1fa
28043ed2ad3164f9602931b0ff295504e3ab4705
refs/heads/master
2020-11-26T00:14:55.721083
2019-12-18T18:49:20
2019-12-18T18:49:20
228,902,033
0
0
null
null
null
null
UTF-8
Java
false
false
653
java
package oz.veriparkapp.Utils; import android.support.annotation.Nullable; import org.greenrobot.eventbus.EventBus; public class UITools { public static void startProgressDialog(@Nullable final String message) { EventBus.getDefault().postSticky(new ProgressDialogEvent(ProgressDialogEvent.EventType.START, message)); } public static void startProgressDialog() { EventBus.getDefault().postSticky(new ProgressDialogEvent(ProgressDialogEvent.EventType.START)); } public static void closeProgressDialog() { EventBus.getDefault().postSticky(new ProgressDialogEvent(ProgressDialogEvent.EventType.STOP)); } }
[ "ozanozfirat@gmail.com" ]
ozanozfirat@gmail.com
ba12cd908b360dc5413d676687edd7bc1a264950
e715ae7dea442f874649b5426e456458ce8e9832
/src/main/java/com/pdfjet/example/Example_08.java
3c66bcade01df8529561056c3dd2a09ef53dc6a9
[ "BSD-2-Clause" ]
permissive
isocom/natanedwin
b1ce40e0c9936fe8a9d0cadf1bdacd3f96d1948a
44a4acddce215bce48eb86d0d942ab3bc1d8a522
refs/heads/master
2022-11-28T13:09:17.552550
2015-02-20T06:47:08
2015-02-20T06:47:08
285,677,200
0
0
null
null
null
null
UTF-8
Java
false
false
4,315
java
package com.pdfjet.example; import java.io.*; import java.util.*; import com.pdfjet.*; /** * Example_08.java * */ public class Example_08 { public Example_08() throws Exception { PDF pdf = new PDF( new BufferedOutputStream( new FileOutputStream("Example_08.pdf")), Compliance.PDF_A_1B); Page page = new Page(pdf, Letter.PORTRAIT); Font f1 = new Font(pdf, CoreFont.HELVETICA_BOLD); f1.setSize(7f); Font f2 = new Font(pdf, CoreFont.HELVETICA); f2.setSize(7f); Font f3 = new Font(pdf, CoreFont.HELVETICA_BOLD_OBLIQUE); f3.setSize(7f); Table table = new Table(); List<List<Cell>> tableData = getData( "data/world-communications.txt", "|", Table.DATA_HAS_2_HEADER_ROWS, f1, f2); table.setData(tableData, Table.DATA_HAS_2_HEADER_ROWS); // table.setCellBordersWidth(1.2f); table.setLocation(70f, 30f); table.setTextColorInRow(6, Color.blue); table.setTextColorInRow(39, Color.red); table.setFontInRow(26, f3); table.removeLineBetweenRows(0, 1); table.autoAdjustColumnWidths(); table.setColumnWidth(0, 120.0f); table.rightAlignNumbers(); int numOfPages = table.getNumberOfPages(page); while (true) { Point point = table.drawOn(page); // TO DO: Draw "Page 1 of N" here if (!table.hasMoreData()) { // Allow the table to be drawn again later: table.resetRenderedPagesCount(); break; } page = new Page(pdf, Letter.PORTRAIT); } pdf.close(); } public List<List<Cell>> getData( String fileName, String delimiter, int numOfHeaderRows, Font f1, Font f2) throws Exception { List<List<Cell>> tableData = new ArrayList<List<Cell>>(); int currentRow = 0; BufferedReader reader = new BufferedReader(new FileReader(fileName)); String line = null; while ((line = reader.readLine()) != null) { List<Cell> row = new ArrayList<Cell>(); String[] cols = null; if (delimiter.equals("|")) { cols = line.split("\\|", -1); } else if (delimiter.equals("\t")) { cols = line.split("\t", -1); } else { throw new Exception( "Only pipes and tabs can be used as delimiters"); } for (int i = 0; i < cols.length; i++) { String text = cols[i].trim(); Cell cell = null; if (currentRow < numOfHeaderRows) { cell = new Cell(f1, text); cell.setTopPadding(2f); cell.setBottomPadding(2f); } else { cell = new Cell(f2, text); cell.setTopPadding(1f); cell.setBottomPadding(1f); } row.add(cell); } tableData.add(row); currentRow++; } reader.close(); appendMissingCells(tableData, f2); return tableData; } private void appendMissingCells(List<List<Cell>> tableData, Font f2) { List<Cell> firstRow = tableData.get(0); int numOfColumns = firstRow.size(); for (int i = 0; i < tableData.size(); i++) { List<Cell> dataRow = tableData.get(i); int dataRowColumns = dataRow.size(); if (dataRowColumns < numOfColumns) { for (int j = 0; j < (numOfColumns - dataRowColumns); j++) { dataRow.add(new Cell(f2)); } dataRow.get(dataRowColumns - 1).setColSpan((numOfColumns - dataRowColumns) + 1); } } } public static void main(String[] args) throws Exception { long time0 = System.currentTimeMillis(); new Example_08(); long time1 = System.currentTimeMillis(); if (args.length > 0 && args[0].equals("time")) { System.out.println(time1 - time0); } } } // End of Example_08.java
[ "prokop.bart@gmail.com" ]
prokop.bart@gmail.com
455766415602d05899865d9164098b5ca373b3f6
7000209eeab06ffe0fbbd9377f9aadec806a8e9a
/src/tree/ListOfPathSumFromRootToLeaf.java
0ba6b46362f098c3407be5f27c7934fc1514770c
[]
no_license
StevenCurran/InterviewPrep
c0b0aa9acb9f41f5ac01df0ed9d755b0e98afd9c
55bcecc424b4c2be073e1e40a500969152274083
refs/heads/master
2023-01-01T17:54:51.086586
2020-10-18T23:20:52
2020-10-18T23:20:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,882
java
package tree; import java.util.ArrayList; import java.util.HashSet; import java.util.List; // https://leetcode.com/problems/path-sum-ii/ public class ListOfPathSumFromRootToLeaf { public static void main(String[] args) { TreeNode left = new TreeNode(5); TreeNode right = new TreeNode(-3); TreeNode root = new TreeNode(10).withLeftNode(left).withRightNode(right); left.withLeftNode(new TreeNode(3).withLeftNode(new TreeNode(3).withRightNode(-3)).withRightNode(0)) .withRightNode(new TreeNode(2).withRightNode(new TreeNode(1))); right.withRightNode(11).withLeftNode(4); /* 10 / \ 5 -3 / \ / \ 3 2 4 11 / \ \ 3 0 1 \ -3 */ pathSumList1(root, 18); pathSumList2(root, 18); pathSumList1(root, 10); pathSumList2(root, 10); pathSumList1(root, 11); pathSumList2(root, 11); } private static void pathSumList1(TreeNode root, int sum) { HashSet<List<Integer>> setOfPaths = new HashSet<>(); pathSumList(root, sum, new ArrayList<>(), 0, setOfPaths); System.out.println(setOfPaths); } private static void pathSumList2(TreeNode root, int sum) { HashSet<List<Integer>> setOfPaths = new HashSet<>(); pathSumList(root, sum, new ArrayList<>(), setOfPaths); System.out.println(setOfPaths); } // Better solution as we dont need to keep track of index, but it means we need to delete the last entry in the list before returning private static void pathSumList(TreeNode root, int sum, List<Integer> prefixPath, HashSet<List<Integer>> setOfPaths) { if (root == null) return; prefixPath.add(root.value); if (root.value == sum && root.left == null && root.right == null) { setOfPaths.add(new ArrayList<>(prefixPath)); prefixPath.remove(prefixPath.size() - 1); return; } pathSumList(root.right, sum - root.value, prefixPath, setOfPaths); pathSumList(root.left, sum - root.value, prefixPath, setOfPaths); prefixPath.remove(prefixPath.size() - 1); } private static void pathSumList(TreeNode root, int sum, List<Integer> prefixPath, int index, HashSet<List<Integer>> setOfPaths) { if (root == null) { return; } prefixPath.add(index, root.value); index++; if (root.value == sum && root.left == null && root.right == null) { setOfPaths.add(new ArrayList<>(prefixPath.subList(0, index))); return; } pathSumList(root.right, sum - root.value, prefixPath, index, setOfPaths); pathSumList(root.left, sum - root.value, prefixPath, index, setOfPaths); } }
[ "indian01" ]
indian01
d890f39569d19f16636f7f44d8395905d1094e11
f2af6b8af2732410177ce5dcefc515e8405ba802
/kjoram/src/org/objectweb/kjoram/Requestor.java
fa6f532fc0ff3c97552478554ce405158a22ccee
[]
no_license
STAMP-project/joram
908f871169e3e3648555a298e0f718dc3dbdc0f9
b72b82381456d8d1494ee9eaf9d0e237ac5063f5
refs/heads/master
2020-05-03T04:39:08.746932
2020-02-06T10:39:26
2020-02-06T10:39:26
178,427,746
0
0
null
2020-02-06T10:42:12
2019-03-29T15:09:26
Java
UTF-8
Java
false
false
5,308
java
/* * JORAM: Java(TM) Open Reliable Asynchronous Messaging * Copyright (C) 2008 ScalAgent Distributed Technologies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA. * * Initial developer(s): ScalAgent Distributed Technologies * Contributor(s): */ package org.objectweb.kjoram; public class Requestor implements ReplyListener { private static class Status { /** * The requestor is free: it can be called by a client thread. */ public static final int INIT = 0; /** * The requestor is busy: the client thread is waiting. * Two threads can make a call: * 1- the demultiplexer thread can call replyReceived and replyAborted. * 2- another client thread can abort the request. */ public static final int RUN = 1; /** * The requestor is either completed (by the demultiplxer thread) or * aborted (by another client thread or a timeout). * This state is transitional. It enables the requesting client thread to * finalize its request. */ public static final int DONE = 2; public static final int CLOSE = 3; private static final String[] names = { "INIT", "RUN", "DONE", "CLOSE"}; public static String toString(int status) { return names[status]; } } private int status; private RequestMultiplexer mtpx; AbstractRequest request; AbstractReply reply; public Requestor(RequestMultiplexer mtpx) { this.mtpx = mtpx; if (status == Status.DONE) { setStatus(Status.INIT); request = null; reply = null; } } private void setStatus(int status) { this.status = status; } public final synchronized int getRequestId() { return request.getRequestId(); } public synchronized AbstractReply request(AbstractRequest request) throws JoramException { return request(request, 0); } /** * Method sending a synchronous request to the server and waiting for an * answer. * * @exception IllegalStateException If the connection is closed or broken, * if the server state does not allow to * process the request. * @exception SecurityException When sending a request to a destination * not accessible because of security. * @exception InvalidDestinationException When sending a request to a * destination that no longer exists. * @exception JoramException If the request failed for any other reason. */ public synchronized AbstractReply request( AbstractRequest request, long timeout) throws JoramException { if (status == Status.CLOSE) { return null; } else if (status == Status.RUN) { throw new IllegalStateException("Requestor already used"); } this.request = request; this.reply = null; mtpx.sendRequest(request, this); setStatus(Status.RUN); try { wait(timeout); } catch (InterruptedException exc) { setStatus(Status.DONE); } if (status == Status.RUN) { // Means that the wait ended with a timeout. // Abort the request. mtpx.abortRequest(getRequestId()); this.request = null; return null; } else if (status == Status.CLOSE) { if (reply instanceof ConsumerMessages) { mtpx.deny((ConsumerMessages) reply); } this.request = null; return null; } else if (status == Status.DONE) { this.request = null; return reply; } return reply; } public synchronized boolean replyReceived(AbstractReply reply) throws AbortedRequestException { if (status == Status.RUN && reply.getCorrelationId() == request.getRequestId()) { this.reply = reply; setStatus(Status.DONE); notify(); return true; } else { // The request has been aborted. throw new AbortedRequestException(); } } public synchronized void replyAborted() { if (status == Status.RUN) { this.request = null; this.reply = null; setStatus(Status.DONE); notify(); } // Else the request has been aborted. // Do nothing } public synchronized void abortRequest() { if (status == Status.RUN && request != null) { mtpx.abortRequest(request.getRequestId()); this.request = null; setStatus(Status.DONE); notify(); } // Else the request has been completed. // Do nothing } public synchronized void close() { if (status != Status.CLOSE) { abortRequest(); setStatus(Status.CLOSE); } // Else idempotent. } }
[ "Nicolas.Tachker@scalagent.com" ]
Nicolas.Tachker@scalagent.com
4a827eecb8b43d94a58e8e7dfdcedaa1bc505c93
93c7ab3ca6e059bfb33c3016bf99fbb09678d7be
/BrowserActivity/app/src/main/java/intentslab/labs/course/browseractivity/MyBrowserActivity.java
a71e94a140413119be38cf55e6222d322e132c56
[]
no_license
thirumurthis/android-code-demo
390fbc6a209e667051f4290e546ac6e878c5c5a2
02dbe49da3c6c7f49d2b649df2502801b403b991
refs/heads/master
2021-01-01T18:49:22.157834
2015-08-20T08:06:53
2015-08-20T08:06:53
40,285,288
0
0
null
null
null
null
UTF-8
Java
false
false
1,493
java
package intentslab.labs.course.browseractivity; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; public class MyBrowserActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_browser_activity); // Save the String passed with the intent String url = getIntent().getDataString(); if (null == url) url = "No Data Provided"; // Get a reference to the TextView and set the text it to the String TextView textView = (TextView) findViewById(R.id.url); textView.setText(url); } @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_my_browser, 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(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "thirumurthi.s@gmail.com" ]
thirumurthi.s@gmail.com
1e8f6e004abda63608f5394bd8477d1ae4f3c99f
cd4ff816badcfb191389c9926deda2891bdeabc1
/src/com/market/admin/controller/SaleProdRemoveController.java
ad4ef52297daa36f7f1ebbf1cbf7b334813c695f
[]
no_license
kjb0722/Semi-MarketHoly
85834b6c19e33cc144658a4c65eaf0968ec513fe
e50bc4c52646412526994eee704d62e3ff504581
refs/heads/master
2023-01-30T12:28:54.150728
2020-12-03T10:32:48
2020-12-03T10:32:48
262,923,344
1
1
null
2020-05-14T00:19:23
2020-05-11T02:52:33
Java
UTF-8
Java
false
false
904
java
package com.market.admin.controller; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.JSONObject; import com.market.admin.dao.SaleDao; @WebServlet("/admin/saleProdRemove.do") public class SaleProdRemoveController extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int pnum = Integer.parseInt(req.getParameter("pnum")); SaleDao dao = SaleDao.getInstance(); int n = dao.delSaleProd(pnum); JSONObject json = new JSONObject(); json.put("n", n); resp.setContentType("text/plain;charset=utf-8"); PrintWriter pw = resp.getWriter(); pw.print(json); } }
[ "58472980+kjb0722@users.noreply.github.com" ]
58472980+kjb0722@users.noreply.github.com
e81e03a6fc834481e5de2392c2bcd7fc8ab976a9
4ab4f1e76e7d83f056a28dc0b0690795225f1907
/app/src/main/java/com/trojx/fangyan/activity/MyActivity.java
e8d0bc61877788363f3d06f80e05890211aa72f2
[ "Apache-2.0" ]
permissive
JianxunRao/FangYanShuo
c5510c8df2886307a1d9ac24f977962a566b2e01
a0ebe4d30a3d2329d3b481ea6393e216ea2016bc
refs/heads/master
2021-01-10T16:36:36.410559
2017-09-18T11:59:24
2017-09-18T11:59:24
51,422,298
1
1
null
null
null
null
UTF-8
Java
false
false
12,995
java
package com.trojx.fangyan.activity; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.TextView; import com.avos.avoscloud.AVException; import com.avos.avoscloud.AVFile; import com.avos.avoscloud.AVGeoPoint; import com.avos.avoscloud.AVObject; import com.avos.avoscloud.AVQuery; import com.avos.avoscloud.AVUser; import com.avos.avoscloud.CountCallback; import com.avos.avoscloud.FindCallback; import com.avos.avoscloud.GetCallback; import com.avos.avoscloud.LogInCallback; import com.avos.avoscloud.SaveCallback; import com.avos.avoscloud.SignUpCallback; import com.trojx.fangyan.R; import org.json.JSONObject; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.List; /** * Created by Administrator on 2016/1/15. */ public class MyActivity extends AppCompatActivity { private TextView tv; private File[] files; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_activity); // tv = (TextView) findViewById(R.id.tv); // File file =new File("mnt/shared/voiceFile/zh"); // files = file.listFiles(); // Log.e("files size",files.length+""); // uploadFiles(); // AVQuery<AVObject> query=new AVQuery<>("story"); // query.getFirstInBackground(new GetCallback<AVObject>() { // @Override // public void done(AVObject avObject, AVException e) { // AVObject item = new AVObject("storycomment"); // item.put("user", AVUser.getCurrentUser()); // item.put("story", avObject); // item.saveInBackground(new SaveCallback() { // @Override // public void done(AVException e) { // if(e!=null){ // Log.e("e",e.toString()); // } // } // }); // } // }); // AVUser avUser=AVUser.getCurrentUser(); // try { // AVFile file=AVFile.withAbsoluteLocalPath("xxxxx.jpg","sdcard/bitmapThumbReceiverSmall.jpg"); // avUser.put("logo",file); // avUser.saveInBackground(); // } catch (IOException e) { // e.printStackTrace(); // } renameUser(); } private void uploadFile(){ AVQuery<AVObject> query=new AVQuery<>("word"); query.whereEqualTo("lang", 1 + ""); query.whereDoesNotExist("voiceFile"); query.countInBackground(new CountCallback() { @Override public void done(int i, AVException e) { tv.setText(i + ""); } }); query.getFirstInBackground(new GetCallback<AVObject>() { @Override public void done(AVObject avObject, AVException e) { try { Log.e("avobject", avObject.get("voice").toString()); AVFile avFile = AVFile.withFile(findFile(avObject.getString("voice")).getName(), findFile(avObject.getString("voice"))); avObject.put("voiceFile", avFile); avObject.saveInBackground(new SaveCallback() { @Override public void done(AVException e) { uploadFile(); } }); } catch (Exception e1) { e1.printStackTrace(); } } }); } private void uploadFiles(){ AVQuery<AVObject> query=new AVQuery<>("word"); query.setLimit(50); query.whereEqualTo("lang", 5 + ""); query.whereDoesNotExist("voiceFile"); // query.countInBackground(new CountCallback() { // @Override // public void done(int i, AVException e) { // tv.setText(i+""); // } // }); query.findInBackground(new FindCallback<AVObject>() { @Override public void done(final List<AVObject> list, AVException e) { try { final int[] a = new int[1]; a[0] = 0; for (AVObject item : list) { AVFile avFile = AVFile.withFile(findFile(item.getString("voice")).getName(), findFile(item.getString("voice"))); item.put("voiceFile", avFile); item.saveInBackground(new SaveCallback() { @Override public void done(AVException e) { a[0]++; if (a[0] == list.size()) uploadFiles(); } }); } } catch (Exception ex) { } } }); } private File findFile(String s){ for(int i=0;i<files.length;i++){ if(files[i].getName().equals(s+".mp3")) return files[i]; } return new File("sdcard/Download/httpclient-4.3.1.jar"); } /** * 上传story */ private void uploadStorys(){ try{ File file=new File("sdcard/story.txt"); BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream(file),"GBK")); String line; while((line=br.readLine())!=null){ if(line.length()>10){ String url=line.split("\\|")[0]; String name=line.split("\\|")[1]; String title=line.split("\\|")[2]; double lat=Double.parseDouble(line.split("\\|")[3]); double lng=Double.parseDouble(line.split("\\|")[4]); Log.e("url id",url); uploadStory(name, url, lat, lng, title); } } br.close(); }catch (Exception e){ Log.e("upload story error",e.toString()); } } /** * 上传指定信息的story * @param username * @param url * @param lat * @param lng * @param title */ private void uploadStory(String username, final String url, final double lat, final double lng, final String title){ final AVUser avUser=new AVUser(); avUser.setUsername(username + title.hashCode()); avUser.setPassword("123456"); avUser.signUpInBackground(new SignUpCallback() { @Override public void done(AVException e) { if (e == null) { AVGeoPoint geoPoint = new AVGeoPoint(lat, lng); AVObject story = new AVObject("story"); story.put("provider", avUser); story.put("geoPoint", geoPoint); story.put("content", title); story.put("url", url); story.saveInBackground(); } else { Log.e("upload story error", e.toString()); } } }); } /** * 为story添加file */ private void uploadStoryFile(){ AVQuery<AVObject> query=new AVQuery<>("story"); query.whereExists("url"); query.whereDoesNotExist("voiceFile"); query.setLimit(1000); query.findInBackground(new FindCallback<AVObject>() { @Override public void done(List<AVObject> list, AVException e) { if (e == null) { for (AVObject item : list) { String url = item.getString("url"); try { AVFile avFile = AVFile.withAbsoluteLocalPath(item.getString("content") + ".mp3", "sdcard/storyFile/" + url + ".mp3"); item.put("voiceFile", avFile); item.saveInBackground(); } catch (IOException e1) { Log.e("upload file error", e1.toString()); } } } } }); } private void getAddress(final AVObject item,final double lat, final double lng){ new Thread(new Runnable() { @Override public void run() { try{ StringBuilder url=new StringBuilder(); url.append("http://api.map.baidu.com/geocoder/v2/?ak=hRPA3mCvMq00f57wndGUVQ42" + "&mcode=AF:91:42:AA:61:C1:95:22:E6:0C:14:93:0A:DA:FC:45:D6:DC:3B:27;com.trojx.fangyan&callback=renderReverse&location="); url.append(lat+","+lng); url.append("&output=json&pois=0"); URL urls=new URL(url.toString()); InputStream ins=urls.openStream(); BufferedReader br=new BufferedReader(new InputStreamReader(ins)); String line; StringBuilder response=new StringBuilder(); while ((line=br.readLine())!=null){ response.append(line); } JSONObject jsonObject=new JSONObject(response.toString().substring(29)); JSONObject result=jsonObject.getJSONObject("result"); JSONObject addressComponent=result.getJSONObject("addressComponent"); String LocationMsg=new String(addressComponent.getString("province")+addressComponent.getString("city")); // Log.e("city",addressComponent.getString("city")); // Log.e("province",addressComponent.getString("province")); Log.e(lat+","+lng,LocationMsg); item.put("location", LocationMsg); item.saveInBackground(); }catch (Exception e){ Log.e("get location error",e.toString()); } } }).start(); } /** * 为story添加timelong */ private void addTimeLong(){ AVQuery<AVObject> query=new AVQuery<>("story"); query.setLimit(1000); query.whereExists("voiceFile"); query.whereExists("url"); query.findInBackground(new FindCallback<AVObject>() { @Override public void done(List<AVObject> list, AVException e) { if (e == null) { for (AVObject item : list) { int timeLong = getTimeLong(item.getString("url")); item.put("timelong", timeLong); item.saveInBackground(); } } } }); } /** * 获取指定文件的timelong * @param url * @return */ private int getTimeLong(String url){ MediaPlayer mp=MediaPlayer.create(this, Uri.parse("sdcard/storyFile/"+url+".mp3")); // mp.start(); return mp.getDuration(); } /** * 重命名user {"code":1,"error":"Forbidden to find by class permissions."} 增加头像 */ private void renameUser(){ try { BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream("sdcard/story.txt"),"GBK")); String line; File file=new File("sdcard/其他"); final File[] files=file.listFiles(); final int lenth=files.length; while((line=br.readLine())!=null){ String name=line.split("\\|")[1]; String title=line.split("\\|")[2]; name=name+title.hashCode(); AVUser user=new AVUser(); user.logInInBackground(name, "123456", new LogInCallback<AVUser>() { @Override public void done(AVUser avUser, AVException e) { if(e==null){ try { AVFile avFile=AVFile.withAbsoluteLocalPath(avUser.getUsername(),files[(int)(Math.random()*lenth)].getAbsolutePath()); avUser.put("logo",avFile); avUser.saveInBackground(); } catch (IOException e1) { e1.printStackTrace(); } }else { Log.e("get user error",e.toString()); } } }); AVUser.getCurrentUser().logOut(); } } catch (IOException e) { e.printStackTrace(); } } }
[ "raojianxun@126.com" ]
raojianxun@126.com
ce1f583b17de6b51cea47dc1b00cb9128121cd9c
16ce64327cad32f3a7f62466c1b22851f67f39ff
/src/main/java/com/foamtec/service/AppUserService.java
a0aa66e3ea99cfb281653be82e333f8d1662a1dc
[]
no_license
kobaep/foamtec-springboot
a42e22c8850e24b719da2ffd8cb455c71129bc63
c0dde531a1c40324dcd870af613a5735312a97ee
refs/heads/master
2021-01-17T10:18:09.272547
2016-11-09T04:28:48
2016-11-09T04:28:48
56,039,800
0
0
null
null
null
null
UTF-8
Java
false
false
3,210
java
package com.foamtec.service; import com.foamtec.dao.AppUserDao; import com.foamtec.domain.AppUser; import org.json.JSONArray; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.security.Principal; import java.util.List; /** * Created by apichat on 4/19/2016 AD. */ @Service public class AppUserService { private final Logger LOGGER = LoggerFactory.getLogger(AppUserService.class); @Autowired private AppUserDao appUserDao; public AppUser create(String data, Principal principal) { JSONObject jsonObject = new JSONObject(data); AppUser appUser = new AppUser(); appUser.setUsername(jsonObject.getString("inputUser")); appUser.setPassword(jsonObject.getString("inputPassword")); appUser.setName(jsonObject.getString("inputName")); appUser.setDepartment(jsonObject.getString("inputDepartment")); appUser.setDepartmentCode(jsonObject.getString("inputDepartmentCode")); appUser.setEnabled(1); appUser.setEmailAddress(jsonObject.getString("inputEmail")); appUser.setPhoneNumber(jsonObject.getString("inputTelephoneNumber")); appUser.setRoleName(jsonObject.getString("inputRoleName")); appUserDao.create(appUser); return appUser; } public AppUser update(String data, Principal principal) { JSONObject jsonObject = new JSONObject(data); AppUser appUser = findById(jsonObject.getLong("inputId")); appUser.setUsername(jsonObject.getString("inputUser")); appUser.setPassword(jsonObject.getString("inputPassword")); appUser.setName(jsonObject.getString("inputName")); appUser.setDepartment(jsonObject.getString("inputDepartment")); appUser.setDepartmentCode(jsonObject.getString("inputDepartmentCode")); appUser.setEnabled(1); appUser.setEmailAddress(jsonObject.getString("inputEmail")); appUser.setPhoneNumber(jsonObject.getString("inputTelephoneNumber")); appUser.setRoleName(jsonObject.getString("inputRoleName")); appUserDao.update(appUser); return appUser; } public void delete(String data, Principal principal) { JSONObject jsonObject = new JSONObject(data); AppUser appUser = findById(jsonObject.getLong("inputId")); appUserDao.delete(appUser); } public List<AppUser> findAll() { return appUserDao.getAll(); } public List<AppUser> findAllSaleOut() { return appUserDao.getAllSaleOut(); } public AppUser findById(Long id) { return appUserDao.getById(id); } public AppUser findByUsername(String username) { return appUserDao.getByUsername(username); } public JSONArray getAllSaleOutJson() { List<AppUser> appUsers = findAllSaleOut(); JSONArray jsonArray = new JSONArray(); for (AppUser a : appUsers) { JSONObject jsonObject = new JSONObject(); jsonObject.put("name", a.getName()); jsonArray.put(jsonObject); } return jsonArray; } }
[ "apichat.kop@gmail.com" ]
apichat.kop@gmail.com
8b2789c2c3941219068fe043e6375f862b7d5a62
e652e896b1e4e40b205d7ca64c9a267d2683345a
/android/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/com/github/barteksc/pdfviewer/R.java
249af95ae3042bf410358395ab441aac46be6445
[]
no_license
GautierL4/Subline
2e75818352355a5bfd8c475b23f015a42fbd944f
54bcb331813bdfca684ad37caa34309217844b44
refs/heads/master
2022-12-08T11:07:42.418005
2020-05-13T10:05:41
2020-05-13T10:05:41
137,458,194
3
2
null
2022-12-07T19:38:57
2018-06-15T07:54:21
Java
UTF-8
Java
false
false
1,401
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package com.github.barteksc.pdfviewer; public final class R { private R() {} public static final class attr { private attr() {} public static final int sb_handlerColor = 0x7f0200ee; public static final int sb_horizontal = 0x7f0200ef; public static final int sb_indicatorColor = 0x7f0200f0; public static final int sb_indicatorTextColor = 0x7f0200f1; } public static final class drawable { private drawable() {} public static final int default_scroll_handle_bottom = 0x7f060067; public static final int default_scroll_handle_left = 0x7f060068; public static final int default_scroll_handle_right = 0x7f060069; public static final int default_scroll_handle_top = 0x7f06006a; } public static final class styleable { private styleable() {} public static final int[] ScrollBar = { 0x7f0200ee, 0x7f0200ef, 0x7f0200f0, 0x7f0200f1 }; public static final int ScrollBar_sb_handlerColor = 0; public static final int ScrollBar_sb_horizontal = 1; public static final int ScrollBar_sb_indicatorColor = 2; public static final int ScrollBar_sb_indicatorTextColor = 3; } }
[ "ladrien2@gmail.com" ]
ladrien2@gmail.com
ed25d15bd6879da1dd7ae2ba993dbd5afecb6d7d
df486e0ae5a80a885795ff2f71c134b40c8ab9fd
/src/L113_Path_Sum_II.java
2e95a3eb3496f0433f365c8ad26a244891a59667
[]
no_license
chenglingli/LeetCodeSolution
8f60bb53f78047d76a5c1e30fa3f1560beddec60
841ba2516137907958c56a0b952952256e8ce496
refs/heads/master
2023-08-29T20:33:09.853320
2023-08-29T02:13:08
2023-08-29T02:13:08
130,654,274
2
0
null
2021-05-27T09:07:37
2018-04-23T07:06:11
Java
UTF-8
Java
false
false
2,098
java
import java.util.ArrayList; import java.util.List; public class L113_Path_Sum_II { void backtrack(TreeNode root, List<List<Integer>> res, List<Integer> tmp, int sum) { if (root == null) { return; } if (root.right == null && root.left == null && sum == root.val) { List<Integer> resTmp = new ArrayList<>(tmp); resTmp.add(root.val); res.add(resTmp); return; } tmp.add(root.val); backtrack(root.left, res, tmp, sum - root.val); backtrack(root.right, res, tmp, sum - root.val); tmp.remove(tmp.size() - 1); } public List<List<Integer>> pathSum(TreeNode root, int targetSum) { List<List<Integer>> res = new ArrayList<>(); backtrack(root, res, new ArrayList<>(), targetSum); return res; } public static void main(String[] args) { L113_Path_Sum_II s = new L113_Path_Sum_II(); long sysDate1 = System.currentTimeMillis(); int sum = 22; // init data TreeNode root = new TreeNode(5); TreeNode root1 = new TreeNode(4); TreeNode root2 = new TreeNode(8); TreeNode root3 = new TreeNode(11); TreeNode root5 = new TreeNode(13); TreeNode root6 = new TreeNode(4); TreeNode root7 = new TreeNode(7); TreeNode root8 = new TreeNode(2); TreeNode root9 = new TreeNode(5); TreeNode root10 = new TreeNode(1); root.left = root1; root.right = root2; root1.left = root3; root3.left = root7; root3.right = root8; root2.left = root5; root2.right = root6; root6.left = root9; root6.right = root10; // [-2,null,-3] TreeNode t = new TreeNode(-2); TreeNode t1 = new TreeNode(-3); t.left = t1; List<List<Integer>> res = s.pathSum(root, 22); System.out.println(res); long sysDate2 = System.currentTimeMillis(); System.out.println("\ntime "); System.out.print(sysDate2 - sysDate1); } }
[ "solomon-li@outlook.com" ]
solomon-li@outlook.com
222e1736fcaec2893e958959ae7c414a57c2d040
a3994f60d0f4fc1ed84dc8fcc637cf8b3061f8fc
/src/main/java/entity/Facturas.java
f61cb25a0ad166a528cd7330213cc779c66de407
[]
no_license
FernandoGuzmanH/RentaCar
acf2148a8300f2da1ec65f09968778b57861fb2e
a1e0417df68da14423ccb0c6b3f3db08cfe0b576
refs/heads/master
2021-03-13T11:21:18.343464
2020-03-11T20:47:59
2020-03-11T20:47:59
246,675,045
0
0
null
null
null
null
UTF-8
Java
false
false
3,242
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 entity; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; @Entity @Table(name = "facturas") public class Facturas implements Serializable{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @JoinColumn(name = "ID_personas", referencedColumnName = "id") @ManyToOne private Personas ID_personas; @JoinColumn(name = "ID_estados", referencedColumnName = "id") @ManyToOne private Estados ID_estados; @Column(name = "correlativo") private int correlativo; @Temporal(TemporalType.DATE) @Column(name = "fecha") private Date fecha; @Column(name = "direccion") private String direccion; @JoinColumn(name = "ID_empresas", referencedColumnName = "id") @ManyToOne private Empresas ID_empresas; public int getId() { return id; } public void setId(int id) { this.id = id; } public Personas getID_personas() { return ID_personas; } public void setID_personas(Personas ID_personas) { this.ID_personas = ID_personas; } public Estados getID_estados() { return ID_estados; } public void setID_estados(Estados ID_estados) { this.ID_estados = ID_estados; } public int getCorrelativo() { return correlativo; } public void setCorrelativo(int correlativo) { this.correlativo = correlativo; } public Date getFecha() { return fecha; } public void setFecha(Date fecha) { this.fecha = fecha; } public String getDireccion() { return direccion; } public void setDireccion(String direccion) { this.direccion = direccion; } public Empresas getID_empresas() { return ID_empresas; } public void setID_empresas(Empresas ID_empresas) { this.ID_empresas = ID_empresas; } @Override public int hashCode() { int hash = 5; hash = 19 * hash + this.id; return hash; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Facturas other = (Facturas) obj; if (this.id != other.id) { return false; } return true; } @Override public String toString() { return "Facturas{" + "id=" + id + '}'; } public Facturas() { } }
[ "noreply@github.com" ]
noreply@github.com
eabc5ef52add623cbccdeb8621f9ad46425b800a
ba0cc2e3f6c690b68038792c8ecb71931785a1a6
/src/autocarro/carro.java
74fb049b96d3d26636d1e30f6676e30865360adb
[]
no_license
ElianaNeto/Java2D-MovingCar
e0c158187150d95aa2817e8bdb44424cd0a92c75
ef74c6457e3c434ea4c499db1ca19ce74b157786
refs/heads/master
2023-06-20T14:37:07.459146
2021-07-09T20:57:07
2021-07-09T20:57:07
384,548,825
0
0
null
null
null
null
UTF-8
Java
false
false
3,132
java
package autocarro; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.geom.Ellipse2D; import javax.swing.JPanel; public class carro extends JPanel implements Runnable { Thread thread; int movimentX = 0; int insideObjectMovement = 0; float angulo = 0; boolean flagInsideObjectMovement = true; AffineTransform at; public carro() { thread = new Thread(this); thread.start(); } public void paint (Graphics g ) { super.paint(g); Graphics2D g2d = (Graphics2D)g; at = new AffineTransform(); at.translate(movimentX, 0); g2d.setTransform(at); g2d.setColor(Color.GRAY); //Desenhar o carro g2d.fillRect(100, 45, 150, 75); g2d.fillRect(100, 120, 200, 75); // desenhar a janela g2d.setColor(Color.WHITE); g2d.fillRect(120, 60, 45, 45); //desenhar porta g2d.fillRect(175, 60, 45, 120); //janela que vai se movimentar g2d.setColor(Color.BLUE); g2d.fillRect(130 + insideObjectMovement, 60, 22, 45); // desenhar as rodas g2d.setColor(Color.BLACK); float dash1[] = {10.0f}; BasicStroke dashed = new BasicStroke(5.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f); g2d.setStroke(dashed); // faz os tracejados at = new AffineTransform(); at.translate(movimentX, 0); at.rotate(Math.toRadians(angulo), 145, 220); g2d.setTransform(at); g2d.drawOval(120, 195, 50, 50); // 1 roda at = new AffineTransform(); at.translate(movimentX, 0); at.rotate(Math.toRadians(angulo), 225, 220); g2d.setTransform(at); g2d.drawOval(200, 195, 50, 50); // 2 roda } public void run() { try { while (true) { this.movimentX += 1; if (this.movimentX > getSize().width) { this.movimentX = -300;//tamanho do carro } //movimento da janela if (flagInsideObjectMovement) { this.insideObjectMovement = this.insideObjectMovement + 1; if (this.insideObjectMovement > 10) { this.flagInsideObjectMovement = false; } } else { this.insideObjectMovement = this.insideObjectMovement - 1; if (this.insideObjectMovement < 0) { this.flagInsideObjectMovement = true; } } angulo += 1; super.repaint(); thread.sleep(20); } } catch (Exception e) { System.err.println("S"); } } }
[ "eliananeto29@gmail.com" ]
eliananeto29@gmail.com
94b535c4074976e6d3277bcf2e966f0a63607541
9f058d655045b8c5ca87a04178b12484a52eca92
/src/main/java/com/newrelic/mobile/fbs/AgentDataBundle.java
eb40c3b086dd1e32df035c7b1154ffee7c43aea3
[]
no_license
ramboo0524/com.newrelic.agent
ad5eb64b6f4abd7e4d81d3de1dbe0508cd197b12
b5e6960b0fee493420f35db710925b4ea749a8c3
refs/heads/master
2020-03-10T10:33:57.922944
2018-04-13T02:15:58
2018-04-13T02:15:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,549
java
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // package com.newrelic.mobile.fbs; import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.Table; import java.nio.ByteBuffer; import java.nio.ByteOrder; public final class AgentDataBundle extends Table { public AgentDataBundle() { } public static AgentDataBundle getRootAsAgentDataBundle(ByteBuffer _bb) { return getRootAsAgentDataBundle(_bb, new AgentDataBundle()); } public static AgentDataBundle getRootAsAgentDataBundle(ByteBuffer _bb, AgentDataBundle obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb); } public void __init(int _i, ByteBuffer _bb) { this.bb_pos = _i; this.bb = _bb; } public AgentDataBundle __assign(int _i, ByteBuffer _bb) { this.__init(_i, _bb); return this; } public AgentData agentData(int j) { return this.agentData(new AgentData(), j); } public AgentData agentData(AgentData obj, int j) { int o = this.__offset(4); return o != 0?obj.__assign(this.__indirect(this.__vector(o) + j * 4), this.bb):null; } public int agentDataLength() { int o = this.__offset(4); return o != 0?this.__vector_len(o):0; } public static int createAgentDataBundle(FlatBufferBuilder builder, int agentDataOffset) { builder.startObject(1); addAgentData(builder, agentDataOffset); return endAgentDataBundle(builder); } public static void startAgentDataBundle(FlatBufferBuilder builder) { builder.startObject(1); } public static void addAgentData(FlatBufferBuilder builder, int agentDataOffset) { builder.addOffset(0, agentDataOffset, 0); } public static int createAgentDataVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for(int i = data.length - 1; i >= 0; --i) { builder.addOffset(data[i]); } return builder.endVector(); } public static void startAgentDataVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } public static int endAgentDataBundle(FlatBufferBuilder builder) { int o = builder.endObject(); return o; } public static void finishAgentDataBundleBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); } }
[ "ramboo348700" ]
ramboo348700
3e13ecfe082be490103ac7fba4ef227aa77a04dd
1539c20241768a8a016a9463dd04effe1b48285a
/data-structure/src/main/java/com/vista/drill/xiaochao/高频题/爱吃香蕉的珂珂.java
f995e58a2782576c48d8d260807239585d9b47e5
[]
no_license
VVvista/vista-drill
540477cfdd76325e104cd69933bb002c60a9f262
5433a468b1ed07ce6c72198b74a427c4aebc3a13
refs/heads/master
2021-04-08T03:41:06.672973
2021-02-19T02:48:50
2021-02-19T02:48:50
248,736,526
0
0
null
null
null
null
UTF-8
Java
false
false
978
java
package com.vista.drill.xiaochao.高频题; /** * https://leetcode-cn.com/problems/koko-eating-bananas/ * * @author Wen TingTing by 2021/2/16 */ public class 爱吃香蕉的珂珂 { public int minEatingSpeed(int[] piles, int H) { int max = getMaxt(piles); int left = 1; int right = max + 1; while (left < right) { int mid=(left+right)/2; if(canFinsh(piles,mid,H)){ right=mid; }else{ left=mid+1; } } return left; } private boolean canFinsh(int[] piles, int mid, int h) { int result=0; for (int i = 0; i < piles.length; i++) { result+=Math.ceil((double)piles[i]/mid); } return result<=h; } private int getMaxt(int[] piles) { int max=piles[0]; for (int i = 1; i < piles.length; i++) { max=Math.max(piles[i],max); } return max; } }
[ "wentingting_vista@163.com" ]
wentingting_vista@163.com
b6833a683e52df5111a471604f035833ee1f2997
049cc427d0cfe184e9f2eb30082c0b19a163d4a9
/src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableConcatWithMaybe.java
7f3d8d87168763cbb58a709e64c622b9612f0c48
[ "Apache-2.0" ]
permissive
Kacent123/RxJava
0e2988c95c50971841bf1fcb2e6c214a16033dee
633398bcbf01d7b6e68e4ce5359c377d6fa0d8b0
refs/heads/3.x
2020-06-14T23:12:56.847157
2019-12-25T06:56:44
2019-12-25T06:56:44
195,149,779
1
0
Apache-2.0
2019-12-25T06:56:46
2019-07-04T01:39:07
Java
UTF-8
Java
false
false
3,301
java
/** * Copyright (c) 2016-present, RxJava Contributors. * * 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 io.reactivex.rxjava3.internal.operators.observable; import java.util.concurrent.atomic.AtomicReference; import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.disposables.Disposable; import io.reactivex.rxjava3.internal.disposables.DisposableHelper; /** * Subscribe to a main Observable first, then when it completes normally, subscribe to a Maybe, * signal its success value followed by a completion or signal its error or completion signal as is. * <p>History: 2.1.10 - experimental * @param <T> the element type of the main source and output type * @since 2.2 */ public final class ObservableConcatWithMaybe<T> extends AbstractObservableWithUpstream<T, T> { final MaybeSource<? extends T> other; public ObservableConcatWithMaybe(Observable<T> source, MaybeSource<? extends T> other) { super(source); this.other = other; } @Override protected void subscribeActual(Observer<? super T> observer) { source.subscribe(new ConcatWithObserver<T>(observer, other)); } static final class ConcatWithObserver<T> extends AtomicReference<Disposable> implements Observer<T>, MaybeObserver<T>, Disposable { private static final long serialVersionUID = -1953724749712440952L; final Observer<? super T> downstream; MaybeSource<? extends T> other; boolean inMaybe; ConcatWithObserver(Observer<? super T> actual, MaybeSource<? extends T> other) { this.downstream = actual; this.other = other; } @Override public void onSubscribe(Disposable d) { if (DisposableHelper.setOnce(this, d) && !inMaybe) { downstream.onSubscribe(this); } } @Override public void onNext(T t) { downstream.onNext(t); } @Override public void onSuccess(T t) { downstream.onNext(t); downstream.onComplete(); } @Override public void onError(Throwable e) { downstream.onError(e); } @Override public void onComplete() { if (inMaybe) { downstream.onComplete(); } else { inMaybe = true; DisposableHelper.replace(this, null); MaybeSource<? extends T> ms = other; other = null; ms.subscribe(this); } } @Override public void dispose() { DisposableHelper.dispose(this); } @Override public boolean isDisposed() { return DisposableHelper.isDisposed(get()); } } }
[ "noreply@github.com" ]
noreply@github.com
ff2a1611b36d3f1ebcfa94cafc467d6fb698b254
cdb7cd20e16fb8517ddce538e0c13c16ccabaa7c
/src/whut/zy1302/database/task/repository/Low_value_productReposity.java
9454afe256bbfe4c3bb7c653385362c789d4e308
[]
no_license
zcy-fover/LabMSystem
f9afda7dd908dd4c28bd9cd767785ef4f260e5c1
a48d08a42f31b104d4c00815d9b5a94b5511dcf9
refs/heads/master
2020-08-30T19:02:10.129898
2016-08-23T03:47:16
2016-08-23T03:47:16
66,330,318
1
0
null
null
null
null
UTF-8
Java
false
false
422
java
package whut.zy1302.database.task.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import whut.zy1302.database.task.domain.Low_value_product; /** * Created by yang on 2015/12/26. */ public interface Low_value_productReposity extends JpaRepository<Low_value_product,String>,JpaSpecificationExecutor<Low_value_product>{ }
[ "15207189058@163.com" ]
15207189058@163.com
3fc46d713f01ea1fb9bfeb37aff6979c57ecaf9a
8704b9259e3e664d4c9e7d5594da620500cb0547
/SangBlog/src/main/java/com/blog/sang/manager/menu/domain/Menu.java
93a37c73eb2ca75659a255cba50fe929b15f35e5
[]
no_license
ItChoi/SangBlog
219181ebb727ba22643a19d76f263fc1bcd06a3b
ee710e7212204b057ddcf628a27e28492ead7579
refs/heads/master
2022-12-25T05:41:33.144740
2019-10-16T11:58:40
2019-10-16T11:58:40
146,068,088
0
0
null
null
null
null
UTF-8
Java
false
false
3,153
java
package com.blog.sang.manager.menu.domain; public class Menu { private Long id; private Long parentId; private String menuLevel; private String menuCode; private String menuName; private String ordering; private String url; private String uri; private String menuDisplay; private Long childId; private Long childParentId; private String childMenuLevel; private String childMenuCode; private String childMenuName; private String childOrdering; private String childUrl; private String childUri; private String childMenuDisplay; // private List<Menu> childMenu; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getParentId() { return parentId; } public void setParentId(Long parentId) { this.parentId = parentId; } public String getMenuLevel() { return menuLevel; } public void setMenuLevel(String menuLevel) { this.menuLevel = menuLevel; } public String getMenuCode() { return menuCode; } public void setMenuCode(String menuCode) { this.menuCode = menuCode; } public String getMenuName() { return menuName; } public void setMenuName(String menuName) { this.menuName = menuName; } public String getOrdering() { return ordering; } public void setOrdering(String ordering) { this.ordering = ordering; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getUri() { return uri; } public void setUri(String uri) { this.uri = uri; } /*public List<Menu> getChildMenu() { return childMenu; } public void setChildMenu(List<Menu> childMenu) { this.childMenu = childMenu; }*/ public String getMenuDisplay() { return menuDisplay; } public void setMenuDisplay(String menuDisplay) { this.menuDisplay = menuDisplay; } public Long getChildId() { return childId; } public void setChildId(Long childId) { this.childId = childId; } public Long getChildParentId() { return childParentId; } public void setChildParentId(Long childParentId) { this.childParentId = childParentId; } public String getChildMenuLevel() { return childMenuLevel; } public void setChildMenuLevel(String childMenuLevel) { this.childMenuLevel = childMenuLevel; } public String getChildMenuCode() { return childMenuCode; } public void setChildMenuCode(String childMenuCode) { this.childMenuCode = childMenuCode; } public String getChildMenuName() { return childMenuName; } public void setChildMenuName(String childMenuName) { this.childMenuName = childMenuName; } public String getChildOrdering() { return childOrdering; } public void setChildOrdering(String childOrdering) { this.childOrdering = childOrdering; } public String getChildUrl() { return childUrl; } public void setChildUrl(String childUrl) { this.childUrl = childUrl; } public String getChildUri() { return childUri; } public void setChildUri(String childUri) { this.childUri = childUri; } public String getChildMenuDisplay() { return childMenuDisplay; } public void setChildMenuDisplay(String childMenuDisplay) { this.childMenuDisplay = childMenuDisplay; } }
[ "itchoi0429@gmail.com" ]
itchoi0429@gmail.com
c290a3cdda7cb19959bf75cee5aae6c7c698348e
66d764804d87f759c2d8191a5189f4a793b6a9f3
/src/main/java/com/andrewprogramming/WebApplication.java
8694d7c9132e834367327667fb8458e0eb656832
[]
no_license
yongk/Springboot-JWT-Shiro
e6d2360060fb184de74f542f0b8d52a21d3e9063
e6c4e26b08bccdbb593b29397ca0bab13da8b381
refs/heads/master
2021-10-11T06:39:30.823575
2019-01-23T03:50:09
2019-01-23T03:50:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
313
java
package com.andrewprogramming; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class WebApplication { public static void main(String[] args) { SpringApplication.run(WebApplication.class); } }
[ "nttdata.deng@daimler.com" ]
nttdata.deng@daimler.com
595212d844502641d28116eaa678aee32d44ef9f
a5a7263d1874a3f3b2ad8c9c31420d8cd39d37ea
/src/main/java/com/bin/util/MapUtils.java
591ff386582b829d26038e4c228375801babd900
[]
no_license
hu-git-2000/MongoDB01
5e95a5c2afc747f57420e8415c9c03f72d2ceaa9
6c9d1170e052c3a2079d9ea6a6232677d58c22e8
refs/heads/master
2022-12-29T05:26:00.512715
2020-08-31T11:51:12
2020-08-31T11:51:12
304,902,575
0
0
null
null
null
null
UTF-8
Java
false
false
984
java
package com.bin.util; /** * 工具类 根据经纬度计算距离 (2个坐标值的距离差) */ public class MapUtils { private static double rad(double d) { return d * Math.PI / 180.00; // 角度转换成弧度 } /* * 根据经纬度计算两点之间的距离(单位米) */ public static double algorithm(double longitude1, double latitude1, double longitude2, double latitude2) { double Lat1 = rad(latitude1); // 纬度 double Lat2 = rad(latitude2); double a = Lat1 - Lat2;// 两点纬度之差 double b = rad(longitude1) - rad(longitude2); // 经度之差 double s = 2 * Math.asin(Math .sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(Lat1) * Math.cos(Lat2) * Math.pow(Math.sin(b / 2), 2)));// 计算两点距离的公式 s = s * 6378137.0;// 弧长乘地球半径(半径为米) s = Math.round(s * 10000d) / 10000d;// 精确距离的数值 // 四舍五入 保留一位小数 //DecimalFormat df = new DecimalFormat("#.0"); return s; } }
[ "bin20001115@163.com" ]
bin20001115@163.com
0832f54bec9b6be17731dfc6f583971b275a1352
57f919d68986bf619c764bb3a8d0b7b832d5bb3a
/IndiaBuzzNews/app/src/main/java/com/example/rama/IndiaBuzzNews/FourthActivity_Threading.java
14ce84eec311e386f98dd8f9dd63f856df6631e7
[]
no_license
kondaramakrishna99/IndiaBuzzNews
72ee33318d0981efff811949f5af2ba14ccc11cf
de1d7b6fe7880d6b17f74e675df966409d281db2
refs/heads/master
2021-01-17T05:24:50.096607
2015-08-07T14:52:47
2015-08-07T14:52:47
40,361,425
2
0
null
null
null
null
UTF-8
Java
false
false
16,084
java
package com.example.rama.IndiaBuzzNews; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; public class FourthActivity_Threading extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fourth_activity__threading); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).build(); ImageLoader.getInstance().init(config); MyHttpConnection threadConn=new MyHttpConnection(); String theHindu = "http://www.thehindu.com/?service=rss"; String liveMint = "http://www.livemint.com/rss/homepage"; String timesOfIndia="http://timesofindia.feedsportal.com/c/33039/f/533965/index.rss"; String ddNews="http://www.ddinews.gov.in/rssNews/Pages/rssnews.aspx"; String economicTimes = "http://economictimes.indiatimes.com/rssfeedsdefault.cms"; String businessStandard = "http://www.business-standard.com/rss/latest.rss"; String indianExpress = "http://indianexpress.com/section/india/feed/"; String cnnIBN="http://www.ibnlive.com/xml/top.xml"; String dna = "http://www.dnaindia.com/syndication/rss_topnews.xml"; String ndtv="http://feeds.feedburner.com/NDTV-LatestNews?format=xml"; String bbc="http://feeds.bbci.co.uk/news/rss.xml?edition=int"; String newsPaper = getIntent().getStringExtra("newsPaper"); String url=""; switch (newsPaper){ case "The Hindu": url = theHindu; setTitle("The Hindu"); break; case "Times Of India": url = timesOfIndia; setTitle("Times Of India"); break; case "DD News": url = ddNews; setTitle("DD News"); break; case "Live Mint": url = liveMint; setTitle("Live Mint"); break; case "Economic Times": url = economicTimes; setTitle("Economic Times"); break; case "Business Standard": url = businessStandard; setTitle("Business Standard"); break; case "Indian Express": url = indianExpress; setTitle("Indian Express"); break; case "CNNIBN": url = cnnIBN; setTitle("CNNIBN"); break; case "DNA": url = dna; setTitle("DNA"); break; case "NDTV": url = ndtv; setTitle("NDTV"); break; case "BBC": url = bbc; setTitle("BBC"); break; } threadConn.execute(url); } class MyHttpConnection extends AsyncTask<String, String, ArrayList<RssItem>> { URL url; HttpURLConnection conn; InputStream is; EditText xmlTextBox; String xmlFinal; ArrayList<RssItem> arrayRSS = new ArrayList<RssItem>(); RssItem rss = new RssItem(); @Override protected ArrayList<RssItem> doInBackground(String... params) { try { url = new URL(params[0]); Log.i("url krk",url.toString()); conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod("GET"); conn.connect(); is = conn.getInputStream(); processXML(); /* int read =-1; byte[] buffer = new byte[1024]; ByteArrayOutputStream os = new ByteArrayOutputStream(); while((read=is.read(buffer))!=-1) { os.write(buffer); } os.close(); xmlFinal = new String(os.toByteArray()); Log.i("final XML RK",xmlFinal); publishProgress(xmlFinal); */ } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally{ if(conn!=null) conn.disconnect(); if(is!=null) try { is.close(); } catch (IOException e) { e.printStackTrace(); } } return arrayRSS; } @Override protected void onProgressUpdate(String... values) { super.onProgressUpdate(values); // xmlTextBox = (EditText)findViewById(R.id.editText_XML); //xmlTextBox.setText(values[0]); } public void processXML() { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { DocumentBuilder builder = factory.newDocumentBuilder(); Document xmlDocument = builder.parse(is); Element rootElement = xmlDocument.getDocumentElement(); //Log.d("root Element RKK",rootElement.getTagName()); NodeList itemsList = rootElement.getElementsByTagName("item"); NodeList itemChildren; Node currentItem; Node currentChild; for(int i=0;i<itemsList.getLength();i++) { RssItem rss = new RssItem("","","","",""); currentItem = itemsList.item(i); itemChildren = currentItem.getChildNodes(); //Log.w("ITEM",currentItem.getNodeName()); for(int j=0;j<itemChildren.getLength();j++) { currentChild = itemChildren.item(j); if(currentChild.getNodeName().equalsIgnoreCase("title")) { if(currentChild.getTextContent()!=null) rss.setTitle(currentChild.getTextContent()); } else if(currentChild.getNodeName().equalsIgnoreCase("description")) { if(currentChild.getTextContent()!=null) rss.setDescription(currentChild.getTextContent()); } else if(currentChild.getNodeName().equalsIgnoreCase("link")) { if(currentChild.getTextContent()!=null) rss.setLink(currentChild.getTextContent()); } else if(currentChild.getNodeName().equalsIgnoreCase("pubDate")) { if(currentChild.getTextContent()!=null) { rss.setDate(currentChild.getTextContent()); } } else if(currentChild.getNodeName().equalsIgnoreCase("image")) { if(currentChild.getTextContent()!=null) { rss.setImageUrl(currentChild.getTextContent()); } } //arrayRSS.add(rss); /*Log.i("debug","--------ITEM---------"); //Log.d(" TITLE ",rss.getTitle()); Log.d(" Link ",rss.getLink()); Log.d(" description ",rss.getDescription()); Log.d(" Date ",rss.getDate()); Log.d(" imageURL ",rss.getImageUrl()); */ } arrayRSS.add(i,rss); // Log.i("debug","--------ITEM---------"); // Log.d(" TITLE ",i+" : "+rss.getTitle()); } /* for(int i=0;i<arrayRSS.size();i++) { Log.w("final item num : ",""+i); RssItem temp = arrayRSS.get(i); Log.d(" TITLE ",temp.getTitle()); Log.d(" description ",temp.getDescription()); } */ } catch (Exception e) { e.printStackTrace(); } } @Override protected void onPostExecute(ArrayList<RssItem> tempRss) { super.onPostExecute(tempRss); final ArrayList<RssItem> arrayRSS = tempRss; ListView listview_rss =(ListView)findViewById(R.id.listView_rssparse); //RssNewsAdapter newsadapter = new RssNewsAdapter(FourthActivity_Threading.this,arrayRSS); Log.d("in post execute ", "arrayrss title : "); String[] title = new String[arrayRSS.size()]; String[] description = new String[arrayRSS.size()]; String[] link = new String[arrayRSS.size()]; String[] date = new String[arrayRSS.size()]; String[] imageURL = new String[arrayRSS.size()]; for(int i=0;i<arrayRSS.size();i++) { // Log.w("item num : ",""+i); RssItem temp = arrayRSS.get(i); // Log.d(" TITLE ",temp.getTitle()); // Log.d(" description ",temp.getDescription()); title[i]=temp.getTitle(); description[i] = temp.getDescription(); link[i]= temp.getLink(); date[i] = temp.getDate(); imageURL[i] = temp.getImageUrl(); } RssNewsAdapter newsadapter = new RssNewsAdapter(FourthActivity_Threading.this,imageURL,title,date); listview_rss.setAdapter(newsadapter); //ArrayAdapter<String> tempadapter = new ArrayAdapter<String>(FourthActivity_Threading.this,R.layout.layout_rss,R.id.textview_title,newwsss); //listview_rss.setAdapter(tempadapter); listview_rss.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent i = new Intent(FourthActivity_Threading.this,RssNewsItem.class); i.putExtra("url",arrayRSS.get(position).getLink()); startActivity(i); } }); Log.i("finished", "in getVIew"); } } public class RssItem { String title; String description; String link; String date; String imageUrl; public RssItem() { } public RssItem(String title,String description,String link,String date,String imageURL) { this.title = title; this.description = description; this.link = link ; this.date = date; this.imageUrl = imageURL; } public void setTitle(String title) { this.title = title; } public String getTitle() { if(title!=null) return title; else return "NO TITLE"; } public void setDescription(String description) { this.description = description; } public String getDescription() { if(description!=null) return description; else return "NO DESCRIPTION"; } public void setLink(String link) { this.link = link; } public String getLink() { if(link!=null) return link; else return "NO LINK"; } public void setDate(String date) { this.date = date; } public String getDate() { if(date!=null) return date; else return "NO DATE"; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public String getImageUrl() { if(imageUrl!=null) return imageUrl; else return "NO IMAGE"; } } class RssNewsAdapter extends ArrayAdapter { Context c; String[] imageUrls; String[] titles; String[] date; LayoutInflater inflater; RssNewsAdapter(Context con, String[] imgs, String[] titles, String[] date) { super(con,R.layout.layout_rss,R.id.textview_title,titles); this.c = con; this.date = date; this.titles = titles; this.imageUrls=imgs; inflater = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public View getView(int position, View convertView, ViewGroup parent) { /*LayoutInflater inflater = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = inflater.inflate(R.layout.layout_rss,parent,false); ImageView img = (ImageView)row.findViewById(R.id.postThumb); TextView textView_titles = (TextView)row.findViewById(R.id.textview_title); TextView textView_description =(TextView)row.findViewById(R.id.textview_date); ImageLoader imgload = ImageLoader.getInstance(); imgload.displayImage(imageUrls[position],img); textView_titles.setText(titles[position]); textView_description.setText(date[position]);*/ ViewHolder viewHolder; View row = convertView; if (row==null) { row = inflater.inflate(R.layout.layout_rss,parent,false); viewHolder = new ViewHolder(row); row.setTag(viewHolder); } else { viewHolder = (ViewHolder) row.getTag(); } // RssItem rssitem = arr.get(position); viewHolder.date.setText(date[position]); viewHolder.title.setText(titles[position]); ImageLoader imgload = ImageLoader.getInstance(); imgload.displayImage(imageUrls[position],viewHolder.image); if(viewHolder.image.getDrawable() == null) { viewHolder.image.setImageResource(R.drawable.noimage1); } return row; } } public class ViewHolder { ImageView image; TextView title ; TextView date ; public ViewHolder(View row) { image = (ImageView)row.findViewById(R.id.postThumb); title = (TextView)row.findViewById(R.id.textview_title); date = (TextView)row.findViewById(R.id.textview_date); } } }
[ "kondaramakrishna99@gmail.com" ]
kondaramakrishna99@gmail.com
d8e1c91baf5282c4e0bcf372a9aaaa075d1b5c27
2fc8f1ad6b47994789eab060f86a5f45c2485e24
/GroovyLabSrc/com/nr/cg/Polygon.java
7f5343422ac1d3fb0a45c222e0346fa8dc04e982
[]
no_license
navalsteed/jlabgroovy
4648f80008ae1a8eab92ad31697c4f478b4caf4e
28139e98281502d61bf08b0757acf6dc10011801
refs/heads/master
2021-01-17T07:07:49.349587
2014-01-01T19:37:02
2014-01-01T19:37:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,607
java
package com.nr.cg; import static java.lang.Math.*; /** * geometric polygon * Copyright (C) Numerical Recipes Software 1986-2007 * Java translation Copyright (C) Huang Wen Hui 2012 * * @author hwh * */ public class Polygon { private final static int DIM = 2; private Polygon(){} public static int polywind(final Point[] vt, final Point pt) { for(int i=0;i<vt.length;i++) if(vt[i].dim() != DIM) throw new IllegalArgumentException("Need same dim!"); int i,np, wind = 0; double d0,d1,p0,p1,pt0,pt1; np = vt.length; pt0 = pt.x[0]; pt1 = pt.x[1]; p0 = vt[np-1].x[0]; p1 = vt[np-1].x[1]; for (i=0; i<np; i++) { d0 = vt[i].x[0]; d1 = vt[i].x[1]; if (p1 <= pt1) { if (d1 > pt1 && (p0-pt0)*(d1-pt1)-(p1-pt1)*(d0-pt0) > 0) wind++; } else { if (d1 <= pt1 && (p0-pt0)*(d1-pt1)-(p1-pt1)*(d0-pt0) < 0) wind--; } p0=d0; p1=d1; } return wind; } public static int ispolysimple(final Point[] vt) { for(int i=0;i<vt.length;i++) if(vt[i].dim() != DIM) throw new IllegalArgumentException("Need same dim!"); int i,ii,j,jj,np,schg=0,wind=0; double p0,p1,d0,d1,pp0,pp1,dd0,dd1,t,tp,t1,t2,crs,crsp=0.0; np = vt.length; p0 = vt[0].x[0]-vt[np-1].x[0]; p1 = vt[0].x[1]-vt[np-1].x[1]; for (i=0,ii=1; i<np; i++,ii++) { if (ii == np) ii = 0; d0 = vt[ii].x[0]-vt[i].x[0]; d1 = vt[ii].x[1]-vt[i].x[1]; crs = p0*d1-p1*d0; if (crs*crsp < 0) schg = 1; if (p1 <= 0.0) { if (d1 > 0.0 && crs > 0.0) wind++; } else { if (d1 <= 0.0 && crs < 0.0) wind--; } p0=d0; p1=d1; if (crs != 0.0) crsp = crs; } if (abs(wind) != 1) return 0; if (schg == 0) return (wind>0? 1 : -1); for (i=0,ii=1; i<np; i++,ii++) { if (ii == np) ii=0; d0 = vt[ii].x[0]; d1 = vt[ii].x[1]; p0 = vt[i].x[0]; p1 = vt[i].x[1]; tp = 0.0; for (j=i+1,jj=i+2; j<np; j++,jj++) { if (jj == np) {if (i==0) break; jj=0;} dd0 = vt[jj].x[0]; dd1 = vt[jj].x[1]; t = (dd0-d0)*(p1-d1) - (dd1-d1)*(p0-d0); if (t*tp <= 0.0 && j>i+1) { pp0 = vt[j].x[0]; pp1 = vt[j].x[1]; t1 = (p0-dd0)*(pp1-dd1) - (p1-dd1)*(pp0-dd0); t2 = (d0-dd0)*(pp1-dd1) - (d1-dd1)*(pp0-dd0); if (t1*t2 <= 0.0) return 0; } tp = t; } } return (wind>0? 2 : -2); } }
[ "hendersk101401@yahoo.com@b4fadc4d-074d-6a4d-2736-b2e1b6825370" ]
hendersk101401@yahoo.com@b4fadc4d-074d-6a4d-2736-b2e1b6825370
104d6543e35fcd2532e745a5e164004eebad69e8
71b621c6b87b1a80fb3ea91686cbf508775db06b
/src/main/java/co/usa/reto3/reto3/web/ComputerControlador.java
890ac542a6f2373f02bbc2ae920080e52b257c9d
[]
no_license
adalinarivera/reto5
cf6e6b4bbe3b1a7a99a8497eb995bc914bd062c3
03abc8e102f382d1925240664d11a4ba1c500644
refs/heads/master
2023-08-31T22:51:29.925647
2021-11-09T21:33:13
2021-11-09T21:33:13
426,392,563
0
0
null
null
null
null
UTF-8
Java
false
false
2,030
java
package co.usa.reto3.reto3.web; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import co.usa.reto3.reto3.model.Computer; import co.usa.reto3.reto3.service.ComputerService; @RestController @RequestMapping ("api/Computer") @CrossOrigin (origins = "*", methods = {RequestMethod.GET,RequestMethod.POST,RequestMethod.DELETE,RequestMethod.PUT}) public class ComputerControlador { @Autowired public ComputerService computerService; @GetMapping("/all") public List<Computer>getComputers(){ return computerService.getAll(); } @GetMapping("/{Id}") public Optional<Computer>getComputer(@PathVariable("Id") int id){ return computerService.getComputer(id); } @PostMapping("/save") @ResponseStatus (HttpStatus.CREATED) public Computer save (@RequestBody Computer compu){ return computerService.save(compu); } @PutMapping("/update") @ResponseStatus(HttpStatus.CREATED) public Computer update(@RequestBody Computer compu) { return computerService.update(compu); } @DeleteMapping("/{id}") @ResponseStatus(HttpStatus.NO_CONTENT) public boolean deleteComputer(@PathVariable("id") int id) { return computerService.deleteComputer(id); } }
[ "adalina.rivera.mt@correo.usa.edu.co" ]
adalina.rivera.mt@correo.usa.edu.co
a5635f2c180cfb9b00a82de07e92c32d786e160e
7eb066e5f5621ae190bfb5ca8946141cdeff7f11
/src/main/java/cloud/martinodutto/tpt/security/StatelessAuthenticationFilter.java
d9945dc5843218580625ee7991977b9b33a776cd
[ "MIT" ]
permissive
martinodutto/tennis-personal-tracker
026637b88f492974c4b811497ef66c073590952c
89eef5dde52efa8c216c10734a88a75e310e608b
refs/heads/master
2021-10-08T17:59:10.584840
2018-12-08T12:35:22
2018-12-08T12:35:22
112,785,174
0
0
null
null
null
null
UTF-8
Java
false
false
1,819
java
package cloud.martinodutto.tpt.security; import io.jsonwebtoken.JwtException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Component; import org.springframework.web.filter.GenericFilterBean; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @Component public class StatelessAuthenticationFilter extends GenericFilterBean { private final TokenAuthenticationService tokenAuthenticationService; @Autowired public StatelessAuthenticationFilter(TokenAuthenticationService tokenAuthenticationService) { this.tokenAuthenticationService = tokenAuthenticationService; } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { try { Authentication authentication = tokenAuthenticationService.getAuthentication((HttpServletRequest) servletRequest); SecurityContextHolder.getContext().setAuthentication(authentication); filterChain.doFilter(servletRequest, servletResponse); SecurityContextHolder.getContext().setAuthentication(null); } catch (AuthenticationException | JwtException e) { SecurityContextHolder.clearContext(); ((HttpServletResponse) servletResponse).setStatus(HttpServletResponse.SC_UNAUTHORIZED); } } }
[ "martinodutto@gmail.com" ]
martinodutto@gmail.com
672e6415fa6fee944ecf7b0216af302b80740b3f
5ab026c6a6213e3301b127c9a9456533a694129b
/code/java/1.4.0/opc-ua-java-stack-1.02/src/org/opcfoundation/ua/core/EnumeratedTestType.java
7fdd562d30c455ef26acff7f5502894b822c35a7
[ "Apache-2.0" ]
permissive
wuzhaojie/opcua-training
2071ef1390feb76f1657baa9afa0137fec3bbc48
f9c595fda501778acc1f531cfb5e1a27e192f68d
refs/heads/master
2021-12-26T10:57:55.525000
2021-08-04T15:15:43
2021-08-04T15:15:43
226,808,478
3
0
null
2021-06-04T02:21:48
2019-12-09T07:14:59
Java
UTF-8
Java
false
false
4,390
java
/* ======================================================================== * Copyright (c) 2005-2014 The OPC Foundation, Inc. All rights reserved. * * OPC Foundation MIT License 1.00 * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * The complete license agreement can be found here: * http://opcfoundation.org/License/MIT/1.00/ * ======================================================================*/ package org.opcfoundation.ua.core; import java.util.Collection; import java.util.ArrayList; import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; import org.opcfoundation.ua.builtintypes.Enumeration; import org.opcfoundation.ua.builtintypes.NodeId; import org.opcfoundation.ua.builtintypes.UnsignedInteger; import org.opcfoundation.ua.core.Identifiers; public enum EnumeratedTestType implements Enumeration { Red(1), Yellow(4), Green(5); public static final NodeId ID = Identifiers.EnumeratedTestType; public static EnumSet<EnumeratedTestType> NONE = EnumSet.noneOf( EnumeratedTestType.class ); public static EnumSet<EnumeratedTestType> ALL = EnumSet.allOf( EnumeratedTestType.class ); private final int value; EnumeratedTestType(int value) { this.value = value; } @Override public int getValue() { return value; } private static final Map<Integer, EnumeratedTestType> map; static { map = new HashMap<Integer, EnumeratedTestType>(); for (EnumeratedTestType i : EnumeratedTestType.values()) map.put(i.value, i); } public static EnumeratedTestType valueOf(int value) { return map.get(value); } public static EnumeratedTestType valueOf(Integer value) { return value == null ? null : valueOf(value.intValue()); } public static EnumeratedTestType valueOf(UnsignedInteger value) { return value == null ? null : valueOf(value.intValue()); } public static EnumeratedTestType[] valueOf(int[] value) { EnumeratedTestType[] result = new EnumeratedTestType[value.length]; for(int i=0; i<value.length; i++) result[i] = valueOf(value[i]); return result; } public static EnumeratedTestType[] valueOf(Integer[] value) { EnumeratedTestType[] result = new EnumeratedTestType[value.length]; for(int i=0; i<value.length; i++) result[i] = valueOf(value[i]); return result; } public static EnumeratedTestType[] valueOf(UnsignedInteger[] value) { EnumeratedTestType[] result = new EnumeratedTestType[value.length]; for(int i=0; i<value.length; i++) result[i] = valueOf(value[i]); return result; } public static UnsignedInteger getMask(EnumeratedTestType...list) { int result = 0; for (EnumeratedTestType c : list) result |= c.value; return UnsignedInteger.getFromBits(result); } public static UnsignedInteger getMask(Collection<EnumeratedTestType> list) { int result = 0; for (EnumeratedTestType c : list) result |= c.value; return UnsignedInteger.getFromBits(result); } public static EnumSet<EnumeratedTestType> getSet(UnsignedInteger mask) { return getSet(mask.intValue()); } public static EnumSet<EnumeratedTestType> getSet(int mask) { List<EnumeratedTestType> res = new ArrayList<EnumeratedTestType>(); for (EnumeratedTestType l : EnumeratedTestType.values()) if ( (mask & l.value) == l.value ) res.add(l); return EnumSet.copyOf(res); } }
[ "wuzj@sunwayland.com.cn" ]
wuzj@sunwayland.com.cn
a39f38e4681acad40fcaa37472e82627fc4f7dfe
1c0fd7788057250076b89a2950296c6dd634235f
/src/main/java/org/assertj/core/error/ShouldBeBefore.java
cff47e60ccfb0e70782b9be45acb816a1d6f7a62
[ "Apache-2.0" ]
permissive
cybernetics/assertj-core
ee34de8afd26add2224f8fe64f56302ec972c6a6
15cc375a8975a98cd98f1bc4c1e6b1112094d4b1
refs/heads/master
2021-01-22T12:44:24.856925
2014-02-23T21:40:10
2014-02-23T21:40:10
17,436,955
1
0
null
null
null
null
UTF-8
Java
false
false
2,700
java
/* * Created on Oct 18, 2010 * * 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. * * Copyright @2010-2011 the original author or authors. */ package org.assertj.core.error; import static org.assertj.core.util.Dates.parse; import java.util.Date; import org.assertj.core.internal.*; /** * Creates an error message indicating that an assertion that verifies that a {@link Date} is before another one failed. * * @author Joel Costigliola */ public class ShouldBeBefore extends BasicErrorMessageFactory { /** * Creates a new </code>{@link ShouldBeBefore}</code>. * @param actual the actual value in the failed assertion. * @param other the value used in the failed assertion to compare the actual value to. * @param comparisonStrategy the {@link ComparisonStrategy} used to evaluate assertion. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldBeBefore(Date actual, Date other, ComparisonStrategy comparisonStrategy) { return new ShouldBeBefore(actual, other, comparisonStrategy); } /** * Creates a new </code>{@link ShouldBeBefore}</code>. * @param actual the actual value in the failed assertion. * @param other the value used in the failed assertion to compare the actual value to. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldBeBefore(Date actual, Date other) { return new ShouldBeBefore(actual, other, StandardComparisonStrategy.instance()); } /** * Creates a new </code>{@link ShouldBeBefore}</code>. * @param actual the actual value in the failed assertion. * @param year the year to compare the actual date's year to. * @return the created {@code ErrorMessageFactory}. */ public static ErrorMessageFactory shouldBeBefore(Date actual, int year) { Date januaryTheFirstOfGivenYear = parse(year + "-01-01"); return new ShouldBeBefore(actual, januaryTheFirstOfGivenYear, StandardComparisonStrategy.instance()); } private ShouldBeBefore(Date actual, Date other, ComparisonStrategy comparisonStrategy) { super("\nExpecting:\n <%s>\nto be strictly before:\n <%s>%s", actual, other, comparisonStrategy); } }
[ "joel.costigliola@gmail.com" ]
joel.costigliola@gmail.com
08caf5e048a26757458b0d003a99bce344e16446
54d2ff6d47a6f65655dd564b2a446dc81bb93c53
/src/c10_04/study/com/TestParcel.java
13ce42a03d8c28bc0b60e252307b8c4ac415a9d5
[]
no_license
WXB506/ThinkInJava
b3ce8df6127eb68f4b63319e23986e48d07e09f5
d975baa13da9df5cc2036641ef6f6395b8b7cfd8
refs/heads/master
2021-01-10T14:36:10.370748
2016-04-24T15:31:26
2016-04-24T15:31:26
54,129,877
0
0
null
null
null
null
UTF-8
Java
false
false
878
java
package c10_04.study.com; interface Contents { int value(); } interface Destination { String readLabel(); } class Parcel4 { private class PContents implements Contents { private int i = 11; public int value() { return i; } } protected class PDestination implements Destination { private String label; private PDestination(String whereTo) { label = whereTo; } public String readLabel() { return label; } } public Destination destination(String s) { return new PDestination(s); } public Contents contents() { return new PContents(); } } public class TestParcel { public static void main(String[] args) { Parcel4 parcel4 = new Parcel4(); Contents contents = parcel4.contents(); Destination destination = parcel4.destination("Tasmania"); System.out.println(contents.value()); System.out.println(destination.readLabel()); } }
[ "1922686887@qq.com" ]
1922686887@qq.com
889d4bde6af8ac616d3d443cadf9032806a3dfb4
64ab24706765596fff6a64207dcdf5b1f520bf44
/src/marisol/deo/camera/Camera_Logic.java
6301de5738ac2c2c28df3085cdf1d6915c7584dc
[ "MIT" ]
permissive
arpablue/marisol
f5ce763b57936b73bcb00b48b13cd8c47c8699d2
0fbd910f1bf73815c08ccf78529ede99121d02f8
refs/heads/main
2023-07-13T04:52:37.347564
2021-08-23T00:16:27
2021-08-23T00:16:27
398,435,904
0
0
null
null
null
null
UTF-8
Java
false
false
713
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 marisol.deo.camera; /** * * @author Augusto Flores */ class Camera_Logic extends Camera_DAO { /** * It return a different canera object, but with the sale values of the current object. * @return It is copy of the current object. */ public Camera copy() { Camera res = new Camera(); res.setId( this.getId()); res.setName(this.getName()); res.setFullName( this.getFullName() ); res.setRoverId(this.getRoverId()); return res; } }
[ "eng.aug.flores@gmail.com" ]
eng.aug.flores@gmail.com
fd89e0756e6ce314ab6bfa69d427799fa1fc1021
ef0c1514e9af6de3ba4a20e0d01de7cc3a915188
/sdk/resourcemanager/azure-resourcemanager-sql/src/main/java/com/azure/resourcemanager/sql/models/DiffBackupIntervalInHours.java
3335b9c4978b8816eb63b933c8863743743d9db3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "CC0-1.0", "BSD-3-Clause", "UPL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-generic-cla" ]
permissive
Azure/azure-sdk-for-java
0902d584b42d3654b4ce65b1dad8409f18ddf4bc
789bdc6c065dc44ce9b8b630e2f2e5896b2a7616
refs/heads/main
2023-09-04T09:36:35.821969
2023-09-02T01:53:56
2023-09-02T01:53:56
2,928,948
2,027
2,084
MIT
2023-09-14T21:37:15
2011-12-06T23:33:56
Java
UTF-8
Java
false
false
1,551
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.sql.models; import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** * The differential backup interval in hours. This is how many interval hours between each differential backup will be * supported. This is only applicable to live databases but not dropped databases. */ public final class DiffBackupIntervalInHours extends ExpandableStringEnum<DiffBackupIntervalInHours> { /** Static value 12 for DiffBackupIntervalInHours. */ public static final DiffBackupIntervalInHours ONE_TWO = fromInt(12); /** Static value 24 for DiffBackupIntervalInHours. */ public static final DiffBackupIntervalInHours TWO_FOUR = fromInt(24); /** * Creates or finds a DiffBackupIntervalInHours from its string representation. * * @param name a name to look for. * @return the corresponding DiffBackupIntervalInHours. */ @JsonCreator public static DiffBackupIntervalInHours fromInt(int name) { return fromString(String.valueOf(name), DiffBackupIntervalInHours.class); } /** * Gets known DiffBackupIntervalInHours values. * * @return known DiffBackupIntervalInHours values. */ public static Collection<DiffBackupIntervalInHours> values() { return values(DiffBackupIntervalInHours.class); } }
[ "noreply@github.com" ]
noreply@github.com
f34c4e08afd87df7352ef08fa40a1f67c61ce805
99b40270b63a45c380edc29d1933fc64bd303d85
/src/java/linhnq/servlets/LoginServlet.java
228d418709500e04bc13839c7016f63654524aaf
[]
no_license
quoclinh121/J3.L.P0014
1c958ede4182fc3709e6dd569e451c20ea1e9d6b
edff4d8152ae16f1d96bbb2f5f39364ad17a75f4
refs/heads/master
2023-04-13T00:28:50.010827
2021-04-11T13:37:09
2021-04-11T13:37:09
356,874,246
0
0
null
null
null
null
UTF-8
Java
false
false
4,070
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 linhnq.servlets; import java.io.IOException; 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; import javax.servlet.http.HttpSession; import linhnq.daos.TblUsersDAO; import linhnq.dtos.TblUsersDTO; import linhnq.utils.HashSHA256; import org.apache.log4j.Logger; /** * * @author quocl */ @WebServlet(name = "LoginServlet", urlPatterns = {"/LoginServlet"}) public class LoginServlet extends HttpServlet { private static final Logger LOGGER = Logger.getLogger(LoginServlet.class); private final String ADMIN_PAGE = "admin_page.jsp"; private final String STUDENT_PAGE = "LoadAllQuizHistoryServlet"; private final String INVALID = "login.jsp"; /** * 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"); String url = INVALID; try { String email = request.getParameter("txtEmail"); String password = request.getParameter("txtPassword"); //Hash SHA256 password = HashSHA256.toHexString(HashSHA256.getSHA(password)); TblUsersDAO dao = new TblUsersDAO(); TblUsersDTO user = dao.checkLogin(email, password); if(user != null) { HttpSession session = request.getSession(); session.setAttribute("LOGIN_USER", user); if("admin".equals(user.getRole())) { url = ADMIN_PAGE; } else { url = STUDENT_PAGE; } } else { request.setAttribute("INVALID_ACCOUNT", "Invalid email or password!"); } } catch (Exception e) { LOGGER.error(e); } finally { RequestDispatcher rd = request.getRequestDispatcher(url); rd.forward(request, response); } } // <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 { processRequest(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 { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "" ]
c018a884dd2f2a396274344b3799fbc217c33bc4
7eaccafcf6128f4abd3cd4d7eacef8cac9fd3394
/salescloud-mobile/src/main/java/dk/jyskit/salescloud/application/pages/wifiadditionalinfo/WiFiAdditionalInfo.java
58db90100d61fa8c804ed889492ec2bb3700f4e1
[]
no_license
JayRox1605/salescloudtestoneplus
d83f5f039c3f731806acd7b4d044129c1ee35f54
bfa2c8dcbe9cb126b3a6dee556188edc61d91989
refs/heads/master
2022-12-05T10:42:40.636879
2020-08-13T19:16:55
2020-08-13T19:16:55
291,664,159
0
0
null
2020-08-31T09:06:03
2020-08-31T08:53:44
HTML
UTF-8
Java
false
false
242
java
package dk.jyskit.salescloud.application.pages.wifiadditionalinfo; import org.apache.wicket.util.value.ValueMap; /* * Only exists for namespace -> CoreApplication.properties lookup */ public class WiFiAdditionalInfo extends ValueMap { }
[ "jan@jyskit.dk" ]
jan@jyskit.dk
646891a3406911e8398f4378fc3318678e8af7d5
02df4492cd1c4bf1d92c08e12acca8b10a5da3ff
/tpv-ejb/src/main/java/com/tesis/tpv/ejb/CategoryBean.java
e1c89c737621c7bb822ec983fb8ac8098424a5e1
[]
no_license
modemm3/tpv-tesis
ade9fd6ed8d5aea66fcbc908ed6b9357ff260bcb
afe4822612004eb5d53ee0a102a2cb358d399000
refs/heads/master
2021-01-20T02:57:31.233582
2018-11-04T20:23:01
2018-11-04T20:23:01
89,475,752
0
0
null
null
null
null
UTF-8
Java
false
false
5,696
java
package com.tesis.tpv.ejb; import java.util.ArrayList; import java.util.List; import javax.ejb.Stateless; import javax.ejb.TransactionManagement; import javax.ejb.TransactionManagementType; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import javax.persistence.TransactionRequiredException; import javax.transaction.TransactionalException; import org.postgresql.util.PSQLException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.tesis.remote.CategoryRemote; import com.tesis.tpv.dto.CategoryDTO; import com.tesis.tpv.dto.MessageResponseDTO; import com.tesis.tpv.ejb.builder.config.TransferObjectAssembler; import com.tesis.tpv.jpa.Category; @Stateless(mappedName="CategoryBean") @TransactionManagement(TransactionManagementType.CONTAINER) public class CategoryBean implements CategoryRemote { private static Logger log=LoggerFactory.getLogger(CategoryBean.class); @PersistenceContext private EntityManager entityManager; @Override public MessageResponseDTO save(final CategoryDTO categoryDTO) { MessageResponseDTO messageResponseDTO=new MessageResponseDTO(); try{ Category category=new Category(); category.setName(categoryDTO.getName()); category.setDescription(categoryDTO.getDescription()); entityManager.persist(category); messageResponseDTO.setCode(1); messageResponseDTO.setMessage("success"); }catch(Exception e){ e.printStackTrace(); messageResponseDTO.setCode(-1); messageResponseDTO.setMessage("failed"); } return messageResponseDTO; } @Override public MessageResponseDTO delete(final Integer idCategory) { MessageResponseDTO messageResponseDTO=new MessageResponseDTO(); try { Category category=new Category(); category=entityManager.find(Category.class, idCategory); if(category!=null){ entityManager.remove(category); messageResponseDTO.setCode(1); messageResponseDTO.setMessage("success"); messageResponseDTO.setIdTransaction(idCategory); }else{ messageResponseDTO.setCode(-1); messageResponseDTO.setMessage("No existe el registro especificado para eliminar"); } }catch(TransactionRequiredException e){ e.printStackTrace(); log.error("Ocurrio error al eliminar el registro"); messageResponseDTO=new MessageResponseDTO(); messageResponseDTO.setCode(-1); messageResponseDTO.setMessage("El dato no puede ser eliminado, verifique que no se este utilizando"); } return messageResponseDTO; } @Override public MessageResponseDTO update(final CategoryDTO categoryDTO) { MessageResponseDTO messageResponseDTO=new MessageResponseDTO(); try{ Category category=new Category(); category=entityManager.find(category.getClass(), categoryDTO.getId()); if(category!=null){ category.setName(categoryDTO.getName()); category.setDescription(categoryDTO.getDescription()); entityManager.merge(category); messageResponseDTO.setCode(1); messageResponseDTO.setMessage("success"); }else{ messageResponseDTO.setCode(-1); messageResponseDTO.setMessage("No existe el registro especificado para actualizar"); } }catch(Exception e){ e.printStackTrace(); messageResponseDTO.setCode(-1); messageResponseDTO.setMessage("failed"); } return messageResponseDTO; } public CategoryDTO getCategory(final Integer idCategory) { Category category=new Category(); CategoryDTO categoryDTO=new CategoryDTO(); category=entityManager.find(category.getClass(), idCategory); if(category!=null){ categoryDTO=TransferObjectAssembler.getInstance().assembleTO(categoryDTO.getClass(), category); } return categoryDTO; } /* @Override public MessageResponseDTO getCategory(Integer idCategory) { MessageResponseDTO message=new MessageResponseDTO(); Category category=new Category(); CategoryDTO categoryDTO=new CategoryDTO(); category=entityManager.find(category.getClass(), idCategory); if(category!=null){ categoryDTO=TransferObjectAssembler.getInstance().assembleTO(categoryDTO.getClass(), category); } message.setCode(1); message.setMessage("hola"); return message; }*/ @SuppressWarnings("unchecked") @Override public List<CategoryDTO> getList() { CategoryDTO categoryDTO=new CategoryDTO(); List<CategoryDTO> categoryLstDTO=new ArrayList<CategoryDTO>(); List<Category> categoryLst= entityManager.createQuery("Category.getAll").getResultList(); if(categoryLst!=null && categoryLst.size()>0){ for(Category category: categoryLst){ categoryDTO=TransferObjectAssembler.getInstance().assembleTO(categoryDTO.getClass(), category); categoryLstDTO.add(categoryDTO); } } return categoryLstDTO; } @Override public List<CategoryDTO> getPagination(final Integer pageInit,final Integer pageEnd) { CategoryDTO categoryDTO=new CategoryDTO(); List<CategoryDTO> categoryDTOLst=new ArrayList<CategoryDTO>(); Query query=entityManager.createNamedQuery("Category.getAll"); query.setMaxResults(pageEnd); query.setFirstResult(pageInit); List<Category> categoryLst=query.getResultList(); if(categoryLst!=null && categoryLst.size()>0){ for(Category category:categoryLst){ categoryDTO=TransferObjectAssembler.getInstance().assembleTO(categoryDTO.getClass(), category); categoryDTOLst.add(categoryDTO); } } System.out.println("Se imprime la lista de categorias en paginacion: "+ categoryDTOLst); return categoryDTOLst; } @Override public Integer numberRecords() { Query query; Integer count=0; query=entityManager.createNamedQuery("Category.getCount"); count=((Long)query.getSingleResult()).intValue(); return count; } }
[ "developer@MacBook-Pro-de-esperanza.local" ]
developer@MacBook-Pro-de-esperanza.local
b9d05931cf092d435cb571486afbf2adae315a26
eac990b5cfc316eff1841d1f7e71d59c35e1ae42
/spectra-cluster-hadoop/branches/development/src/main/java/uk/ac/ebi/pride/spectracluster/hadoop/SpectrumInClustererRecombineReducer.java
e0a570b82ad0839ce5b7c4cc1e4e1cdce84eadda
[]
no_license
lordjoe/spectra-cluster
a0d58299ead2c0484f233a5e0aa38734e034ecd9
776bc8a4beb3ccc4cdd9e837e2d8b445feb151b1
refs/heads/master
2021-01-10T08:13:40.079514
2015-02-13T10:57:59
2015-02-13T10:57:59
46,876,377
0
0
null
null
null
null
UTF-8
Java
false
false
3,383
java
package uk.ac.ebi.pride.spectracluster.hadoop; import org.apache.hadoop.io.*; import org.systemsbiology.hadoop.*; import uk.ac.ebi.pride.spectracluster.cluster.*; import uk.ac.ebi.pride.spectracluster.keys.*; import uk.ac.ebi.pride.spectracluster.spectrum.*; import uk.ac.ebi.pride.spectracluster.util.*; import javax.annotation.*; import java.io.*; import java.util.*; /** * uk.ac.ebi.pride.spectracluster.hadoop.SpectrumInClustererRecombineReducer * <p/> * Merge spectra with unstable clusters */ public class SpectrumInClustererRecombineReducer extends AbstractParameterizedReducer { private boolean spectrumInBestCluster; @Override protected void setup(final Context context) throws IOException, InterruptedException { super.setup(context); ISetableParameterHolder application = getApplication(); spectrumInBestCluster = application.getBooleanParameter(ClusterUtilities.PLACE_SPECTRUM_IN_BEST_CLUSTER,false); } @SuppressWarnings("UnusedDeclaration") public boolean isSpectrumInBestCluster() { return spectrumInBestCluster; } @Override public void reduceNormal(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException { SpectralCluster sc = new SpectralCluster(); Set<String> processedSpectrunIds = new HashSet<String>(); // Note this will not be large so memory requirements are ok for (Text tv : values) { String value = tv.toString(); LineNumberReader rdr = new LineNumberReader((new StringReader(value))); SpectrumInCluster sci2 = ClusterUtilities.readSpectrumInCluster(rdr); IPeptideSpectrumMatch spectrum = sci2.getSpectrum(); String id = spectrum.getId(); if (!sci2.isRemoveFromCluster()) { sc.addSpectra(spectrum); } else { // handle spectra kicked out if (!processedSpectrunIds.contains(id)) { ISpectralCluster cluster = spectrum.asCluster(); writeOneVettedCluster(context, cluster); } else { System.out.println("duplicate id " + id); } } processedSpectrunIds.add(id); } if (sc.getClusteredSpectraCount() == 0) return; writeOneVettedCluster(context, sc); } /** * this version of writeCluster does all the real work * * @param context * @param cluster * @throws IOException * @throws InterruptedException */ protected void writeOneVettedCluster(@Nonnull final Context context, @Nonnull final ISpectralCluster cluster) throws IOException, InterruptedException { if (cluster.getClusteredSpectraCount() == 0) return; // empty dont bother ChargeMZKey key = new ChargeMZKey(cluster.getPrecursorCharge(), cluster.getPrecursorMz()); StringBuilder sb = new StringBuilder(); cluster.append(sb); String string = sb.toString(); if (string.length() > SpectraHadoopUtilities.MIMIMUM_CLUSTER_LENGTH) { writeKeyValue(key.toString(), string, context); } } }
[ "lordjoe2000@gmail.com" ]
lordjoe2000@gmail.com
ec6b4e4b8b059b04c684837c950ae8fb62c402e4
96342d1091241ac93d2d59366b873c8fedce8137
/java/com/l2jolivia/gameserver/model/zone/type/L2JumpZone.java
9a13bda7917beb8d707722e5c60933f3d214b665
[]
no_license
soultobe/L2JOlivia_EpicEdition
c97ac7d232e429fa6f91d21bb9360cf347c7ee33
6f9b3de9f63d70fa2e281b49d139738e02d97cd6
refs/heads/master
2021-01-10T03:42:04.091432
2016-03-09T06:55:59
2016-03-09T06:55:59
53,468,281
0
1
null
null
null
null
UTF-8
Java
false
false
3,157
java
/* * This file is part of the L2J Olivia project. * * 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 com.l2jolivia.gameserver.model.zone.type; import java.util.HashMap; import java.util.Map; import java.util.concurrent.Future; import com.l2jolivia.Config; import com.l2jolivia.gameserver.ThreadPoolManager; import com.l2jolivia.gameserver.model.actor.L2Character; import com.l2jolivia.gameserver.model.actor.instance.L2PcInstance; import com.l2jolivia.gameserver.model.zone.L2ZoneType; import com.l2jolivia.gameserver.model.zone.ZoneId; import com.l2jolivia.gameserver.network.serverpackets.ExNotifyFlyMoveStart; /** * L2JumpZone zones * @author ALF (r2max) */ public class L2JumpZone extends L2ZoneType { private final Map<Integer, Future<?>> _task = new HashMap<>(); private final int _startTask; private final int _reuseTask; private int _trackId; public L2JumpZone(int id) { super(id); _startTask = 10; _reuseTask = 500; _trackId = -1; } @Override public void setParameter(String name, String value) { if (name.equals("trackId")) { _trackId = Integer.parseInt(value); } else { super.setParameter(name, value); } } public int getTrackId() { return _trackId; } @Override protected void onEnter(L2Character character) { if (!isInsideZone(character)) { return; } if (character.isPlayer()) { character.setInsideZone(ZoneId.JUMP, true); } if (character instanceof L2PcInstance) { final L2PcInstance plr = (L2PcInstance) character; if (!plr.isAwaken() && !Config.FREE_JUMPS_FOR_ALL) { return; } stopTask(plr); _task.put(plr.getObjectId(), ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new JumpReq(plr), _startTask, _reuseTask)); } } @Override protected void onExit(L2Character character) { if (character.isPlayer()) { character.setInsideZone(ZoneId.JUMP, false); } stopTask(character); } @Override public void onDieInside(L2Character character) { onExit(character); } @Override public void onReviveInside(L2Character character) { onEnter(character); } protected void stopTask(L2Character character) { final int poid = character.getObjectId(); final Future<?> t = _task.get(poid); _task.remove(poid); if (t != null) { t.cancel(false); } } class JumpReq implements Runnable { private final L2PcInstance player; JumpReq(L2PcInstance pl) { player = pl; } @Override public void run() { player.sendPacket(new ExNotifyFlyMoveStart()); } } }
[ "kim@tsnet-j.co.jp" ]
kim@tsnet-j.co.jp
025d95b095d24edf325ced5d1e566d7af745506a
964601fff9212bec9117c59006745e124b49e1e3
/matos-android/src/main/java/android/view/DragEvent.java
0cebb266b567d2cfd8e9a4b76d4bfa7edd40d29e
[ "Apache-2.0" ]
permissive
vadosnaprimer/matos-profiles
bf8300b04bef13596f655d001fc8b72315916693
fb27c246911437070052197aa3ef91f9aaac6fc3
refs/heads/master
2020-05-23T07:48:46.135878
2016-04-05T13:14:42
2016-04-05T13:14:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,207
java
package android.view; /* * #%L * Matos * $Id:$ * $HeadURL:$ * %% * Copyright (C) 2010 - 2014 Orange SA * %% * 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. * #L% */ public class DragEvent implements android.os.Parcelable { // Fields public static final int ACTION_DRAG_STARTED = 1; public static final int ACTION_DRAG_LOCATION = 2; public static final int ACTION_DROP = 3; public static final int ACTION_DRAG_ENDED = 4; public static final int ACTION_DRAG_ENTERED = 5; public static final int ACTION_DRAG_EXITED = 6; public static final android.os.Parcelable.Creator<DragEvent> CREATOR = null; // Constructors private DragEvent(){ } // Methods public java.lang.String toString(){ return (java.lang.String) null; } public void writeToParcel(android.os.Parcel arg1, int arg2){ } public int describeContents(){ return 0; } public float getX(){ return 0.0f; } public float getY(){ return 0.0f; } public int getAction(){ return 0; } public static DragEvent obtain(int arg1, float arg2, float arg3, java.lang.Object arg4, android.content.ClipDescription arg5, android.content.ClipData arg6, boolean arg7){ return (DragEvent) null; } public static DragEvent obtain(DragEvent arg1){ return (DragEvent) null; } public final void recycle(){ } public boolean getResult(){ return false; } public android.content.ClipData getClipData(){ return (android.content.ClipData) null; } public java.lang.Object getLocalState(){ return (java.lang.Object) null; } public android.content.ClipDescription getClipDescription(){ return (android.content.ClipDescription) null; } }
[ "pierre.cregut@orange.com" ]
pierre.cregut@orange.com
a9c3ab447386ef92ba3cb1319d96dfb66dcff53b
e73d65c0d642b832dfd36c8cb44520f7b89cde5d
/app/src/main/java/com/aci/yamaha/yamahacustomerarsenal/model/ServiceResponse.java
879a02482508ebf9c7852ae3af481bb1aaa0f944
[]
no_license
ash018/YAMAHACustomerArsenal
ed21da0a67ca87ab00937f2e6c67eff7c8eb6d37
0c024da1725e859580a804a969a9a92768562f83
refs/heads/master
2020-04-17T21:10:31.222807
2019-01-22T06:16:17
2019-01-22T06:16:17
166,937,210
0
0
null
null
null
null
UTF-8
Java
false
false
1,313
java
package com.aci.yamaha.yamahacustomerarsenal.model; /** * Created by aburasel on 11/5/2017. */ import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.util.List; public class ServiceResponse { @SerializedName("success") @Expose private Integer success; @SerializedName("message") @Expose private String message; @SerializedName("services") @Expose private List<Service> services = null; public Integer getSuccess() { return success; } public void setSuccess(Integer success) { this.success = success; } public ServiceResponse withSuccess(Integer success) { this.success = success; return this; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public ServiceResponse withMessage(String message) { this.message = message; return this; } public List<Service> getServices() { return services; } public void setServices(List<Service> services) { this.services = services; } public ServiceResponse withServices(List<Service> services) { this.services = services; return this; } }
[ "smakash@aci-bd.com" ]
smakash@aci-bd.com
0aa6ce3b3786dd683ea2a935f0924ea7e19c4674
28359f43c0768cf75eca6516928a2cd575c5b966
/mall-pms/pms-api/src/main/java/com/youlai/mall/pms/pojo/dto/InventoryDTO.java
9abd03b7578d6a3f3c166249bef3d8755a7a8998
[ "Apache-2.0" ]
permissive
JueMiaoShen/youlai-mall
4ae6c50bc8ae02668c5703e9c9cfd58323851ebc
5afe6fad2ffa56e875004b59e98a1388f605da2d
refs/heads/master
2023-03-17T12:08:10.498572
2021-03-10T16:30:21
2021-03-10T16:30:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
580
java
package com.youlai.mall.pms.pojo.dto; import lombok.Data; /** * @author huawei * @desc * @email huawei_code@163.com * @date 2021/1/13 */ @Data public class InventoryDTO { private Long id; private String code; private String name; private String pic; private Long originPrice; private Long price; private Integer inventory; private Long spuId; private String productName; private String productPic; private Long brandId; private String brandName; private Long categoryId; private String categoryName; }
[ "1490493387@qq.com" ]
1490493387@qq.com
75922b12d766efaf2d5832787610e8669e38d61a
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-waf/src/main/java/com/amazonaws/services/waf/model/waf_regional/transform/DeletePermissionPolicyRequestProtocolMarshaller.java
6f03471edb155bcfa0b9395fa18692249c60ca7b
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
2,808
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.waf.model.waf_regional.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.Request; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.waf.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.protocol.*; import com.amazonaws.protocol.Protocol; import com.amazonaws.annotation.SdkInternalApi; /** * DeletePermissionPolicyRequest Marshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class DeletePermissionPolicyRequestProtocolMarshaller implements Marshaller<Request<DeletePermissionPolicyRequest>, DeletePermissionPolicyRequest> { private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.AWS_JSON).requestUri("/") .httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true) .operationIdentifier("AWSWAF_Regional_20161128.DeletePermissionPolicy").serviceName("AWSWAFRegional").build(); private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory; public DeletePermissionPolicyRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) { this.protocolFactory = protocolFactory; } public Request<DeletePermissionPolicyRequest> marshall(DeletePermissionPolicyRequest deletePermissionPolicyRequest) { if (deletePermissionPolicyRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { final ProtocolRequestMarshaller<DeletePermissionPolicyRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING, deletePermissionPolicyRequest); protocolMarshaller.startMarshalling(); DeletePermissionPolicyRequestMarshaller.getInstance().marshall(deletePermissionPolicyRequest, protocolMarshaller); return protocolMarshaller.finishMarshalling(); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
568c34e5457f283bc248c4a718a2dbb09865dae5
9fc7f7dcf986e5aa47181d13cc0e60d1854d2263
/src/main/java/engine/repository/AccountRepository.java
6cf8ed060a5d76ae208428ee75b583365edc9efe
[]
no_license
kazokmr/hs-WebQuizEngine
7a563db15f60aa0db301910b6961cf6049d919b8
84bf4481637f15bad4b943870a487289dfc8a0cd
refs/heads/main
2023-01-07T06:27:40.795242
2020-11-08T10:04:33
2020-11-08T10:04:33
311,033,326
1
0
null
null
null
null
UTF-8
Java
false
false
271
java
package engine.repository; import engine.entity.Account; import org.springframework.data.repository.CrudRepository; import java.util.Optional; public interface AccountRepository extends CrudRepository<Account, Long> { Optional<Account> findByEmail(String email); }
[ "engkokmr@gmail.com" ]
engkokmr@gmail.com