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
d64ed7927fee679883a9d1e23d2ccc998c53ce05
ada0c9168deedece91162b5c2a3908c61626caaa
/src/telas/NotaSaida/ListaProdutoSaidaBeanTableModel.java
4e4e5f895cf408fc871dbd9ca8c363c751882462
[]
no_license
julioizidoro/jgdynamic
52464107c48c43708eb91637ee82dad7d321bc89
11735a498712f902409688d30963a79a7c990c9d
refs/heads/master
2020-04-12T01:33:54.980169
2019-04-25T18:54:38
2019-04-25T18:54:38
30,019,734
0
0
null
null
null
null
UTF-8
Java
false
false
3,160
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package telas.NotaSaida; import Regras.Formatacao; import java.util.List; import javax.swing.table.AbstractTableModel; /** * * @author wolverine */ public class ListaProdutoSaidaBeanTableModel extends AbstractTableModel{ private List<NotaSaidaProdutoBean> listaProdutoBean; private String[] colunas ={"Código", "Descrição", "Unidade", "NCM", "CEST", "Quantidade", "Valor Unitário", "Valor Total", "Valor Desconto", "Valor Outros" ,"Situação"}; public ListaProdutoSaidaBeanTableModel(List<NotaSaidaProdutoBean> listaProdutoBean) { this.listaProdutoBean = listaProdutoBean; } public int getRowCount() { return listaProdutoBean.size(); } public int getColumnCount() { return colunas.length; } public Object getValueAt(int rowIndex, int columnIndex) { if (columnIndex==0){ return listaProdutoBean.get(rowIndex).getProduto().getReferencia(); }else if (columnIndex==1){ return listaProdutoBean.get(rowIndex).getProduto().getDescricao(); }else if (columnIndex==2){ return listaProdutoBean.get(rowIndex).getProduto().getUnidade(); }else if (columnIndex==3){ return listaProdutoBean.get(rowIndex).getProduto().getNcm(); }else if (columnIndex==4){ return listaProdutoBean.get(rowIndex).getProduto().getCest(); }else if (columnIndex==5){ return Formatacao.foramtarQuantidade(listaProdutoBean.get(rowIndex).getQuantidade()); }else if (columnIndex==6){ return Formatacao.foramtarDoubleString(listaProdutoBean.get(rowIndex).getValorUnitario()); }else if (columnIndex==7){ return Formatacao.foramtarDoubleString(listaProdutoBean.get(rowIndex).getValortotal()); }else if (columnIndex==8){ return Formatacao.foramtarDoubleString(listaProdutoBean.get(rowIndex).getValorDesconto()); }else if (columnIndex==9){ return Formatacao.foramtarDoubleString(listaProdutoBean.get(rowIndex).getValoracessorios()); }else return listaProdutoBean.get(rowIndex).getSituacao(); } @Override public String getColumnName(int column) { return colunas[column]; } @Override public Class<?> getColumnClass(int columnIndex) { if (columnIndex==0){ return Integer.class; } else if (columnIndex==1){ return String.class; }else if (columnIndex==2){ return String.class; }else if (columnIndex==3){ return String.class; }else if (columnIndex==4){ return String.class; }else if (columnIndex==5){ return String.class; }else if (columnIndex==6){ return String.class; }else if (columnIndex==7){ return String.class; }else if (columnIndex==8){ return String.class; }else return String.class; } }
[ "jizidoro@globo.com" ]
jizidoro@globo.com
353e4d80b1aa7bd9c1d296cea36ea03c88dc4672
ea4a4a70ca7e7396053d90d52c0c141d86b3ec16
/src/main/java/com/loniks/letsgo/domain/TicketEntity.java
1e524a1b562d488a20e8695bdd03d2a06b470de8
[ "Apache-2.0" ]
permissive
Loniks/LetsGo
97d19a2d073c53406a98759f2865463928b3193e
9a8f6906c2c641ce40f7727d8958aa0c09c82087
refs/heads/master
2023-04-30T14:11:24.109150
2020-11-25T19:50:12
2020-11-25T19:50:12
79,941,686
0
1
Apache-2.0
2023-04-17T20:58:18
2017-01-24T18:39:29
JavaScript
UTF-8
Java
false
false
820
java
package com.loniks.letsgo.domain; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; import javax.persistence.*; /** * @author Bondar Dmytro */ @Data @Entity @Table(name = "tickets") @AllArgsConstructor @NoArgsConstructor public class TicketEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name="status") @Enumerated(EnumType.STRING) private TicketStatus status; @ManyToOne @OnDelete(action = OnDeleteAction.CASCADE) @JoinColumn(name = "owner") private VisitorEntity owner; @ManyToOne @OnDelete(action = OnDeleteAction.CASCADE) @JoinColumn(name = "event") private EventEntity event; }
[ "work.bondar@gmail.com" ]
work.bondar@gmail.com
bcef0e11db3261ab0b886ebd91962c4e5c8a8547
a75d31d3a2466bc92233f7494adf503a79de05ce
/src/main/java/org/mifos/ussd/MifosUssdApplication.java
428ffc29439a56cb7f44330a034d5909b29231a5
[]
no_license
openMF/ussd-app
b5ad71a92e2014c97713091188ac3b8907dad192
9fc6b8e44b0212cd01355aecc45db7821cab22e1
refs/heads/master
2022-07-12T14:42:23.932699
2020-07-12T15:55:44
2020-07-12T15:55:44
78,035,460
5
16
null
2020-05-15T02:24:27
2017-01-04T17:02:51
Java
UTF-8
Java
false
false
325
java
package org.mifos.ussd; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class MifosUssdApplication { public static void main(String[] args) { SpringApplication.run(MifosUssdApplication.class, args); } }
[ "antony.omeri@dtone.com" ]
antony.omeri@dtone.com
248d0669eb57f7d67771e38f45d95f9e13911fd3
aed9a76e700affb78211a89db311fc88191ba9da
/js相关/SampleAndroidProject/src/com/phonegap/sample/MainActivity.java
b2db9723186dd4822df99e5e8bbb06d25f5856fd
[]
no_license
laiqurufeng/jidiao
52bd95707285c6bc81064237b3c33969081125ef
f934c6beaed3718269fa80915491afe2cfd96ff7
refs/heads/master
2021-01-23T19:13:12.108304
2016-03-30T02:58:57
2016-03-30T02:58:57
40,657,295
1
0
null
null
null
null
UTF-8
Java
false
false
2,404
java
package com.phonegap.sample; import android.app.Activity; import android.content.Context; import android.os.Build; import android.os.Bundle; import android.util.AttributeSet; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.webkit.WebView; import com.splunk.mint.Mint; import com.splunk.mint.MintJavascript; import com.splunk.mint.MintWebView; import com.splunk.mint.MintWebViewClient; public class MainActivity extends Activity { public final static String TAG = "hope"; private WebView mWebView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { WebView.setWebContentsDebuggingEnabled(true); } Mint.initAndStartSession(this, "f091edc8"); setContentView(R.layout.main_webview); } @Override protected void onStart() { super.onStart(); mWebView = (WebView) findViewById(R.id.wv_demo); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.setWebViewClient(new NBSWebViewClient(this, null)); // MintJavascript mintJavascript = new MintJavascript(this, mWebView); // NBSJavascript javascript = new NBSJavascript(this, mWebView); CritterJSInterface javascript = new CritterJSInterface(); mWebView.addJavascriptInterface(javascript, "_crttr"); // // UTester.instrumentWebViewNew(this, mWebView); // instrumentWebView(this, mWebView); // mWebView.getSettings().setJavaScriptEnabled(true); // super.loadUrl("file:///android_asset/www/index.html"); mWebView.loadUrl("file:///android_asset/www/index.html"); // mWebView.loadUrl("http://www.sina.com.cn/"); // try{ // Thread.sleep(1500); // //Thread.sleep(1500); // }catch (InterruptedException in){ // Log.e(MainActivity.TAG, "sleep"); // } // // instrumentWebView(this, mWebView); } @Override protected void onResume() { super.onResume(); try{ Thread.sleep(1500); //Thread.sleep(1500); }catch (InterruptedException in){ Log.e(MainActivity.TAG, "sleep"); } // UTester.instrumentWebView(this, mWebView); // instrumentWebView(this, mWebView); } }
[ "3124692@163.com" ]
3124692@163.com
1f1834034ea578d4b1bf821112c645eb723f4359
b1a102037f6a6e82285097f006bab55d58679936
/app/src/main/java/io/github/mcvlaga/sunshine/MainActivity.java
38b199317e3d5210b55265bb648b5b61ca75f34f
[]
no_license
McVlaga/sunshine
c246081f50b1b705ed6c3e1ebb3e22cc74c03559
33a3cf03690952214740c23fded8aea0fea44f38
refs/heads/master
2021-01-10T16:16:59.098247
2016-01-15T08:27:37
2016-01-15T08:27:37
45,015,157
1
0
null
null
null
null
UTF-8
Java
false
false
2,197
java
package io.github.mcvlaga.sunshine; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.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) { Intent intent = new Intent(this, SettingsActivity.class); startActivity(intent); return true; } else if (id == R.id.action_location) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); String zipCode = preferences.getString(getResources().getString(R.string.pref_zipcode_key), getResources().getString(R.string.pref_zipcode_stcharles)); String address = "http://maps.google.co.in/maps?q=" + zipCode; Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(address)); // Verify that the intent will resolve to an activity if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } } return super.onOptionsItemSelected(item); } }
[ "ata.benzona94@hotmail.com" ]
ata.benzona94@hotmail.com
eb7fe368cd48b3f710d462b06d2548c75c4af325
fb723603cce3fd93a7ae7bcf0a94839cddea331c
/src/uo/ri/ui/admin/action/ListMechanicsAction.java
05f71a9dc09fb9a390e7fcd6468dbe24beb08f3f
[]
no_license
robertofd1995/RI-JDBC
43c1db0698b7a1922115bc236d49ba8e82882b31
8130d6e62493f92607ec070cad9388c10d0cd255
refs/heads/master
2020-04-15T23:15:12.350614
2016-06-27T03:59:28
2016-06-27T03:59:28
61,814,905
0
0
null
null
null
null
UTF-8
Java
false
false
939
java
package uo.ri.ui.admin.action; import java.util.List; import java.util.Map; import uo.ri.business.AdminService; import uo.ri.common.BusinessException; import uo.ri.conf.ServicesFactory; import alb.util.console.Console; import alb.util.menu.Action; public class ListMechanicsAction implements Action { @Override public void execute() throws BusinessException { Console.println("\nListado de mecánicos\n"); AdminService adminService=ServicesFactory.getAdminService(); List<Map<String,Object>> lista=adminService.listMechanic(); for (int i = 0; i < lista.size(); i++) { long id=(long)lista.get(i).get("id"); String nombre=(String)lista.get(i).get("nombre"); String apellido=(String)lista.get(i).get("apellido"); StringBuilder str=new StringBuilder(); str.append(id+","); str.append(nombre+","); str.append(apellido+"\n"); System.out.println(str.toString()); } } }
[ "robertofd1995@gmail.com" ]
robertofd1995@gmail.com
216962b5e0b19acf163151bf718a7ad1bafe5c4f
41076deea9f13f7c16682f607d9a30a3b46a4bc2
/NoemiLabant/src/main/java/persoane/Hash.java
b9019aa4145e928086533c30a40810353efcda8c
[]
no_license
Noemi-Labant/JavaLearning
dbc1c9a837831ab25aa6ece803787eacf550d97b
1ff40cbc74f313b3994592d117c5decdd72530f3
refs/heads/main
2023-01-30T12:30:17.390239
2020-12-12T08:52:03
2020-12-12T08:52:03
309,957,425
0
0
null
null
null
null
UTF-8
Java
false
false
1,789
java
package persoane; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; public class Hash { public static void main(String[] args) { Map<Persoana, List<Hobby>> persoane = new HashMap<>(); Address address1 = new Address("Carpati nr. 254", "Romania"); Address address2 = new Address("Salcamilor nr. 3", "Germany"); Address address3 = new Address("Caprioarei nr. 10", "Italy"); List<Address> addresses1 = new LinkedList<>(); addresses1.add(address1); addresses1.add(address2); List<Address> addresses2 = new LinkedList<>(); addresses2.add(address1); addresses2.add(address3); Hobby hobby1 = new Hobby("skiing", 3, addresses1); Hobby hobby2 = new Hobby("golfing", 5, addresses2); List<Hobby> hobbies1 = new LinkedList<>(); hobbies1.add(hobby1); hobbies1.add(hobby2); List<Hobby> hobbies2 = new LinkedList<>(); hobbies2.add(hobby1); Persoana persoana1 = new Persoana("Cristiano", 34); Persoana persoana2 = new Persoana("Tarzan", 80); persoane.put(persoana1, hobbies1); persoane.put(persoana2, hobbies2); for (Map.Entry<Persoana, List<Hobby>> entry: persoane.entrySet()) { Persoana pers1 = entry.getKey(); List<Hobby> hobbiesList1 = entry.getValue(); System.out.println("Person name: " + pers1.getNume()); for (Hobby hobby: hobbiesList1) { System.out.println("Hobby name: " + hobby.getHobbyName()); for (Address address: hobby.getAddresses()) { System.out.println("Address country: " + address.getTara()); } } } } }
[ "labancz.noemi@yahoo.com" ]
labancz.noemi@yahoo.com
e71b1c51f6bb29fe3d0ccf3770cd659451a554ef
334b8028bc22989212da33159a8434227f30cb1b
/src/salary/org/jsoft/salary/dao/impl/SalaryDAO.java
822caa90455708db3180995d077fc2d3aeb43a45
[]
no_license
dongyating/personnel19
0be434650c53e5516f53fa90d1975fa65bb505a7
e863421f37c93b7db66fd09d1457db049db533b0
refs/heads/master
2021-05-28T20:50:53.230134
2015-03-18T19:29:00
2015-03-18T19:29:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,673
java
package org.jsoft.salary.dao.impl; import java.util.ArrayList; import java.util.List; import org.jsoft.comm.dao.impl.BaseDAO; import org.jsoft.comm.vo.Bak; import org.jsoft.comm.vo.DeptJobRel; import org.jsoft.comm.vo.PageDivid; import org.jsoft.comm.vo.Salary; import org.jsoft.salary.dao.ISalaryDAO; public class SalaryDAO extends BaseDAO<Object> implements ISalaryDAO { @Override public Salary querySalary(String salaryId) { String hql = "from Salary where salaryId = " + salaryId; List<Object> list = find(hql); Salary salary = (Salary) list.get(0); return salary; } @Override public void updateSalary(Salary salary) { update(salary); } @Override public DeptJobRel queryDeptJobRel(String jobid, String deptid) { // TODO Auto-generated method stub String hql = "from DeptJobRel where department.departmentId=? and job.jobId=? "; List<Object> paraments = new ArrayList<Object>(); paraments.add(jobid); paraments.add(deptid); List<Object> list = find(hql, paraments); DeptJobRel d = (DeptJobRel) list.get(0); return d; } @Override public int AllCount() { String hql = "select count(*) From DeptJobRel where isDelete=?"; List<Object> paraments = new ArrayList<Object>(); paraments.add(0); int a = Integer.parseInt(count(hql, paraments) + ""); return a; // TODO Auto-generated method stub } public int AllCount2() { String hql = "select count(*) From DeptJobRel where isDelete=? and salary is null"; List<Object> paraments = new ArrayList<Object>(); paraments.add(0); int a = Integer.parseInt(count(hql, paraments) + ""); System.out.println("我要输出总页数了 a A AA A A "); System.out.println(a); return a; } @Override public List<DeptJobRel> queryAll(PageDivid pageDivid) { BaseDAO<DeptJobRel> base = new BaseDAO<DeptJobRel>(); String hql = "From DeptJobRel where isDelete=? and salary is not null"; List<Object> paraments = new ArrayList<Object>(); paraments.add(0); List<DeptJobRel> baks = base.find(hql, paraments, pageDivid); return baks; } @Override public void saveSalary(Salary salary) { save(salary); // TODO Auto-generated method stub } @Override public DeptJobRel queryDeptJobRelbyId(String DeptJobRelId) { // TODO Auto-generated method stub String hql = "from DeptJobRel where deptJobRelId =" + DeptJobRelId; return (DeptJobRel) (find(hql).get(0)); } public static void main(String[] args) { SalaryDAO sa = new SalaryDAO(); DeptJobRel d = sa.queryDeptJobRelbyId("2"); System.out.println(d.getJob().getJobName()); } }
[ "franksnolf@hotmail.com" ]
franksnolf@hotmail.com
d7c7d2e764510f5ece7c09f0ab92afd4cd12f20d
d6e937c0526d90d41d22b2e31bd05da290447f2c
/src/main/java/com/biblioteca/exception/InvalidItemException.java
afbc0e5e56256910abd50765b1761dd896b08153
[]
no_license
prachi-kr/biblioteca
4f166da96caaa6d66a624bda7484774c2bb7c1e8
ee08f5921b011e421a87157ee6037e74a7504c57
refs/heads/master
2021-09-16T09:17:00.955460
2018-06-18T18:17:49
2018-06-18T18:17:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
220
java
package com.biblioteca.exception; public class InvalidItemException extends RuntimeException { public InvalidItemException(String bookId) { super("Item id - " + bookId + ", is an invalid BookId"); } }
[ "prachigpt18@yahoo.com" ]
prachigpt18@yahoo.com
6f59c3318468b3bd47b391f07b8c7e924aa1c205
612efa8a2d20a844b6126119783d6add8d235972
/src/main/java/com/situ/market/order/domain/Order.java
038d08bad239bc2e8f62dbc3787e993eea6072c0
[]
no_license
java-code-cpu/market
937156ace48955c660b70aba7f635c45f8204eb4
faaef7b80efbc76ca314d4644edfe8d2d46c0838
refs/heads/master
2022-12-21T11:08:50.787731
2020-01-06T02:38:13
2020-01-06T02:38:13
232,007,317
1
0
null
2022-12-15T23:33:52
2020-01-06T02:18:28
Java
UTF-8
Java
false
false
1,287
java
package com.situ.market.order.domain; import java.math.BigDecimal; import org.apache.ibatis.type.Alias; import com.situ.market.base.BaseClass; @Alias("Order") public class Order extends BaseClass { private static final long serialVersionUID = 1L; private Long userRowId; //用户ID 关联用户表的ID private BigDecimal allMoney; // 总价格 private String addressId; //收获地址ID private Integer orderState; //订单状态 1:已付款 2:未付款 3:退单 private Integer payMothed; //支付方法 1:微信 2:支付宝 public Long getUserRowId() { return userRowId; } public void setUserRowId(Long userRowId) { this.userRowId = userRowId; } public BigDecimal getAllMoney() { return allMoney; } public void setAllMoney(BigDecimal allMoney) { this.allMoney = allMoney; } public String getAddressId() { return addressId; } public void setAddressId(String addressId) { this.addressId = addressId; } public Integer getOrderState() { return orderState; } public void setOderState(Integer orderState) { this.orderState = orderState; } public Integer getPayMothed() { return payMothed; } public void setPayMothed(Integer payMothed) { this.payMothed = payMothed; } }
[ "xtx@DESKTOP-2A8NOQS.lan" ]
xtx@DESKTOP-2A8NOQS.lan
3436ceb4860bd032e99ee5b899a041adf7b86d22
a3c11f233154c78fdd71aaa958dd6dffce281019
/src/com/company/MyRunnable.java
3d3982b29837cb1b13ac73a72d056b1acd65e05d
[]
no_license
matheusmig/MyFirstJavaCode
3662914d4fd7913e83ee3666414206e679333242
88c9df255728a3b8b6f6ba22aedf176774c6f49f
refs/heads/master
2021-09-04T10:25:10.431742
2018-01-18T00:58:35
2018-01-18T00:58:35
112,982,704
0
0
null
null
null
null
UTF-8
Java
false
false
433
java
package com.company; /** * Created by mmignoni on 2017-11-09. * * Implementa thread através de "implements Runanble" */ public class MyRunnable implements Runnable { String strName; //Nome da thread MyRunnable(String strName) { this.strName = strName; } public void run() { for(int x = 0; x < 100; x = x + 1) { System.out.println("I'm "+this.strName+" Thread"); } } }
[ "matheus.mignoni@gmail.com" ]
matheus.mignoni@gmail.com
c86c16e0fab5a90c7ed90823435051d1b2a5c100
8341549a002086aa2ef3c9294a5f15bfec219199
/message/src/main/java/com/ydzb/message/service/ISmsLogService.java
05a731e2e9b39ae5b35daaa2b2fa5a6de64991e8
[]
no_license
songziyang/ydzb
2498204b9ee3d8e101a64ee7e366d8115514908c
e8483e26efab94a110821a7612fbaee3b08e66d5
refs/heads/master
2021-01-19T22:41:01.600194
2017-04-20T09:20:24
2017-04-20T09:20:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
188
java
package com.ydzb.message.service; import com.ydzb.core.service.IBaseService; import com.ydzb.sms.entity.SmsLog; public interface ISmsLogService extends IBaseService<SmsLog, Long> { }
[ "447587850@qq.com" ]
447587850@qq.com
8c3d3c567dfb2f651179f1f1a82527b8cb92971f
be55285edbca96a3cdcf1c945e4363aa8455f15e
/src/main/java/co/iay/leetcode/Tester/Easy/TestConvertANumberToHexadecimal.java
06757bef013489ac21f4150987ce040560c776e8
[]
no_license
liaoaoyang/LeetCode
03ce3ddfdf55968f719c857bc9f42f0cdd40e20f
338f8137c3223b4f1d73b9b96f85637ea54975f9
refs/heads/master
2021-01-16T23:41:42.275307
2019-04-25T00:05:16
2019-04-25T00:05:16
55,667,787
1
0
null
null
null
null
UTF-8
Java
false
false
1,323
java
package co.iay.leetcode.Tester.Easy; import co.iay.leetcode.Easy.ConvertANumberToHexadecimal; import org.junit.Assert; import org.junit.Test; /** * Created by ng on 16/10/1. */ public class TestConvertANumberToHexadecimal { private ConvertANumberToHexadecimal c = new ConvertANumberToHexadecimal(); @Test public void testTestConvertANumberToHexadecimalCase1() { Assert.assertEquals("1", c.toHex(1)); } @Test public void testTestConvertANumberToHexadecimalCase2() { Assert.assertEquals("a", c.toHex(10)); } @Test public void testTestConvertANumberToHexadecimalCase3() { Assert.assertEquals("b", c.toHex(11)); } @Test public void testTestConvertANumberToHexadecimalCase4() { Assert.assertEquals("1a", c.toHex(26)); } @Test public void testTestConvertANumberToHexadecimalCase5() { Assert.assertEquals("ffffffff", c.toHex(-1)); } @Test public void testTestConvertANumberToHexadecimalCase6() { Assert.assertEquals("fffffffe", c.toHex(-2)); } @Test public void testTestConvertANumberToHexadecimalCase7() { Assert.assertEquals("10", c.toHex(16)); } @Test public void testTestConvertANumberToHexadecimalCase8() { Assert.assertEquals("0", c.toHex(0)); } }
[ "liaoaoyang@gmail.com" ]
liaoaoyang@gmail.com
7e759d99f192e2c98e02ad7a89eec546e813cfd7
44e082b233a2e44212422514fa9225cf1b6358d2
/GPROG_oldPruefungen/src/_glProg_2016_NT2_GrA/Reihe.java
040cc9cb2dfc92ed8637fa858ddda6af0f028a8e
[]
no_license
fhbgraceb/VerbundA-SS20
b3af20000e1a4b6efe768156ad415dbf67e16be0
7e672445bb785386af2ff65d3526f89c67882a71
refs/heads/master
2022-12-28T05:56:20.158197
2020-10-10T23:20:18
2020-10-10T23:20:18
238,525,365
0
0
null
null
null
null
UTF-8
Java
false
false
724
java
package _glProg_2016_NT2_GrA; public class Reihe { public static void main(String[] args) { final double grenze = -3.0; double summe; double glied; int zaehler; int nenner; summe = 0; zaehler = 1; nenner = 2; do { glied = ((double)zaehler) / nenner; if ((zaehler % 5 == 1) || (zaehler % 5 == 2) || (zaehler % 5 == 3)) { summe -= glied; } else { summe += glied; } System.out.println(zaehler + " / " + nenner + " = " + glied + " - " + summe); if (summe >= grenze) { nenner += zaehler; zaehler++; } } while (summe >= grenze); System.out.println("Bei Glied Nr. " + zaehler + " ist die Summe zum ersten Mal kleiner als " + grenze + "."); } }
[ "fhb190776@fh-vie.ac.at" ]
fhb190776@fh-vie.ac.at
ba76695a649be616b1337912febc162ab96e53d8
f860e709ba232caffe4f8f77bfa9d7c91822df3b
/src/java/controller/Hanggiuacontroller.java
d10ca2986957b2fecf1d3bae50c3463cdfdb1f0f
[]
no_license
theanhhp/asm_Front-End-Frameworks
cbde4ce82ef31687ded57eac94400d4c5747d3da
2ef548530c7fc186ede20f4797e65b91a57f500b
refs/heads/master
2020-06-06T07:13:16.459868
2019-06-19T06:52:53
2019-06-19T06:52:53
192,674,682
0
0
null
null
null
null
UTF-8
Java
false
false
3,980
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package controller; import entity.Hanggiua; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; /** * * @author trant */ @Transactional @Controller @RequestMapping("/Hanggiua") public class Hanggiuacontroller { @Autowired SessionFactory factory; @RequestMapping() public String index(ModelMap model) { model.addAttribute("Hanggiua", new Hanggiua()); model.addAttribute("Hanggiuas", getHanggiua()); return "Hanggiua"; } @RequestMapping(params = "btnInsert") public String insert(ModelMap model, @ModelAttribute("Hanggiua") Hanggiua Hanggiua , Integer id) { Session session = factory.openSession(); Transaction t = session.beginTransaction(); try { if (id < 8) { session.save(Hanggiua); t.commit(); model.addAttribute("message", "Thêm mới thành công !"); } else { t.rollback(); model.addAttribute("message", "Thêm mới thất bại !"); } } catch (Exception e) { e.printStackTrace(); } finally { session.close(); } model.addAttribute("Hanggiuas", getHanggiua()); return "Hanggiua"; } @RequestMapping(params = "btnUpdate") public String update(ModelMap model, @ModelAttribute("Hanggiua") Hanggiua Hanggiua) { Session session = factory.openSession(); Transaction t = session.beginTransaction(); try { session.update(Hanggiua); t.commit(); model.addAttribute("message", "Cập nhật thành công !"); } catch (Exception e) { t.rollback(); model.addAttribute("message", "Cập nhật thành công !"); } finally { session.close(); } model.addAttribute("Hanggiuas", getHanggiua()); return "Hanggiua"; } @RequestMapping(params = "btnDelete") public String delete(ModelMap model, Hanggiua Hanggiua) { Session session = factory.openSession(); Transaction t = session.beginTransaction(); try { session.delete(Hanggiua); t.commit(); model.addAttribute("message", "Xóa thành công !"); } catch (Exception e) { t.rollback(); model.addAttribute("message", "Xóa thất bại !"); } finally { session.close(); } model.addAttribute("Hanggiua", new Hanggiua()); model.addAttribute("Hanggiuas", getHanggiua()); return "Hanggiua"; } @RequestMapping("{id}") public String edit(ModelMap model, @PathVariable("id") Integer id) { Session session = factory.openSession(); Hanggiua Hanggiua = (Hanggiua) session.get(Hanggiua.class, id); model.addAttribute("Hanggiua", Hanggiua); model.addAttribute("Hanggiuas", getHanggiua()); return "Hanggiua"; } @ModelAttribute("Hanggiuas") @SuppressWarnings("unchecked") public List<Hanggiua> getHanggiua() { Session session = factory.openSession(); String hql = "FROM Hanggiua"; Query query = session.createQuery(hql); List<Hanggiua> list = query.list(); return list; } }
[ "=" ]
=
ccce4f6c8d2e40f02d4f7675df9d55567d479c2e
a5d1355228908daf110db93a8641f212f5e9fbb1
/src/main/java/gov/va/oit/vistaevolution/mailman/ws/xma2r/model/AbstractXMA2RRequest.java
a65798700486e46b145933091f4b4b70398cf3a0
[]
no_license
MillerTom/Evolution
24d10c0cad9887fcfeee5266a69fa9d98df66334
448a3136fa2205c12f135a432f7912317195482a
refs/heads/master
2016-08-12T16:56:18.896488
2016-01-01T01:53:03
2016-01-01T01:53:03
48,867,152
0
0
null
null
null
null
UTF-8
Java
false
false
3,737
java
package gov.va.oit.vistaevolution.mailman.ws.xma2r.model; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; /** * @author Tom Miller<tom.miller@dbitpro.com> * */ public abstract class AbstractXMA2RRequest { /** * duz: * * (optional) User's DUZ. If DUZ is not defined, it defaults to the * Postmaster. This is who is really sending the message. * * xmduz: * * (required) User's DUZ or FREE TEXT. This is from whom the message will * appear to be. If it is not defined, it defaults to DUZ. (If DUZ is not * defined, it defaults to Postmaster.) If it is FREE TEXT, it must not be * more than 70 characters. * * xmsub: * * (required) Subject of the message, It should be from 3 to 65 characters * in length. * * xmtext : * * (required) The name of the array (in open format) containing the text of * the message. The array itself may be a local or a global variable, and it * must be in a format acceptable to VA FileMan WORD-PROCESSING fields. * * xmz : * * (required) Message IEN in the MESSAGE file (#3.9) * * xmstrip : * * (optional) String containing characters that should be removed from the * answer text. Default is none. */ @XmlElement(required = false) protected String duz; @XmlElement(required = true) protected String xmduz; @XmlElement(required = true) protected String xmsub; @XmlElementWrapper(name = "text") @XmlElement(name = "entry", required = true) protected List<String> xmtext; @XmlElement(required = true) protected String xmz; @XmlElement(required = false) protected String xmstrip; /** * Default Empty Constructor */ public AbstractXMA2RRequest() { super(); } /** * * Parameterised Constructor * * @param duz * @param xmduz * @param xmsub * @param xmtext * @param xmz * @param xmstrip */ public AbstractXMA2RRequest(String duz, String xmduz, String xmsub, List<String> xmtext, String xmz, String xmstrip) { super(); this.duz = duz; this.xmduz = xmduz; this.xmsub = xmsub; this.xmtext = xmtext; this.xmz = xmz; this.xmstrip = xmstrip; } /** * Mandatory Parameters Constructor * * @param xmduz * @param xmsub * @param xmtext * @param xmz */ public AbstractXMA2RRequest(String xmduz, String xmsub, List<String> xmtext, String xmz) { super(); this.xmduz = xmduz; this.xmsub = xmsub; this.xmtext = xmtext; this.xmz = xmz; } /** * @return the duz */ public String getDuz() { return duz; } /** * @param duz * the duz to set */ protected void setDuz(String duz) { this.duz = duz; } /** * @return the xmduz */ public String getXmduz() { return xmduz; } /** * @param xmduz * the xmduz to set */ protected void setXmduz(String xmduz) { this.xmduz = xmduz; } /** * @return the xmsub */ public String getXmsub() { return xmsub; } /** * @param xmsub * the xmsub to set */ protected void setXmsub(String xmsub) { this.xmsub = xmsub; } /** * @return the xmtext */ public List<String> getXmtext() { return xmtext; } /** * @param xmtext * the xmtext to set */ protected void setXmtext(List<String> xmtext) { this.xmtext = xmtext; } /** * @return the xmz */ public String getXmz() { return xmz; } /** * @param xmz * the xmz to set */ protected void setXmz(String xmz) { this.xmz = xmz; } /** * @return the xmstrip */ public String getXmstrip() { return xmstrip; } /** * @param xmstrip * the xmstrip to set */ protected void setXmstrip(String xmstrip) { this.xmstrip = xmstrip; } }
[ "tom.a.miller@gmail.com" ]
tom.a.miller@gmail.com
05a18e593050bfc307f7bbf953086a8988f5dff1
11b5c6aea88051838685f2597e1fd4a580433c56
/src/main/java/com/leetcode/number/Solution36.java
ae930978a0a848ffd2eb98efbd4257125dccdf12
[]
no_license
coolxll/LeetCodePractise
93e71591bc58c8aa66797c3d85111d092805f6ab
5b53dd6794509b4120245cbce66e337f88c0e18e
refs/heads/master
2022-06-20T21:24:00.706278
2021-06-07T11:51:49
2021-06-07T11:51:49
244,534,971
0
0
null
2022-06-17T03:00:40
2020-03-03T03:43:51
Java
UTF-8
Java
false
false
1,345
java
package com.leetcode.number; import java.util.HashMap; public class Solution36 { public boolean isValidSudoku(char[][] board) { //init data HashMap<Integer, Integer>[] rows = new HashMap[9]; HashMap<Integer, Integer>[] columns = new HashMap[9]; HashMap<Integer, Integer>[] boxes = new HashMap[9]; for (int i = 0; i < 9; i++) { rows[i] = new HashMap<>(); columns[i] = new HashMap<>(); boxes[i] = new HashMap<>(); } //validate a board for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { char num = board[i][j]; if (num != '.') { int n = num - '0'; int box_index = (i / 3 ) * 3 + j / 3; // keep the current cell value rows[i].put(n, rows[i].getOrDefault(n, 0) + 1); columns[j].put(n, columns[j].getOrDefault(n, 0) + 1); boxes[box_index].put(n, boxes[box_index].getOrDefault(n, 0) + 1); // check if this value has been already seen before if (rows[i].get(n) > 1 || columns[j].get(n) > 1 || boxes[box_index].get(n) > 1) return false; } } } return true; } }
[ "coolxll@gmail.com" ]
coolxll@gmail.com
fdcf4e5227a2666fd72fd8d6129758b87a0f533d
51d05106ddd3494f0b6098cc97653ffac4896b70
/motorMain/src/main/java/test/ZipTest.java
f345810ab39c709aa0e1ed5ac3523b2fc1067e7a
[]
no_license
cyf120209/motor
f6ed18d334abba370f5794d20a0328f0f56188de
c3f2a0c83439e5447c77bb0966744654d849d899
refs/heads/master
2021-09-22T14:33:26.528610
2018-08-30T08:26:46
2018-08-30T08:26:46
103,228,108
2
0
null
null
null
null
UTF-8
Java
false
false
3,121
java
package test; import java.io.*; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; public class ZipTest { public static void main(String[] args) { ZipTest zipTest = new ZipTest(); zipTest.readZip(); } /** * 读取zip文件内容 */ private void readZip() { File fil = new File("D:\\Android\\Android.zip"); ZipInputStream zipIn = null; try { zipIn = new ZipInputStream(new FileInputStream(fil)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } ZipEntry zipEn = null; /** * 需要读取zip文件项的内容时,需要ZipFile类的对象的getInputStream方法取得该项的内容, * 然后传递给InputStreamReader的构造方法创建InputStreamReader对象, * 最后使用此InputStreamReader对象创建BufferedReader实例 * 至此已把zip文件项的内容读出到缓存中,可以遍历其内容 */ ZipFile zfil = null; try { zfil = new ZipFile("D:\\Android\\Android.zip"); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { while ((zipEn = zipIn.getNextEntry()) != null) { if (!zipEn.isDirectory()) { // 判断此zip项是否为目录 System.out.println(zipEn.getName() + ":\t"); /** * 把是文件的zip项读出缓存, * zfil.getInputStream(zipEn):返回输入流读取指定zip文件条目的内容 zfil:new * ZipFile();供阅读的zip文件 zipEn:zip文件中的某一项 */ // BufferedReader buff = new BufferedReader( // new InputStreamReader(zfil.getInputStream(zipEn))); // String str; // while ((str = buff.readLine()) != null) { // System.out.println("\t" + str); // } // buff.close(); long size = zipEn.getSize(); byte[] b = new byte[(int) size]; InputStream is = zfil.getInputStream(zipEn); BufferedInputStream bis = new BufferedInputStream(is); while (bis.available()>0){ bis.read(b); } String s = new String(b); System.out.println("\t"+s); bis.close(); } zipIn.closeEntry();// 关闭当前打开的项 } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { zfil.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
[ "2445940439@qq.com" ]
2445940439@qq.com
5406d98c6b134cf3bfd8f94afe9891ca661222a9
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/1/1_07b90692d7708c480911010589e0ce4fc203329a/RemoveRegionDialog/1_07b90692d7708c480911010589e0ce4fc203329a_RemoveRegionDialog_s.java
d3afb8bfff43fd1f06186dd5d20c8b98c874908f
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
3,001
java
package org.dawb.workbench.plotting.system.dialog; import org.dawb.common.ui.plot.region.IRegion; import org.dawb.workbench.plotting.system.swtxy.RegionArea; import org.dawb.workbench.plotting.system.swtxy.XYRegionGraph; import org.dawb.workbench.plotting.system.swtxy.selection.AbstractSelectionRegion; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; /**The dialog for removing annotation. * @author Xihui Chen * @author Kay Kasemir layout tweaks */ public class RemoveRegionDialog extends Dialog { private XYRegionGraph xyGraph; private Combo regionCombo; private AbstractSelectionRegion removedRegion; public RemoveRegionDialog(Shell parentShell, XYRegionGraph xyGraph) { super(parentShell); this.xyGraph = xyGraph; // Allow resize setShellStyle(getShellStyle() | SWT.RESIZE); } @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText("Remove Region"); } @Override protected Control createDialogArea(Composite parent) { final Composite parent_composite = (Composite) super.createDialogArea(parent); final Composite composite = new Composite(parent_composite, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); composite.setLayout(new GridLayout(1, false)); final Label removeLabel = new Label(composite, SWT.None); removeLabel.setLayoutData(new GridData()); if(((RegionArea)xyGraph.getPlotArea()).getRegionMap().size() > 0){ removeLabel.setText("Select the region to be removed: "); regionCombo = new Combo(composite, SWT.DROP_DOWN); regionCombo.setLayoutData(new GridData(SWT.FILL, 0, true, false)); final RegionArea regArea = (RegionArea)xyGraph.getPlotArea(); for (String name : regArea.getRegionMap().keySet()) { final AbstractSelectionRegion region = regArea.getRegion(name); regionCombo.add(region.getName()); } regionCombo.select(0); }else{ removeLabel.setText("There are no selection regions on the graph."); } return parent_composite; } @Override protected void okPressed() { if(regionCombo != null) { final int index = regionCombo.getSelectionIndex(); removedRegion = ((RegionArea)xyGraph.getPlotArea()).getRegions().get(index); } super.okPressed(); } /** * @return the annotation to be removed. */ public AbstractSelectionRegion getRegion() { return removedRegion; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
f6a47bdd6d944aa73e929f0ad8b8565065e69839
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-chimesdkmediapipelines/src/main/java/com/amazonaws/services/chimesdkmediapipelines/model/ThrottledClientException.java
05e2a1f9f91d2c44eb15f6220fc6d102e324ad5b
[ "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
3,546
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.chimesdkmediapipelines.model; import javax.annotation.Generated; /** * <p> * The client exceeded its request rate limit. * </p> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ThrottledClientException extends com.amazonaws.services.chimesdkmediapipelines.model.AmazonChimeSDKMediaPipelinesException { private static final long serialVersionUID = 1L; private String code; /** * <p> * The request ID associated with the call responsible for the exception. * </p> */ private String requestId; /** * Constructs a new ThrottledClientException with the specified error message. * * @param message * Describes the error encountered. */ public ThrottledClientException(String message) { super(message); } /** * @param code * @see ErrorCode */ @com.fasterxml.jackson.annotation.JsonProperty("Code") public void setCode(String code) { this.code = code; } /** * @return * @see ErrorCode */ @com.fasterxml.jackson.annotation.JsonProperty("Code") public String getCode() { return this.code; } /** * @param code * @return Returns a reference to this object so that method calls can be chained together. * @see ErrorCode */ public ThrottledClientException withCode(String code) { setCode(code); return this; } /** * @param code * @return Returns a reference to this object so that method calls can be chained together. * @see ErrorCode */ public ThrottledClientException withCode(ErrorCode code) { this.code = code.toString(); return this; } /** * <p> * The request ID associated with the call responsible for the exception. * </p> * * @param requestId * The request ID associated with the call responsible for the exception. */ @com.fasterxml.jackson.annotation.JsonProperty("RequestId") public void setRequestId(String requestId) { this.requestId = requestId; } /** * <p> * The request ID associated with the call responsible for the exception. * </p> * * @return The request ID associated with the call responsible for the exception. */ @com.fasterxml.jackson.annotation.JsonProperty("RequestId") public String getRequestId() { return this.requestId; } /** * <p> * The request ID associated with the call responsible for the exception. * </p> * * @param requestId * The request ID associated with the call responsible for the exception. * @return Returns a reference to this object so that method calls can be chained together. */ public ThrottledClientException withRequestId(String requestId) { setRequestId(requestId); return this; } }
[ "" ]
0bfd5e04ec8f2768e5e916b818abcf0a67f6ca25
d37f5210cd4b5bef64df74a86919ae6a86ab0873
/EstudoJavaComoProgramar/src/LivroNotas.java
8e3f9834db5b28801b541fcd012ded4aa5af9d9f
[]
no_license
fabianoalv/CursoJava
4434668ae330b1e084047ecafa4d77fb3bf89464
da5644b66f9d45accdf1fffccfdba174648c637f
refs/heads/master
2020-05-04T14:46:50.273152
2019-04-03T04:31:53
2019-04-03T04:31:53
179,210,402
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,919
java
public class LivroNotas { private String nomeCurso; private int[] notas; public LivroNotas(String nomeCurso, int[] notas) { this.nomeCurso = nomeCurso; this.notas = notas; } public String getNomeCurso() { return nomeCurso; } public void setNomeCurso(String nomeCurso) { this.nomeCurso = nomeCurso; } // realiza várias operações nos dados public void processarNotas() { mostrarNotas(); System.out.printf("%nA média da classe é: %.2f%n", getMedia()); System.out.printf("Maior nota é %d%nMenor nota é: %d%n", getMaximo(), getMinimo()); barraGrafico(); } public int getMinimo() { int menorNota = notas[0]; for (int n : notas) { if (n < menorNota) menorNota = n; } return menorNota; } public int getMaximo() { int maiorNota = notas[0]; for (int n : notas) { if (n > maiorNota) maiorNota = n; } return maiorNota; } public double getMedia() { int total = 0; for (int n : notas) { total += n; } return (double) total / notas.length; } public void barraGrafico() { System.out.println("Distribuíção de Notas: "); //Armazena a frequencia de nota em cada intervalo de 10 notas int[]frequencia = new int[11]; for (int n : notas) { ++frequencia[n/10]; } //Gera a saída do rótulo de barras for (int count = 0; count < frequencia.length; count++) { if(count == 10) System.out.printf("%5d: ", 100); else System.out.printf("%02d-%02d: ", count * 10, count * 10 + 9); //Gera o gráfico com asteristico for (int stars = 0; stars < frequencia[count]; stars++) { System.out.print("*"); } System.out.println(); } } public void mostrarNotas() { System.out.printf("As notas são:%n%n"); for(int estudante = 0; estudante < notas.length; estudante++) { System.out.printf("Estudante %2d: %3d%n", estudante + 1, notas[estudante]); } } }
[ "fastec@outlook.com" ]
fastec@outlook.com
2799206d575c6c5e0010e4a3d080d5ddd608742f
9254e7279570ac8ef687c416a79bb472146e9b35
/r-kvstore-20150101/src/main/java/com/aliyun/r_kvstore20150101/models/CreateTairInstanceRequest.java
615c6abdc5ed31501450493f1c0fd6ad74fe7230
[ "Apache-2.0" ]
permissive
lquterqtd/alibabacloud-java-sdk
3eaa17276dd28004dae6f87e763e13eb90c30032
3e5dca8c36398469e10cdaaa34c314ae0bb640b4
refs/heads/master
2023-08-12T13:56:26.379027
2021-10-19T07:22:15
2021-10-19T07:22:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,729
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.r_kvstore20150101.models; import com.aliyun.tea.*; public class CreateTairInstanceRequest extends TeaModel { @NameInMap("SecurityToken") public String securityToken; @NameInMap("OwnerId") public Long ownerId; @NameInMap("ResourceOwnerAccount") public String resourceOwnerAccount; @NameInMap("ResourceOwnerId") public Long resourceOwnerId; @NameInMap("OwnerAccount") public String ownerAccount; @NameInMap("RegionId") public String regionId; @NameInMap("InstanceName") public String instanceName; @NameInMap("Password") public String password; @NameInMap("InstanceClass") public String instanceClass; @NameInMap("ZoneId") public String zoneId; @NameInMap("ChargeType") public String chargeType; @NameInMap("VpcId") public String vpcId; @NameInMap("VSwitchId") public String vSwitchId; @NameInMap("Period") public Integer period; @NameInMap("BusinessInfo") public String businessInfo; @NameInMap("CouponNo") public String couponNo; @NameInMap("SrcDBInstanceId") public String srcDBInstanceId; @NameInMap("BackupId") public String backupId; @NameInMap("PrivateIpAddress") public String privateIpAddress; @NameInMap("AutoUseCoupon") public String autoUseCoupon; @NameInMap("AutoRenew") public String autoRenew; @NameInMap("AutoRenewPeriod") public String autoRenewPeriod; @NameInMap("AutoPay") public Boolean autoPay; @NameInMap("ClientToken") public String clientToken; @NameInMap("StorageType") public String storageType; @NameInMap("Storage") public Integer storage; @NameInMap("ShardType") public String shardType; @NameInMap("ShardCount") public Integer shardCount; @NameInMap("EngineVersion") public String engineVersion; @NameInMap("InstanceType") public String instanceType; public static CreateTairInstanceRequest build(java.util.Map<String, ?> map) throws Exception { CreateTairInstanceRequest self = new CreateTairInstanceRequest(); return TeaModel.build(map, self); } public CreateTairInstanceRequest setSecurityToken(String securityToken) { this.securityToken = securityToken; return this; } public String getSecurityToken() { return this.securityToken; } public CreateTairInstanceRequest setOwnerId(Long ownerId) { this.ownerId = ownerId; return this; } public Long getOwnerId() { return this.ownerId; } public CreateTairInstanceRequest setResourceOwnerAccount(String resourceOwnerAccount) { this.resourceOwnerAccount = resourceOwnerAccount; return this; } public String getResourceOwnerAccount() { return this.resourceOwnerAccount; } public CreateTairInstanceRequest setResourceOwnerId(Long resourceOwnerId) { this.resourceOwnerId = resourceOwnerId; return this; } public Long getResourceOwnerId() { return this.resourceOwnerId; } public CreateTairInstanceRequest setOwnerAccount(String ownerAccount) { this.ownerAccount = ownerAccount; return this; } public String getOwnerAccount() { return this.ownerAccount; } public CreateTairInstanceRequest setRegionId(String regionId) { this.regionId = regionId; return this; } public String getRegionId() { return this.regionId; } public CreateTairInstanceRequest setInstanceName(String instanceName) { this.instanceName = instanceName; return this; } public String getInstanceName() { return this.instanceName; } public CreateTairInstanceRequest setPassword(String password) { this.password = password; return this; } public String getPassword() { return this.password; } public CreateTairInstanceRequest setInstanceClass(String instanceClass) { this.instanceClass = instanceClass; return this; } public String getInstanceClass() { return this.instanceClass; } public CreateTairInstanceRequest setZoneId(String zoneId) { this.zoneId = zoneId; return this; } public String getZoneId() { return this.zoneId; } public CreateTairInstanceRequest setChargeType(String chargeType) { this.chargeType = chargeType; return this; } public String getChargeType() { return this.chargeType; } public CreateTairInstanceRequest setVpcId(String vpcId) { this.vpcId = vpcId; return this; } public String getVpcId() { return this.vpcId; } public CreateTairInstanceRequest setVSwitchId(String vSwitchId) { this.vSwitchId = vSwitchId; return this; } public String getVSwitchId() { return this.vSwitchId; } public CreateTairInstanceRequest setPeriod(Integer period) { this.period = period; return this; } public Integer getPeriod() { return this.period; } public CreateTairInstanceRequest setBusinessInfo(String businessInfo) { this.businessInfo = businessInfo; return this; } public String getBusinessInfo() { return this.businessInfo; } public CreateTairInstanceRequest setCouponNo(String couponNo) { this.couponNo = couponNo; return this; } public String getCouponNo() { return this.couponNo; } public CreateTairInstanceRequest setSrcDBInstanceId(String srcDBInstanceId) { this.srcDBInstanceId = srcDBInstanceId; return this; } public String getSrcDBInstanceId() { return this.srcDBInstanceId; } public CreateTairInstanceRequest setBackupId(String backupId) { this.backupId = backupId; return this; } public String getBackupId() { return this.backupId; } public CreateTairInstanceRequest setPrivateIpAddress(String privateIpAddress) { this.privateIpAddress = privateIpAddress; return this; } public String getPrivateIpAddress() { return this.privateIpAddress; } public CreateTairInstanceRequest setAutoUseCoupon(String autoUseCoupon) { this.autoUseCoupon = autoUseCoupon; return this; } public String getAutoUseCoupon() { return this.autoUseCoupon; } public CreateTairInstanceRequest setAutoRenew(String autoRenew) { this.autoRenew = autoRenew; return this; } public String getAutoRenew() { return this.autoRenew; } public CreateTairInstanceRequest setAutoRenewPeriod(String autoRenewPeriod) { this.autoRenewPeriod = autoRenewPeriod; return this; } public String getAutoRenewPeriod() { return this.autoRenewPeriod; } public CreateTairInstanceRequest setAutoPay(Boolean autoPay) { this.autoPay = autoPay; return this; } public Boolean getAutoPay() { return this.autoPay; } public CreateTairInstanceRequest setClientToken(String clientToken) { this.clientToken = clientToken; return this; } public String getClientToken() { return this.clientToken; } public CreateTairInstanceRequest setStorageType(String storageType) { this.storageType = storageType; return this; } public String getStorageType() { return this.storageType; } public CreateTairInstanceRequest setStorage(Integer storage) { this.storage = storage; return this; } public Integer getStorage() { return this.storage; } public CreateTairInstanceRequest setShardType(String shardType) { this.shardType = shardType; return this; } public String getShardType() { return this.shardType; } public CreateTairInstanceRequest setShardCount(Integer shardCount) { this.shardCount = shardCount; return this; } public Integer getShardCount() { return this.shardCount; } public CreateTairInstanceRequest setEngineVersion(String engineVersion) { this.engineVersion = engineVersion; return this; } public String getEngineVersion() { return this.engineVersion; } public CreateTairInstanceRequest setInstanceType(String instanceType) { this.instanceType = instanceType; return this; } public String getInstanceType() { return this.instanceType; } }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
a55a416d42e488d944b3633c36425adc6c88b30a
649850df39bab4b699a9be75b7bb428f7a90aaf6
/app/src/main/java/cn/dlc/wifilistdemo/PasswordDialog.java
0aa9c81f7e72819f0577788e90f51ea1bd13c208
[]
no_license
DlcAndroidTeam123456/WifiConnection
1f6f2ad9744ffb12343dd6548183642530c5bfe6
45ce4927f2258fc64804d89fe140373936afe6e8
refs/heads/master
2020-09-14T07:42:58.471956
2019-11-21T02:19:06
2019-11-21T02:19:06
223,068,250
0
1
null
null
null
null
UTF-8
Java
false
false
1,645
java
package cn.dlc.wifilistdemo; import android.app.Dialog; import android.content.Context; import android.support.annotation.NonNull; import android.view.View; import android.widget.Button; import android.widget.EditText; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; /** * Created by John on 2018/3/28. */ public class PasswordDialog extends Dialog { @BindView(R.id.et_password) EditText mEtPassword; @BindView(R.id.btn_cancel) Button mBtnCancel; @BindView(R.id.btn_connect) Button mBtnConnect; private OnClickConnectListener mListener; public interface OnClickConnectListener { void toConnect(PasswordDialog dialog, String password); } public PasswordDialog(@NonNull Context context) { super(context, R.style.CommonDialogStyle); setContentView(R.layout.dialog_password); ButterKnife.bind(this); } @OnClick({ R.id.btn_cancel, R.id.btn_connect }) public void onViewClicked(View view) { switch (view.getId()) { case R.id.btn_cancel: dismiss(); break; case R.id.btn_connect: String password = mEtPassword.getText().toString(); if (mListener != null) { mListener.toConnect(this, password); } break; } } public void show(OnClickConnectListener listener) { mListener = listener; super.show(); } @Override public void show() { super.show(); throw new RuntimeException("不要调用这个方法"); } }
[ "licheedev@foxmail.com" ]
licheedev@foxmail.com
10b947694d91b8c6aafd6ee62642f8bab664ef55
5c1aaa432d832579a653c49b2a475b974795c2a4
/src/main/java/itba/pdc/admin/filter/ManageFilter.java
1f8359ecf504599926527fab45c1f5a935d77e31
[]
no_license
bahui80/HTTP-Proxy
0cfee14f92f4f7668dfc0577cf764099a9221db2
b84196efebf2fba9a1e0c479af04e7393a94cc3f
refs/heads/master
2020-09-25T01:40:28.407786
2013-11-20T14:01:39
2013-11-20T14:01:39
66,895,625
0
0
null
null
null
null
UTF-8
Java
false
false
1,214
java
package itba.pdc.admin.filter; import java.nio.ByteBuffer; import java.util.HashSet; import java.util.Set; import java.util.concurrent.ConcurrentLinkedQueue; public class ManageFilter { private static ManageFilter instance = null; private ConcurrentLinkedQueue<Filter> filters = null; private Set<String> set; private ManageFilter() { if (instance != null) { throw new IllegalAccessError("This class is already isntantiated"); } filters = new ConcurrentLinkedQueue<Filter>(); set = new HashSet<String>(); } public static ManageFilter getInstace() { if (instance == null) { instance = new ManageFilter(); } return instance; } public void addOrRemoveFilter(FilterStatus filterStatus) { switch (filterStatus) { case TRANSFORMER: TransformationFilter f = TransformationFilter.getInstace(); if (filters.contains(f)) { set.remove(FilterStatus.TRANSFORMER.toString()); filters.remove(f); } else { set.add(FilterStatus.TRANSFORMER.toString()); filters.add(f); } break; default: break; } } public void doFilters(ByteBuffer buffer) { for (Filter f : filters) { f.doFilter(buffer); } } public Set<String> getSet() { return set; } }
[ "martinpurita@gmail.com" ]
martinpurita@gmail.com
14c941644000dfd9181a90fb5ea8a0da2f0829a6
a88112855489699b7bb53a1571066cecc186c976
/src/main/java/rough/LoginPage.java
c4048a8ac0dea3bab9339a956485ed112a4f10be
[]
no_license
shikhaswaroop/Cucumber
eff0a875648de4f2d2674266278a79649a821e88
691146a5a125e3b344aa25aad40f8c6fea5ad307
refs/heads/master
2023-05-04T03:06:43.996858
2021-05-23T06:36:28
2021-05-23T06:36:28
369,845,120
0
0
null
null
null
null
UTF-8
Java
false
false
1,494
java
package rough; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.testng.Assert; import testbase.TestBase; public class LoginPage { public WebDriver driver; public LoginPage(WebDriver driver){ this.driver = driver; PageFactory.initElements(driver, this); } @FindBy(xpath="//input[@name='uid']") public WebElement username_txtbox; @FindBy(xpath="//input[@name='password']") public WebElement password_txtbox; @FindBy(name="btnLogin") public WebElement login_btn; @FindBy(xpath="//input[@name='btnReset']") public WebElement reset_btn; public void enterUserName(String username) { //wait_until_visibilityOfElement(username_txtbox); username_txtbox.clear(); username_txtbox.sendKeys(username); } public void enterPassword(String password) { //wait_until_visibilityOfElement(password_txtbox); password_txtbox.clear(); password_txtbox.sendKeys(password); } public void clickOnLogin() { //wait_until_visibilityOfElement(login_btn); login_btn.click(); } public void clickonResetbutton() { reset_btn.click(); } public void verifyTitle(){ String title = driver.getTitle(); String expectedtitle = "Guru99 Bank Manager HomePage"; Assert.assertEquals(title,expectedtitle); } public String getAlertText(){ String text = driver.switchTo().alert().getText(); return text; } }
[ "shikhaswaroop27@gmail.com" ]
shikhaswaroop27@gmail.com
0e91aba004bf35fa8bc56e987cc0f1af5b13cce6
4faacf02003e2f9304490bf5c1bacab77ac8c30c
/java05/src/loop/WhileTest4.java
fb5c45ba460861e20f6e9611a5f86ecd8ef754e8
[]
no_license
heffy127/bigdata_java
44933a50586c65dda65f2aa75936ec82117a7a3c
9086a29af3364af1d9cdf23597a6c81d86511a08
refs/heads/master
2020-05-14T13:27:18.631178
2019-07-09T06:05:27
2019-07-09T06:05:27
181,812,606
0
0
null
null
null
null
UTF-8
Java
false
false
557
java
package loop; import javax.swing.JOptionPane; //두 개의 입력 값을 받아서, //첫 번째 값부터 두 번째 값까지 더함 public class WhileTest4 { public static void main(String[] args) { int num1 = Integer.parseInt(JOptionPane.showInputDialog("첫 번째 값 입력 : ")); int num2 = Integer.parseInt(JOptionPane.showInputDialog("두 번째 값 입력 : ")); int sum = 0; while(num1 <= num2) { sum += num1; num1++; } JOptionPane.showMessageDialog(null, "첫 번째 값 + 두 번째 값 = " + sum); } }
[ "noreply@github.com" ]
noreply@github.com
4bfea6d0b91b7f48d1d27ffce54d801f4ba76415
d49120908d0ecfb05452e9f04fc168c9f38ea95f
/app/src/test/java/sadiq/raza/projectharvest/ExampleUnitTest.java
9f534a615f3ca3f9169bb1b728b352972c261f70
[]
no_license
SadiqKhanRaza/ProjectHarvest
1c379044815368fd2bf1d3e7e4c447ace26c7509
fdd64542f57f51d7c670cc471d9f2ad2a9afc529
refs/heads/master
2020-04-25T17:57:23.955831
2019-03-01T09:25:34
2019-03-01T09:25:34
172,967,348
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package sadiq.raza.projectharvest; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "sadiqkhanraza@gmail.com" ]
sadiqkhanraza@gmail.com
d5d55b9055c775f1d78ac4f34581c19bb7537bcf
da7801451fdad67a239b7eb264c92efbd32f778f
/src/test/java/SoyTest.java
13f19374eb2f60f563b19f2fabd052e910aa1fd9
[]
no_license
stephanecharron/decorateur
1afcd8213a9a0377f61339bc89ec3b95dea51654
95c56eed7d9d1e3c26f08d4a960a8a94e54c3644
refs/heads/master
2020-04-20T16:48:15.541424
2019-02-03T16:59:59
2019-02-03T16:59:59
168,967,193
0
0
null
null
null
null
UTF-8
Java
false
false
468
java
import org.junit.Test; import static org.junit.Assert.assertEquals; public class SoyTest { Beverage beverage = new Soy( new Mocha( new Espresso())); @Test public void cost() { Double price = beverage.cost(); Double expectedPrice = 2.34; assertEquals(expectedPrice, price); } @Test public void getDescription() { String s = beverage.getDescription(); assertEquals("Espresso, Mocha, Soy", s); } }
[ "noreply@github.com" ]
noreply@github.com
6649c90a6a68e77c3aae5c97346629c051e2bab3
0af8b92686a58eb0b64e319b22411432aca7a8f3
/api-vs-impl-small/core/src/main/java/org/gradle/testcore/performancenull_10/Productionnull_903.java
63c3f162f31745130ea4b44106a1b16716ca1410
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
587
java
package org.gradle.testcore.performancenull_10; public class Productionnull_903 { private final String property; public Productionnull_903(String param) { this.property = param; } public String getProperty() { return property; } private String prop0; public String getProp0() { return prop0; } public void setProp0(String value) { prop0 = value; } private String prop1; public String getProp1() { return prop1; } public void setProp1(String value) { prop1 = value; } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
22b328ebe9c95809be24716b566868ab94e09ab3
f9c89f6c9ce3fb29a16a4bb6229922a2aa88b41f
/changmie/app/src/androidTest/java/com/hjchangmie/changmie/ApplicationTest.java
a2a8a7c398e5eb805156f4965c98f3d20a09b272
[]
no_license
ljnwork/changmie
4a9cfa5a24a0a249daff9d90b2a8e66ac5e2432f
fb0cd92b865931dd98ed61bf4e7cc8976689d23c
refs/heads/master
2021-01-01T05:35:08.820860
2015-02-07T01:43:56
2015-02-07T01:43:56
30,439,751
2
1
null
null
null
null
UTF-8
Java
false
false
354
java
package com.hjchangmie.changmie; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "747554505@qq.com" ]
747554505@qq.com
7cff5732dda42a69c23f9f0a90740322a83fe93a
7f1b4e346fb0968af22c51f1c55384c61f772ceb
/GmailMaven/src/main/java/gmail/test/GmailMaven/App.java
4edc277574feb8f8b339f7604c806bef18083a35
[]
no_license
NikhilRaj25/Niks
2da0f0de30d38a1f1350be125923bdec556e2c3b
a92cdab2993ea76dddd8a51656143aae556ab1fe
refs/heads/master
2023-05-10T22:05:30.916819
2019-08-18T17:46:15
2019-08-18T17:46:15
200,024,690
0
0
null
2023-05-09T18:11:45
2019-08-01T09:53:10
Java
UTF-8
Java
false
false
197
java
package gmail.test.GmailMaven; /** * Hello world! * */ public class App { public static void main( String[] args ) { System.out.println( "Hello World!" ); } }
[ "NIKHIL@LAPTOP-KJSGBRV1" ]
NIKHIL@LAPTOP-KJSGBRV1
59c5ccdde97018c0d5756603e2ece412661fe761
a562d1095df3bab42da4ff54f56c8db94fe0c73f
/src/main/java/com/example/demo/exception/InstitutionNotFoundException.java
e899e98e53b22c11bbeed9e5caf4a409be090280
[]
no_license
kangmin46/mission
e3ca6c9b62255b3f97bdd931d55d6287dc096d4e
746aeda144f475ac69b1aa813a2b42bb885dd78f
refs/heads/master
2020-11-23T21:46:15.991626
2019-12-15T14:59:44
2019-12-15T14:59:44
227,832,996
0
0
null
null
null
null
UTF-8
Java
false
false
309
java
package com.example.demo.exception; public class InstitutionNotFoundException extends RuntimeException { public static final String INSTITUTE_NOT_FOUND_MESSAGE = "해당 기관을 찾을 수 없습니다."; public InstitutionNotFoundException() { super(INSTITUTE_NOT_FOUND_MESSAGE); } }
[ "kangmin789@naver.com" ]
kangmin789@naver.com
6128c880e08fd60d94f0904d7575629fcaf8a521
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/12/12_2d07f9194af111c4a1b6b431f3a59798c43fb8c7/KeyManager/12_2d07f9194af111c4a1b6b431f3a59798c43fb8c7_KeyManager_s.java
0b38a13e0cd01d3ba8a50deb22a4089a358cad7c
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
38,570
java
/** * Part of the CCNx Java Library. * * Copyright (C) 2008, 2009 Palo Alto Research Center, Inc. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 2.1 * as published by the Free Software Foundation. * 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., 51 Franklin Street, * Fifth Floor, Boston, MA 02110-1301 USA. */ package org.ccnx.ccn; import java.io.FileNotFoundException; import java.io.IOException; import java.net.URI; import java.security.InvalidKeyException; import java.security.PrivateKey; import java.security.Provider; import java.security.PublicKey; import java.security.Security; import java.util.logging.Level; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.ccnx.ccn.config.ConfigurationException; import org.ccnx.ccn.config.SystemConfiguration; import org.ccnx.ccn.impl.CCNFlowControl; import org.ccnx.ccn.impl.CCNFlowControl.SaveType; import org.ccnx.ccn.impl.CCNFlowControl.Shape; import org.ccnx.ccn.impl.repo.RepositoryFlowControl; import org.ccnx.ccn.impl.security.keys.BasicKeyManager; import org.ccnx.ccn.impl.security.keys.PublicKeyCache; import org.ccnx.ccn.impl.security.keys.SecureKeyCache; import org.ccnx.ccn.impl.support.Log; import org.ccnx.ccn.impl.support.Tuple; import org.ccnx.ccn.io.CCNReader; import org.ccnx.ccn.io.ErrorStateException; import org.ccnx.ccn.io.content.PublicKeyObject; import org.ccnx.ccn.profiles.SegmentationProfile; import org.ccnx.ccn.profiles.VersioningProfile; import org.ccnx.ccn.profiles.security.KeyProfile; import org.ccnx.ccn.profiles.security.access.AccessControlManager; import org.ccnx.ccn.protocol.CCNTime; import org.ccnx.ccn.protocol.ContentName; import org.ccnx.ccn.protocol.ContentObject; import org.ccnx.ccn.protocol.KeyLocator; import org.ccnx.ccn.protocol.KeyName; import org.ccnx.ccn.protocol.PublisherPublicKeyDigest; import org.ccnx.ccn.protocol.ContentObject.SimpleVerifier; import org.ccnx.ccn.protocol.KeyLocator.KeyLocatorType; import org.ccnx.ccn.protocol.SignedInfo.ContentType; /** * Top-level interface for managing our own keys, as well as maintaining an address book containing * the keys of others (which will be used by the TrustManager). Also handles loading of the BouncyCastle * provider, which we need for many things. Very minimal interface now, expect to evolve extensively. */ public abstract class KeyManager { static { // This needs to be done once. Do it here to be sure it happens before // any work that needs it. KeyManager.initializeProvider(); } /** * Canary value, indicates we want to override any other key locator available. */ protected static final KeyLocator SELF_SIGNED_KEY_LOCATOR = new KeyLocator(); /** * Currently default to SHA-256. Only thing that associates a specific digest algorithm * with a version of the CCN protocol is the calculation of the vestigial content digest component * of ContentName used in Interest matching, and publisher digests. Changing the latter * is handled by backwards-compatible changes to the protocol encoding. All other digests are * stored prefaced with an algorithm identifier, to allow them to be modified. * We expect the protocol default digest algorithm to move to SHA3 when defined. */ public static final String DEFAULT_DIGEST_ALGORITHM = "SHA-256"; protected static Provider BC_PROVIDER = null; /** * The default KeyManager for this user/VM pair. The KeyManager will eventually have access * to significant cached state, and so a single one should be shared by as many processes * within the same trust domain as possible. We might make multiple KeyManagers representing * different "users" for testing purposes. */ protected static KeyManager _defaultKeyManager = null; /** * A default verifier to use, relative to these key caches and all. Move to TrustManager eventually. */ protected ContentVerifier _verifier = null; /** * Accessor to retrieve default key manager instance, or create it if necessary. * @return the KeyManager * @throws ConfigurationException if there is a problem with the user or system configuration that * requires intervention to resolve, or we have a significant problem starting up the key manager. */ public static synchronized KeyManager getDefaultKeyManager() { // could print a stack trace if (Log.isLoggable(Log.FAC_KEYS, Level.FINER)) { Log.finer(Log.FAC_KEYS, "NOTICE: retrieving default key manager. Do you really want to do this?"); try { throw new ConfigurationException("THIS IS NOT AN ERROR: tracking stack trace to find use of default key manager."); } catch (ConfigurationException e) { Log.logStackTrace(Level.FINER, e); } } if (null != _defaultKeyManager) return _defaultKeyManager; try { return createDefaultKeyManager(); } catch (IOException io) { Log.warning("IOException attempting to get KeyManager: " + io.getClass().getName() + ":" + io.getMessage()); Log.warningStackTrace(io); throw new RuntimeException("Error in system configuration. Cannot get KeyManager.",io); } catch (InvalidKeyException io) { Log.warning("InvalidKeyException attempting to get KeyManager: " + io.getClass().getName() + ":" + io.getMessage()); Log.warningStackTrace(io); throw new RuntimeException("Error in system configuration. Cannot get KeyManager.",io); } catch (ConfigurationException e) { Log.warning("Configuration exception attempting to get KeyManager: " + e.getMessage()); Log.warningStackTrace(e); throw new RuntimeException("Error in system configuration. Cannot get KeyManager.",e); } } /** * Clean up state left around by the default key manager and remove it. * For now that just means shutting down the network manager started by it */ public static synchronized void closeDefaultKeyManager() { if (null != _defaultKeyManager) { _defaultKeyManager.close(); _defaultKeyManager = null; } } /** * Create the default key manager. * @return the key manager * @throws ConfigurationException if there is a problem with the user or system configuration * that requires intervention to fix * @throws IOException if there is an operational problem loading data or initializing the key store * @throws ConfigurationException */ protected static synchronized KeyManager createDefaultKeyManager() throws InvalidKeyException, IOException, ConfigurationException { if (null == _defaultKeyManager) { _defaultKeyManager = new BasicKeyManager(); _defaultKeyManager.initialize(); } return _defaultKeyManager; } /** * Set the default key manager to one of our choice. If you do this, be careful on * calling close(). */ public static synchronized void setDefaultKeyManager(KeyManager keyManager) { if (null == keyManager) { Log.warning("Setting default key manager to NULL. Default user key manager will be loaded on next request for default key manager."); } closeDefaultKeyManager(); if (Log.isLoggable(Log.FAC_KEYS, Level.INFO)) { Log.info(Log.FAC_KEYS, "Setting default key manager: new KeyManager {0}", keyManager.getClass().getName()); } _defaultKeyManager = keyManager; } /** * Load the BouncyCastle and other necessary providers, should be called once for initialization. * Currently this is done by CCNHandle. */ public static void initializeProvider() { synchronized(KeyManager.class) { if (null == BC_PROVIDER) { BC_PROVIDER = Security.getProvider("BC"); if (null == BC_PROVIDER) { Provider bc = new BouncyCastleProvider(); int result = Security.addProvider(bc); BC_PROVIDER = bc; if (null != BC_PROVIDER) { if (result > 0) { if (Log.isLoggable(Log.FAC_KEYS, Level.INFO)) { Log.info(Log.FAC_KEYS, "KeyManager: Successfully initialized BouncyCastle provider at position " + result); } } else { if (Log.isLoggable(Log.FAC_KEYS, Level.INFO)) { Log.info(Log.FAC_KEYS, "KeyManager: BouncyCastle provider already installed."); } } } else { Log.severe("ERROR: NULL default provider! Cannot load BouncyCastle! Result of addProvider: " + result); } } else { if (Log.isLoggable(Log.FAC_KEYS, Level.INFO)) { Log.info(Log.FAC_KEYS, "KeyManager: BouncyCastle provider installed by default."); } } Provider checkProvider = Security.getProvider("BC"); if (null == checkProvider) { Log.severe("Could not load BouncyCastle provider back in!"); } } } } /** * Retrieve our default BouncyCastle provider. * @return the BouncyCastle provider instance */ public static Provider getDefaultProvider() { if (null == BC_PROVIDER) { initializeProvider(); } if (null == BC_PROVIDER) { Log.severe("ERROR: NULL default provider! Cannot load BouncyCastle!"); } return BC_PROVIDER; } public static boolean checkDefaultProvider() { boolean test = true; if (null == BC_PROVIDER) { test = false; Log.warning("checkDefaultProvider: initialization of BouncyCastle provider did not proceed properly, no BC_PROVIDER."); } if (null == Security.getProvider("BC")) { test = false; Log.warning("checkDefaultProvider: cannot load BouncyCastle provider!"); } return test; } /** * Subclasses can override with fancier verification behavior; again move to TrustManager eventually */ public ContentVerifier getDefaultVerifier() { if (null == _verifier) { synchronized(this) { if (null == _verifier) { _verifier = new SimpleVerifier(null, this); } } } return _verifier; } /** * Close any connections we have to the network. Ideally prepare to * reopen them when they are next needed. */ public abstract void close(); /** * Allows subclasses to specialize key manager initialization. * @throws ConfigurationException * @throws IOException */ public abstract void initialize() throws InvalidKeyException, IOException, ConfigurationException; public abstract boolean initialized(); public abstract void clearSavedConfigurationState() throws FileNotFoundException, IOException; /** * Get our default key ID. * @return the digest of our default key */ public abstract PublisherPublicKeyDigest getDefaultKeyID(); public boolean isOurDefaultKey(PublisherPublicKeyDigest keyID) { if (getDefaultKeyID().equals(keyID)) return true; return false; } /** * Access our collected store of public keys. * @return our PublicKeyCache */ public abstract PublicKeyCache getPublicKeyCache(); /** * Access our store of private keys and other secret key * material that we have retrieved. * @return our SecureKeyCache */ public abstract SecureKeyCache getSecureKeyCache(); public abstract void saveSecureKeyCache() throws FileNotFoundException, IOException; public abstract void saveConfigurationState() throws FileNotFoundException, IOException; /** * Not sure that this is the best idea, but others want to bootstrap on * our configuration data store to stash their own config data. Return * location as a URI as it might be a namespace rather than a directory. */ public abstract URI getConfigurationDataURI(); /** * Get our default private key. * @return our default private key */ public abstract PrivateKey getDefaultSigningKey(); /** * Get our default public key. * @return our default public key */ public abstract PublicKey getDefaultPublicKey(); /** * Return the key's content name for a given key id, given * a specified prefix and version. * The default key name is the publisher ID itself, * under the user's key collection. * @param keyID[] publisher ID * @return content name */ public ContentName getDefaultKeyName(ContentName keyPrefix, PublisherPublicKeyDigest keyID, CCNTime keyVersion) { if (null == keyPrefix) { keyPrefix = getDefaultKeyNamePrefix(); if (Log.isLoggable(Log.FAC_KEYS, Level.INFO)) { Log.info(Log.FAC_KEYS, "Got default key name prefix: {0}", keyPrefix); } } ContentName keyName = KeyProfile.keyName(keyPrefix, keyID); if (null != keyVersion) { return VersioningProfile.addVersion(keyName, keyVersion); } return keyName; } /** * Get the key-manager determined default key name for a key. Might include * a version, might allow caller to save with generated version. */ public abstract ContentName getDefaultKeyName(PublisherPublicKeyDigest keyID); /** * Allow subclasses to override default publishing location. */ public abstract ContentName getDefaultKeyNamePrefix(); /** * Gets the preferred key locator for this signing key. * @param publisherKeyID the key whose locator we want to retrieve, * if null retrieves the key locator for our default key * @return the current preferred key locator for that key */ public abstract KeyLocator getKeyLocator(PublisherPublicKeyDigest publisherKeyID); /** * Get our current preferred key locator for this signing key. Uses * getKeyLocator(PublisherPublicKeyDigest). */ public abstract KeyLocator getKeyLocator(PrivateKey signingKey); /** * Get the key locator for our default key. Same as getKeyLocator(null) */ public KeyLocator getDefaultKeyLocator() { return getKeyLocator(getDefaultKeyID()); } public abstract boolean haveStoredKeyLocator(PublisherPublicKeyDigest keyID); public abstract KeyLocator getStoredKeyLocator(PublisherPublicKeyDigest keyID); public abstract void clearStoredKeyLocator(PublisherPublicKeyDigest keyID); /** * Remember the key locator to use for a given key. Use * this to publish this key in the future if not overridden by method * calls. If no key locator stored for this key, and no override * given, compute a KEY type key locator if this key has not been * published, and the name given to it when published if it has. * @param publisherKeyID the key whose locator to set; if null sets it for our * default key * @param keyLocator the new key locator for this key; overrides any previous value. * If null, erases previous value and defaults will be used. */ public abstract void setKeyLocator(PublisherPublicKeyDigest publisherKeyID, KeyLocator keyLocator); /** * Get a KEY type key locator for a particular public key. * @param publisherKeyID the key whose locator we want to retrieve * @return the key locator * @throws IOException */ public KeyLocator getKeyTypeKeyLocator(PublisherPublicKeyDigest publisherKeyID) { PublicKey theKey = getPublicKey(publisherKeyID); if (null == theKey) { return null; } return new KeyLocator(theKey); } /** * Get the public key associated with a given publisher * @param publisher the digest of the desired key * @return the key, or null if no such key known to our cache * @throws IOException */ public abstract PublicKey getPublicKey(PublisherPublicKeyDigest publisher); /** * Get the publisher key digest associated with one of our signing keys * @param signingKey key whose publisher data we want * @return the digest of the corresponding public key */ public abstract PublisherPublicKeyDigest getPublisherKeyID(PrivateKey signingKey); /** * Get the private key associated with a given publisher * @param publisherKeyID the public key digest of the desired key * @return the key, or null if no such key known to our cache */ public abstract PrivateKey getSigningKey(PublisherPublicKeyDigest publisherKeyID); /** * Get all of our private keys, used for cache loading. * @return an array of our currently available private keys */ public abstract PrivateKey[] getSigningKeys(); /** * Get any timestamp associate with this key. * @param keyID * @return */ public abstract CCNTime getKeyVersion(PublisherPublicKeyDigest keyID); /** * Get the public key for a given publisher, going to the network to retrieve it if necessary. * @param publisherKeyID the digest of the keys we want * @param keyLocator the key locator to tell us where to retrieve the key from * @param timeout how long to try to retrieve the key * @return the key * @throws IOException if we run into an error attempting to read the key */ public abstract PublicKey getPublicKey( PublisherPublicKeyDigest publisherKeyID, KeyLocator keyLocator, long timeout) throws IOException; /** * Get the public key for a given publisher, going to the network to retrieve it if necessary. * Uses the SystemConfiguration.EXTRA_LONG_TIMEOUT to be aggressive and reexpress. * @param publisherKeyID the digest of the keys we want * @param keyLocator the key locator to tell us where to retrieve the key from * @return the key * @throws IOException if we run into an error attempting to read the key */ public PublicKey getPublicKey( PublisherPublicKeyDigest publisherKeyID, KeyLocator keyLocator) throws IOException { return getPublicKey(publisherKeyID, keyLocator, SystemConfiguration.EXTRA_LONG_TIMEOUT); } /** * Get the public key for a given publisher as it was explicitly published, * going to the network to retrieve it if necessary. If the key was not * published as a KEY content item (was in our keystore, or was in a KEY * type of key locator), this wil not retrieve anything. * @param publisherKeyID the digest of the keys we want * @param keyLocator the key locator to tell us where to retrieve the key from * @param timeout how long to try to retrieve the key * @return the key * @throws IOException if we run into an error attempting to read the key */ public abstract PublicKeyObject getPublicKeyObject( PublisherPublicKeyDigest desiredKeyID, KeyLocator locator, long timeout) throws IOException; /** * Allow subclasses to specialize key publication, if any. * @param defaultPrefix our default namespace, if we know * one for this environment. If null, take user defaults. * @throws ConfigurationException */ public PublicKeyObject publishDefaultKey(ContentName keyName) throws IOException, InvalidKeyException { if (!initialized()) { throw new IOException("KeyServer: cannot publish keys, have not yet initialized KeyManager!"); } return publishKey(keyName, getDefaultKeyID(), null, null); } /** * Publish a key at a certain name, signed by a specified identity (our * default, if null). Usually used to * publish our own keys, but can specify other keys we have in our cache. * * This publishes our key to our own internal key server, from where it can be retrieved * as long as this KeyManager is running. It does not put it on the wire until someone * requests it. * Implementation Note: This code is used in CCNHandle initialization, and as such it * cannot use a CCNHandle or any of the standard network operations without introducing * a circular dependency. The code is very low-level and should only be modified with * great caution. * * @param keyName content name of the public key * @param keyToPublish public key digest of key to publish, if null publish our default key * @param handle handle for ccn * @throws IOException * @throws InvalidKeyException */ public PublicKeyObject publishKey(ContentName keyName, PublisherPublicKeyDigest keyToPublish, PublisherPublicKeyDigest signingKeyID, KeyLocator signingKeyLocator) throws InvalidKeyException, IOException { if (null == keyToPublish) { keyToPublish = getDefaultKeyID(); } PublicKey theKey = getPublicKey(keyToPublish); if (null == theKey) { Log.warning("Cannot publish key {0} to name {1}, do not have public key in cache.", keyToPublish, keyName); return null; } return publishKey(keyName, theKey, signingKeyID, signingKeyLocator, true); } /** * Publish my public key to a local key server run in this JVM, as a self-signed key * record. We do this by default if we don't have any credentials for this key; this * just allows the caller to explicitly request this behavior even if we do have * credentials. * TODO need mechanism for controlling whether this ends up in the key locator... * @param keyName content name of the public key * @param keyToPublish public key digest of key to publish and to sign with * @param handle handle for ccn * @throws IOException * @throws InvalidKeyException */ public PublicKeyObject publishSelfSignedKey(ContentName keyName, PublisherPublicKeyDigest keyToPublish, boolean learnKeyLocator) throws InvalidKeyException, IOException { if (null == keyToPublish) { keyToPublish = getDefaultKeyID(); } PublicKey theKey = getPublicKey(keyToPublish); if (null == theKey) { Log.warning("Cannot publish key {0} to name {1}, do not have public key in cache.", keyToPublish, keyName); return null; } return publishKey(keyName, theKey, keyToPublish, SELF_SIGNED_KEY_LOCATOR, learnKeyLocator); } /** * Publish a key at a certain name, signed by our default identity. Usually used to * publish our own keys, but can specify other keys we have in our cache. * * This publishes our key to our own internal key server, from where it can be retrieved * as long as this KeyManager is running. It does not put it on the wire until someone * requests it. * Implementation Note: This code is used in CCNHandle initialization, and as such it * cannot use a CCNHandle or any of the standard network operations without introducing * a circular dependency. The code is very low-level and should only be modified with * great caution. * * @param keyName the name under which the key should be published. For the moment, keys are * unversioned. * @param keyToPublish can be null, in which case we publish our own default public key * @param signingKeyID key to sign with, if we wish to override default * @param signingKeyLocator locator to use, if we wish to override default; if null, one will * be computed * @param learnKeyLocator do we remember the key locator used as the default for this signing key * @throws InvalidKeyException * @throws IOException * @throws ConfigurationException */ public abstract PublicKeyObject publishKey(ContentName keyName, PublicKey keyToPublish, PublisherPublicKeyDigest signingKeyID, KeyLocator signingKeyLocator, boolean learnKeyLocator) throws InvalidKeyException, IOException; /** * Publish a key at a certain name, ensuring that it is stored in a repository. Will throw an * exception if no repository available. Usually used to publish our own keys, but can specify * any key known to our key cache. * @param keyName Name under which to publish the key. Currently added under existing version, or version * included in keyName. * @param keyToPublish can be null, in which case we publish our own default public key. * @param handle the handle to use for network requests * @throws InvalidKeyException * @throws IOException */ public abstract PublicKeyObject publishKeyToRepository(ContentName keyName, PublisherPublicKeyDigest keyToPublish, long timeToWaitForPreexisting) throws InvalidKeyException, IOException; /** * Publish one of our keys to a repository, if it isn't already there, and ensure * that it's self-signed regardless of what credentials we have for it (this * is the default behavior if we have no credentials for the key. Throws an exception * if no repository is available * @param keyName Name under which to publish the key. Currently added under existing version, or version * included in keyName. * @param theKey the public key to publish, if we happen to have it; otherwise it will be retrieved * from cache based on keyToPublish. * @param keyToPublish can be null, in which case we publish our own default public key. * @param handle the handle to use for network requests * @throws InvalidKeyException * @throws IOException */ public abstract PublicKeyObject publishSelfSignedKeyToRepository(ContentName keyName, PublicKey theKey, PublisherPublicKeyDigest keyToPublish, long timeToWaitForPreexisting) throws InvalidKeyException, IOException; /** * Publish our default key to a repository at its default location. * @param handle the handle used for network requests * @throws InvalidKeyException * @throws IOException */ public PublicKeyObject publishKeyToRepository() throws InvalidKeyException, IOException { return publishKeyToRepository(null, null); } public PublicKeyObject publishKeyToRepository(ContentName keyName, PublisherPublicKeyDigest keyToPublish) throws InvalidKeyException, IOException { return publishKeyToRepository(keyName, keyToPublish, SystemConfiguration.SHORT_TIMEOUT); } /** * Publish a public key to repository, if it isn't already there. * @param keyName content name of the public key to publish under (adds a version) * @param keyToPublish the key to publish * @param handle the handle to use to publish it with * @return the published information about this key, whether we published it or someone else had * @throws IOException */ public static PublicKeyObject publishKeyToRepository( ContentName keyName, PublicKey keyToPublish, PublisherPublicKeyDigest signingKeyID, KeyLocator signingKeyLocator, CCNHandle handle) throws IOException { return publishKeyToRepository(keyName, keyToPublish, signingKeyID, signingKeyLocator, SystemConfiguration.SHORT_TIMEOUT, false, handle); } /** * Publish a public key to repository, if it isn't already there. * @param keyName content name of the public key to publish under (adds a version) * @param keyToPublish the key to publish * @param signingKeyID the key to sign with * @param signingKeyLocator the key locator to use * @param timeToWaitForPreexisting how long to wait to see if it has already been published * (avoid re-publishing). If 0, we don't even try to find preexisting content. * @param requirePublisherMatch check to see if we match the specified publisher. Key locator * match too complex to check, make caller do that one. * @param handle the handle to use to publish it with * @return the published information about this key, whether we published it or someone else had * @throws IOException */ public static PublicKeyObject publishKeyToRepository( ContentName keyName, PublicKey keyToPublish, PublisherPublicKeyDigest signingKeyID, KeyLocator signingKeyLocator, long timeToWaitForPreexisting, boolean requirePublisherMatch, CCNHandle handle) throws IOException { // To avoid repeating work, we first see if this content is available on the network, then // if it's in a repository. That's because if it's not in a repository, we need to know if // it's on the network, and this way we save doing that work twice (as the repo-checking code // also needs to know if it's on the network). PublisherPublicKeyDigest keyDigest = new PublisherPublicKeyDigest(keyToPublish); // Returns immediately if timeToWaitForPreexisting is 0. ContentObject availableContent = CCNReader.isVersionedContentAvailable(keyName, ContentType.KEY, keyDigest.digest(), (requirePublisherMatch ? signingKeyID : null), null, timeToWaitForPreexisting, handle); // If we want it self-signed... if ((SELF_SIGNED_KEY_LOCATOR == signingKeyLocator) && (null != availableContent)) { // do mean == here.... // have already verified that keyDigest is the digest of the content of availableContent if (!PublicKeyObject.isSelfSigned(SegmentationProfile.segmentRoot(availableContent.name()), keyDigest, availableContent.signedInfo().getKeyLocator())) { // it would be perfect, but it's not self-signed if (Log.isLoggable(Log.FAC_KEYS, Level.INFO)) { Log.info(Log.FAC_KEYS, "Found our key published under desired name {0}, but not self-signed as required - key locator is {1}.", availableContent.name(), availableContent.signedInfo().getKeyLocator()); } availableContent = null; } } if (null != availableContent) { // See if some repository has this key already if (null != CCNReader.isContentInRepository(availableContent, timeToWaitForPreexisting, handle)) { if (Log.isLoggable(Log.FAC_KEYS, Level.INFO)) { Log.info(Log.FAC_KEYS, "publishKeyToRepository: key {0} is already in a repository; not re-publishing.", keyName); } } else { // Otherwise, we just need to trick the repo into pulling it. ContentName streamName = SegmentationProfile.segmentRoot(availableContent.name()); RepositoryFlowControl rfc = new RepositoryFlowControl(streamName, handle); // This will throw an IOException if there is no repository there to read it. rfc.startWrite(streamName, Shape.STREAM); // OK, once we've emitted the interest, we don't actually need that flow controller anymore. if (Log.isLoggable(Log.FAC_KEYS, Level.INFO)) { Log.info(Log.FAC_KEYS, "Key {0} published to repository.", keyName); } rfc.close(); } return new PublicKeyObject(availableContent, handle); } else { // We need to write this content ourselves, nobody else has it. We know we really want to // write it, no point in checking again to see if it's there. return publishKey(keyName, keyToPublish, signingKeyID, signingKeyLocator, null, SaveType.REPOSITORY, handle, handle.keyManager()); } } /** * Note: this is the lowest level interface to key publication; there are many higher-level * interfaces that are probably what you want. This needs to be public to get across * package constraints. * Publish a signed record for this key. We've already decided we need to publish, * and how; no more checks are made to see if the key already exists. * * @param keyName the key's content name. Will add a version when saving if it doesn't * have one already. If it does have a version, will use that one (see below for effect * of version on the key locator). (Note that this is not * standard behavior for savable network content, which needs its version explicitly * set.) * @param keyToPublish the public key to publish * @param keyID the publisher id * @param signingKeyID the key id of the key pair to sign with * @param signingKeyLocator the key locator to use if we save this key (if it is not already published). * If not specified, we look for the default locator for the signing key. If there is none, * and we are signing with the same key we are publishing, we build a * self-referential key locator, using the name passed in (versioned or not). * @param flowController flow controller to use. If non-null, saveType is ignored. * @param saveType -- if we don't want to hand in a special-purpose flow controller, set saveType to RAW * or REPO to get standard publishing behavior. * @param handle the handle to use if we haven't specified a flow controller. Makes a flow controller * of the type specified by saveType. * @param keyManager the key manager to use to pull additional signing information (default keys * and locators if not specified). If null, taken from handle. Also publish key added to its cache. * @return the published information about this key, whether we published it or someone else had * @throws IOException */ public static PublicKeyObject publishKey( ContentName keyName, PublicKey keyToPublish, PublisherPublicKeyDigest signingKeyID, KeyLocator signingKeyLocator, CCNFlowControl flowController, SaveType saveType, CCNHandle handle, KeyManager keyManager) throws IOException { if ((null == keyManager) && (null != handle)) { keyManager = handle.keyManager(); } if ((null == keyManager) || ((null == flowController) && (null == handle)) || ((null == flowController) && (null == saveType))) { // TODO DKS not quite right type... throw new ErrorStateException("Must provide a flow controller or a handle and a save type, and a key manager!"); } // Now, finally; it's not published, so make an object to write it // with. We've already tried to pull it, so don't try here. Will // set publisher info below. // Need a key locator to stick in data entry for // locator. Could use key itself, but then would have // key both in the content for this item and in the // key locator, which is redundant. Use naming form // that allows for self-referential key names -- the // CCN equivalent of a "self-signed cert". Means that // we will refer to only the base key name and the publisher ID. if (null == signingKeyID) { signingKeyID = keyManager.getDefaultKeyID(); } // Here is where we get tricky. We might really want the key to be of a particular // version. In general, as we use the network objects to write versioned versioned stuff, // we might not be able to take the last component of a name, if versioned, as the version // to use to save -- might really want <name>/<version1>/<version2>. So unless we want to // make that impossible to achieve, we need to not have the network objects take the // name <name>/<version1> and save to <version1> (though they read from <version1> just // fine given the same). You always want to save to a new version, unless someone tells you // something different from the outside. // Come up with a contorted option. If you want to publish <version>/<version> stuff, you // need to pass in the second version... CCNTime keyVersion = null; // do we force a version? Tuple<ContentName, byte []> nameAndVersion = VersioningProfile.cutTerminalVersion(keyName); if (null != nameAndVersion.second()) { keyVersion = VersioningProfile.getVersionComponentAsTimestamp(nameAndVersion.second()); } else { keyVersion = new CCNTime(); // so we can use it in locator } // Set key locator if not specified, include version for self-signed. // Really do want == here if ((null == signingKeyLocator) || (SELF_SIGNED_KEY_LOCATOR == signingKeyLocator)) { KeyLocator existingLocator = keyManager.getKeyLocator(signingKeyID); // If we've asked for this to be self-signed, or we have made the default KEY // type key locator, make this a self-signed key. if ((SELF_SIGNED_KEY_LOCATOR == signingKeyLocator) || (existingLocator.type() == KeyLocatorType.KEY)) { PublisherPublicKeyDigest keyDigest = new PublisherPublicKeyDigest(keyToPublish); if (signingKeyID.equals(keyDigest)) { // Make a self-referential key locator. For now do not include the // version. existingLocator = new KeyLocator( new KeyName(VersioningProfile.addVersion(keyName, keyVersion), signingKeyID)); if (Log.isLoggable(Log.FAC_KEYS, Level.FINER)) { Log.finer(Log.FAC_KEYS, "Overriding constructed key locator of type KEY, making self-referential locator {0}", existingLocator); } } } signingKeyLocator = existingLocator; } PublicKeyObject keyObject = null; if (null != flowController) { // If a flow controller was specified, use that keyObject = new PublicKeyObject(nameAndVersion.first(), keyToPublish, signingKeyID, signingKeyLocator, flowController); } else { // No flow controller given, use specified saveType. keyObject = new PublicKeyObject(nameAndVersion.first(), keyToPublish, saveType, signingKeyID, signingKeyLocator, handle); } if (Log.isLoggable(Log.FAC_KEYS, Level.INFO)) { Log.info(Log.FAC_KEYS, "publishKey: key not previously published, making new key object {0} with version {1} displayed as {2}", keyObject.getVersionedName(), keyVersion, ((null != nameAndVersion.second()) ? ContentName.componentPrintURI(nameAndVersion.second()) : "<no version>")); } // Eventually may want to find something already published and link to it, but be simple here. if (!keyObject.save(keyVersion)) { if (Log.isLoggable(Log.FAC_KEYS, Level.INFO)) { Log.info(Log.FAC_KEYS, "Not saving key when we thought we needed to: desired key value {0}, have key value {1}, " + keyToPublish, new PublisherPublicKeyDigest(keyObject.publicKey())); } } else { if (Log.isLoggable(Log.FAC_KEYS, Level.INFO)) { Log.info(Log.FAC_KEYS, "Published key {0} to name {1} with key locator {2}.", keyToPublish, keyObject.getVersionedName(), signingKeyLocator); } } keyManager.getPublicKeyCache().remember(keyObject); return keyObject; } /** * Right now KeyServers are hidden in our subclasses.... this makes it hard to expose * control of filter registration. This is a bad attempt at an API for that, it should * change. Don't make it abstract as subclasses may not need it. * @throws IOException */ public void respondToKeyRequests(ContentName keyPrefix) throws IOException {} /** * Handle access control manager cache. * @param contentName * @return */ public abstract AccessControlManager getAccessControlManagerForName(ContentName contentName); public abstract void rememberAccessControlManager(AccessControlManager acm); }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
310a6c1fc836499132feba14ba4eb54a834c1e7a
52e82999b26ea658f96574021c0a653ab355eb95
/src/main/java/com/example/spring/multidb/models/CommonBaseModel.java
cedd17a10223b1a3a93cd400f01b346fcfd37ab4
[]
no_license
sureshpec04/multidbspring
494b5e67e903e8b131ecd90547c49c40972de993
cb82e514c2e902b4700b6c4469e3975966fc0887
refs/heads/master
2020-03-18T04:24:17.735100
2018-05-21T15:29:59
2018-05-21T15:29:59
134,285,378
0
0
null
null
null
null
UTF-8
Java
false
false
1,749
java
package com.example.spring.multidb.models; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import java.util.Date; import javax.persistence.Column; import javax.persistence.EntityListeners; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.MappedSuperclass; /** Abstract base model including primary id and * created_at and updated_at time fields. */ @MappedSuperclass @EntityListeners(AuditingEntityListener.class) public class CommonBaseModel { /** Primary id. */ @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; /** Model created at timestamp. */ @CreatedDate @Column(name = "created_at") private Date createdAt; /** Model updated at timestamp. */ @LastModifiedDate @Column(name = "updated_at") private Date updatedAt; /** Constructor. */ protected CommonBaseModel() { // Private constructor to prevent direct instantiation. } /** Primary id getter. */ public Long getId() { return id; } /** Primary id setter. */ public void setId(final Long id) { this.id = id; } /** Created at getter. */ public Date getCreatedAt() { return (Date) createdAt.clone(); } /** Created at setter. */ public void setCreatedAt(final Date createdAt) { this.createdAt = (Date) createdAt.clone(); } /** Updated at getter. */ public Date getUpdatedAt() { return (Date) updatedAt.clone(); } /** Updated at setter. */ public void setUpdatedAt(final Date updatedAt) { this.updatedAt = (Date) updatedAt.clone(); } }
[ "smuthuku@win.cccis.com" ]
smuthuku@win.cccis.com
df8d7a8bc9a1802e6b265e378896d599c7e32937
c885ef92397be9d54b87741f01557f61d3f794f3
/tests-without-trycatch/Lang-9/org.apache.commons.lang3.time.FastDateParser/BBC-F0-opt-60/27/org/apache/commons/lang3/time/FastDateParser_ESTest.java
947a283234d0974a4544539646adf5437a29e9f5
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
24,558
java
/* * This file was automatically generated by EvoSuite * Sat Oct 23 09:48:10 GMT 2021 */ package org.apache.commons.lang3.time; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import java.text.ParseException; import java.text.ParsePosition; import java.time.ZoneId; import java.time.temporal.ChronoField; import java.util.Date; import java.util.Locale; import java.util.SimpleTimeZone; import java.util.TimeZone; import java.util.regex.Pattern; import org.apache.commons.lang3.time.FastDateParser; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) public class FastDateParser_ESTest extends FastDateParser_ESTest_scaffolding { @Test(timeout = 4000) public void test00() throws Throwable { TimeZone timeZone0 = TimeZone.getTimeZone("7)@WyFkK%("); Locale locale0 = Locale.GERMANY; FastDateParser fastDateParser0 = new FastDateParser("7)@WyFkK%(", timeZone0, locale0); assertEquals("7)@WyFkK%(", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test01() throws Throwable { Locale locale0 = Locale.CHINA; TimeZone timeZone0 = TimeZone.getDefault(); FastDateParser fastDateParser0 = new FastDateParser("5", timeZone0, locale0); int int0 = fastDateParser0.adjustYear(3489); assertEquals(5389, int0); } @Test(timeout = 4000) public void test02() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(63, ""); Locale locale0 = Locale.FRANCE; FastDateParser fastDateParser0 = new FastDateParser("zcQJ.Nc|qL-pCZw}", simpleTimeZone0, locale0); boolean boolean0 = fastDateParser0.isNextNumber(); assertFalse(boolean0); } @Test(timeout = 4000) public void test03() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(0, " not in ("); Locale locale0 = Locale.ENGLISH; FastDateParser fastDateParser0 = new FastDateParser(" not in (", simpleTimeZone0, locale0); TimeZone timeZone0 = fastDateParser0.getTimeZone(); assertEquals(0, timeZone0.getRawOffset()); } @Test(timeout = 4000) public void test04() throws Throwable { Locale locale0 = Locale.CHINA; SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(2764, "g1HyD}Y()6y?_&Bk*"); FastDateParser fastDateParser0 = new FastDateParser("dzJ%4", simpleTimeZone0, locale0); TimeZone timeZone0 = fastDateParser0.getTimeZone(); assertEquals("g1HyD}Y()6y?_&Bk*", timeZone0.getID()); } @Test(timeout = 4000) public void test05() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(63, ""); Locale locale0 = Locale.ENGLISH; FastDateParser fastDateParser0 = new FastDateParser("hLMAA[[", simpleTimeZone0, locale0); int int0 = fastDateParser0.adjustYear((-2280)); assertEquals((-280), int0); } @Test(timeout = 4000) public void test06() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, ".G4;"); Locale locale0 = Locale.ENGLISH; FastDateParser fastDateParser0 = new FastDateParser(".G4;", simpleTimeZone0, locale0); ParsePosition parsePosition0 = new ParsePosition((-861034049)); // Undeclared exception! // try { fastDateParser0.parseObject("AET", parsePosition0); // fail("Expecting exception: StringIndexOutOfBoundsException"); // } catch(StringIndexOutOfBoundsException e) { // } } @Test(timeout = 4000) public void test07() throws Throwable { ZoneId zoneId0 = ZoneId.systemDefault(); TimeZone timeZone0 = TimeZone.getTimeZone(zoneId0); Locale locale0 = FastDateParser.JAPANESE_IMPERIAL; FastDateParser fastDateParser0 = new FastDateParser(")+5a^mb+", timeZone0, locale0); ParsePosition parsePosition0 = new ParsePosition(42); // Undeclared exception! // try { fastDateParser0.parseObject((String) null, parsePosition0); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.apache.commons.lang3.time.FastDateParser", e); // } } @Test(timeout = 4000) public void test08() throws Throwable { TimeZone timeZone0 = TimeZone.getDefault(); Locale locale0 = Locale.JAPANESE; FastDateParser fastDateParser0 = new FastDateParser("a;ysog", timeZone0, locale0); // try { fastDateParser0.parseObject("GMTAET"); // fail("Expecting exception: ParseException"); // } catch(ParseException e) { // // // // Unparseable date: \"GMTAET\" does not match (\u5348\u524D|\u5348\u5F8C);(\\p{IsNd}{1}+)(\\p{IsNd}++) // // // verifyException("org.apache.commons.lang3.time.FastDateParser", e); // } } @Test(timeout = 4000) public void test09() throws Throwable { Locale locale0 = Locale.CHINA; TimeZone timeZone0 = TimeZone.getDefault(); FastDateParser fastDateParser0 = new FastDateParser("D+|E+|F+|G+|H+|K+|M+|S+|W+|Z+|a+|d+|h+|k+|m+|s+|w+|y+|z+|''|'[^']++(''[^']*+)*+'|[^'A-Za-z]++", timeZone0, locale0); // Undeclared exception! // try { fastDateParser0.parseObject((String) null); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.apache.commons.lang3.time.FastDateParser", e); // } } @Test(timeout = 4000) public void test10() throws Throwable { TimeZone timeZone0 = TimeZone.getDefault(); Locale locale0 = Locale.KOREA; FastDateParser fastDateParser0 = new FastDateParser("w.G)yyD~~qCB8fYp)j", timeZone0, locale0); ParsePosition parsePosition0 = new ParsePosition(14); // Undeclared exception! // try { fastDateParser0.parse("CAT", parsePosition0); // fail("Expecting exception: StringIndexOutOfBoundsException"); // } catch(StringIndexOutOfBoundsException e) { // } } @Test(timeout = 4000) public void test11() throws Throwable { Locale locale0 = Locale.CHINA; TimeZone timeZone0 = TimeZone.getDefault(); FastDateParser fastDateParser0 = new FastDateParser("<<g^", timeZone0, locale0); // Undeclared exception! // try { fastDateParser0.parse("pBO}uTn*'G.bw3Ua;", (ParsePosition) null); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.apache.commons.lang3.time.FastDateParser", e); // } } @Test(timeout = 4000) public void test12() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(0, "]kdf1@4uJ|v?q"); Locale locale0 = new Locale("]kdf1@4uJ|v?q", "", ""); FastDateParser fastDateParser0 = new FastDateParser("]kdf1@4uJ|v?q", simpleTimeZone0, locale0); // Undeclared exception! // try { fastDateParser0.parse((String) null); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.apache.commons.lang3.time.FastDateParser", e); // } } @Test(timeout = 4000) public void test13() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, ".G4;"); Locale locale0 = Locale.ENGLISH; FastDateParser fastDateParser0 = new FastDateParser(".G4;", simpleTimeZone0, locale0); // Undeclared exception! // try { fastDateParser0.getFieldWidth(); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.apache.commons.lang3.time.FastDateParser", e); // } } @Test(timeout = 4000) public void test14() throws Throwable { Locale locale0 = Locale.GERMANY; Locale locale1 = Locale.CHINESE; TimeZone timeZone0 = TimeZone.getDefault(); timeZone0.getDisplayName(); FastDateParser fastDateParser0 = new FastDateParser("D+|E+|F+|G+|H+|K+|M+|S+|W+|Z+|a+|d+|h+|k+|m+|s+w+|y+|7+|''|'[^']++''[^']*+)*+'|[^'A-Za-z]++", timeZone0, locale1); FastDateParser fastDateParser1 = new FastDateParser("D+|E+|F+|G+|H+|K+|M+|S+|W+|Z+|a+|d+|h+|k+|m+|s+w+|y+|7+|''|'[^']++''[^']*+)*+'|[^'A-Za-z]++", timeZone0, locale0); Object object0 = new Object(); } @Test(timeout = 4000) public void test15() throws Throwable { Locale locale0 = Locale.CANADA; FastDateParser fastDateParser0 = null; // try { fastDateParser0 = new FastDateParser("L2,5q", (TimeZone) null, locale0); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // } } @Test(timeout = 4000) public void test16() throws Throwable { Locale locale0 = Locale.CHINA; TimeZone timeZone0 = TimeZone.getDefault(); FastDateParser fastDateParser0 = new FastDateParser("M,9/pu)+Cfi<W?", timeZone0, locale0); ParsePosition parsePosition0 = new ParsePosition(1); Date date0 = fastDateParser0.parse("GMTEAT", parsePosition0); assertNull(date0); } @Test(timeout = 4000) public void test17() throws Throwable { TimeZone timeZone0 = TimeZone.getDefault(); Locale locale0 = Locale.JAPAN; FastDateParser fastDateParser0 = new FastDateParser("z", timeZone0, locale0); ParsePosition parsePosition0 = new ParsePosition(0); fastDateParser0.parse("IST", parsePosition0); assertEquals("java.text.ParsePosition[index=3,errorIndex=-1]", parsePosition0.toString()); assertEquals(3, parsePosition0.getIndex()); } @Test(timeout = 4000) public void test18() throws Throwable { TimeZone timeZone0 = TimeZone.getDefault(); Locale locale0 = Locale.JAPANESE; FastDateParser fastDateParser0 = new FastDateParser("z", timeZone0, locale0); Object object0 = fastDateParser0.parseObject("GMTCTT"); assertEquals("Fri Feb 14 20:21:21 GMT 2014", object0.toString()); } @Test(timeout = 4000) public void test19() throws Throwable { TimeZone timeZone0 = TimeZone.getDefault(); Locale locale0 = Locale.JAPAN; FastDateParser fastDateParser0 = new FastDateParser("z", timeZone0, locale0); Date date0 = fastDateParser0.parse("IST"); assertEquals("Fri Feb 14 20:21:21 GMT 2014", date0.toString()); } @Test(timeout = 4000) public void test20() throws Throwable { TimeZone timeZone0 = TimeZone.getTimeZone(""); Locale locale0 = Locale.TAIWAN; FastDateParser fastDateParser0 = new FastDateParser("_iSI,#jGhJ/>dTC", timeZone0, locale0); assertEquals("_iSI,#jGhJ/>dTC", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test21() throws Throwable { TimeZone timeZone0 = TimeZone.getTimeZone("7)@WyFkK%("); Locale locale0 = Locale.GERMANY; FastDateParser fastDateParser0 = new FastDateParser("m(ED@Ir_owNcE+cFHj(", timeZone0, locale0); assertEquals("m(ED@Ir_owNcE+cFHj(", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test22() throws Throwable { TimeZone timeZone0 = TimeZone.getTimeZone(">BX0.y"); Locale locale0 = Locale.GERMANY; FastDateParser fastDateParser0 = new FastDateParser(">6", timeZone0, locale0); assertEquals(">6", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test23() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone((-2287), "K1"); Locale locale0 = Locale.ENGLISH; FastDateParser fastDateParser0 = new FastDateParser("=nI[os", simpleTimeZone0, locale0); assertEquals("=nI[os", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test24() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(0, " not in ("); Locale locale0 = Locale.CHINA; FastDateParser fastDateParser0 = new FastDateParser(":Lhq*>'%l1_", simpleTimeZone0, locale0); assertEquals(":Lhq*>'%l1_", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test25() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(0, "6$cVbVRRBgtsHjlP"); Locale locale0 = Locale.ENGLISH; FastDateParser fastDateParser0 = new FastDateParser("6$cVbVRRBgtsHjlP", simpleTimeZone0, locale0); assertEquals("6$cVbVRRBgtsHjlP", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test26() throws Throwable { Locale locale0 = Locale.CHINA; TimeZone timeZone0 = TimeZone.getDefault(); FastDateParser fastDateParser0 = new FastDateParser("32*! ", timeZone0, locale0); ParsePosition parsePosition0 = new ParsePosition(43); Object object0 = fastDateParser0.parseObject("org.apache.commons.lang3.time.FastDateParser", parsePosition0); assertNull(object0); } @Test(timeout = 4000) public void test27() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, ""); Locale locale0 = Locale.CHINA; FastDateParser fastDateParser0 = new FastDateParser("2(pK&Pa", simpleTimeZone0, locale0); assertEquals("2(pK&Pa", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test28() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone((-2287), "K1"); Locale locale0 = Locale.CHINA; FastDateParser fastDateParser0 = new FastDateParser("/y", simpleTimeZone0, locale0); assertEquals("/y", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test29() throws Throwable { TimeZone timeZone0 = TimeZone.getTimeZone(">BX0.y"); Locale locale0 = Locale.GERMANY; FastDateParser fastDateParser0 = new FastDateParser("8}!s5!D0S,\"^ pu0j", timeZone0, locale0); assertEquals("8}!s5!D0S,\"^ pu0j", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test30() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, ":-OgS3}n;]Mf+~m|v"); Locale locale0 = Locale.ENGLISH; FastDateParser fastDateParser0 = new FastDateParser("1a{MKf,\"Lm&2wy", simpleTimeZone0, locale0); int int0 = fastDateParser0.adjustYear(0); assertEquals(2000, int0); } @Test(timeout = 4000) public void test31() throws Throwable { TimeZone timeZone0 = TimeZone.getDefault(); Locale locale0 = Locale.TAIWAN; FastDateParser fastDateParser0 = new FastDateParser("~ZXD}", timeZone0, locale0); int int0 = fastDateParser0.adjustYear(34); assertEquals(1934, int0); } @Test(timeout = 4000) public void test32() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(398, "GMTART"); Locale locale0 = Locale.forLanguageTag("GMTART"); FastDateParser fastDateParser0 = new FastDateParser("`a?@'-+:N&&s'yqlmR", simpleTimeZone0, locale0); assertEquals("`a?@'-+:N&&s'yqlmR", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test33() throws Throwable { Locale locale0 = Locale.CHINA; TimeZone timeZone0 = TimeZone.getDefault(); FastDateParser fastDateParser0 = new FastDateParser("9$_/loZ0PlED", timeZone0, locale0); assertEquals("9$_/loZ0PlED", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test34() throws Throwable { Locale locale0 = Locale.CHINESE; TimeZone timeZone0 = TimeZone.getDefault(); FastDateParser fastDateParser0 = new FastDateParser("-mVj.V#hWAu", timeZone0, locale0); // try { fastDateParser0.parse("&H>2`|9g0"); // fail("Expecting exception: ParseException"); // } catch(ParseException e) { // // // // Unparseable date: \"&H>2`|9g0\" does not match -(\\p{IsNd}++) // // // verifyException("org.apache.commons.lang3.time.FastDateParser", e); // } } @Test(timeout = 4000) public void test35() throws Throwable { TimeZone timeZone0 = TimeZone.getTimeZone("7L@WyFkK%[("); Locale locale0 = FastDateParser.JAPANESE_IMPERIAL; FastDateParser fastDateParser0 = new FastDateParser("w*,;}*[H71L", timeZone0, locale0); // try { fastDateParser0.parse("w*,;}*[H71L"); // fail("Expecting exception: ParseException"); // } catch(ParseException e) { // // // // (The ja_JP_JP_#u-ca-japanese locale does not support dates before 1868 AD) // // Unparseable date: \"w*,;}*[H71L\" does not match (\\p{IsNd}++)\\*,;\\}\\*\\[(\\p{IsNd}{1}+)71 // // // verifyException("org.apache.commons.lang3.time.FastDateParser", e); // } } @Test(timeout = 4000) public void test36() throws Throwable { Locale locale0 = Locale.CHINA; TimeZone timeZone0 = TimeZone.getDefault(); Locale locale1 = Locale.ENGLISH; FastDateParser fastDateParser0 = new FastDateParser("(The ", timeZone0, locale1); FastDateParser fastDateParser1 = new FastDateParser("(The ", timeZone0, locale0); boolean boolean0 = fastDateParser0.equals(fastDateParser1); assertFalse(boolean0); } @Test(timeout = 4000) public void test37() throws Throwable { TimeZone timeZone0 = TimeZone.getDefault(); Locale locale0 = Locale.CHINESE; FastDateParser fastDateParser0 = new FastDateParser(";.g]", timeZone0, locale0); SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(2023, "GMTPNT"); FastDateParser fastDateParser1 = new FastDateParser(";.g]", simpleTimeZone0, locale0); boolean boolean0 = fastDateParser1.equals(fastDateParser0); assertFalse(boolean0); } @Test(timeout = 4000) public void test38() throws Throwable { Locale locale0 = Locale.CHINA; TimeZone timeZone0 = TimeZone.getDefault(); FastDateParser fastDateParser0 = new FastDateParser("GMTNET", timeZone0, locale0); FastDateParser fastDateParser1 = new FastDateParser("a!,a&H`!d;&", timeZone0, locale0); boolean boolean0 = fastDateParser0.equals(fastDateParser1); assertFalse(boolean0); } @Test(timeout = 4000) public void test39() throws Throwable { Locale locale0 = Locale.ENGLISH; TimeZone timeZone0 = TimeZone.getTimeZone(""); FastDateParser fastDateParser0 = new FastDateParser("dwTcnu*te-kU\"q\b&g", timeZone0, locale0); ChronoField chronoField0 = ChronoField.EPOCH_DAY; boolean boolean0 = fastDateParser0.equals(chronoField0); assertFalse(boolean0); } @Test(timeout = 4000) public void test40() throws Throwable { Locale locale0 = Locale.CHINA; TimeZone timeZone0 = TimeZone.getDefault(); FastDateParser fastDateParser0 = new FastDateParser("GMTNET", timeZone0, locale0); boolean boolean0 = fastDateParser0.equals(fastDateParser0); assertTrue(boolean0); } @Test(timeout = 4000) public void test41() throws Throwable { Locale locale0 = Locale.CHINA; TimeZone timeZone0 = TimeZone.getDefault(); FastDateParser fastDateParser0 = null; // try { fastDateParser0 = new FastDateParser("CAT", timeZone0, locale0); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // Invalid pattern // // // verifyException("org.apache.commons.lang3.time.FastDateParser", e); // } } @Test(timeout = 4000) public void test42() throws Throwable { TimeZone timeZone0 = TimeZone.getDefault(); Locale locale0 = Locale.CANADA_FRENCH; FastDateParser fastDateParser0 = new FastDateParser("MIT", timeZone0, locale0); Object object0 = fastDateParser0.parseObject("4"); assertEquals("Fri Feb 14 20:21:21 GMT 2014", object0.toString()); } @Test(timeout = 4000) public void test43() throws Throwable { TimeZone timeZone0 = TimeZone.getDefault(); Locale locale0 = Locale.JAPAN; FastDateParser fastDateParser0 = new FastDateParser("z", timeZone0, locale0); Pattern pattern0 = fastDateParser0.getParsePattern(); assertEquals(0, pattern0.flags()); } @Test(timeout = 4000) public void test44() throws Throwable { Locale locale0 = Locale.CHINA; TimeZone timeZone0 = TimeZone.getDefault(); FastDateParser fastDateParser0 = new FastDateParser("D+|E+|F+|G+|H+|K+|M+|S+|W+|Z+|a+|d+|h+|k+|m+|s+|w+|y+|z+|''|'[^']++(''[^']*+)*+'|[^'A-Za-z]++", timeZone0, locale0); Locale locale1 = fastDateParser0.getLocale(); assertEquals("", locale1.getVariant()); } @Test(timeout = 4000) public void test45() throws Throwable { ZoneId zoneId0 = ZoneId.systemDefault(); TimeZone timeZone0 = TimeZone.getTimeZone(zoneId0); Locale locale0 = FastDateParser.JAPANESE_IMPERIAL; FastDateParser fastDateParser0 = new FastDateParser(")+5ub+", timeZone0, locale0); String string0 = fastDateParser0.getPattern(); assertEquals(")+5ub+", string0); } @Test(timeout = 4000) public void test46() throws Throwable { TimeZone timeZone0 = TimeZone.getDefault(); Locale locale0 = Locale.CANADA; FastDateParser fastDateParser0 = new FastDateParser("(The ", timeZone0, locale0); ParsePosition parsePosition0 = new ParsePosition(0); fastDateParser0.parseObject("(The ", parsePosition0); assertEquals("java.text.ParsePosition[index=1,errorIndex=-1]", parsePosition0.toString()); assertEquals(1, parsePosition0.getIndex()); } @Test(timeout = 4000) public void test47() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, ":-OgS3}n;]Mf+~m|v"); Locale locale0 = Locale.ENGLISH; FastDateParser fastDateParser0 = new FastDateParser("1a{MKf,\"Lm&2wy", simpleTimeZone0, locale0); String string0 = fastDateParser0.toString(); assertEquals("FastDateParser[1a{MKf,\"Lm&2wy,en,:-OgS3}n;]Mf+~m|v]", string0); } @Test(timeout = 4000) public void test48() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, ".G4;"); Locale locale0 = Locale.ENGLISH; FastDateParser fastDateParser0 = new FastDateParser(".G4;", simpleTimeZone0, locale0); fastDateParser0.hashCode(); } @Test(timeout = 4000) public void test49() throws Throwable { Locale locale0 = Locale.SIMPLIFIED_CHINESE; TimeZone timeZone0 = TimeZone.getDefault(); FastDateParser fastDateParser0 = new FastDateParser("MMM<", timeZone0, locale0); assertEquals("MMM<", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test50() throws Throwable { Locale locale0 = Locale.ENGLISH; TimeZone timeZone0 = TimeZone.getTimeZone(""); FastDateParser fastDateParser0 = new FastDateParser("dwTcnu*te-kU\"q\b&g", timeZone0, locale0); Object object0 = fastDateParser0.parseObject("85"); assertEquals("Fri Feb 14 20:21:21 GMT 2014", object0.toString()); } @Test(timeout = 4000) public void test51() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone(29, ".G4;"); Locale locale0 = Locale.ENGLISH; FastDateParser fastDateParser0 = new FastDateParser("FastDateParser[.G4;,en,.G4;]", simpleTimeZone0, locale0); assertEquals("FastDateParser[.G4;,en,.G4;]", fastDateParser0.getPattern()); } @Test(timeout = 4000) public void test52() throws Throwable { SimpleTimeZone simpleTimeZone0 = new SimpleTimeZone((-2287), "K1"); Locale locale0 = Locale.ENGLISH; FastDateParser fastDateParser0 = new FastDateParser("dzJ%4", simpleTimeZone0, locale0); TimeZone timeZone0 = fastDateParser0.getTimeZone(); assertSame(simpleTimeZone0, timeZone0); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
2826d8e76de8d4030b1912d33fb3035b69aa543e
7b0de570be092879a621d47ccfbd07525d79dcb1
/datacatalog-dashboard/src/main/java/edu/indiana/d2i/datacatalog/dashboard/api/PerformanceLog.java
41dc9d40d9b7bca88eedc4b41e4745f5684bd126
[]
no_license
milinda/DataCatalog-Dashboard
d31f89ed47885d0cede27e9f72e1b5424e6d3aea
932f930bf8597fb973312c8c6a59b205f1db45df
refs/heads/master
2021-01-20T06:25:57.166409
2011-11-24T18:19:35
2011-11-24T18:19:35
2,551,077
0
0
null
null
null
null
UTF-8
Java
false
false
9,068
java
package edu.indiana.d2i.datacatalog.dashboard.api; import edu.indiana.d2i.datacatalog.dashboard.Constants; import edu.indiana.d2i.datacatalog.dashboard.api.beans.Collections; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import javax.servlet.ServletContext; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import java.io.*; import java.util.ArrayList; import java.util.List; import java.util.Properties; @Path("/perflog") public class PerformanceLog { private static Log log = LogFactory.getLog(PerformanceLog.class); @Context ServletContext context; @GET @Path("currentstate") @Produces(MediaType.TEXT_PLAIN) public String getCurrentState() throws IOException { String dashboardConfFilePath = context.getRealPath("/WEB-INF/conf/dashboard-conf.properties"); Properties dashboardProps = new Properties(); dashboardProps.load(new FileInputStream(new File(dashboardConfFilePath))); if (dashboardProps.get(Constants.PROP_DATACAT_PERF_LOG) != null) { String tail = tail(new File(((String) dashboardProps.get(Constants.PROP_DATACAT_PERF_LOG)).trim())); if (tail != null) { String[] tailElements = tail.split("\\|"); return "In the " + tailElements[1] + " queue, processing data product " + tailElements[4] + " of catalog " + tailElements[3]; } return "Error reading performance log."; } return "Cannot find performance log file in configuration."; } @GET @Path("history") @Produces(MediaType.APPLICATION_JSON) public String getDataCrawlingHistory() throws IOException { JSONObject crawlHistory = new JSONObject(); crawlHistory.put("dateTimeFormat", "Gregorian"); org.json.simple.JSONArray events = new JSONArray(); String dashboardConfFilePath = context.getRealPath("/WEB-INF/conf/dashboard-conf.properties"); Properties dashboardProps = new Properties(); dashboardProps.load(new FileInputStream(new File(dashboardConfFilePath))); if (dashboardProps.get(Constants.PROP_DATACAT_PERF_LOG) != null) { //String tail = tail2(new File(((String) dashboardProps.get(Constants.PROP_DATACAT_PERF_LOG)).trim()), 2); List<String> eventStrings = getCatalogerEvents(); if (eventStrings != null && eventStrings.size() > 0) { for (String element : eventStrings) { String[] items = element.split("\\|"); events.add(createEvent(items[0], "Done processing catalog: " + items[3])); } crawlHistory.put("events", events); return crawlHistory.toJSONString(); } return "{'error': 'Error reading performance log.'}"; } return "{'error': 'Cannot find performance log file in configuration.'}"; } private JSONObject createEvent(String date, String title) { JSONObject event = new JSONObject(); event.put("start", date); event.put("title", title); event.put("durationEvent", false); return event; } public String tail(File file) { try { RandomAccessFile fileHandler = new RandomAccessFile(file, "r"); long fileLength = file.length() - 1; StringBuilder sb = new StringBuilder(); for (long filePointer = fileLength; filePointer != -1; filePointer--) { fileHandler.seek(filePointer); int readByte = fileHandler.readByte(); if (readByte == 0xA) { if (filePointer == fileLength) { continue; } else { break; } } else if (readByte == 0xD) { if (filePointer == fileLength - 1) { continue; } else { break; } } sb.append((char) readByte); } return sb.reverse().toString(); } catch (java.io.FileNotFoundException e) { log.error("Log file not found.", e); return null; } catch (java.io.IOException e) { log.error("Error reading log file.", e); return null; } } public String tail2(File file, int lines) { try { java.io.RandomAccessFile fileHandler = new java.io.RandomAccessFile(file, "r"); long fileLength = file.length() - 1; StringBuilder sb = new StringBuilder(); int line = 0; for (long filePointer = fileLength; filePointer != -1; filePointer--) { fileHandler.seek(filePointer); int readByte = fileHandler.readByte(); if (readByte == 0xA) { if (line == lines) { if (filePointer == fileLength) { continue; } else { break; } } } else if (readByte == 0xD) { line = line + 1; if (line == lines) { if (filePointer == fileLength - 1) { continue; } else { break; } } } sb.append((char) readByte); } sb.deleteCharAt(sb.length() - 1); String lastLine = sb.reverse().toString(); return lastLine; } catch (java.io.FileNotFoundException e) { e.printStackTrace(); return null; } catch (java.io.IOException e) { e.printStackTrace(); return null; } } public void tail3(File src, OutputStream out, int maxLines) throws FileNotFoundException, IOException { BufferedReader reader = new BufferedReader(new FileReader(src)); String[] lines = new String[maxLines]; int lastNdx = 0; for (String line = reader.readLine(); line != null; line = reader.readLine()) { if (lastNdx == lines.length) { lastNdx = 0; } lines[lastNdx++] = line; } OutputStreamWriter writer = new OutputStreamWriter(out); for (int ndx = lastNdx; ndx != lastNdx - 1; ndx++) { if (ndx == lines.length) { ndx = 0; } writer.write(lines[ndx]); writer.write("\n"); } writer.flush(); } private List<String> getCatalogerEvents() throws IOException { String dashboardConfFilePath = context.getRealPath("/WEB-INF/conf/dashboard-conf.properties"); Properties dashboardProps = new Properties(); dashboardProps.load(new FileInputStream(new File(dashboardConfFilePath))); if (dashboardProps.get(Constants.PROP_DATACAT_PERF_LOG) != null) { Runtime r = Runtime.getRuntime(); try { /* * Here we are executing the UNIX command ls for directory listing. * The format returned is the long format which includes file * information and permissions. */ Process p = r.exec("grep Cataloger " + dashboardProps.get(Constants.PROP_DATACAT_PERF_LOG)); InputStream in = p.getInputStream(); BufferedInputStream buf = new BufferedInputStream(in); InputStreamReader inread = new InputStreamReader(buf); BufferedReader bufferedreader = new BufferedReader(inread); // Read the ls output List<String> matchingEvents = new ArrayList<String>(); String line; while ((line = bufferedreader.readLine()) != null) { matchingEvents.add(line); } // Check for ls failure try { if (p.waitFor() != 0) { log.info("exit value = " + p.exitValue()); } } catch (InterruptedException e) { log.error("Error executing grep on performance.log!",e); } finally { // Close the InputStream bufferedreader.close(); inread.close(); buf.close(); in.close(); } return matchingEvents; } catch (IOException e) { log.error("Error executing grep on performance log!", e); } } return java.util.Collections.emptyList(); } }
[ "milinda.pathirage@gmail.com" ]
milinda.pathirage@gmail.com
f708b96c05030c22a00763771f6e30d46615db87
b824da283de89417361dd7d5b781fff8e3875a2d
/src/main/java/com/mycompany/cafeteriaweb/domain/Store.java
52ba6372fcbfd8309e986e159293cfd53996ae7f
[]
no_license
ZandileN/RestRepo
4bfdfeab373be027dbf3727ce90a027e959898ca
6aed9a0eade1404a5058a71c284e870965589c11
refs/heads/master
2020-12-24T17:17:46.723552
2014-05-30T09:07:30
2014-05-30T09:07:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,923
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.mycompany.cafeteriaweb.domain; import com.mycompany.cafeteriaweb.domain.Help.Builder; import java.io.Serializable; import java.util.List; import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; /** * * @author Sibakhulu */ @Entity public class Store implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String strname; private int hoursOpen; private String tel; @Embedded private Help help; @OneToMany @JoinColumn(name="cust_id") private List <Customer> customer; private Store(Builder builder) { id = builder.id; strname = builder.strname; hoursOpen = builder.hoursOpen; tel = builder.tel; help = builder.help; customer=builder.customer; } private Store() { } public static class Builder { private long id; private String strname; private int hoursOpen; private String tel; private Help help; private List <Customer> customer; public Builder(String value) { this.strname = value; } public Builder hoursOpen(int value) { hoursOpen = value; return this; } public Builder id(Long value) { id = value; return this; } public Builder tel(String value) { tel = value; return this; } public Builder help(Help value) { help = value; return this; } public Builder Customer(List <Customer> cust) { customer=cust; return this; } public Builder copy(Store store) { this.id=store.getId(); this.strname = store.getName(); this.hoursOpen = store.getHoursOpen(); this.tel = store.getTel(); this.help = store.getHelp(); this.customer= store.getCustomer(); return this; } public Store build() { return new Store(this); } } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public static long getSerialVersionUID() { return serialVersionUID; } public String getName() { return strname; } public int getHoursOpen() { return hoursOpen; } public String getTel() { return tel; } public Help getHelp() { return help; } public List <Customer> getCustomer() { return customer; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Store)) { return false; } Store other = (Store) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "com.mycompany.cafeteriaweb.domain.Store[ id=" + id + " ]"; } }
[ "Sibakhulu@Madlamini" ]
Sibakhulu@Madlamini
c727688c578a529670d45670b9994c3c9375322e
66631af1297ee9b00241454396422ba4c216fba6
/Java/src/javaSyntax/Regex.java
26d0e63287566902deb07ebae373bea4a15ecf58
[]
no_license
Code-200-OK/fuzzy-carnival
b378f19df721a008af7f982ca87bd3bb12b1d323
acf409bfdc15375a9885fc780a8ec6c504c87354
refs/heads/master
2020-12-02T07:54:27.549280
2017-07-11T08:04:07
2017-07-11T08:04:07
96,578,136
0
0
null
null
null
null
UTF-8
Java
false
false
50
java
package javaSyntax; public class Regex { }
[ "sakthiazhaku@gmail.com" ]
sakthiazhaku@gmail.com
32ced481ac43231bdec544e02e1ea93746410d5b
6eb9945622c34e32a9bb4e5cd09f32e6b826f9d3
/src/com/inponsel/android/v2/RoomChatActivity$15.java
b601166be6a8a6f382320840c7ff085e1d94362c
[]
no_license
alexivaner/GadgetX-Android-App
6d700ba379d0159de4dddec4d8f7f9ce2318c5cc
26c5866be12da7b89447814c05708636483bf366
refs/heads/master
2022-06-01T09:04:32.347786
2020-04-30T17:43:17
2020-04-30T17:43:17
260,275,241
0
0
null
null
null
null
UTF-8
Java
false
false
774
java
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.inponsel.android.v2; import android.content.DialogInterface; // Referenced classes of package com.inponsel.android.v2: // RoomChatActivity class this._cls0 implements android.content.ickListener { final RoomChatActivity this$0; public void onClick(DialogInterface dialoginterface, int i) { dialoginterface.dismiss(); statJoinChat = "0"; RoomChatActivity.access$17(RoomChatActivity.this, RoomChatActivity.user_id, codename, "0", t, bottom_id); } ner() { this$0 = RoomChatActivity.this; super(); } }
[ "hutomoivan@gmail.com" ]
hutomoivan@gmail.com
a5b0949e792b0840e004fdc5e890caf282795b2f
3fa72fe5e9366d6c79b438811d8625bd354aa36d
/pyramus/src/main/java/fi/pyramus/util/dataimport/DataImportUtils.java
8d0bc05a96a04f43beb0b21c1422c8b69af54579
[]
no_license
myrtti/pyramus
4f486d90c109b898a3a1a53c8c9b354a182066f1
b95ce66441925c94d13168f3842993eb7a61e8fe
refs/heads/master
2021-01-09T06:58:56.067323
2014-02-18T07:23:48
2014-02-18T07:23:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,170
java
package fi.pyramus.util.dataimport; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Locale; import java.util.Map; import org.apache.commons.lang.math.NumberUtils; import fi.internetix.smvc.SmvcRuntimeException; import fi.pyramus.domainmodel.base.VariableType; import fi.pyramus.domainmodel.projects.ProjectModuleOptionality; import fi.pyramus.domainmodel.students.Sex; import fi.pyramus.domainmodel.students.StudentContactLogEntryType; import fi.pyramus.domainmodel.users.Role; import fi.pyramus.framework.PyramusStatusCode; import fi.pyramus.framework.UserRole; import fi.pyramus.persistence.usertypes.MonetaryAmount; public class DataImportUtils { /** * * @param pojo * @param methodName * @param params * @return */ public static Method getMethod(Object pojo, String methodName, Class<?>[] params) { Method method = null; Class<?> cClass = pojo.getClass(); while (cClass != null && method == null) { try { method = cClass.getDeclaredMethod(methodName, params); } catch (NoSuchMethodException nsf) { cClass = cClass.getSuperclass(); } } return method; } /** * * @param pojo * @param property * @param value * @throws SecurityException * @throws NoSuchFieldException * @throws IllegalArgumentException * @throws IllegalAccessException */ public static void setValue(Object pojo, String property, Object value) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { Field field = getField(pojo, property); Class<?> fieldType = field.getType(); ValueInterpreter<?> valueInterpreter = DataImportUtils.getValueInterpreter(fieldType); if (valueInterpreter != null) setFieldValue(pojo, field, valueInterpreter.interpret(value)); else throw new SmvcRuntimeException(PyramusStatusCode.UNDEFINED, "Value interpreter for " + fieldType + " is not implemented yet"); } /** * * @param pojo * @param property * @return */ public static Field getField(Object pojo, String property) { Field field = null; Class<?> cClass = pojo.getClass(); while (cClass != null && field == null) { try { field = cClass.getDeclaredField(property); } catch (NoSuchFieldException nsf) { cClass = cClass.getSuperclass(); } } return field; } /** * * @param pojo * @param field * @param value * @throws SecurityException * @throws NoSuchFieldException * @throws IllegalArgumentException * @throws IllegalAccessException */ public static void setFieldValue(Object pojo, Field field, Object value) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { field.setAccessible(true); field.set(pojo, value); } /** * Returns Value Interpreter for given type * * @param fieldType * @return */ public static ValueInterpreter<?> getValueInterpreter(Class<?> fieldType) { return interpreters.get(fieldType); } private static Map<Class<?>, ValueInterpreter<?>> interpreters = new HashMap<Class<?>, ValueInterpreter<?>>(); static { interpreters.put(String.class, new ValueInterpreter<String>() { public String interpret(Object o) { return (String) o; } }); interpreters.put(Long.class, new ValueInterpreter<Long>() { public Long interpret(Object o) { return NumberUtils.createLong((String) o); } }); interpreters.put(Double.class, new ValueInterpreter<Double>() { public Double interpret(Object o) { return NumberUtils.createDouble((String) o); } }); interpreters.put(Boolean.class, new ValueInterpreter<Boolean>() { public Boolean interpret(Object o) { return "true".equals(o) ? Boolean.TRUE : Boolean.FALSE; } }); interpreters.put(Date.class, new ValueInterpreter<Date>() { public Date interpret(Object o) { if ("NOW".equals(o)) return new Date(System.currentTimeMillis()); String s = (String) o; if (s.contains("-")) { DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); try { return df.parse(s); } catch (ParseException e) { e.printStackTrace(); throw new SmvcRuntimeException(e); } } if (s.contains(".")) { DateFormat df = new SimpleDateFormat("dd.MM.yyyy"); try { return df.parse(s); } catch (ParseException e) { e.printStackTrace(); throw new SmvcRuntimeException(e); } } return new Date(NumberUtils.createLong(s)); } }); interpreters.put(UserRole.class, new ValueInterpreter<UserRole>() { public UserRole interpret(Object o) { return UserRole.getRole(NumberUtils.createInteger((String) o)); } }); interpreters.put(Role.class, new ValueInterpreter<Role>() { public Role interpret(Object o) { return Role.getRole(NumberUtils.createInteger((String) o)); } }); interpreters.put(MonetaryAmount.class, new ValueInterpreter<MonetaryAmount>() { public MonetaryAmount interpret(Object o) { return new MonetaryAmount(NumberUtils.createDouble((String) o)); } }); interpreters.put(Sex.class, new ValueInterpreter<Sex>() { public Sex interpret(Object o) { return "male".equalsIgnoreCase((String) o) ? Sex.MALE : Sex.FEMALE; } }); interpreters.put(ProjectModuleOptionality.class, new ValueInterpreter<ProjectModuleOptionality>() { public ProjectModuleOptionality interpret(Object o) { return ProjectModuleOptionality.getOptionality(NumberUtils.createInteger((String) o)); } }); interpreters.put(VariableType.class, new ValueInterpreter<VariableType>() { public VariableType interpret(Object o) { return VariableType.getType(NumberUtils.createInteger((String) o)); } }); interpreters.put(StudentContactLogEntryType.class, new ValueInterpreter<StudentContactLogEntryType>() { public StudentContactLogEntryType interpret(Object o) { return StudentContactLogEntryType.getType(NumberUtils.createInteger((String) o)); } }); interpreters.put(Locale.class, new ValueInterpreter<Locale>() { public Locale interpret(Object o) { return new Locale((String) o); } }); interpreters.put(Integer.class, new ValueInterpreter<Integer>() { public Integer interpret(Object o) { return NumberUtils.createInteger((String) o); } }); } }
[ "antti.leppa@foyt.fi" ]
antti.leppa@foyt.fi
b95a4918ddce598451c22a5b1333d9916f36da0a
e274754a91532315366e69d67ebd4e622cf01383
/src/Levels/Level.java
e91f47d2a13b86e4e5f840bfe368dfac40f64b80
[]
no_license
ventz-lgtm/VEngine
88b1dd687370ad2d33233c59466efcac971147f5
094bcaf908342de96316d303e3b607afc1622e08
refs/heads/master
2022-08-04T16:33:06.696235
2017-09-29T16:11:51
2017-09-29T16:11:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,019
java
package Levels; import java.awt.Color; import java.util.ArrayList; import Entities.Entity; import Main.Game; public abstract class Level { private Game game; private String name; private Color background = new Color(30,30,30); private boolean spawned = false; private ArrayList<Entity> entities = new ArrayList<Entity>(); public Level(String name) { this.name = name; } public void initialize(){ entities.clear(); onLoad(); } public abstract void onLoad(); public void spawn() { if(spawned) {return;} spawned = true; System.out.println("spawn level"); for(Entity e : entities) { game.handler.createEntity(e); } } public void setGame(Game game) { this.game = game; } public Entity addEntity(Entity e) { entities.add(e); return e; } public String getName() { return name; } public Game getGame() { return game; } public void setBackgroundColor(Color background) { this.background = background; Game.frame.setBackgroundColor(background);; } }
[ "dhog10@googlemail.com" ]
dhog10@googlemail.com
3d4067a947503c6c4a1571585c8a4c19d70688b0
6fd908523412b376e6f1f2d32a1b3d63e8f936a9
/src/main/java/com/hatanaka/ecommerce/payment/entity/PaymentEntity.java
abf0639bde2f4d03550f3980ee4d602e2ee6aa77
[]
no_license
schott-anderson/dio-ecommerce-payment
7cd3a39a47c6614c96767aa5d3f92df000c77981
b1cb6f97580ef9069f1814a3a788af942f2b7191
refs/heads/main
2023-08-17T08:45:23.329702
2021-09-23T15:44:01
2021-09-23T15:44:01
408,993,571
0
0
null
null
null
null
UTF-8
Java
false
false
846
java
package com.hatanaka.ecommerce.payment.entity; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.envers.Audited; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import javax.persistence.*; import java.time.LocalDateTime; @Entity @Audited @EntityListeners(AuditingEntityListener.class) @Builder @Data @AllArgsConstructor @NoArgsConstructor public class PaymentEntity { @Id @GeneratedValue private Long id; @Column private String code; @Column private String checkoutCode; @CreatedDate private LocalDateTime createdAt; @LastModifiedDate private LocalDateTime updatedAt; }
[ "schott.anderson@hotmail.com" ]
schott.anderson@hotmail.com
6e424894eb787a5b8dabc78748ff9e956b777441
8b9facbaf9c57ee998aba63d57b14d93a5d95b8e
/src/org/xpande/financial/model/MZMedioPagoMotivoRep.java
8798b623e04e0ecafd3acbfee981ba515bc36604
[]
no_license
gvilauy/XpandeFinancial
e5270094176d43da3017e7213ef75d634426627a
4a69c6203b54d685af686be630b18b7d79378cd9
refs/heads/master
2023-06-30T07:32:45.286633
2023-06-15T12:07:47
2023-06-15T12:07:47
98,096,052
0
0
null
null
null
null
UTF-8
Java
false
false
638
java
package org.xpande.financial.model; import java.sql.ResultSet; import java.util.Properties; /** * Modelo para motivos de reemplazo de medios de pago. * Product: Adempiere ERP & CRM Smart Business Solution. Localization : Uruguay - Xpande * Xpande. Created by Gabriel Vila on 9/21/17. */ public class MZMedioPagoMotivoRep extends X_Z_MedioPagoMotivoRep { public MZMedioPagoMotivoRep(Properties ctx, int Z_MedioPagoMotivoRep_ID, String trxName) { super(ctx, Z_MedioPagoMotivoRep_ID, trxName); } public MZMedioPagoMotivoRep(Properties ctx, ResultSet rs, String trxName) { super(ctx, rs, trxName); } }
[ "gabrielvila13@gmail.com" ]
gabrielvila13@gmail.com
cdaf6a6f21abf1db430b49e2142276e8d9e8e207
ed70f3b7189afd587fe9a9ecbdf49b6cb2bea43a
/A295_FindMedianFromDataStream.java
5bca0f491a9cb308b0b5da0006643e09c1671354
[]
no_license
wfei26/LeetCode-Java
9fb25a3f5a8377469a74b2945ecbd4114e57e860
ed710da888d25e3d67342c16d957423c8e06873f
refs/heads/master
2020-03-28T15:21:57.599960
2019-04-23T01:09:31
2019-04-23T01:09:31
148,585,375
0
0
null
null
null
null
UTF-8
Java
false
false
1,644
java
import java.util.Collections; import java.util.PriorityQueue; public class A295_FindMedianFromDataStream { public static void main(String[] args) { A295_FindMedianFromDataStream solution = new A295_FindMedianFromDataStream(); solution.addNum(1); solution.addNum(2); System.out.println(solution.findMedian()); solution.addNum(3); System.out.println(solution.findMedian()); } //left part - max heap PriorityQueue<Integer> maxHeap; //right part - min heap PriorityQueue<Integer> minHeap; /** initialize your data structure here. */ public A295_FindMedianFromDataStream() { maxHeap = new PriorityQueue<>(Collections.reverseOrder()); minHeap = new PriorityQueue<>(); } /** AddNum() strategy: divides the entire “array" into two parts and saves in two priority queues max heap and min * heap. Every new element will be inserted into the max heap, and then (after heapify) move the root of max heap * to to the min heap. Always keep balance (maxHeap.size() >= minHeap.size()) of two sides after insertion step. */ public void addNum(int num) { maxHeap.offer(num); minHeap.offer(maxHeap.poll()); // keep size of minHeap is always smaller than or equal to max heap if (minHeap.size() > maxHeap.size()) { maxHeap.offer(minHeap.poll()); } } public double findMedian() { if (maxHeap.size() > minHeap.size()) { return (double)maxHeap.peek(); } else { return (double)(maxHeap.peek() + minHeap.peek()) / 2; } } }
[ "weifei6441@gmail.com" ]
weifei6441@gmail.com
61d5b131422cc6dbee787c221bb377c6e7267241
6c9f684c2c7550ab436a949e8a9dd725ade7402e
/cims/src/dao/IShareFileDao.java
f7a1c7efd704f5be20e3cab6105368d4b9b63377
[]
no_license
wenyoushixun/java-
9fc73f45c32c4918d507eeb62205408e5ba185e3
55772433a8a59955496bc7c364f6e2663d7a4c94
refs/heads/master
2021-09-04T20:27:48.129433
2018-01-22T06:09:49
2018-01-22T06:09:49
112,140,132
0
0
null
null
null
null
UTF-8
Java
false
false
1,007
java
package dao; import java.util.List; import entity.ShareFile; public interface IShareFileDao { /** * 保存一条共享文件记录 * @param file * @throws Exception */ void saveShareFile(ShareFile file) throws Exception; /** * 删除共享文件记录 * @param file * @throws Exception */ void deleteShareFile(ShareFile file) throws Exception; /** * 更新共享文件记录 * @param file * @throws Exception */ void updateShareFile(ShareFile file) throws Exception; /** * 根据ID查找共享文件记录 * @param fildId * @return * @throws Exception */ ShareFile findShareFile(int fildId)throws Exception; /** * 查找所有共享文件 * @return * @throws Exception */ List<ShareFile> findAllShareFiles()throws Exception; /** * 查找某人发布的所有共享文件 * @param sid * @return * @throws Exception */ List<ShareFile> findAllShareFiles(int sid)throws Exception; }
[ "wenyou@192.168.1.99" ]
wenyou@192.168.1.99
035fc47ce15f71610fb7171fbd519ba6241724f6
3fd59375ae82528ee9c6ac2e09438f5ae1b83eb0
/app/src/main/java/com/example/oluwatobiloba/medmanager/database/MedicationDao.java
6cf70abc88fb857f25a5719b482200ee2bc8ca85
[]
no_license
natintosh/Med-Manager
e11ce76e464f29fc3943dd59f9bf94b06dbf1fcc
35ab2f62cdff4c423381b6358d1a361184c4c540
refs/heads/master
2020-03-11T12:42:42.675109
2018-04-18T18:54:12
2018-04-18T18:54:12
130,005,006
1
0
null
null
null
null
UTF-8
Java
false
false
1,241
java
package com.example.oluwatobiloba.medmanager.database; import android.arch.lifecycle.LiveData; import android.arch.persistence.room.Dao; import android.arch.persistence.room.Delete; import android.arch.persistence.room.Insert; import android.arch.persistence.room.Query; import com.example.oluwatobiloba.medmanager.models.Medication; import java.util.List; @Dao public interface MedicationDao { @Query("SELECT * FROM medication") LiveData<List<Medication>> getAll(); @Query("SELECT * FROM medication") List<Medication> getAllMedication(); @Query("SELECT * FROM medication WHERE medicationId IN (:medicationIds)") List<Medication> loadAllByIds(int[] medicationIds); @Query("SELECT * FROM medication WHERE medicationId = :medicationId LIMIT 1") Medication loadById(long medicationId); @Query("SELECT * FROM medication WHERE name LIKE :name LIMIT 1") Medication findByName(String name); @Query("SELECT * FROM medication ORDER BY start_date ASC") List<Medication> sortMedicationByStartDate(); @Insert long insertMedication(Medication medication); @Insert void insertMultipleMedications(Medication... medications); @Delete void delete(Medication medication); }
[ "ogunye4nao@gmail.com" ]
ogunye4nao@gmail.com
4a29e2e211c96637ac5734b4debe26af4219ec44
b37e12dc57857d57c926061f3cc98a8c4e4a9221
/src/mitiv/linalg/ScaleOperator.java
ca263fcc746fd9300a50af9956ce61b4b6005ec7
[ "MIT" ]
permissive
emmt/TiPi
7e45f5fecd0a0d4ea36c6fd64e400a03b2fb97a9
dfcdf5b21eeaaf6b9d0372cb86f527ff47ba3dfd
refs/heads/master
2020-12-25T17:17:45.290688
2020-11-03T22:00:01
2020-11-03T22:00:23
19,735,125
8
3
null
2014-05-14T09:25:18
2014-05-13T10:39:13
null
UTF-8
Java
false
false
2,811
java
/* * This file is part of TiPi (a Toolkit for Inverse Problems and Imaging) * developed by the MitiV project. * * Copyright (c) 2014-2016 the MiTiV project, http://mitiv.univ-lyon1.fr/ * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ package mitiv.linalg; import mitiv.exception.SingularOperatorException; public class ScaleOperator extends LinearEndomorphism { protected double scale = 1.0; /** * Create a new scale operator which operates on a given vector space. * * The returned operator has a scaling factor equal to 1 and is thus * similar to the identity. * @param vsp * the vector space. */ public ScaleOperator(VectorSpace vsp) { super(vsp); } /** * Create a new scale operator which operates on a given vector space. * * @param vsp * the vector space. * @param alpha * the scaling factor. */ public ScaleOperator(VectorSpace vsp, double alpha) { super(vsp); this.scale = alpha; } @Override protected void _apply(Vector dst, final Vector src, int job) { if (job == DIRECT || job == ADJOINT) { space._scale(dst, scale, src); } else if (scale != 0.0) { space._scale(dst, 1.0/scale, src); } else { throw new SingularOperatorException(); } } /** * Get the scaling factor of a scale operator. * @return the scaling factor of the operator. */ public double getScale() { return scale; } /** * Set the scaling factor of a scale operator. * @param alpha * the new scaling factor. */ public void setScale(double alpha) { this.scale = alpha; } }
[ "eric.thiebaut@univ-lyon1.fr" ]
eric.thiebaut@univ-lyon1.fr
b0cd0cde0eb0689f982bdaf223221ac53a2263cf
0ba903ad259e346fb880e78dcca23660be0dce4b
/wfe-web/src/main/java/ru/runa/common/web/portlet/impl/ReturnHomeExceptionHandler.java
8bdc492f94de1418831f8908c0f30fbef3078186
[]
no_license
ARyaskov/runawfe-server
c61eaff10945c99a8dab423c55faa1b5b6159e1d
f721a7613da95b9dd3ac2bf5a86d3cac7bca683e
refs/heads/master
2021-05-03T06:09:36.209627
2017-02-06T13:19:47
2017-02-06T13:19:47
70,156,281
0
0
null
2016-10-06T13:25:41
2016-10-06T13:25:41
null
UTF-8
Java
false
false
2,223
java
/* * This file is part of the RUNA WFE project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 * of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ package ru.runa.common.web.portlet.impl; import java.io.IOException; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.Globals; import org.apache.struts.action.ActionMessages; import ru.runa.common.web.ActionExceptionHelper; import ru.runa.common.web.portlet.PortletExceptionHandler; public class ReturnHomeExceptionHandler implements PortletExceptionHandler { @Override public boolean processError(Exception exception, ServletContext servletContext, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ActionExceptionHelper.addException(getActionErrors(request), exception); String thinInterfacePage = (String) request.getAttribute("runawfe.thin.interface.page"); if (thinInterfacePage == null) { thinInterfacePage = "/start.do"; } servletContext.getRequestDispatcher(thinInterfacePage).forward(request, response); return true; } private static ActionMessages getActionErrors(HttpServletRequest request) { ActionMessages messages = (ActionMessages) request.getAttribute(Globals.ERROR_KEY); if (messages == null) { messages = new ActionMessages(); request.setAttribute(Globals.ERROR_KEY, messages); } return messages; } }
[ "tarwirdur@ya.ru" ]
tarwirdur@ya.ru
73393cb6caa5f6db0c42d6d23c83b492ae0df8cd
36ff4a05af289437faf2fe21ea6f2055cc8e576f
/timesPayMobile/android/app/src/main/java/com/timespaymobile/generated/BasePackageList.java
b055d8c8c1408103cdda16b4d7739391bf20eaed
[]
no_license
siusiukim/Times-Pay
e78f59579e120a2ca7a77aa1302a8d977df70a78
da3bc76b7fc97e01008f96e3ceb22fba9719db1e
refs/heads/master
2020-12-04T00:04:32.838461
2020-01-02T18:07:22
2020-01-02T18:07:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
485
java
package com.timespaymobile.generated; import java.util.Arrays; import java.util.List; import org.unimodules.core.interfaces.Package; public class BasePackageList { public List<Package> getPackageList() { return Arrays.<Package>asList( new expo.modules.constants.ConstantsPackage(), new expo.modules.filesystem.FileSystemPackage(), new expo.modules.permissions.PermissionsPackage(), new expo.modules.securestore.SecureStorePackage() ); } }
[ "schrodingerdquation@gmail.com" ]
schrodingerdquation@gmail.com
96c057a834d6b474e85fe8c7d2c9f8f96ea64f9e
321df9a1996cce025fcf6cb447161b6a8d4ed0f4
/src/cine/ListaPeliculas.java
c587072b092ca6f65f827b4fad8978d758e5ae43
[]
no_license
jaravad/Dunord-Cinema
85b7bbb7b30165472cfd192add03cf201de3bf30
ad4af82d4744dca8adbb0677412f26a98a8d5a17
refs/heads/master
2020-03-15T02:54:25.825171
2018-08-29T23:30:19
2018-08-29T23:30:19
131,929,323
1
0
null
null
null
null
UTF-8
Java
false
false
31,577
java
package cine; import com.sun.awt.AWTUtilities; import java.awt.Color; import java.awt.Image; import java.io.File; import java.util.Scanner; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; public class ListaPeliculas extends javax.swing.JFrame { public ListaPeliculas() { initComponents(); AWTUtilities.setWindowOpaque(this, false); setLocationRelativeTo(null); table.getTableHeader().setReorderingAllowed(false); table.setDefaultRenderer(Object.class, new ImgTable()); table.setRowHeight(230); table.setShowHorizontalLines(false); table.setShowVerticalLines(false); table.getTableHeader().setUI(null); File archivo = new File("mispeliculas.txt"); Scanner s = null; try { DefaultTableModel model = (DefaultTableModel) table.getModel(); s = new Scanner(archivo); while (s.hasNextLine()) { String linea = s.nextLine(); JLabel lbl = new JLabel(); lbl.setSize(165, 230); String[] campos = linea.split(","); ImageIcon icon = new ImageIcon(campos[3]); Icon icono = new ImageIcon(icon.getImage().getScaledInstance(lbl.getWidth(), lbl.getHeight(), Image.SCALE_SMOOTH)); lbl.setText(null); lbl.setIcon(icono); model.addRow(new Object[]{campos[0], campos[1], campos[2], lbl}); } } catch (Exception ex) { System.out.println("Mensaje: " + ex.toString()); } finally { try { if (s != null) { s.close(); } } catch (Exception ex2) { System.out.println("Mensaje 2: " + ex2.getMessage()); } } table.setBackground(Color.white); } public void Refresh(){ File archivo = new File("mispeliculas.txt"); Scanner s = null; try { DefaultTableModel model = (DefaultTableModel) table.getModel(); s = new Scanner(archivo); while (s.hasNextLine()) { String linea = s.nextLine(); JLabel lbl = new JLabel(); lbl.setSize(165, 230); String[] campos = linea.split(","); ImageIcon icon = new ImageIcon(campos[3]); Icon icono = new ImageIcon(icon.getImage().getScaledInstance(lbl.getWidth(), lbl.getHeight(), Image.SCALE_SMOOTH)); lbl.setText(null); lbl.setIcon(icono); model.addRow(new Object[]{campos[0], campos[1], campos[2], lbl}); } } catch (Exception ex) { System.out.println("Mensaje: " + ex.toString()); } finally { try { if (s != null) { s.close(); } } catch (Exception ex2) { System.out.println("Mensaje 2: " + ex2.getMessage()); } } } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { back = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); table = new javax.swing.JTable(); close = new javax.swing.JLabel(); volver = new javax.swing.JLabel(); topbar = new javax.swing.JLabel(); title = new javax.swing.JLabel(); delete = new javax.swing.JLabel(); modify = new javax.swing.JLabel(); back1 = new javax.swing.JPanel(); jScrollPane2 = new javax.swing.JScrollPane(); table1 = new javax.swing.JTable(); close1 = new javax.swing.JLabel(); volver1 = new javax.swing.JLabel(); topbar1 = new javax.swing.JLabel(); title1 = new javax.swing.JLabel(); delete1 = new javax.swing.JLabel(); modify1 = new javax.swing.JLabel(); add = new javax.swing.JLabel(); refresh = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setUndecorated(true); back.setBackground(new java.awt.Color(255, 255, 255)); back.setBorder(javax.swing.BorderFactory.createEtchedBorder()); back.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); table.setFont(new java.awt.Font("Microsoft JhengHei UI", 0, 18)); // NOI18N table.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Nombre", "Duración", "Clasificación", "Caratula" } ) { boolean[] canEdit = new boolean [] { false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); jScrollPane1.setViewportView(table); if (table.getColumnModel().getColumnCount() > 0) { table.getColumnModel().getColumn(0).setResizable(false); table.getColumnModel().getColumn(0).setPreferredWidth(160); table.getColumnModel().getColumn(1).setResizable(false); table.getColumnModel().getColumn(1).setPreferredWidth(4); table.getColumnModel().getColumn(2).setResizable(false); table.getColumnModel().getColumn(2).setPreferredWidth(5); table.getColumnModel().getColumn(3).setResizable(false); table.getColumnModel().getColumn(3).setPreferredWidth(52); } back.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 90, 700, 490)); close.setBackground(new java.awt.Color(255, 255, 255)); close.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); close.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/Delete_25px.png"))); // NOI18N close.setOpaque(true); close.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { closeMouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { closeMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { closeMouseExited(evt); } }); back.add(close, new org.netbeans.lib.awtextra.AbsoluteConstraints(820, 0, 40, 40)); volver.setBackground(new java.awt.Color(255, 255, 255)); volver.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); volver.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/Back Arrow_28px.png"))); // NOI18N volver.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); volver.setOpaque(true); volver.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { volverMouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { volverMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { volverMouseExited(evt); } }); back.add(volver, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 40, 40)); topbar.setCursor(new java.awt.Cursor(java.awt.Cursor.MOVE_CURSOR)); topbar.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { topbarMouseDragged(evt); } }); topbar.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { topbarMousePressed(evt); } }); back.add(topbar, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 860, 40)); title.setFont(new java.awt.Font("Microsoft YaHei UI Light", 0, 18)); // NOI18N title.setText("Peliculas Disponibles"); back.add(title, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 40, 180, 26)); delete.setBackground(new java.awt.Color(255, 255, 255)); delete.setFont(new java.awt.Font("Microsoft JhengHei", 1, 12)); // NOI18N delete.setForeground(new java.awt.Color(255, 51, 51)); delete.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); delete.setText("Eliminar"); delete.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 51, 51))); delete.setOpaque(true); delete.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { deleteMouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { deleteMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { deleteMouseExited(evt); } }); back.add(delete, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 130, 60, 30)); modify.setBackground(new java.awt.Color(255, 255, 255)); modify.setFont(new java.awt.Font("Microsoft JhengHei", 1, 12)); // NOI18N modify.setForeground(new java.awt.Color(0, 153, 0)); modify.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); modify.setText("Modificar"); modify.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 0))); modify.setOpaque(true); modify.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { modifyMouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { modifyMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { modifyMouseExited(evt); } }); back.add(modify, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 180, 60, 30)); back1.setBackground(new java.awt.Color(255, 255, 255)); back1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); back1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); table1.setFont(new java.awt.Font("Microsoft JhengHei UI", 0, 18)); // NOI18N table1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Nombre", "Duración", "Clasificación", "Caratula" } ) { boolean[] canEdit = new boolean [] { false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); jScrollPane2.setViewportView(table1); if (table1.getColumnModel().getColumnCount() > 0) { table1.getColumnModel().getColumn(0).setResizable(false); table1.getColumnModel().getColumn(0).setPreferredWidth(160); table1.getColumnModel().getColumn(1).setResizable(false); table1.getColumnModel().getColumn(1).setPreferredWidth(4); table1.getColumnModel().getColumn(2).setResizable(false); table1.getColumnModel().getColumn(2).setPreferredWidth(5); table1.getColumnModel().getColumn(3).setResizable(false); table1.getColumnModel().getColumn(3).setPreferredWidth(52); } back1.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 90, 700, 490)); close1.setBackground(new java.awt.Color(255, 255, 255)); close1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); close1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/Delete_25px.png"))); // NOI18N close1.setOpaque(true); close1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { close1MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { close1MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { close1MouseExited(evt); } }); back1.add(close1, new org.netbeans.lib.awtextra.AbsoluteConstraints(820, 0, 40, 40)); volver1.setBackground(new java.awt.Color(255, 255, 255)); volver1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); volver1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/Back Arrow_28px.png"))); // NOI18N volver1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); volver1.setOpaque(true); volver1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { volver1MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { volver1MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { volver1MouseExited(evt); } }); back1.add(volver1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 40, 40)); topbar1.setCursor(new java.awt.Cursor(java.awt.Cursor.MOVE_CURSOR)); topbar1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { topbar1MouseDragged(evt); } }); topbar1.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { topbar1MousePressed(evt); } }); back1.add(topbar1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 860, 40)); title1.setFont(new java.awt.Font("Microsoft YaHei UI Light", 0, 18)); // NOI18N title1.setText("Peliculas Disponibles"); back1.add(title1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 40, 180, 26)); delete1.setBackground(new java.awt.Color(255, 255, 255)); delete1.setFont(new java.awt.Font("Microsoft JhengHei", 1, 12)); // NOI18N delete1.setForeground(new java.awt.Color(255, 51, 51)); delete1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); delete1.setText("Eliminar"); delete1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 51, 51))); delete1.setOpaque(true); delete1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { delete1MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { delete1MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { delete1MouseExited(evt); } }); back1.add(delete1, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 130, 60, 30)); modify1.setBackground(new java.awt.Color(255, 255, 255)); modify1.setFont(new java.awt.Font("Microsoft JhengHei", 1, 12)); // NOI18N modify1.setForeground(new java.awt.Color(0, 153, 0)); modify1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); modify1.setText("Modificar"); modify1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 0))); modify1.setOpaque(true); modify1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { modify1MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { modify1MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { modify1MouseExited(evt); } }); back1.add(modify1, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 180, 60, 30)); add.setBackground(new java.awt.Color(255, 255, 255)); add.setFont(new java.awt.Font("Microsoft JhengHei", 1, 12)); // NOI18N add.setForeground(new java.awt.Color(0, 102, 255)); add.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); add.setText("Agregar"); add.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 255))); add.setOpaque(true); add.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { addMouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { addMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { addMouseExited(evt); } }); back1.add(add, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 230, 60, 30)); refresh.setBackground(new java.awt.Color(255, 255, 255)); refresh.setFont(new java.awt.Font("Microsoft JhengHei", 1, 11)); // NOI18N refresh.setForeground(new java.awt.Color(153, 0, 153)); refresh.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); refresh.setText("Actualizar"); refresh.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 0, 153))); refresh.setOpaque(true); refresh.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { refreshMouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { refreshMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { refreshMouseExited(evt); } }); back1.add(refresh, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 280, 60, 30)); back.add(back1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(back, javax.swing.GroupLayout.PREFERRED_SIZE, 858, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(back, javax.swing.GroupLayout.PREFERRED_SIZE, 604, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void closeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_closeMouseClicked this.dispose(); System.exit(0); }//GEN-LAST:event_closeMouseClicked private void closeMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_closeMouseEntered close.setBackground(new Color(255, 51, 51)); close.setIcon(new ImageIcon("src/imagenes/Deletewhite_25px.png")); }//GEN-LAST:event_closeMouseEntered public static int x; public static int y; private void closeMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_closeMouseExited close.setBackground(new Color(255, 255, 255)); close.setIcon(new ImageIcon("src/imagenes/Delete_25px.png")); }//GEN-LAST:event_closeMouseExited private void topbarMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_topbarMouseDragged this.setLocation(this.getLocation().x + evt.getX() - x, this.getLocation().y + evt.getY() - y); }//GEN-LAST:event_topbarMouseDragged private void topbarMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_topbarMousePressed x = evt.getX(); y = evt.getY(); }//GEN-LAST:event_topbarMousePressed private void deleteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_deleteMouseClicked try { DefaultTableModel model = (DefaultTableModel) table.getModel(); String name = String.valueOf(model.getValueAt(table.getSelectedRow(), 0)); int j = JOptionPane.showConfirmDialog(null, "¿Seguro que desea borrar la pelicula " + "\"" + name + "\"" + "?, esta acción no es reversible", name, JOptionPane.YES_NO_OPTION); if (j == JOptionPane.YES_OPTION) { for (int i = 0; i < model.getRowCount(); i++) { if (model.getValueAt(i, 0).equals(name)) { model.removeRow(i); File archivo = new File("mispeliculas.txt"); FileHandle a = new FileHandle(); a.delete(archivo, name); } } } } catch (ArrayIndexOutOfBoundsException e) { JOptionPane.showMessageDialog(null, "No hay peliculas seleccionadas", "Error", JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_deleteMouseClicked private void deleteMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_deleteMouseEntered delete.setBackground(new Color(255, 51, 51)); delete.setForeground(Color.WHITE); }//GEN-LAST:event_deleteMouseEntered private void deleteMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_deleteMouseExited delete.setBackground(Color.WHITE); delete.setForeground(new Color(255, 51, 51)); }//GEN-LAST:event_deleteMouseExited private void modifyMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_modifyMouseEntered modify.setForeground(Color.WHITE); modify.setBackground(new Color(0, 153, 0)); }//GEN-LAST:event_modifyMouseEntered private void modifyMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_modifyMouseExited modify.setForeground(new Color(0, 153, 0)); modify.setBackground(Color.WHITE); }//GEN-LAST:event_modifyMouseExited public static String nombre; public static String fichero; private void modifyMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_modifyMouseClicked try { DefaultTableModel model = (DefaultTableModel) table.getModel(); String name = String.valueOf(model.getValueAt(table.getSelectedRow(), 0)); nombre=name; String campos[]=FileHandle.getField(nombre,3).split("/"); fichero=campos[3]; String durcombo = String.valueOf(model.getValueAt(table.getSelectedRow(), 1)); String clasicombo = String.valueOf(model.getValueAt(table.getSelectedRow(), 2)); JLabel portada=(JLabel)model.getValueAt(table.getSelectedRow(), 3); EditPeliculas ventana = new EditPeliculas(name, durcombo,clasicombo,portada); ventana.setVisible(true); } catch (ArrayIndexOutOfBoundsException e) { JOptionPane.showMessageDialog(null, "No hay peliculas seleccionadas", "Error", JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_modifyMouseClicked private void volverMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volverMouseClicked Admin u = new Admin(); this.setVisible(false); u.setVisible(true); }//GEN-LAST:event_volverMouseClicked private void volverMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volverMouseEntered volver.setBackground(new Color(231, 231, 231)); }//GEN-LAST:event_volverMouseEntered private void volverMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volverMouseExited volver.setBackground(new Color(255, 255, 255)); }//GEN-LAST:event_volverMouseExited private void addMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addMouseClicked AddPeliculas ventana=new AddPeliculas(); ventana.setVisible(true); }//GEN-LAST:event_addMouseClicked private void addMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addMouseEntered add.setForeground(Color.WHITE); add.setBackground(new Color(0,102,255)); }//GEN-LAST:event_addMouseEntered private void addMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addMouseExited add.setForeground(new Color(0,102,255)); add.setBackground(Color.WHITE); }//GEN-LAST:event_addMouseExited private void close1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_close1MouseClicked // TODO add your handling code here: }//GEN-LAST:event_close1MouseClicked private void close1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_close1MouseEntered // TODO add your handling code here: }//GEN-LAST:event_close1MouseEntered private void close1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_close1MouseExited // TODO add your handling code here: }//GEN-LAST:event_close1MouseExited private void volver1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volver1MouseClicked // TODO add your handling code here: }//GEN-LAST:event_volver1MouseClicked private void volver1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volver1MouseEntered // TODO add your handling code here: }//GEN-LAST:event_volver1MouseEntered private void volver1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_volver1MouseExited // TODO add your handling code here: }//GEN-LAST:event_volver1MouseExited private void topbar1MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_topbar1MouseDragged // TODO add your handling code here: }//GEN-LAST:event_topbar1MouseDragged private void topbar1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_topbar1MousePressed // TODO add your handling code here: }//GEN-LAST:event_topbar1MousePressed private void delete1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_delete1MouseClicked // TODO add your handling code here: }//GEN-LAST:event_delete1MouseClicked private void delete1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_delete1MouseEntered // TODO add your handling code here: }//GEN-LAST:event_delete1MouseEntered private void delete1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_delete1MouseExited // TODO add your handling code here: }//GEN-LAST:event_delete1MouseExited private void modify1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_modify1MouseClicked // TODO add your handling code here: }//GEN-LAST:event_modify1MouseClicked private void modify1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_modify1MouseEntered // TODO add your handling code here: }//GEN-LAST:event_modify1MouseEntered private void modify1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_modify1MouseExited // TODO add your handling code here: }//GEN-LAST:event_modify1MouseExited private void refreshMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_refreshMouseClicked DefaultTableModel model=(DefaultTableModel) table.getModel(); model.setRowCount(0); Refresh(); }//GEN-LAST:event_refreshMouseClicked private void refreshMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_refreshMouseEntered refresh.setBackground(new Color(153,0,153)); refresh.setForeground(Color.WHITE); }//GEN-LAST:event_refreshMouseEntered private void refreshMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_refreshMouseExited refresh.setBackground(Color.WHITE); refresh.setForeground(new Color(153,0,153)); }//GEN-LAST:event_refreshMouseExited /** * bo * * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Windows".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(ListaPeliculas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(ListaPeliculas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(ListaPeliculas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(ListaPeliculas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ListaPeliculas().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel add; private javax.swing.JPanel back; private javax.swing.JPanel back1; private javax.swing.JLabel close; private javax.swing.JLabel close1; private javax.swing.JLabel delete; private javax.swing.JLabel delete1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JLabel modify; private javax.swing.JLabel modify1; private javax.swing.JLabel refresh; private javax.swing.JTable table; private javax.swing.JTable table1; private javax.swing.JLabel title; private javax.swing.JLabel title1; private javax.swing.JLabel topbar; private javax.swing.JLabel topbar1; private javax.swing.JLabel volver; private javax.swing.JLabel volver1; // End of variables declaration//GEN-END:variables }
[ "Jesus David@JesusDavid" ]
Jesus David@JesusDavid
5df516a30a141ca6928d682f11747ef27c591654
486f84c1b4432948e63de3fd9d74eec9b45e6c67
/snsbuy~huiduweb/biz/src/main/java/net/java/mapyou/mybatis/enums/NotifyType.java
676f0e786f34e4bf15e08da1e6b141cbaff4419d
[]
no_license
gubaojian/huidu
78a49eaf59d2605485a9cc970de531c96e8cb756
7d2fe0d83304cffab8b71c8aad125103ff403349
refs/heads/master
2022-12-25T14:07:49.886961
2020-06-06T09:45:14
2022-01-05T01:37:39
188,653,887
1
1
null
2022-12-16T10:04:48
2019-05-26T07:39:34
Java
UTF-8
Java
false
false
661
java
package net.java.mapyou.mybatis.enums; public enum NotifyType { NONE((byte)0, "无任何提示"), BRADGE((byte)1, "红点提示"), PUSH((byte)2, "Push消息提示"); private final byte value; private final String desc; private NotifyType(byte value, String desc){ this.value = value; this.desc = desc; } public byte getValue() { return value; } public String getDesc() { return desc; } public static NotifyType type(Byte value){ if(value == null){ return NONE; } NotifyType[] values = NotifyType.values(); for(NotifyType os : values){ if (os.getValue() == value) { return os; } } return NONE; } }
[ "gubaojian@163.com" ]
gubaojian@163.com
c520d6b8cd7865d1e9d2f8afbe4143d20ad54bc6
6a4a1c5835f6a575a5b00b3db3ed328019a93581
/app/src/main/java/com/example/david/journalapp/data/source/local/LocalDb.java
901e6c0d8515d099ab4ad818aeef5eb4c2df617c
[ "MIT" ]
permissive
davidkathoh/JournalApp
96692ca51931776dfcd0f34359bad5127ca6d461
f7eb00d82c9583c8a0e44d55e84195426b5ffea3
refs/heads/master
2020-03-21T12:59:48.420007
2019-02-01T13:50:16
2019-02-01T13:50:16
138,582,379
2
1
null
2018-08-25T14:27:55
2018-06-25T10:54:33
Java
UTF-8
Java
false
false
907
java
package com.example.david.journalapp.data.source.local; import android.arch.persistence.room.Database; import android.arch.persistence.room.Room; import android.arch.persistence.room.RoomDatabase; import android.content.Context; import com.example.david.journalapp.data.Note; /** * Created by david on 6/27/18. */ @Database(entities = Note.class,version = 1) public abstract class LocalDb extends RoomDatabase{ private static LocalDb INSTANCE; public abstract NoteDao mNoteDaoDao(); public static LocalDb getLocalDb(Context context) { if (INSTANCE == null){ INSTANCE = Room.databaseBuilder(context.getApplicationContext(), LocalDb.class,"Note") .fallbackToDestructiveMigration() .build(); } return INSTANCE; } public static void destroyInstance() { INSTANCE = null; } }
[ "mudavidkat@gmail.com" ]
mudavidkat@gmail.com
f32f98c76ed10aa8faa95670012c646ed9769c36
47225f6683b9ce1408aa95fb1ec36d953485b53a
/rover.service/src/main/java/rover/tasks/CollectTask.java
1cce452c2e5b019ae7f640104f599d1976c9162c
[]
no_license
AKAfreaky/IntelligentAgentsRover
e6fc332134d4590ca6d38b1edefb0cfe9c1e2f12
8019468a86d7de358d0c6899da80cb928fe790a6
refs/heads/master
2021-01-20T22:28:54.983079
2014-01-05T23:52:14
2014-01-05T23:52:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,282
java
package rover.tasks; import rover.PollResult; import rover.ResourceInfo; import rover.RoverInfo; import rover.RoverServiceImpl; public class CollectTask extends Task { private ResourceInfo ri; public CollectTask(RoverInfo rover, RoverServiceImpl impl, ResourceInfo ri) { super(rover, impl, 5000); this.ri = ri; setEnergyPerSecond(1); //adjust count down ri.setCount(ri.getCount()- 1); } @Override public void Cancel() { // reduce rover power and add resource // back to world ri.setCount(ri.getCount()+ 1); adjustEnergy(); } @Override public void Complete() { // add resource to rover and reduce power adjustEnergy(); getRover().setPollResult(new PollResult(PollResult.COLLECT, PollResult.COMPLETE)); getRover().setCurrentLoad(getRover().getCurrentLoad() + 1); } @Override public void Update() { // don't need to do anything adjustEnergy(); if(getRover().getEnergy() < 0) { PollResult pr = new PollResult(PollResult.COLLECT, PollResult.FAILED); pr.setPercentComplete(percentComplete()); getRover().setPollResult(pr); //add resource back ri.setCount(ri.getCount()+ 1); getRover().setTask(null); } } @Override public int taskNum() { return PollResult.COLLECT; } }
[ "frogman.jo@gmail.com" ]
frogman.jo@gmail.com
e346888a4bbfacae7224ef802ace498d0685a90a
84671b8d8fa5bc51be717d579e2b50de6dbae957
/app/src/main/java/com/example/xavi/shoppinglist3/ShoppingList3Activity.java
b8830545b868f987560771bdf10839de9f55caca
[]
no_license
XaviVilaseca/ShoppingList3
eb6769b1d5668bd80be23b0994a02c760f4da5ad
19459cccd59cbc5e04a68251be78a0b1b536698e
refs/heads/master
2021-07-18T20:59:21.126332
2017-10-27T18:43:23
2017-10-27T18:43:23
108,582,224
0
0
null
null
null
null
UTF-8
Java
false
false
7,191
java
package com.example.xavi.shoppinglist3; import android.content.Context; import android.content.DialogInterface; import android.support.annotation.RequiresPermission; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; public class ShoppingList3Activity extends AppCompatActivity { private static final String FILENAME = "shopping_list.txt"; private static final int MAX_BYTES = 8000; private ArrayList<ShoppingItem> itemlist; private ShoppingListAdapter adapter; private ListView list; private Button addButton; private EditText editItem; private void WriteItemList() { try { FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE); for (int i = 0; i < itemlist.size(); i++) { ShoppingItem it = itemlist.get(i); String line = String.format("%s;%b\n", it.getText(), it.isCheck()); fos.write(line.getBytes()); } fos.close(); } catch (FileNotFoundException e) { Log.e("xavi", "writeItemList: FileNotFoundException"); Toast.makeText(this, R.string.cannot_write, Toast.LENGTH_LONG).show(); } catch (IOException e) { Log.e("xavi", "writeItemList: IOException"); Toast.makeText(this, R.string.cannot_write, Toast.LENGTH_LONG).show(); } } private void ReadItemList() { itemlist = new ArrayList<>(); try { FileInputStream fis = openFileInput(FILENAME); byte[] buffer = new byte[MAX_BYTES]; int nread = fis.read(buffer); if (nread > 0){ String content = new String(buffer, 0, nread); String[] lines = content.split("\n"); for (String line : lines) { String[] parts = line.split(";"); itemlist.add(new ShoppingItem(parts[0], parts[1].equals("true"))); } } fis.close(); } catch (FileNotFoundException e) { Log.e("xavi", "ReadItemList: FileNotFoundException"); } catch (IOException e) { Log.e("xavi", "ReadItemList: IOException"); Toast.makeText(this, R.string.cannot_read, Toast.LENGTH_LONG).show(); } } @Override protected void onStop() { super.onStop(); WriteItemList(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_shopping_list3); list = (ListView) findViewById(R.id.list); addButton = (Button) findViewById(R.id.button_add); editItem = (EditText) findViewById(R.id.editItem); itemlist = new ArrayList<>(); ReadItemList(); adapter = new ShoppingListAdapter(this, android.R.layout.simple_list_item_1, itemlist); addButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { addItem(); } }); editItem.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { addItem(); return false; } }); list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int pos, long id) { itemlist.get(pos).toggleCheck(); adapter.notifyDataSetChanged(); } }); list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> list, View item, int pos, long id) { maybeRemobeItem(pos); return false; } }); list.setAdapter(adapter); } private void maybeRemobeItem(final int pos) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.confirm); String fmt = getResources().getString(R.string.confirm_message); builder.setMessage(String.format(fmt, itemlist.get(pos).getText())); builder.setPositiveButton(R.string.remove, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { itemlist.remove(pos); adapter.notifyDataSetChanged(); } }); builder.setNegativeButton(android.R.string.cancel, null); builder.create().show(); } private void addItem() { String item_text = editItem.getText().toString(); if (!item_text.isEmpty()) { itemlist.add(new ShoppingItem(item_text)); adapter.notifyDataSetChanged(); editItem.setText(""); } list.smoothScrollToPosition(itemlist.size() - 1); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.options, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.clear_checked: clearChecked(); return true; case R.id.clear_all: clearAll(); return true; default: return super.onOptionsItemSelected(item); } } private void clearAll() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.confirm); builder.setMessage(R.string.confirm_clear_all); builder.setPositiveButton(R.string.clear_all, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { itemlist.clear(); adapter.notifyDataSetChanged(); } }); builder.setNegativeButton(android.R.string.cancel, null); builder.create().show(); } private void clearChecked() { int i =0; while (i < itemlist.size()) { if (itemlist.get(i).isCheck()) { itemlist.remove(i); } else { i++; } } adapter.notifyDataSetChanged(); } }
[ "xavi.vilaseca.garcia@gmail.com" ]
xavi.vilaseca.garcia@gmail.com
fc4da1de74e56851d83b1615c570658302b5bd25
f4fd782488b9cf6d99d4375d5718aead62b63c69
/com/planet_ink/coffee_mud/Races/Centaur.java
8f19dfed5eda25ef201d1458f980d250896e5fc4
[ "Apache-2.0" ]
permissive
sfunk1x/CoffeeMud
89a8ca1267ecb0c2ca48280e3b3930ee1484c93e
0ac2a21c16dfe3e1637627cb6373d34615afe109
refs/heads/master
2021-01-18T11:20:53.213200
2015-09-17T19:16:30
2015-09-17T19:16:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,444
java
package com.planet_ink.coffee_mud.Races; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2001-2015 Bo Zimmerman 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. */ public class Centaur extends StdRace { @Override public String ID(){ return "Centaur"; } @Override public String name(){ return "Centaur"; } @Override public int shortestMale(){return 60;} @Override public int shortestFemale(){return 60;} @Override public int heightVariance(){return 12;} @Override public int lightestWeight(){return 1150;} @Override public int weightVariance(){return 400;} @Override public long forbiddenWornBits(){return Wearable.WORN_WAIST|Wearable.WORN_LEGS|Wearable.WORN_FEET;} @Override public String racialCategory(){return "Equine";} @Override public boolean useRideClass() { return true; } private final String[]culturalAbilityNames={"Elvish","Foraging"}; private final int[]culturalAbilityProficiencies={75,50}; @Override public String[] culturalAbilityNames(){return culturalAbilityNames;} @Override public int[] culturalAbilityProficiencies(){return culturalAbilityProficiencies;} // an ey ea he ne ar ha to le fo no gi mo wa ta wi private static final int[] parts={0 ,2 ,2 ,1 ,1 ,2 ,2 ,1 ,4 ,4 ,1 ,0 ,1 ,1 ,1 ,0 }; @Override public int[] bodyMask(){return parts;} protected static Vector<RawMaterial> resources=new Vector<RawMaterial>(); @Override public int availabilityCode(){return Area.THEME_FANTASY;} @Override public void affectPhyStats(Physical affected, PhyStats affectableStats) { super.affectPhyStats(affected,affectableStats); affectableStats.setSensesMask(affectableStats.sensesMask()|PhyStats.CAN_SEE_INFRARED); } @Override public void affectCharStats(MOB affectedMOB, CharStats affectableStats) { super.affectCharStats(affectedMOB, affectableStats); affectableStats.setStat(CharStats.STAT_STRENGTH,affectableStats.getStat(CharStats.STAT_STRENGTH)+1); affectableStats.setStat(CharStats.STAT_MAX_STRENGTH_ADJ,affectableStats.getStat(CharStats.STAT_MAX_STRENGTH_ADJ)+1); affectableStats.setStat(CharStats.STAT_INTELLIGENCE,affectableStats.getStat(CharStats.STAT_INTELLIGENCE)+1); affectableStats.setStat(CharStats.STAT_MAX_INTELLIGENCE_ADJ,affectableStats.getStat(CharStats.STAT_MAX_INTELLIGENCE_ADJ)+1); affectableStats.setStat(CharStats.STAT_CHARISMA,affectableStats.getStat(CharStats.STAT_CHARISMA)-1); affectableStats.setStat(CharStats.STAT_MAX_CHARISMA_ADJ,affectableStats.getStat(CharStats.STAT_MAX_CHARISMA_ADJ)-1); affectableStats.setStat(CharStats.STAT_WISDOM,affectableStats.getStat(CharStats.STAT_WISDOM)-1); affectableStats.setStat(CharStats.STAT_MAX_WISDOM_ADJ,affectableStats.getStat(CharStats.STAT_MAX_WISDOM_ADJ)-1); } @Override public Weapon myNaturalWeapon() { if(naturalWeapon==null) { naturalWeapon=CMClass.getWeapon("StdWeapon"); naturalWeapon.setName(L("a pair of hooves")); naturalWeapon.setMaterial(RawMaterial.RESOURCE_BONE); naturalWeapon.setUsesRemaining(1000); naturalWeapon.setWeaponType(Weapon.TYPE_BASHING); } return naturalWeapon; } @Override public String makeMobName(char gender, int age) { switch(age) { case Race.AGE_INFANT: case Race.AGE_TODDLER: return name().toLowerCase()+" foal"; case Race.AGE_CHILD: case Race.AGE_YOUNGADULT: switch(gender) { case 'M': case 'm': return name().toLowerCase()+" colt"; case 'F': case 'f': return name().toLowerCase()+" filly"; default: return "young "+name().toLowerCase(); } case Race.AGE_MATURE: case Race.AGE_MIDDLEAGED: default: switch(gender) { case 'M': case 'm': return "male "+name().toLowerCase(); case 'F': case 'f': return "female "+name().toLowerCase(); default: return name().toLowerCase(); } case Race.AGE_OLD: case Race.AGE_VENERABLE: case Race.AGE_ANCIENT: switch(gender) { case 'M': case 'm': return "old male "+name().toLowerCase(); case 'F': case 'f': return "old female "+name().toLowerCase(); default: return "old "+name().toLowerCase(); } } } @Override public String healthText(MOB viewer, MOB mob) { final double pct=(CMath.div(mob.curState().getHitPoints(),mob.maxState().getHitPoints())); if(pct<.10) return L("^r@x1^r is hovering on deaths door!^N",mob.name(viewer)); else if(pct<.20) return L("^r@x1^r is covered in blood and matted hair.^N",mob.name(viewer)); else if(pct<.30) return L("^r@x1^r is bleeding badly from lots of wounds.^N",mob.name(viewer)); else if(pct<.40) return L("^y@x1^y has large patches of bloody matted fur.^N",mob.name(viewer)); else if(pct<.50) return L("^y@x1^y has some bloody matted fur.^N",mob.name(viewer)); else if(pct<.60) return L("^p@x1^p has a lot of cuts and gashes.^N",mob.name(viewer)); else if(pct<.70) return L("^p@x1^p has a few cut patches.^N",mob.name(viewer)); else if(pct<.80) return L("^g@x1^g has a cut patch of fur.^N",mob.name(viewer)); else if(pct<.90) return L("^g@x1^g has some disheveled fur.^N",mob.name(viewer)); else if(pct<.99) return L("^g@x1^g has some misplaced hairs.^N",mob.name(viewer)); else return L("^c@x1^c is in perfect health.^N",mob.name(viewer)); } @Override public List<RawMaterial> myResources() { synchronized(resources) { if(resources.size()==0) { resources.addElement(makeResource (""+name().toLowerCase()+" mane",RawMaterial.RESOURCE_FUR)); for(int i=0;i<2;i++) resources.addElement(makeResource ("a strip of "+name().toLowerCase()+" leather",RawMaterial.RESOURCE_LEATHER)); resources.addElement(makeResource ("a pound of "+name().toLowerCase()+" meat",RawMaterial.RESOURCE_BEEF)); resources.addElement(makeResource ("some "+name().toLowerCase()+" blood",RawMaterial.RESOURCE_BLOOD)); resources.addElement(makeResource ("a pile of "+name().toLowerCase()+" bones",RawMaterial.RESOURCE_BONE)); } } return resources; } }
[ "bo@zimmers.net" ]
bo@zimmers.net
c2779e34ff9c2f8e94c4d736f3882d9c9beba413
2d8650132bd0a08bb5b8a96d47e5e1c512b5e06a
/Task_6/src/tests/BackpackTest.java
0de7d73d65a0de4a8f712fe9272814b41d7f0ebe
[]
no_license
OrestTorskyi/TAQC
0c331d5f6c26881cf1a773337275cf5cd7add8a3
6a61a9ecbc308901c9b0ed0af99a4cc665dd3eee
refs/heads/main
2023-04-01T17:04:35.759878
2021-04-08T09:54:47
2021-04-08T09:54:47
353,450,290
0
0
null
null
null
null
UTF-8
Java
false
false
1,253
java
package tests; import obj.BackSystem; import obj.Backpack; import java.util.ArrayList; import java.util.List; import static org.junit.jupiter.api.Assertions.*; class BackpackTest { Backpack[] backpacks = new Backpack[6]; List<Integer> objects = new ArrayList<>(); @org.junit.jupiter.api.BeforeEach void setUp() { backpacks[0] = new Backpack(BackSystem.NONE); backpacks[1] = new Backpack(BackSystem.FOAMBACK, "Deuter", 30); backpacks[2] = new Backpack(BackSystem.NET, "LeadHiking"); backpacks[3] = new Backpack(BackSystem.FOAMBACK, "Deuter", 45); backpacks[4] = new Backpack(BackSystem.NONE, "The North Face", 55); backpacks[5] = new Backpack(BackSystem.NET, "Terra Incognita", 30); objects.add(10); objects.add(15); objects.add(25); } @org.junit.jupiter.api.AfterEach void tearDown() { } @org.junit.jupiter.api.Test void fitToBackpack() { assertEquals(true, backpacks[4].fitToBackpack(objects)); assertEquals(false, backpacks[0].fitToBackpack(objects)); } @org.junit.jupiter.api.Test void getBestBackpackFromList() { assertEquals(backpacks[3], Backpack.getBestBackpackFromList(backpacks)); } }
[ "Orest.Torskyi.KN.2017@gmail.com" ]
Orest.Torskyi.KN.2017@gmail.com
0d9f060bfcef219926e50473d68fabf734a0b10b
602dbfdc2a22f1764e76611a39b8b7cfba611239
/src/demos/nehe/lesson42/Lesson42.java
f1387c8a3190986841739d3f3c3e7fc0e14139b3
[]
no_license
linghushaoxia/nehe-swt
a69bc49e76546f5b12e38238b27025569b086690
33cf299667abdae306557fbed43b42434b36cc0b
refs/heads/master
2021-01-20T22:02:44.652758
2015-10-02T10:09:17
2015-10-02T10:09:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
489
java
package demos.nehe.lesson42; import demos.common.GLDisplay; /** * @author Pepijn Van Eeckhoudt */ public class Lesson42 { public static void main(String[] args) { GLDisplay neheGLDisplay = GLDisplay.createGLDisplay("Lesson 42: Multiple viewports"); Renderer renderer = new Renderer(); InputHandler inputHandler = new InputHandler(renderer, neheGLDisplay); neheGLDisplay.addGLEventListener(renderer); neheGLDisplay.addKeyListener(inputHandler); neheGLDisplay.start(); } }
[ "yulin010203@126.com" ]
yulin010203@126.com
d6a796f71323c4958f838ecdc9ee2f20a501ca62
6ee92ecc85ba29f13769329bc5a90acea6ef594f
/bizcore/WEB-INF/retailscm_core_src/com/doublechaintech/retailscm/provincecenteremployee/CandidateProvinceCenterEmployee.java
3aca5e681f774f5aca81c2a1972afe855c56600d
[]
no_license
doublechaintech/scm-biz-suite
b82628bdf182630bca20ce50277c41f4a60e7a08
52db94d58b9bd52230a948e4692525ac78b047c7
refs/heads/master
2023-08-16T12:16:26.133012
2023-05-26T03:20:08
2023-05-26T03:20:08
162,171,043
1,387
500
null
2023-07-08T00:08:42
2018-12-17T18:07:12
Java
UTF-8
Java
false
false
222
java
package com.doublechaintech.retailscm.provincecenteremployee; import com.doublechaintech.retailscm.BaseCandidateEntity; public class CandidateProvinceCenterEmployee extends BaseCandidateEntity<ProvinceCenterEmployee> {}
[ "zhangxilai@doublechaintech.com" ]
zhangxilai@doublechaintech.com
c6e192c650ad60cb553129caa722cec98e6f17ef
dfd8bbc187af8f8bc6529d5d5e213b416fd3ea29
/src/test/java/org/terasology/dynamicCities/region/RegionEntitiesTest.java
c954ac81bf5a2cd28103bd8411b07900bc27a3d0
[]
no_license
Terasology/DynamicCities
862dd1428330033eee44f9a05b459b1e70078920
82c579876c804e205d305ab888cd1e2ff1b4cb9b
refs/heads/develop
2023-07-20T00:08:33.194203
2022-06-07T20:52:33
2022-06-07T20:52:33
59,501,378
19
13
null
2022-12-18T13:53:18
2016-05-23T16:54:14
Java
UTF-8
Java
false
false
4,370
java
// Copyright 2022 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 package org.terasology.dynamicCities.region; import org.joml.RoundingMode; import org.joml.Vector2i; import org.joml.Vector3f; import org.joml.Vector3fc; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.integrationenvironment.jupiter.Dependencies; import org.terasology.engine.integrationenvironment.jupiter.MTEExtension; import org.terasology.engine.logic.location.LocationComponent; import org.terasology.engine.registry.In; import org.terasology.engine.world.chunks.Chunks; import java.util.Arrays; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @Tag("MteTest") @ExtendWith({MockitoExtension.class, MTEExtension.class}) @Dependencies("DynamicCities") @TestInstance(TestInstance.Lifecycle.PER_CLASS) public class RegionEntitiesTest { private static final int HALF_X = Chunks.SIZE_X / 2; private static final int HALF_Z = Chunks.SIZE_Z / 2; @In public RegionEntityManager regionEntityManager; private final Vector3fc[] pos = new Vector3f[] { // These first four are used by the test for #getNearest, which resolves to // the center of chunks. Something around the time of the JOML migration shifted // that value down by one. new Vector3f(HALF_X - 1, 0, HALF_Z - 1), new Vector3f(HALF_X - 1, 0, -HALF_Z - 1), new Vector3f(-HALF_X - 1, 0, HALF_Z - 1), new Vector3f(-HALF_X - 1, 0, -HALF_Z - 1), // …then why does this also have these locations that are at the corners of chunks // instead of their centers? new Vector3f(0, 0, 0), new Vector3f(32, 0, 32), new Vector3f(32, 0, -32), new Vector3f(-32, 0, 32), new Vector3f(-32, 0, -32), new Vector3f(97, 0, -97) }; private final EntityRef[] test = new EntityRef[pos.length]; @BeforeAll public void setupEntityRefs() { for (int i = 0; i < test.length; i++) { test[i] = Mockito.mock(EntityRef.class, "mock EntityRef#" + i); Mockito.when(test[i].getComponent(LocationComponent.class)) .thenReturn(new LocationComponent(pos[i])); regionEntityManager.add(test[i]); } } @Test public void testSimpleGet() { for (int i = 0; i < test.length; i++) { Vector2i position = new Vector2i(pos[i].x(), pos[i].z(), RoundingMode.FLOOR); assertEquals(test[i], regionEntityManager.get(position)); } } @ParameterizedTest(name = "{1}, {2} is nearest pos[{0}]") @CsvSource({ "0, 21, 13", "1, 14, -13", "2, -22, 19", "3, -13, -19" }) public void testNearestGet(int index, int x, int y) { assertEquals(test[index], regionEntityManager.getNearest(new Vector2i(x, y))); } @ParameterizedTest(name = "cell loaded at {0}, {1}") @CsvSource({"0, 0", "16, 0", "0, -25"}) public void testCellsInRegionAreLoaded(int x, int y) { assertTrue(regionEntityManager.cellIsLoaded(new Vector2i(x, y))); } @ParameterizedTest(name = "cell not loaded at {0}, {1}") @CsvSource({"98, -124", "351, 234", "153, -134"}) public void testCellsOutsideRegionAreNotLoaded(int x, int y) { assertFalse(regionEntityManager.cellIsLoaded(new Vector2i(x, y))); } @Disabled @Test public void testGetRegionsInCell() { List<EntityRef> testList = Arrays.asList(test).subList(0, 5); // FIXME: The method under test seems to be returning the correct values, but the list is // out-of-order and contains duplicates. assertEquals(testList, regionEntityManager.getRegionsInCell(new Vector2i(0, 0))); } }
[ "noreply@github.com" ]
noreply@github.com
ae1c1a9e500a03b430893febc1696afc4f09bfc6
5a849f62327bb8e4958925813ae398b9fb9d95e8
/src/main/java/com/diplomski/bioskop/model/Ocena.java
6aa33d760df34e3af452d56dc9109ee22345347d
[]
no_license
MiloradSegan/Cinema
43a12e48727fb275e540e7ecf684ff0f0b3a2a32
65b046bd738c11c2e8b663d125d60d426a5af078
refs/heads/master
2020-07-03T22:41:03.444898
2019-08-13T07:27:15
2019-08-13T07:27:15
202,010,486
0
0
null
null
null
null
UTF-8
Java
false
false
1,061
java
package com.diplomski.bioskop.model; 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; @Entity @Table(name="ocene") public class Ocena { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; private double ocena; @ManyToOne @JoinColumn(name="idfilma") private Film film; @ManyToOne @JoinColumn(name="korsnikId") private Korisnik korisnik; public Ocena() { super(); } public int getId() { return id; } public void setId(int id) { this.id = id; } public double getOcena() { return ocena; } public void setOcena(double ocena) { this.ocena = ocena; } public Film getFilm() { return film; } public void setFilm(Film film) { this.film = film; } public Korisnik getKorisnik() { return korisnik; } public void setKorisnik(Korisnik korisnik) { this.korisnik = korisnik; } }
[ "prestolonaslednikovicevica@hotmail.com" ]
prestolonaslednikovicevica@hotmail.com
e2ad0e20bd8464b258a773c898654f3ca1c84906
13550e8fbae589af18a0af93962c10b27ac50ff6
/src/programmersLevel1/S01_Kakao.java
e4fe941ad88cd09e95e58c300ae6036ba7ccc1da
[]
no_license
SungWoo824/JavaAlgorithm
824fff65bee375694cbf3272789c113661d9bee2
66e7a4893abace8ffa85f7ef1d2a26b28caa51f3
refs/heads/master
2023-08-17T07:12:17.690567
2023-08-08T14:09:32
2023-08-08T14:09:32
214,786,375
0
0
null
null
null
null
UTF-8
Java
false
false
1,343
java
package programmersLevel1; import java.util.HashMap; import java.util.Map; public class S01_Kakao { public int[] solution(String[] id_list, String[] report, int k) { int[] answer = {}; int[] checkArr = new int[id_list.length]; Map<String, Integer> checkMap = new HashMap<>(); Map<String, Integer> userMap = new HashMap<>(); for (int i = 0 ; i < report.length ; i++) { String[] tempArr = report[i].split(" "); if (checkMap.containsKey(tempArr[1])) { checkMap.put(tempArr[1],checkMap.get(tempArr[1])+1); } else { checkMap.put(tempArr[1],1); } if (userMap.containsKey(tempArr[0])) { checkMap.put(tempArr[0],checkMap.get(tempArr[0])+1); } else { checkMap.put(tempArr[0],1); } } return answer; } public static void main(String[] args) { Map<String, Integer> test = new HashMap<>(); String testString = "test"; test.put("test",1); System.out.println(test.get("test")); } } /* id_list report k result ["muzi", "frodo", "apeach", "neo"] ["muzi frodo","apeach frodo","frodo neo","muzi neo","apeach muzi"] 2 [2,1,1,0] ["con", "ryan"] ["ryan con", "ryan con", "ryan con", "ryan con"] 3 [0,0] */
[ "scody1219@gmail.com" ]
scody1219@gmail.com
4fce5bb97bc1d1be66b3f7003d8218ca55db0ab3
072216667ef59e11cf4994220ea1594538db10a0
/xiaomi/yellowpages/android/support/a/a/h.java
594e61d8a4e579142625a76f1f1ebb7491a3d9d6
[]
no_license
jackTang11/REMIUI
896037b74e90f64e6f7d8ddfda6f3731a8db6a74
48d65600a1b04931a510e1f036e58356af1531c0
refs/heads/master
2021-01-18T05:43:37.754113
2015-07-03T04:01:06
2015-07-03T04:01:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,047
java
package android.support.a.a; import android.app.Fragment; import android.app.Fragment.SavedState; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.os.Bundle; import android.os.Parcelable; import android.support.v4.view.D; import android.util.Log; import android.view.View; import android.view.ViewGroup; import java.util.ArrayList; /* compiled from: FragmentStatePagerAdapter */ public abstract class h extends D { private FragmentTransaction Mf; private ArrayList Mg; private ArrayList Mh; private Fragment Mi; private final FragmentManager mFragmentManager; public abstract Fragment r(int i); public h(FragmentManager fragmentManager) { this.Mf = null; this.Mg = new ArrayList(); this.Mh = new ArrayList(); this.Mi = null; this.mFragmentManager = fragmentManager; } public void startUpdate(ViewGroup viewGroup) { } public Object instantiateItem(ViewGroup viewGroup, int i) { if (this.Mh.size() > i) { Fragment fragment = (Fragment) this.Mh.get(i); if (fragment != null) { return fragment; } } if (this.Mf == null) { this.Mf = this.mFragmentManager.beginTransaction(); } Fragment r = r(i); if (this.Mg.size() > i) { SavedState savedState = (SavedState) this.Mg.get(i); if (savedState != null) { r.setInitialSavedState(savedState); } } while (this.Mh.size() <= i) { this.Mh.add(null); } d.b(r, false); d.a(r, false); this.Mh.set(i, r); this.Mf.add(viewGroup.getId(), r); return r; } public void destroyItem(ViewGroup viewGroup, int i, Object obj) { Fragment fragment = (Fragment) obj; if (this.Mf == null) { this.Mf = this.mFragmentManager.beginTransaction(); } while (this.Mg.size() <= i) { this.Mg.add(null); } this.Mg.set(i, this.mFragmentManager.saveFragmentInstanceState(fragment)); this.Mh.set(i, null); this.Mf.remove(fragment); } public void setPrimaryItem(ViewGroup viewGroup, int i, Object obj) { Fragment fragment = (Fragment) obj; if (fragment != this.Mi) { if (this.Mi != null) { d.b(this.Mi, false); d.a(this.Mi, false); } if (fragment != null) { d.b(fragment, true); d.a(fragment, true); } this.Mi = fragment; } } public void finishUpdate(ViewGroup viewGroup) { if (this.Mf != null) { this.Mf.commitAllowingStateLoss(); this.Mf = null; this.mFragmentManager.executePendingTransactions(); } } public boolean isViewFromObject(View view, Object obj) { return ((Fragment) obj).getView() == view; } public Parcelable saveState() { Bundle bundle = null; if (this.Mg.size() > 0) { bundle = new Bundle(); Parcelable[] parcelableArr = new SavedState[this.Mg.size()]; this.Mg.toArray(parcelableArr); bundle.putParcelableArray("states", parcelableArr); } Parcelable parcelable = bundle; for (int i = 0; i < this.Mh.size(); i++) { Fragment fragment = (Fragment) this.Mh.get(i); if (fragment != null) { if (parcelable == null) { parcelable = new Bundle(); } this.mFragmentManager.putFragment(parcelable, "f" + i, fragment); } } return parcelable; } public void restoreState(Parcelable parcelable, ClassLoader classLoader) { if (parcelable != null) { Bundle bundle = (Bundle) parcelable; bundle.setClassLoader(classLoader); Parcelable[] parcelableArray = bundle.getParcelableArray("states"); this.Mg.clear(); this.Mh.clear(); if (parcelableArray != null) { for (Parcelable parcelable2 : parcelableArray) { this.Mg.add((SavedState) parcelable2); } } for (String str : bundle.keySet()) { if (str.startsWith("f")) { int parseInt = Integer.parseInt(str.substring(1)); Fragment fragment = this.mFragmentManager.getFragment(bundle, str); if (fragment != null) { while (this.Mh.size() <= parseInt) { this.Mh.add(null); } d.b(fragment, false); this.Mh.set(parseInt, fragment); } else { Log.w("FragmentStatePagerAdapter", "Bad fragment at key " + str); } } } } } }
[ "songjd@putao.com" ]
songjd@putao.com
a9a2cd078a7a339d0cd270fcb8b6d53664d9b8ff
b16fca18a2eca70bee8cb9c40b1ee5c22e8798ec
/src/main/java/com/casesoft/common/util/Message.java
337d1ee92e50e219db68610a0428c691afb2dfae
[]
no_license
liutianci1201/casesoft-common
fc8b4fe9430606def0341a8bfa8d9aa6af7e9883
fb53ebb3134ba3f25481ff82298b1eda80c5442e
refs/heads/master
2020-03-30T00:20:14.162133
2018-09-27T02:31:26
2018-09-27T02:31:26
150,517,451
0
0
null
null
null
null
UTF-8
Java
false
false
1,073
java
package com.casesoft.common.util; import java.io.Serializable; import com.alibaba.fastjson.JSONObject; public class Message implements Serializable { private static final long serialVersionUID = -4303499387889592642L; private String code; private String message; private JSONObject info; public Message() { } public Message(String code) { super(); this.code = code; } public Message(String code, String message) { super(); this.code = code; this.message = message; } public Message(String code, JSONObject info) { super(); this.code = code; this.info = info; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public JSONObject getInfo() { return info; } public void setInfo(JSONObject info) { this.info = info; } @Override public String toString() { return "Message [code=" + code + ", message=" + message + ", info=" + info + "]"; } }
[ "1253947039@qq.com" ]
1253947039@qq.com
a5f85dc91178171bf5f6d47d6d27916fc2ac46cf
32f38cd53372ba374c6dab6cc27af78f0a1b0190
/app/src/main/java/com/autonavi/jni/ae/pos/LocDRPos.java
5e714c977a517290c13658159b4ef6542c6a8bee
[]
no_license
shuixi2013/AmapCode
9ea7aefb42e0413f348f238f0721c93245f4eac6
1a3a8d4dddfcc5439df8df570000cca12b15186a
refs/heads/master
2023-06-06T23:08:57.391040
2019-08-29T04:36:02
2019-08-29T04:36:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
970
java
package com.autonavi.jni.ae.pos; public class LocDRPos { public int DRStatus; public float alt; public float altAcc; public float course; public float courseAcc; public int day; public float deltaAlt; public float deltaAltAcc; public char ew; public int gpsStatus; public float hdop; public int hour; public boolean isDeltaAltAccValid; public boolean isDeltaAltValid; public boolean isMoveDistValid; public boolean isSlopeAccValid; public boolean isSlopeValueValid; public int lat; public int lon; public int minute; public int month; public double moveDist; public int moveStatus; public char ns; public float pdop; public float posAcc; public int satnum; public int second; public float slopeAcc; public float slopeValue; public float speed; public float speedAcc; public long ticktime64; public float vdop; public int year; }
[ "hubert.yang@nf-3.com" ]
hubert.yang@nf-3.com
9bae7a8a0aff020fe2747f146089f39779b94d17
77d47629438fcfd20d7d7878ea0582969d0f8c22
/Assignment1/Beg_Java_14/Beg_Java_14/Solutions to Exercises/Ch07/sol2/ClassifyIndexException.java
8407e27a97e91bef29d1e7d4d70bf98b176efcf4
[]
no_license
kirouchenaradjou/WebTools
3fba43a0123a3ff57ba714fa9d18b057e545bcb1
3d9dfdc71cd7f7f53462b61dde9a629d8dba7e7d
refs/heads/master
2021-04-27T19:52:30.954375
2019-02-03T01:07:45
2019-02-03T01:07:45
122,365,594
0
0
null
null
null
null
UTF-8
Java
false
false
1,365
java
// Chapter 7 Exercise 2 // ClassifyIndexException class public class ClassifyIndexException extends Throwable { private int index = -1; // Index of array element causing error. private String exception; // String identifying exception. // Default Constructor: public ClassifyIndexException() { exception = "Index value is not known."; // Set defaults for exception string. } // Standard constructor: public ClassifyIndexException(String s) { super(s); // Call the base constructor. exception = "Index value is not known."; // Set defaults for exception string. } public ClassifyIndexException(int index) { super("Index is not within scope of array.\n"); // Call the base constructor. this.index = index; // Set the index value. if(index < 0) { // Check for negative index. exception = "Index to array is negative. Index = " + index; } else { // Index value must be too high: exception = "Index to array is beyond last array element. Index = "+index; } } // Get the array index value for the error: public int getIndex() { return index; // Return the index value. } // Override inherited method for a more informative message string: public String toString() { return getMessage() + exception; } }
[ "kirouchenaradjou.r@husky.neu.edu" ]
kirouchenaradjou.r@husky.neu.edu
6f0b0112e0b403a90d46e27694760ab31823bab5
c7c1c253b1320ab048456716da1769ff8329a9b7
/app/src/main/java/com/mad41/tripreminder/trip_ui/TripModel.java
7a32be4005f708938d411cab60eaf9eb760ff314
[]
no_license
MarwaEbrahem/Trip_Reminder
78d7b0ea450f3a132342e3bebd4278c9f2d2cede
7280ac14ac8ce1d33dc6e1febf914a974892b9d5
refs/heads/master
2023-03-02T22:53:03.091102
2021-02-11T22:55:39
2021-02-11T22:55:39
334,614,211
0
0
null
2021-02-11T00:12:51
2021-01-31T09:06:30
Java
UTF-8
Java
false
false
1,476
java
package com.mad41.tripreminder.trip_ui; import java.util.ArrayList; public class TripModel { private int id; private String name; private String startLoacation; private String endLoacation; private String time; private String date; private int status; private boolean isRepeated; private boolean isRound; private ArrayList<String> myNotes; public TripModel(String name, String startLoacation, String endLoacation, String time, String date, int status, boolean isRepeated, boolean isRound) { this.name = name; this.startLoacation = startLoacation; this.endLoacation = endLoacation; this.time = time; this.date = date; this.status = status; this.isRepeated = isRepeated; this.isRound = isRound; } public int getId() { return id; } public String getName() { return name; } public String getStartLoacation() { return startLoacation; } public String getEndLoacation() { return endLoacation; } public String getTime() { return time; } public String getDate() { return date; } public int getStatus() { return status; } public boolean isRepeated() { return isRepeated; } public boolean isRound() { return isRound; } public ArrayList<String> getMyNotes() { return myNotes; } }
[ "sohamohamed994@gmail.com" ]
sohamohamed994@gmail.com
d67a2bd642a8a585a007dda4824a7af0d2fbcb16
a69111fa92dfae7daefdb1bb0790889ed2fab960
/app/src/test/java/com/example/sajkaan/stormy/ExampleUnitTest.java
176c041a479569c94a21fe8cf1a520f19b34b63c
[]
no_license
Sajkaan/Stormy
d9afdccbd7c0ef2a6252e5ba324b787c5856d228
f3a382d1e9b7a21c178adf30162e9372349efd11
refs/heads/master
2021-01-17T15:51:40.743581
2016-09-25T17:00:14
2016-09-25T17:00:14
69,068,479
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package com.example.sajkaan.stormy; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "safet.garic@hotmail.com" ]
safet.garic@hotmail.com
d6631b27a92069259755d2d6ced059302eb9373a
83d1876a13882b00175c36474391631c5fa0ea9d
/src/main/java/com/sinjinsong/leetcode/hard/LeetCode128.java
81d106ac2827b70cda19067a8a7c71cb5db8f81b
[]
no_license
songxinjianqwe/DataStructures
acc9c103666526bb14ef6cf35396c9321d0b5a9b
53fe5e9ac1605990e3a20bfd4b5c003e9ed60010
refs/heads/master
2021-07-01T19:31:32.594899
2021-02-01T16:17:58
2021-02-01T16:17:58
74,250,991
5
1
null
null
null
null
UTF-8
Java
false
false
770
java
package com.sinjinsong.leetcode.hard; import java.util.HashSet; import java.util.Set; public class LeetCode128 { public int longestConsecutive(int[] nums) { if(nums.length <= 1) { return nums.length; } Set<Integer> set = new HashSet<>(); for (int num : nums) { set.add(num); } int ans = 1; for (int num : nums) { if(set.contains(num - 1)) { continue; } if(set.contains(num + 1)) { int dist = 1; int val = num + 1; while(set.contains(val++)) { dist++; } ans = Math.max(ans, dist); } } return ans; } }
[ "xinjian@xinjiandeMacBook-Pro.local" ]
xinjian@xinjiandeMacBook-Pro.local
fba2362913efee4687d66bbc7c38cbfae7aff25b
7112ce5c2a3f9ab9f36c7c8cf94c2ef627ac7813
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/AmpSensorTest.java
575780977ac7f913044d5a18af9855ba8fcdb8d2
[]
no_license
Aedificatores8581/relic-recovery
be2fab873bdfef808926a173a87430defa72c426
5d6bfca50a29df86849ee31b251ae1d437119baf
refs/heads/master
2022-01-16T13:29:18.573003
2019-07-24T15:31:46
2019-07-24T15:31:46
95,800,731
0
0
null
null
null
null
UTF-8
Java
false
false
1,665
java
package org.firstinspires.ftc.teamcode; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.AnalogInput; import com.qualcomm.robotcore.hardware.AnalogOutput; import com.qualcomm.robotcore.hardware.Gamepad; import com.qualcomm.robotcore.hardware.Servo; import com.qualcomm.robotcore.hardware.DigitalChannel; /** * Created by Hunter Seachrist on 2/9/2018. */ @Disabled @TeleOp(name = "SensorBot: Amp Sensor", group = "Sensor Test") public class AmpSensorTest extends OpMode { AnalogInput ampSensor; Servo testServo; double servoPosition; protected DigitalChannel magFront, magBack; public void init(){ ampSensor = hardwareMap.get(AnalogInput.class, "amp"); testServo = hardwareMap.servo.get("servo"); magFront = hardwareMap.digitalChannel.get("mf"); magBack = hardwareMap.digitalChannel.get("mb"); magFront.setMode(DigitalChannel.Mode.INPUT); magBack.setMode(DigitalChannel.Mode.INPUT); } public void loop(){ testServo.setPosition(servoPosition); telemetry.addData("Amp Sensor Voltage: " , ampSensor.getVoltage()); telemetry.addData("Amp Sensor max Voltage: " , ampSensor.getMaxVoltage()); if (gamepad1.left_bumper) { servoPosition += 0.02; } else if (gamepad1.right_bumper) { servoPosition -= 0.02; } telemetry.addData("back.getState: ", magBack.getState()); telemetry.addData("front.getState: ", magFront.getState()); } }
[ "misterministermaster@gmail.com" ]
misterministermaster@gmail.com
2cac55ef1d355d1bb2b17456f1136307a39e7834
d3a13c99c56c55e14c764ed4a276eb53e1014b90
/src/main/java/forceman/ibank/entity/Client.java
8cb84eb33995631be10fd307af35109cd324df40
[]
no_license
ForceMan1/ibank1
f78b0552f19bf6e989229e592c65dd78803a5639
0fed80411fc0cc6dd10684dece0ef2f3ead14a6f
refs/heads/master
2021-01-11T02:46:16.332964
2016-11-01T12:02:59
2016-11-01T12:02:59
70,904,970
0
0
null
null
null
null
UTF-8
Java
false
false
2,118
java
package forceman.ibank.entity; import javax.persistence.*; /** * Created by Igor on 20.09.2016. */ @Entity @NamedQueries({ @NamedQuery(name = Client.QUERY_COUNT, query = "SELECT COUNT(c.id) FROM Client c"), @NamedQuery(name = Client.QUERY_GET_CLIENTS, query = "SELECT c FROM Client c"), @NamedQuery(name=Client.QUERY_DELETE_ALL_CLIENTS, query="DELETE FROM Client c") }) public class Client { public static final String QUERY_COUNT="countClients"; public static final String QUERY_GET_CLIENTS="getClients"; public static final String QUERY_DELETE_ALL_CLIENTS="deleteAllClients"; @GeneratedValue @Id private Long id; @Basic(optional=false) private String surname; @Basic(optional=false) private String name; @Basic(optional=false) private String login; private String pass; public Client(){} public Client(String surname, String name, String login, String pass){ this.surname = surname; this.name = name; this.login = login; this.pass = pass; } public void update(Client updClient) throws IllegalArgumentException { if( !this.getId().equals( updClient.getId() ) ) throw new IllegalArgumentException("Primary keys of objects are not the same"); surname = updClient.getSurname(); name = updClient.getName(); login = updClient.getLogin(); pass = updClient.getPass(); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getPass() { return pass; } public void setPass(String pass) { this.pass = pass; } }
[ "forceman28@gmail.com" ]
forceman28@gmail.com
ccd45532a0897a08cc92c0a1045d5471c3466c9a
0b1d57269ca8f9ae789c02b55d2f6b1c460b3be7
/src/TermServer/src/main/generated/clamlBindingXSD/ModifiedBy.java
8a98341e43932ed3492205a94d04bc7a2a8490d7
[ "Apache-2.0" ]
permissive
FHDortmund/Termserver
b5e4110c39ec39aec0fee5ddb6dc3c5ada21cf3f
716982054eec5dddabbdfdccaec25593e2544312
refs/heads/master
2021-01-15T15:47:13.578210
2018-05-14T13:15:00
2018-05-14T13:15:00
18,755,910
6
4
null
2014-07-28T08:55:59
2014-04-14T09:50:04
null
UTF-8
Java
false
false
6,909
java
// // Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 generiert // Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Änderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. // Generiert: 2018.04.09 um 11:53:09 AM CEST // package clamlBindingXSD; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlIDREF; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * <p>Java-Klasse für anonymous complex type. * * <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist. * * <pre> * &lt;complexType&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element ref="{}Meta" maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;element ref="{}ValidModifierClass" maxOccurs="unbounded" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;attribute name="position" type="{http://www.w3.org/2001/XMLSchema}string" /&gt; * &lt;attribute name="variants" type="{http://www.w3.org/2001/XMLSchema}IDREFS" /&gt; * &lt;attribute name="all" default="true"&gt; * &lt;simpleType&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}NMTOKEN"&gt; * &lt;enumeration value="true"/&gt; * &lt;enumeration value="false"/&gt; * &lt;/restriction&gt; * &lt;/simpleType&gt; * &lt;/attribute&gt; * &lt;attribute name="code" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" /&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "meta", "validModifierClass" }) @XmlRootElement(name = "ModifiedBy") public class ModifiedBy { @XmlElement(name = "Meta") protected List<Meta> meta; @XmlElement(name = "ValidModifierClass") protected List<ValidModifierClass> validModifierClass; @XmlAttribute(name = "position") protected String position; @XmlAttribute(name = "variants") @XmlIDREF @XmlSchemaType(name = "IDREFS") protected List<Object> variants; @XmlAttribute(name = "all") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String all; @XmlAttribute(name = "code", required = true) @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlSchemaType(name = "NMTOKEN") protected String code; /** * Gets the value of the meta property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the meta property. * * <p> * For example, to add a new item, do as follows: * <pre> * getMeta().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Meta } * * */ public List<Meta> getMeta() { if (meta == null) { meta = new ArrayList<Meta>(); } return this.meta; } /** * Gets the value of the validModifierClass property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the validModifierClass property. * * <p> * For example, to add a new item, do as follows: * <pre> * getValidModifierClass().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link ValidModifierClass } * * */ public List<ValidModifierClass> getValidModifierClass() { if (validModifierClass == null) { validModifierClass = new ArrayList<ValidModifierClass>(); } return this.validModifierClass; } /** * Ruft den Wert der position-Eigenschaft ab. * * @return * possible object is * {@link String } * */ public String getPosition() { return position; } /** * Legt den Wert der position-Eigenschaft fest. * * @param value * allowed object is * {@link String } * */ public void setPosition(String value) { this.position = value; } /** * Gets the value of the variants property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the variants property. * * <p> * For example, to add a new item, do as follows: * <pre> * getVariants().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Object } * * */ public List<Object> getVariants() { if (variants == null) { variants = new ArrayList<Object>(); } return this.variants; } /** * Ruft den Wert der all-Eigenschaft ab. * * @return * possible object is * {@link String } * */ public String getAll() { if (all == null) { return "true"; } else { return all; } } /** * Legt den Wert der all-Eigenschaft fest. * * @param value * allowed object is * {@link String } * */ public void setAll(String value) { this.all = value; } /** * Ruft den Wert der code-Eigenschaft ab. * * @return * possible object is * {@link String } * */ public String getCode() { return code; } /** * Legt den Wert der code-Eigenschaft fest. * * @param value * allowed object is * {@link String } * */ public void setCode(String value) { this.code = value; } }
[ "robert.muetzner@fh-dortmund.de" ]
robert.muetzner@fh-dortmund.de
164dc17f7d7d263c0ff3c8fd40cbe99131d0848e
7e0a42622c381947bdb1a7e95e919edd391d171c
/gulimall-ware/src/main/java/com/atguigu/gulimall/ware/dao/PurchaseDetailDao.java
2a47b4925449a8cc7ed7b4ab663cf4f546c98369
[]
no_license
qi17/guli
17533a2acadb2abd0ece03f88ea6061155ff4b1a
3d364c8f9a5c0f7b6b392a32f69e58f52644e8ac
refs/heads/master
2023-04-26T05:15:55.253271
2021-05-30T03:09:37
2021-05-30T03:09:37
372,111,938
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
package com.atguigu.gulimall.ware.dao; import com.atguigu.gulimall.ware.entity.PurchaseDetailEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; /** * * * @author qichunhui * @email sunlightcs@gmail.com * @date 2021-04-04 17:01:18 */ @Mapper public interface PurchaseDetailDao extends BaseMapper<PurchaseDetailEntity> { }
[ "qichunhui@tiandaai.com" ]
qichunhui@tiandaai.com
302ceda79f6ed505f569b7d74afaa3eac3506b90
8a4fe4d680269376a57bf1a7de610992972fa867
/app/src/main/java/com/vr_mu/vrmu/gson/BannerGson.java
aebcf29bd0a8c2ab2cf43a8cd959d3287c3ba033
[ "Apache-2.0" ]
permissive
qiezi0301/VRMU
cb8118c7486be57647c8297ad2c3925846b7b60c
72225050f377508eb92ea2b8d9104361b5c9173a
refs/heads/master
2021-01-22T21:41:11.005331
2017-04-14T10:17:56
2017-04-14T10:17:56
85,462,354
0
0
null
null
null
null
UTF-8
Java
false
false
953
java
package com.vr_mu.vrmu.gson; import com.google.gson.annotations.SerializedName; import java.util.List; /** * Created by zjl on 17/4/12. */ public class BannerGson { /** * code : 0 * msg : success * data : [{"id":1,"img":"http://api.vr-mu.com/Uploads/banner/img/banner1.jpg"},{"id":2,"img":"http://api.vr-mu.com/Uploads/banner/img/banner2.jpg"},{"id":3,"img":"http://api.vr-mu.com/Uploads/banner/img/banner3.jpg"}] * location : */ @SerializedName("code") public int code; @SerializedName("msg") public String msg; @SerializedName("location") public String location; @SerializedName("data") public List<DataBean> data; public static class DataBean { /** * id : 1 * img : http://api.vr-mu.com/Uploads/banner/img/banner1.jpg */ @SerializedName("id") public int id; @SerializedName("img") public String img; } }
[ "qiezi0301@163.com" ]
qiezi0301@163.com
84d179614a3653982d48fb815de27bdc0d960306
dc5a822f13e6d4cd1b5cf7615c410647224a5054
/algorithm0721/src/palindrome/main.java
1d81912e3792458c9ca2097998afb36d7fb72378
[]
no_license
jibminJung/algorithm-test
7ce0eec839775650789cd13f8af85a13089d72cb
4a57a0c3358979d1ea4c2eb6379c4ee9408bdbd0
refs/heads/master
2023-07-18T12:44:54.948232
2021-08-28T07:29:31
2021-08-28T07:29:31
400,174,773
0
0
null
null
null
null
UTF-8
Java
false
false
1,049
java
package palindrome; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); while (n-- > 0) { String target = br.readLine(); int left = 0; int right = target.length() - 1; int type = 0; while (left <= right) { if (target.charAt(left) == target.charAt(right)) { left++; right--; } else { int l = left; int r = right; l++; while (l <= r) { if (target.charAt(l) == target.charAt(r)) { l++; r--; } else { type++; break; } } l = left; r = right; r--; while (l <= r) { if (target.charAt(l) == target.charAt(r)) { l++; r--; } else { type++; break; } } } if (type > 0) break; } System.out.println(type); } } }
[ "tunej@DESKTOP-NB2UBHG" ]
tunej@DESKTOP-NB2UBHG
02e5edd2eaac4a5591c13593767e6d1dfe2aec07
7bea7fb60b5f60f89f546a12b43ca239e39255b5
/src/java/util/Stack.java
f8248f4cc1957300bca0bfa0e46a9ade84aa9d94
[]
no_license
sorakeet/fitcorejdk
67623ab26f1defb072ab473f195795262a8ddcdd
f946930a826ddcd688b2ddbb5bc907d2fc4174c3
refs/heads/master
2021-01-01T05:52:19.696053
2017-07-15T01:33:41
2017-07-15T01:33:41
97,292,673
0
0
null
null
null
null
UTF-8
Java
false
false
930
java
/** * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package java.util; public class Stack<E> extends Vector<E>{ private static final long serialVersionUID=1224463164541339165L; public Stack(){ } public E push(E item){ addElement(item); return item; } public synchronized E pop(){ E obj; int len=size(); obj=peek(); removeElementAt(len-1); return obj; } public synchronized E peek(){ int len=size(); if(len==0) throw new EmptyStackException(); return elementAt(len-1); } public boolean empty(){ return size()==0; } public synchronized int search(Object o){ int i=lastIndexOf(o); if(i>=0){ return size()-i; } return -1; } }
[ "panxiaoping@9af151c5-2e68-9a40-a710-8967c58c11f7" ]
panxiaoping@9af151c5-2e68-9a40-a710-8967c58c11f7
bdc93667a3bdfb22529fdd9837898fad7a26b294
ba835146483ae9df12b126b3133110e9030b73ec
/structure/src/MyStackAndQueue/MyQueue2.java
3447852400182cd1f92df2c43126e768813186c4
[]
no_license
2170987947/dataStructure
69aa5920d01177e470f0367d7c678629ff82c120
c1fada6f7e0170403cb3f38c8c2a0dae78024a41
refs/heads/master
2023-04-28T13:52:00.739161
2021-05-15T07:57:18
2021-05-15T07:57:18
329,228,497
1
0
null
null
null
null
UTF-8
Java
false
false
982
java
package MyStackAndQueue; /** * @author FMM * @version 7.0 * @date 2021/3/9 14:15 */ public class MyQueue2 { private int[] queue = new int[10]; private int head = 0; private int tail = 0; private int size; public boolean offer(int e) { if (this.size >= queue.length) { return false; } if (this.tail + 1 == this.queue.length) { this.tail = 0; } else { this.queue[tail++] = e; } this.size++; return true; } public Integer peek() { if (this.size <= 0) { return null; } return this.queue[this.head]; } public Integer poll() { if (this.size <= 0) { return null; } int result = this.queue[this.head]; if (this.head + 1 == this.queue.length) { this.head = 0; } else { this.head++; } this.size--; return result; } }
[ "2170987947@qq.com" ]
2170987947@qq.com
3a6ef1220bd618cd7d52ea511d41da24d6f00241
4d6f0e9c036218d5829b6ac2d054248056e13038
/myPackage/transectionManagement/AccountTransactions.java
7df18855b645c555181f2352230a9b153f3af20c
[ "Apache-2.0" ]
permissive
Saidul-M-Khan/Bank-Management-System
8ff9f234b9648f14b54c320a962ba5041192ad16
8f5dfee7b78c393128eda727731a549aa70fe6cb
refs/heads/master
2022-12-31T23:35:34.758296
2020-10-18T20:53:24
2020-10-18T20:53:24
297,986,240
0
0
null
null
null
null
UTF-8
Java
false
false
211
java
package myPackage.transectionManagement; interface AccountTransactions { void deposit(double amount_of_money); void withdraw(double amount_of_money); void transfer(Account account, double amount_of_money); }
[ "noreply@github.com" ]
noreply@github.com
98af3e3ba208880ea7318c759606edfd5ebb071d
e8d587ee5c601ed9b4ce228c202bf7db278a9d82
/ProjectPasswordStrengthMeter/app/src/main/java/com/example/johan/projectpasswordstrengthmeter/PasswordRequirements.java
a408d35bb3419d8004a0a91a683426a9534b6661
[]
no_license
Syllvan/Interaction-programming
2edeb387adbe3c00379ebd6d6e38bb44eb4fec2c
7bfc32c8dd937db30a11ad874a1126b67c73482b
refs/heads/master
2021-01-10T15:10:00.679268
2016-01-13T10:01:02
2016-01-13T10:01:02
49,324,708
0
0
null
null
null
null
UTF-8
Java
false
false
1,912
java
package com.example.johan.projectpasswordstrengthmeter; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by johan on 2016-01-05. */ public class PasswordRequirements { private int minCharacters; public PasswordRequirements(){ minCharacters = 5; } public boolean containsMinimum(String s){ if ( s.length()>= minCharacters){ return true; } else { return false; } } public boolean containsUpper(String s){ for(int i=0; i < s.length(); i++){ if(Character.isUpperCase(s.charAt(i))){ return true; } } return false; } public boolean containsLower(String s){ for(int i=0; i < s.length(); i++){ if(Character.isLowerCase(s.charAt(i))){ return true; } } return false; } public boolean containsNumber(String s){ for(int i=0; i < s.length(); i++){ if(Character.isDigit(s.charAt(i))){ return true; } } return false; } public boolean containsSpecial(String s){ Pattern p = Pattern.compile("[^a-z0-9 ]", Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(s); boolean b = m.find(); if (b){ return true; } else { return false; } } public int passwordStrengthLevel(String s){ int strengthLevel = 0; if(containsMinimum(s)){ strengthLevel++; } if(containsUpper(s)){ strengthLevel++; } if(containsLower(s)){ strengthLevel++; } if(containsNumber(s)){ strengthLevel++; } if(containsSpecial(s)){ strengthLevel++; } return strengthLevel; } }
[ "johsy071@student.liu.se" ]
johsy071@student.liu.se
5ebc53e75f806106b52317e18562b98baa942992
51fa3cc281eee60058563920c3c9059e8a142e66
/Java/src/testcases/CWE191_Integer_Underflow/s03/CWE191_Integer_Underflow__int_URLConnection_multiply_71b.java
8246624687ddd2e54be912504f9030255a39f69e
[]
no_license
CU-0xff/CWE-Juliet-TestSuite-Java
0b4846d6b283d91214fed2ab96dd78e0b68c945c
f616822e8cb65e4e5a321529aa28b79451702d30
refs/heads/master
2020-09-14T10:41:33.545462
2019-11-21T07:34:54
2019-11-21T07:34:54
223,105,798
1
4
null
null
null
null
UTF-8
Java
false
false
2,346
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE191_Integer_Underflow__int_URLConnection_multiply_71b.java Label Definition File: CWE191_Integer_Underflow__int.label.xml Template File: sources-sinks-71b.tmpl.java */ /* * @description * CWE: 191 Integer Underflow * BadSource: URLConnection Read data from a web server with URLConnection * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: multiply * GoodSink: Ensure there will not be an underflow before multiplying data by 2 * BadSink : If data is negative, multiply by 2, which can cause an underflow * Flow Variant: 71 Data flow: data passed as an Object reference argument from one method to another in different classes in the same package * * */ package testcases.CWE191_Integer_Underflow.s03; import testcasesupport.*; import javax.servlet.http.*; public class CWE191_Integer_Underflow__int_URLConnection_multiply_71b { public void badSink(Object dataObject ) throws Throwable { int data = (Integer)dataObject; if(data < 0) /* ensure we won't have an overflow */ { /* POTENTIAL FLAW: if (data * 2) < Integer.MIN_VALUE, this will underflow */ int result = (int)(data * 2); IO.writeLine("result: " + result); } } /* goodG2B() - use goodsource and badsink */ public void goodG2BSink(Object dataObject ) throws Throwable { int data = (Integer)dataObject; if(data < 0) /* ensure we won't have an overflow */ { /* POTENTIAL FLAW: if (data * 2) < Integer.MIN_VALUE, this will underflow */ int result = (int)(data * 2); IO.writeLine("result: " + result); } } /* goodB2G() - use badsource and goodsink */ public void goodB2GSink(Object dataObject ) throws Throwable { int data = (Integer)dataObject; if(data < 0) /* ensure we won't have an overflow */ { /* FIX: Add a check to prevent an underflow from occurring */ if (data > (Integer.MIN_VALUE/2)) { int result = (int)(data * 2); IO.writeLine("result: " + result); } else { IO.writeLine("data value is too small to perform multiplication."); } } } }
[ "frank@fischer.com.mt" ]
frank@fischer.com.mt
15420be9a7da45e8f82a74cc673102f6638b9827
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-mgn/src/main/java/com/amazonaws/services/mgn/model/transform/UpdateReplicationConfigurationTemplateRequestProtocolMarshaller.java
f1c9e0eff3c5fde81718ec82478e9e99eca8cc11
[ "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,985
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.mgn.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.Request; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.mgn.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.protocol.*; import com.amazonaws.protocol.Protocol; import com.amazonaws.annotation.SdkInternalApi; /** * UpdateReplicationConfigurationTemplateRequest Marshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class UpdateReplicationConfigurationTemplateRequestProtocolMarshaller implements Marshaller<Request<UpdateReplicationConfigurationTemplateRequest>, UpdateReplicationConfigurationTemplateRequest> { private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.REST_JSON) .requestUri("/UpdateReplicationConfigurationTemplate").httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true) .serviceName("AWSmgn").build(); private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory; public UpdateReplicationConfigurationTemplateRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) { this.protocolFactory = protocolFactory; } public Request<UpdateReplicationConfigurationTemplateRequest> marshall( UpdateReplicationConfigurationTemplateRequest updateReplicationConfigurationTemplateRequest) { if (updateReplicationConfigurationTemplateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { final ProtocolRequestMarshaller<UpdateReplicationConfigurationTemplateRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller( SDK_OPERATION_BINDING, updateReplicationConfigurationTemplateRequest); protocolMarshaller.startMarshalling(); UpdateReplicationConfigurationTemplateRequestMarshaller.getInstance().marshall(updateReplicationConfigurationTemplateRequest, protocolMarshaller); return protocolMarshaller.finishMarshalling(); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
5c4f7240d87996b860a67d0393943c6f6f4a367f
babcc5556adfebefa1f8ae2dbf0b756ed48ba08c
/src/test/java/learn/field_agent/data/SecurityClearanceJdbcTemplateRepositoryTest.java
91dc1b3809ceb375e4ad5ec5932b732c6477a3e4
[]
no_license
ElderBass/Field_Agent_Dev10
6053235372a0a1aea1275d8697ad57765f9047df
2789972a8ed1688bd83781ee6f9c25ce4ad1f459
refs/heads/master
2023-06-22T05:28:39.779235
2021-07-13T19:41:36
2021-07-13T19:41:36
381,460,005
0
0
null
2021-07-14T03:49:47
2021-06-29T18:23:52
Java
UTF-8
Java
false
false
3,220
java
package learn.field_agent.data; import learn.field_agent.models.SecurityClearance; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Profile; import java.util.List; import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.assertTrue; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) class SecurityClearanceJdbcTemplateRepositoryTest { @Autowired SecurityClearanceJdbcTemplateRepository repository; @Autowired KnownGoodState knownGoodState; @BeforeEach void setup() { knownGoodState.set(); } @Test void shouldFindById() { SecurityClearance secret = new SecurityClearance(1, "Secret"); SecurityClearance topSecret = new SecurityClearance(2, "Top Secret"); SecurityClearance actual = repository.findById(1); assertEquals(secret, actual); actual = repository.findById(2); assertEquals(topSecret, actual); actual = repository.findById(80); assertEquals(null, actual); } @Test void shouldFindAll() { List<SecurityClearance> all = repository.findAll(); assertNotNull(all); assertTrue(all.size() >= 2); SecurityClearance expected = new SecurityClearance(); expected.setSecurityClearanceId(1); expected.setName("Secret"); assertTrue(all.contains(expected) && all.stream().anyMatch(i -> i.getSecurityClearanceId() == 2)); } @Test void shouldAdd() { SecurityClearance sc = new SecurityClearance(3, "Sort of Secret"); SecurityClearance added = repository.add(sc); assertEquals(3, repository.findAll().size()); assertEquals("Sort of Secret", repository.findById(3).getName()); } @Test void shouldUpdateExisting() { SecurityClearance sc = new SecurityClearance(); sc.setSecurityClearanceId(2); sc.setName("Semi-Secret"); assertTrue(repository.update(sc)); assertEquals(sc, repository.findById(2)); } @Test void shouldNotUpdateMissing() { SecurityClearance sc = new SecurityClearance(); sc.setSecurityClearanceId(20000); sc.setName("Super Secret"); assertFalse(repository.update(sc)); } @Test void shouldDelete() { SecurityClearance sc = new SecurityClearance(0, "Sort of Secret"); SecurityClearance added = repository.add(sc); assertEquals(4, repository.findAll().size()); String isDeleted = repository.deleteById(4); assertEquals("Deleted Successfully.", isDeleted); } @Test void shouldNotDeleteMissing() { String result = repository.deleteById(2000); assertEquals("Could not find Security Clearance with ID 2000", result); } @Test void shouldNotDeleteClearanceInUse() { String result = repository.deleteById(1); assertEquals("Security Clearance 1 in active use - cannot delete at this time.", result); } }
[ "zygster11@gmail.com" ]
zygster11@gmail.com
3b06a37a5f02379537a8ac256604c1721d5c28e1
d8ad34475c721d8a3a87590fe43664982d8055b7
/sources/JavaSE/src/StringDemo.java
8b7c463bd56268fd66a62cc84b1aebeb10f56838
[]
no_license
coding-technology/JavaCore
64090ad4a9f19cd67be90a7714aaf7241972c34a
7d0bff6f2dc03af1bf819a4c0378dae3ae5fc236
refs/heads/master
2022-11-23T20:13:51.551061
2020-09-20T08:56:11
2020-09-20T08:56:11
200,790,681
26
19
null
2022-11-16T10:59:02
2019-08-06T06:32:37
Java
UTF-8
Java
false
false
5,345
java
public class StringDemo { static String s3;//有默认值 null //字符串基本操作 public static void test1() { //定义字符串方式一: String s = "abcd"; System.out.println(s); //基本类型 int num = 10 ; //对象类型: Person per = new Person(); //定义字符串方式二: String s1 = "helloworld"; System.out.println(s1); //方式三 String s2 = ""; //方式三 默认生成的s2是 "" System.out.println(s2.equals(""));//“” System.out.println(s2 == null);//null System.out.println("s3" + s3); //常见的String方法 String str = " hello world "; boolean flag = str.equals("helloWorlD"); //忽略大小写 比较 boolean flag2 = str.equalsIgnoreCase("helloWorlD"); System.out.println(flag); System.out.println(flag2); int len = str.length();//字符串长度 System.out.println(len); //转为大写 str = str.toUpperCase(); System.out.println(str); //转为小写 str = str.toLowerCase(); System.out.println(str); //helloworld //判断 字符串A 是否存在于 另一个字符串B中,如果存在 ,则返回位置;如果不存在,返回-1 //int position = str.indexOf('o') ; //char ->int int position = str.lastIndexOf('o'); System.out.println(position); //str System.out.println(str); System.out.println("实际长度" + str.length()); str = str.trim();//去掉首尾空格,不会去掉中间的 System.out.println("去掉首尾空格之后的 长度" + str.length()); } //验证 邮箱是否 合法 157468995@qq.com 15768995.com public static boolean isValidateEmail(String email) { //合法情况 return email.indexOf("@") != -1 && email.indexOf(".") != -1 && email.indexOf("@") < email.indexOf("."); } //校验 电话是否合法 public static void testSubstring() { //029-88888888 // String phone = "18055555555" ; //座机要求: 区号是 3或4位 ,右侧 8位 String phone = "029-123456789"; if (phone.indexOf("-") != -1) { System.out.println("座机号码"); //phone.substring(start,end) : [start,end) //phone.substring(start) : 从start到最后 // phone = phone.substring(2,6); //>=2 <6 // System.out.println(phone); // 区号是 3或4位 ,右侧 8位 // 截取区号 int start = 0; int end = phone.indexOf("-"); // "029" "0931" String zone = phone.substring(start, end); if (zone.length() == 3 || zone.length() == 4) { System.out.println("区号正确"); } else { System.out.println("区号有误!"); } //座机的右侧:"029-12345678" ; int startRight = end + 1; String numberStr = phone.substring(startRight); if (numberStr.length() == 8) { System.out.println("号码正确"); } else { System.out.println("号码有误!"); } } else { System.out.println("手机号码"); } } public static void testSubstring2(String phone) { //029-88888888 // String phone = "18055555555" ; //座机要求: 区号是 3或4位 ,右侧 8位 // String phone = "029-12345678" ; if (phone.indexOf("-") != -1) { System.out.println("座机号码"); int start = 0; int end = phone.indexOf("-"); // "029" "0931" String zone = phone.substring(start, end); //座机的右侧:"029-12345678" ; int startRight = end + 1; String numberStr = phone.substring(startRight); //正确: 区号正确 且 号码正确 if ((zone.length() == 3 || zone.length() == 4) && (numberStr.length() == 8)) { System.out.println("座机正确"); } else { System.out.println("座机有误!"); } } else { //18888888888 System.out.println("手机号码"); String first = phone.substring(0, 1); if (first.equals("1") && phone.length() == 11) { System.out.println("正确的手机号"); } else { System.out.println("错误的手机号"); } } } public static void testSplit() { String phone = "029-12345-678"; String[] ps = phone.split("-"); for (String p : ps) { System.out.println(p); } // System.out.println(ps[0]); // System.out.println(ps[1]); // System.out.println(ps[2]); } //staitc->static public static void main(String[] args) { // boolean result = isValidateEmail("157468995@qq.com"); // System.out.println(result==true ? "合法":"不合法" ); // testSubstring(); // testSubstring2("029-54548787"); testSplit(); } }
[ "157468995@qq.com" ]
157468995@qq.com
2d4783b4c876aea4c2a532b202b208f8e5354b03
ae10be2acd490fd6e1650093d647ea6091181399
/BPMConsoleApp/src/main/java/com/rhiscom/bpm/console/shared/model/rs/TaskWrapper.java
763734d5e4d07c632e32a6ebb902fbc86c0da71e
[]
no_license
gschwarz/nickel
10d2906a109132ce0e0a4b5f1b90e6b4617f92f9
e6e5f704209716733699452edbd292dcf7c4165c
refs/heads/master
2021-01-10T10:59:58.728630
2015-09-23T19:44:42
2015-09-23T19:44:42
43,008,358
0
0
null
null
null
null
UTF-8
Java
false
false
246
java
package com.rhiscom.bpm.console.shared.model.rs; public class TaskWrapper { private TaskDetailRS tasks; public TaskDetailRS getTasks() { return tasks; } public void setTasks(TaskDetailRS tasks) { this.tasks = tasks; } }
[ "guillermo.schwarz@gmail.com" ]
guillermo.schwarz@gmail.com
2547b9d70b319712c9753b4a2866328ee4c4a71a
fe06f97c2cf33a8b4acb7cb324b79a6cb6bb9dac
/java/po/impl/FTZC_AP/PreIndtlPo.java
f3355cabb5d3b80499545bd4342409cba50d57ee
[]
no_license
HeimlichLin/TableSchema
3f67dae0b5b169ee3a1b34837ea9a2d34265f175
64b66a2968c3a169b75d70d9e5cf75fa3bb65354
refs/heads/master
2023-02-11T09:42:47.210289
2023-02-01T02:58:44
2023-02-01T02:58:44
196,526,843
0
0
null
2022-06-29T18:53:55
2019-07-12T07:03:58
Java
UTF-8
Java
false
false
3,918
java
package com.doc.common.po.impl; public class PreIndtlPo implements IPreIndtlPo { public enum COLUMNS { BF_NO("null"), // GOODS_CODE("null"), // COMMODITY_NO("null"), // GOODS_UNIT("null"), // IN_STORAGE_AREA("null"), // GOODS_QTY("null"), // GOODS_DESC("null"), // DECL_NO("null"), // GUID("null"), // DECL_TYPE("null"), // IN_DATE("null"), // ITEM_NO("null"), // DUTY_TYPE("null"), // STAT_MODE("null"), // BOM_NO("null"), // BOM_VER("null"), // PRDT_MARK("null") // ; private final String comment; private COLUMNS(final String comment) { this.comment = comment; } public String getComment() { return this.comment; } } private String bfNo; private String goodsCode; private String commodityNo; private String goodsUnit; private String inStorageArea; private BigDecimal goodsQty; private String goodsDesc; private String declNo; private String guid; private String declType; private String inDate; private BigDecimal itemNo; private String dutyType; private String statMode; private String bomNo; private String bomVer; private String prdtMark; @Override public String getBfNo() { return this.bfNo; } @Override public void setBfNo(final String bfNo) { this.bfNo = bfNo; } @Override public String getGoodsCode() { return this.goodsCode; } @Override public void setGoodsCode(final String goodsCode) { this.goodsCode = goodsCode; } @Override public String getCommodityNo() { return this.commodityNo; } @Override public void setCommodityNo(final String commodityNo) { this.commodityNo = commodityNo; } @Override public String getGoodsUnit() { return this.goodsUnit; } @Override public void setGoodsUnit(final String goodsUnit) { this.goodsUnit = goodsUnit; } @Override public String getInStorageArea() { return this.inStorageArea; } @Override public void setInStorageArea(final String inStorageArea) { this.inStorageArea = inStorageArea; } @Override public BigDecimal getGoodsQty() { return this.goodsQty; } @Override public void setGoodsQty(final BigDecimal goodsQty) { this.goodsQty = goodsQty; } @Override public String getGoodsDesc() { return this.goodsDesc; } @Override public void setGoodsDesc(final String goodsDesc) { this.goodsDesc = goodsDesc; } @Override public String getDeclNo() { return this.declNo; } @Override public void setDeclNo(final String declNo) { this.declNo = declNo; } @Override public String getGuid() { return this.guid; } @Override public void setGuid(final String guid) { this.guid = guid; } @Override public String getDeclType() { return this.declType; } @Override public void setDeclType(final String declType) { this.declType = declType; } @Override public String getInDate() { return this.inDate; } @Override public void setInDate(final String inDate) { this.inDate = inDate; } @Override public BigDecimal getItemNo() { return this.itemNo; } @Override public void setItemNo(final BigDecimal itemNo) { this.itemNo = itemNo; } @Override public String getDutyType() { return this.dutyType; } @Override public void setDutyType(final String dutyType) { this.dutyType = dutyType; } @Override public String getStatMode() { return this.statMode; } @Override public void setStatMode(final String statMode) { this.statMode = statMode; } @Override public String getBomNo() { return this.bomNo; } @Override public void setBomNo(final String bomNo) { this.bomNo = bomNo; } @Override public String getBomVer() { return this.bomVer; } @Override public void setBomVer(final String bomVer) { this.bomVer = bomVer; } @Override public String getPrdtMark() { return this.prdtMark; } @Override public void setPrdtMark(final String prdtMark) { this.prdtMark = prdtMark; } }
[ "jerry.l@acer.com" ]
jerry.l@acer.com
0e6c2a1b5341b6c3f0ac3e954bf9a58903e3158e
c422df5be5b4dfcefafda3b2f53b8b60e57ede19
/LinkedList_Driver.java
fb64a238931e21ecf91c300ee4be9db85925530c
[]
no_license
revachauhan/workspace
32f927d8f1f8aeade879eb3bbb7bfe313d14b53e
8f26f5f3919df15abcf5bea90fe1d1eea1788275
refs/heads/master
2021-05-28T08:46:30.174846
2014-03-04T04:25:37
2014-03-04T04:25:37
13,977,460
1
0
null
null
null
null
UTF-8
Java
false
false
359
java
package reva.java.practice; public class LinkedList_Driver { public static void main(String[] args) { LinkedList list = new LinkedList(); int i =1; while(i <5) { list.insert(i); i++; } list.print(list); list.delete(2); list.print(list); list.insert_in_front(12); list.print(list); System.out.println(list.find(4)); } }
[ "revasingh.sgsits@gmail.com" ]
revasingh.sgsits@gmail.com
7c6160f43ceea3cdf713a0c23e639fafa94d5068
ee110c1ca856b589b7bc5a8e620dffef041343a6
/src/veiculos/veiculo.java
454605858e3c0f54359cee7262fc8c76c3aa3f80
[]
no_license
jhonnyulisilva/veiculo
8f424ee4d928520e78095f4b95047a84318700b8
3d15c11e3705754954daed2a1001200fddff5ed5
refs/heads/master
2020-07-01T22:56:43.986873
2019-08-09T13:41:38
2019-08-09T13:41:38
201,331,610
0
0
null
null
null
null
UTF-8
Java
false
false
1,212
java
package veiculos; public class veiculo { protected static String marca; protected static String modelo; protected static String cor; protected static int QtdTanque; protected static String combus; protected static boolean status; public veiculo() { } public veiculo(String marca, String modelo, String cor, int qtdTanque, String combus) { this.marca = marca; this.modelo = modelo; this.cor = cor; this.QtdTanque = qtdTanque; this.combus = combus; this.status = false; } public String getMarca() { return marca; } public void setMarca(String marca) { this.marca = marca; } public String getModelo() { return modelo; } public void setModelo(String modelo) { this.modelo = modelo; } public String getCor() { return cor; } public void setCor(String cor) { this.cor = cor; } public static int getQtdTanque() { return QtdTanque; } public void setQtdTanque(int qtdTanque) { this.QtdTanque = qtdTanque; } public boolean getStatus() { return status; } public void setStatus(boolean status) { this.status = status; } public String getCombus() { return combus; } public void setCombus(String combus) { this.combus = combus; } }
[ "jhonnyulisilva@gmail.com" ]
jhonnyulisilva@gmail.com
ecd16b5bf67503849aeeca12321001c9083ce447
ebe7183eabbc25fe5e977b4c7e5041c2da32f264
/src/netgest/bo/xwc/framework/annotations/XUIWebDefaultCommand.java
a30b3184443efc5ef448fa56e605579e7d589d8d
[]
no_license
ITDS-PT/xwc
d3aabba541ef35b043cab04134970f7646596df2
62348d12b49b0ae706c7f1b74713a8a8f7334b85
refs/heads/master
2021-01-17T07:43:34.254476
2017-08-24T02:47:49
2017-08-24T02:47:49
27,862,552
2
0
null
null
null
null
UTF-8
Java
false
false
211
java
package netgest.bo.xwc.framework.annotations; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) public @interface XUIWebDefaultCommand { }
[ "pedro.rio@itds.pt" ]
pedro.rio@itds.pt
6065efdeec19e00fc63eebb4eaf617da3683d699
3e4d6deecd6ad41b73cc10e1727236eb3e3b73a0
/.mvn/wrapper/MavenWrapperDownloader.java
2ef0760fec831e7dd32501bee01f5f68d2057c66
[ "Apache-2.0" ]
permissive
Prodsgn/Harvest-Bank
9e9f88ce6b838c0aff7dbd24d9c1ec5df08e6e80
8e4ac1bb2ab783aedeb8b41d6e091b25b091821e
refs/heads/master
2023-07-03T23:50:51.325462
2021-08-09T10:55:54
2021-08-09T10:55:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,921
java
/* * Copyright 2007-present the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://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. */ import java.util.Properties; public class MavenWrapperDownloader { private static final String WRAPPER_VERSION = "0.5.6"; /** * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. */ private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; /** * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to * use instead of the default one. */ private static final String MAVEN_WRAPPER_PROPERTIES_PATH = ".mvn/wrapper/maven-wrapper.properties"; /** * Path where the maven-wrapper.jar will be saved to. */ private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar"; /** * Name of the property which should be used to override the default download url for the wrapper. */ private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; public static void main(String args[]) { System.out.println("- Downloader started"); File baseDirectory = new File(args[0]); System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); // If the maven-wrapper.properties exists, read it and check if it contains a custom // wrapperUrl parameter. File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); String url = DEFAULT_DOWNLOAD_URL; if (mavenWrapperPropertyFile.exists()) { FileInputStream mavenWrapperPropertyFileInputStream = null; try { mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); Properties mavenWrapperProperties = new Properties(); mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); } catch (IOException e) { System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); } finally { try { if (mavenWrapperPropertyFileInputStream != null) { mavenWrapperPropertyFileInputStream.close(); } } catch (IOException e) { // Ignore ... } } } System.out.println("- Downloading from: " + url); File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); if (!outputFile.getParentFile().exists()) { if (!outputFile.getParentFile().mkdirs()) { System.out.println( "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); } } System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); try { downloadFileFromURL(url, outputFile); System.out.println("Done"); System.exit(0); } catch (Throwable e) { System.out.println("- Error downloading"); e.printStackTrace(); System.exit(1); } } private static void downloadFileFromURL(String urlString, File destination) throws Exception { if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { String username = System.getenv("MVNW_USERNAME"); char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); } URL website = new URL(urlString); ReadableByteChannel rbc; rbc = Channels.newChannel(website.openStream()); FileOutputStream fos = new FileOutputStream(destination); fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); fos.close(); rbc.close(); } }
[ "mohamed.taman@gmail.com" ]
mohamed.taman@gmail.com
ce7b4c0d5c118b4985aa12b78fcdc4dfa27772e4
26f921c58071e02b999ff6b5628fec5e915d7b81
/src/pattern/bridge/RandomCountDisplay.java
88dcb02136724df699af90d1e2b315d3e47a1610
[]
no_license
lispe/DesignPattern
313dd47e3cd6bf5956e4a8852d6926f3d240e1ed
37faa120922200115991a126e22fa70cad30f98b
refs/heads/master
2021-08-27T21:28:02.296960
2017-12-10T11:43:01
2017-12-10T11:43:01
113,745,062
0
0
null
null
null
null
UTF-8
Java
false
false
422
java
package pattern.bridge; import java.util.Random; public class RandomCountDisplay extends CountDisplay { Random random = new Random(); public RandomCountDisplay(DisplayImpl impl) { super(impl); } /** * 0以上、指定回数未満だけランダムに表示する。 * @param times 指定回数 */ public void randomDisplay(int times) { multiDisplay(random.nextInt(times)); } }
[ "atlas.of.crmanifold@gmail.com" ]
atlas.of.crmanifold@gmail.com
118241cedf5a9d74424b16c706e51ed55a86b33e
8f44851f6201796c1d5f724d4e3e427d43a83b6e
/wan/src/com/bg/wan/MainActivity.java
a501653d4dbe21196fc86be4e5addf02f4de0f58
[]
no_license
awtsst/HiGradation
051fc12274f824823dbbd01d7d097efcced655c4
e34eb0e4c71749f2f2d00220d450e6342870bc9b
refs/heads/master
2016-08-12T02:30:57.363154
2016-04-01T02:59:51
2016-04-01T02:59:51
55,197,314
0
0
null
null
null
null
UTF-8
Java
false
false
917
java
package com.bg.wan; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "staryumou@163.com" ]
staryumou@163.com
40d9646c82e7fef55659cfb60fef5a80387d5d12
46b785683218e71b6412e3147c4f6456992af8e8
/app/src/main/java/edu/upenn/cis350/hwk2/data/Vowel.java
62f3205c80555083c3c871a73701d60320058f3e
[]
no_license
chenhe95/KashayaPronunciationApp
fce606e0df3e432f00dba274dffb15b7526c7218
4b9f610df366936da637706249b46bb5274bf7db
refs/heads/master
2020-09-18T12:11:02.483296
2016-09-10T17:27:07
2016-09-10T17:27:07
67,884,377
0
0
null
null
null
null
UTF-8
Java
false
false
2,057
java
package edu.upenn.cis350.hwk2.data; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; public class Vowel extends Sound { public Vowel(int id, String name, String className, String form) { super(id, name, className, form); } public static final Set<String> VOWELCLASS = new HashSet<>(Arrays.asList("high_front", "mid_front", "low", "mid_back", "high_back")); public static Vowel[] VOWELS = new Vowel[] { new Vowel(1, "i", "high_front", "short"), new Vowel(2, "i·", "high_front", "long"), new Vowel(3, "e", "mid_front", "short"), new Vowel(4, "e·", "mid_front", "long"), new Vowel(5, "a", "low", "short"), new Vowel(6, "a·", "low", "long"), new Vowel(7, "o", "mid_back", "short"), new Vowel(8, "o·", "mid_back", "long"), new Vowel(9, "u", "high_back", "short"), new Vowel(10, "u·", "high_back", "long") }; // public static Vowel[] SHORT = new Vowel[] { // new Vowel(1, "i"), // new Vowel(3, "e"), // new Vowel(5, "a"), // new Vowel(7, "o"), // new Vowel(9, "u") // }; // // public static Vowel[] LONG = new Vowel[] { // new Vowel(2, "i·"), // new Vowel(4, "e·"), // new Vowel(6, "a·"), // new Vowel(8, "o·"), // new Vowel(10, "u·") // }; public static boolean contains(Vowel[] vs, String name) { for (int i = 0; i < vs.length; i++) { if (vs[i].getName().equals(name)) { return true; } } return false; } public static List<Sound> getSoundsByClass(String className) { return getSoundsByClass(className, VOWELS); } public static List<Sound> getSoundsByForm(String form) { return getSoundsByForm(form, VOWELS); } }
[ "he@hntvlan569.0552.wlan.wireless-resnet.upenn.edu" ]
he@hntvlan569.0552.wlan.wireless-resnet.upenn.edu
7efcdf688a1b3c1bf65d9d9706f15a231d1cb998
48c61bdd1cb92138dca1dbfcd4531d3a1d81472a
/_02_Tools_Basic/_28_Spinner/_07_Editable_Spinner/MyConverter.java
91551f0b3a2a7a82244b53a0c54ab2b4ff5cb06e
[]
no_license
Majd-Talji/JavaFX
b907c85bd9061aef35bb29de68cf907430ca0b47
d2f29d15dcb1ed3d1b24b3393eb73ac942b47cac
refs/heads/master
2022-05-31T22:35:22.990795
2020-05-03T16:25:16
2020-05-03T16:25:16
260,971,476
0
0
null
null
null
null
UTF-8
Java
false
false
425
java
package _02_Tools_Basic._28_Spinner._07_Editable_Spinner; import javafx.util.StringConverter; /** * * @author Majd Talji <en.majd.talji@gmail.com> */ public class MyConverter extends StringConverter<Integer> { @Override public String toString(Integer object) { return object + ""; } @Override public Integer fromString(String string) { return Integer.parseInt(string); } }
[ "53352101+Majd-Talji@users.noreply.github.com" ]
53352101+Majd-Talji@users.noreply.github.com
20970c86379b5d8244c424d9bd2727c633abb218
32b72e1dc8b6ee1be2e80bb70a03a021c83db550
/ast_results/fmetzger_android-sensorium/Sensorium/src/org/xmlrpc/android/IXMLRPCSerializer.java
5de6da09dcd29a176fe5e5ed878340db9bb964f8
[]
no_license
cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning
d90c41a17e88fcd99d543124eeb6e93f9133cb4a
0564143d92f8024ff5fa6b659c2baebf827582b1
refs/heads/master
2020-07-13T13:53:40.297493
2019-01-11T11:51:18
2019-01-11T11:51:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,148
java
// isComment package org.xmlrpc.android; import java.io.IOException; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; public interface isClassOrIsInterface { String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; // isComment String isVariable = "isStringConstant"; String isVariable = "isStringConstant"; void isMethod(XmlSerializer isParameter, Object isParameter) throws IOException; Object isMethod(XmlPullParser isParameter) throws XmlPullParserException, IOException; }
[ "matheus@melsolucoes.net" ]
matheus@melsolucoes.net
e17914cebecf053059097321755c745936d11e79
4c5901b5fe27f4e8ee1305df1e5a8ae07cbb89aa
/Application/MyApplication/app/src/test/java/com/example/jho63/myapplication/ExampleUnitTest.java
a6e2af2074891b8294bd871b55e63803794ee226
[]
no_license
NoGaBi/Geul_Lock
db8d8da844479b5a9b6f1445668752cc5e5b618d
99017e2642469713a5226d9a2d4f851ac15a513b
refs/heads/master
2021-06-04T02:25:27.337657
2020-03-09T14:00:20
2020-03-09T14:00:20
103,520,581
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
package com.example.jho63.myapplication; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "jho6394@hanyang.ac.kr" ]
jho6394@hanyang.ac.kr
64a4af93224dc1df0b969df1c589d1b4e5cf26de
66c86bc3cc1089aee81bc39416f891feb4989aeb
/src/test/java/com/ceitechs/pro/domain/service/service/AttachmentServiceTest.java
0c09dfa7a12a5aca662e6a311a5112e4ddc3d3c6
[]
no_license
CEITECHS/pro-domain-service
efd908dfbf5b7b4f25cc3998e7a29c9cbad53bb1
30d8767f297c2e28760f0484b05156e144ca628c
refs/heads/master
2021-01-01T06:52:04.299893
2017-09-21T23:09:09
2017-09-21T23:09:09
97,533,876
0
0
null
null
null
null
UTF-8
Java
false
false
2,137
java
/** * */ package com.ceitechs.pro.domain.service.service; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.Optional; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockMultipartFile; import com.ceitechs.pro.domain.service.AbstractProDomainServiceIntegrationTest; import com.ceitechs.pro.domain.service.domain.Attachment; import com.ceitechs.pro.domain.service.domain.Pro; import com.ceitechs.pro.domain.service.repositories.AttachmentRepository; import com.ceitechs.pro.domain.service.repositories.AttachmentRepositoryTest; import com.ceitechs.pro.domain.service.util.ProUtility; /** * @author vctrowino * */ public class AttachmentServiceTest extends AbstractProDomainServiceIntegrationTest{ @Autowired private AttachmentService attachmentService; @Autowired private AttachmentRepository attachmentRepository; @Test(expected = RuntimeException.class) public void storeAttachmentWithoutActualAttachmentTest() { Attachment attachment = AttachmentRepositoryTest.createAttachment(); attachment.setAttachment(null); Pro pro = new Pro(); pro.setProReferenceId(ProUtility.generateIdAsString()); attachmentService.storeAttachment(pro, attachment); } @Test public void storeAttachmentWithActualAttachmentTest() throws IOException { attachmentRepository.deleteAll(); Attachment attachment = AttachmentRepositoryTest.createAttachment(); Pro pro = new Pro(); pro.setProReferenceId(ProUtility.generateIdAsString()); attachment.setAttachment(new MockMultipartFile(resource.getFilename(), resource.getInputStream())); Optional<Attachment> attachmentOptional = attachmentService.storeAttachment(pro, attachment); assertTrue(attachmentOptional.isPresent()); assertNotNull(attachmentOptional.get().getUrl()); System.out.println(attachmentOptional.get().getUrl()); } }
[ "vctro@10.0.0.8" ]
vctro@10.0.0.8
2221b9cbd7d68d9953275afd9d727e9670d0f5c1
1d749a8646a6ca9dc12962e3816c178150517215
/app/src/main/java/com/example/rated/Adapters/PostDetailAdapter.java
d24bb73c45525210f29874476dc239131ddc3832
[]
no_license
amirulhakim47/RatedApp
16bf730ec4c98859420fa3692e80b1ae99258ba8
f663cf1245b0ef4a94af2378ecf541b2be39eacf
refs/heads/master
2020-05-03T10:46:53.174859
2019-06-18T05:48:33
2019-06-18T05:48:33
178,587,286
0
0
null
null
null
null
UTF-8
Java
false
false
3,126
java
package com.example.rated.Adapters; import android.content.Context; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.text.format.DateFormat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.bumptech.glide.Glide; import com.example.rated.Activities.PostDetailActivity; import com.example.rated.Models.Comment; import com.example.rated.R; import java.util.Calendar; import java.util.List; import java.util.Locale; import de.hdodenhof.circleimageview.CircleImageView; public class PostDetailAdapter extends RecyclerView.Adapter<PostDetailAdapter.MyViewHolder> { private Context mContext; private List<Comment> mData ; public PostDetailAdapter(Context mContext, List<Comment> mData) { this.mContext = mContext; this.mData = mData; } @NonNull @Override public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) { View row2 = LayoutInflater.from(mContext).inflate(R.layout.row_comment_item,viewGroup,false); return new MyViewHolder(row2); } @Override public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int position) { Glide.with(mContext).load(mData.get(position).getUimg()).into(myViewHolder.uimg); myViewHolder.content.setText(mData.get(position).getContent()); myViewHolder.uname.setText(mData.get(position).getUname()); myViewHolder.usrTimeStamp.setText(mData.get(position).getDate()); // Glide.with(mContext).load(mData.get(position).getTimestamp()).into(myViewHolder.usrTimeStamp); //animation myViewHolder.uimg.setAnimation(AnimationUtils.loadAnimation(mContext,R.anim.fade_transition_animation)); myViewHolder.container.setAnimation(AnimationUtils.loadAnimation(mContext,R.anim.fade_scale_animation)); } @Override public int getItemCount() { return mData.size(); } public class MyViewHolder extends RecyclerView.ViewHolder{ TextView content,uname; TextView usrTimeStamp; CircleImageView uimg; LinearLayout container; public MyViewHolder(@NonNull View itemView) { super(itemView); content = (TextView) itemView.findViewById(R.id.comment_content); uname = (TextView) itemView.findViewById(R.id.comment_uname); usrTimeStamp = (TextView) itemView.findViewById(R.id.comment_time); uimg = (CircleImageView) itemView.findViewById(R.id.comment_img); container = (LinearLayout) itemView.findViewById(R.id.comment_container); } } private String timestampToString(long time) { Calendar calendar = Calendar.getInstance(Locale.ENGLISH); calendar.setTimeInMillis(time); String date = DateFormat.format("dd-MM-yyyy", calendar).toString(); return date; } }
[ "amirulhakim47@gmail.com" ]
amirulhakim47@gmail.com
36b5355292ffbf77b0c87a406e053bc11accd5d9
355143eeb91b845adbfc02b2c55afe949948dd18
/VacuumCleaner/src/vacuumcleaner/EnvironmentInterface.java
7fe57bb94e3dfe9260dcad720d1db07fde587b74
[]
no_license
halhijje/Java-VacuumCleaner
03b4e21db52cf721481eef1d2cc697620b44b14f
a012095573fa46a5868a9cb4c9efa53271774614
refs/heads/master
2021-07-19T20:54:48.262026
2017-10-28T15:28:40
2017-10-28T15:28:40
108,659,825
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package vacuumcleaner; public interface EnvironmentInterface { public int moveLeft(); public int moveRight(); public int moveUp(); public int moveDown(); public void suck(); // clean current cell public boolean isDirty(); // is current cell dirty? public int getScore(); // returns penalty score public boolean isDirty(int i, int y); }
[ "hussainal-hijje@hussains-mbp.afaqe2e.com" ]
hussainal-hijje@hussains-mbp.afaqe2e.com
12224b7099065254c020023748216fb946bee6ff
c12721a92eaaf10d325777e437540794c752caec
/src/model/Petugas.java
efac33d03421cad0efe9777508a0aa7ccf117e4d
[]
no_license
yuchandevi/TugasBesarPBO
28753b144367fcf401a692afc99234ac3e159c27
8a2edd6250516fdb8844c7137a415ed471971698
refs/heads/master
2021-01-21T12:58:44.345781
2016-04-24T12:47:04
2016-04-24T12:47:04
52,098,758
0
2
null
null
null
null
UTF-8
Java
false
false
3,268
java
package model; import javax.swing.JOptionPane; public class Petugas extends Orang { //attribuy private Gudang G = null; //konstruktor public Petugas(String nama, long id){ super(nama,id); } public Petugas(){ } //method public void addBarang(String nama, int jumlah, Penyedia p){ for(int i=0 ; i < p.getDaftarBarang().size(); i++){ //perulangan dilakukan sebanyak jumlah barang yang ada di penyedia if (p.getDaftarBarang().get(i).getNama_barang().equals(nama)){//p.getDaftarBarang()[i] adalah algoritma untuk mendapatkan barang dari indeks ke i dengan 3 atribut. bila di dot get nama artinya untuk mendapatkan nama dari suatu barang tersebut. Barang b = new Barang(); b.setId(p.getDaftarBarang().get(i).getId()); // create objek barang, barang sudah di dapatkan dari penyedia b.setNama_barang(p.getDaftarBarang().get(i).getNama_barang()); b.setJumlah_stok(p.getDaftarBarang().get(i).getJumlah_stok()); if (jumlah <= b.getJumlah_stok()) { b.setJumlah_stok(jumlah); // mengeset jumlah barang yang akan di terima petugas dari penyedia. dengan menggunakan jumlah barang si petugas. getG().addBarang(b); break; }else{ JOptionPane.showMessageDialog(null,"Jumlah Melebihi Kapasitas Penyedia !","Error !",0); } } } } @Override public void removeBarang(int Indeks){ getG().setKapasitas(getG().getKapasitas()+getG().getBarang(Indeks).getJumlah_stok()); getG().removeBarang(Indeks); } public void editBarang(String nama, int jumlah){ int stok_lama = 0; int temp = 0; Barang br = new Barang(); if (jumlah < getG().getKapasitas()){ for(int i=0 ; i< getG().getBarangGudang().size(); i++){ if (getG().getBarangGudang().get(i).getNama_barang().equals(nama)){ temp = i; stok_lama = getG().getBarangGudang().get(i).getJumlah_stok(); getG().getBarangGudang().get(i).setJumlah_stok(jumlah); br = getG().getBarangGudang().get(i); if(br.getJumlah_stok() < stok_lama){ getG().setKapasitas(getG().getKapasitas()+(stok_lama-br.getJumlah_stok())); } else if(br.getJumlah_stok() > stok_lama){ getG().setKapasitas(getG().getKapasitas()-(br.getJumlah_stok()-stok_lama)); } JOptionPane.showMessageDialog(null,"Edit Barang Berhasil","Sukses !",1); break; } } }else{ JOptionPane.showMessageDialog(null,"Jumlah Melebihi Kapasitas Gudang, Kapasitas Gudang : "+getG().getKapasitas(),"Error !",0); } } @Override public Barang getBarang(int Indeks){ return(getG().getBarang(Indeks)); } //setter getter public Gudang getG() { return G; } public void setG(Gudang G) { this.G = G; } }
[ "Windows@User" ]
Windows@User
5f6f93c2a1109c5f2de7f2cb6d8c91bdc6e034f4
a77ad5eae0244622550e98e75d478d939af8e809
/backend/PI5/src/main/java/dev/gabrielgrazziani/dto/ItemResponse.java
9ec665f061f3947ae935dd75625d9f8dd2038d68
[]
no_license
gabrielgrazziani/Projeto-Integrador-5
b365a67fe93066867784d455f79c7b710bfbfb62
b966631e83e8ada46e2a9d1f0f94fd84b7adcc5a
refs/heads/master
2023-05-22T22:58:14.877155
2021-06-15T05:04:44
2021-06-15T05:04:44
348,739,905
0
1
null
null
null
null
UTF-8
Java
false
false
525
java
package dev.gabrielgrazziani.dto; import java.math.BigDecimal; import io.swagger.annotations.ApiModelProperty; import lombok.Builder; import lombok.Data; @Data @Builder public class ItemResponse { private Long id; private Long idOrdemServico; private ServicoProdutoResponse servicoProduto; private int quantidade; @ApiModelProperty(notes = "Valor de uma unidade") private BigDecimal valorUnidade; public BigDecimal getSoma(){ return servicoProduto.getValorComercial().multiply(new BigDecimal(quantidade)); } }
[ "gabriel.grazzianibarbosa@gmail.com" ]
gabriel.grazzianibarbosa@gmail.com
575af143daac10e450d49165d6c101b19b0a20a1
2f7ed1053572b112bc5421c2ff0c46135eb3967e
/wane2/src/main/java/org/yescola/livraison/security/package-info.java
5267e5f72e7b0e0eeb0f794d343a4662ae1b4a3f
[]
no_license
makhmadane/localisation
4f52418d6eda81d92276b5031bb6f9bae740096d
6b4550373e277ba801ca70745eea0eafc9b05914
refs/heads/master
2020-05-17T00:57:32.403408
2019-05-06T10:54:17
2019-05-06T10:54:17
183,410,885
1
0
null
null
null
null
UTF-8
Java
false
false
82
java
/** * Spring Security configuration. */ package org.yescola.livraison.security;
[ "dl7781775@gmail.com" ]
dl7781775@gmail.com