blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
abf00dd32588b06ccbf1351bfa5bb135ccdfa054
67bd5ecdcfd97b6cdb4cc301410ccef03c358f20
/app/src/androidTest/java/com/kronos/sample/ExampleInstrumentedTest.java
71c991207def4d46d073e64edf74f2507854f7f9
[]
no_license
Leifzhang/DiffUtils
8522120be2a44eb0d3d2d5295dafcabe51c36969
d25143d77d26a02db6ce78d6752a090ab0102a42
refs/heads/master
2022-09-11T11:20:01.468247
2022-08-09T04:02:57
2022-08-09T04:02:57
189,940,249
34
7
null
2022-08-09T04:02:57
2019-06-03T05:29:45
Kotlin
UTF-8
Java
false
false
704
java
package com.kronos.sample; import android.content.Context; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.kronos.sample", appContext.getPackageName()); } }
e3f2e56a0d227657baa1c00c98a9a944aa2b521c
8f59ac1ee3928ac0a769198074d271654374a93c
/src/main/java/com/chensee/aop/Test1.java
b3158dcf90bd79b79bb1154f76e4a610773a3bf9
[]
no_license
ah0507/designPatterns
8fcd0d7d021418fa206c59686d9966f01f26629f
9f8e5e92b45ba89e9d9e9e35690ad277569d2c69
refs/heads/master
2022-07-05T19:27:19.691989
2020-05-18T06:23:28
2020-05-18T06:23:28
264,211,293
0
0
null
2020-05-15T14:42:17
2020-05-15T14:13:18
Java
UTF-8
Java
false
false
963
java
package com.chensee.aop; import com.chensee.DesignPatternsApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** * @author gaohang * @title: Test * @projectName DesignPatterns * @date 2019/10/12 16:54 */ @RunWith(SpringRunner.class) @SpringBootTest(classes = DesignPatternsApplication.class) public class Test1 { @Autowired private BaseService baseService; @Test public void bbb(){ System.out.println("单元测试开始"); String msg; try { baseService.anoundTest("111",1); msg = "成功!"; } catch (Exception e) { e.printStackTrace(); msg = "失败!"; } System.out.println(msg); System.out.println("单元测试完成"); } }
7eb434c0adb1f4d00cac0d7a6af1a4d16e58167d
e18aa0964f23c72a60801044dee81826afb2c30b
/cpsc476/Project3/V3.3/UrlShortnerProjV3/source/production/java/com/cpsc476/site/user/UserDaoImp.java
1a3f6d3c0ab379b561a54c79d80275dd7a85f2f9
[]
no_license
deannaji/Java-Development
22267e1cf19eadea9e1a72092521808e6d49909d
4c342dc2062a8ab1ae8936d65510463267220cb4
refs/heads/master
2021-04-29T09:09:59.393439
2016-12-29T20:27:17
2016-12-29T20:27:17
77,637,844
0
0
null
null
null
null
UTF-8
Java
false
false
1,950
java
package com.cpsc476.site.user; import java.sql.ResultSet; import java.sql.SQLException; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.support.JdbcDaoSupport; import com.cpsc476.site.url.Url; public class UserDaoImp extends JdbcDaoSupport implements UserDaoInterface{ /* (non-Javadoc) * @see com.cpsc476.UserDaoInterface#getOneRow(java.lang.String) */ @Override public Url getOneRow(String username,String password){ return getJdbcTemplate().queryForObject("Select count(username) as counts from project3.userdetails where username = ? and password = ?", new userMapper(),username,password); } /* (non-Javadoc) * @see com.cpsc476.UserDaoInterface#insertOneRow(java.lang.String, java.lang.String) */ @Override public void insertOneRow(String username, String password){ getJdbcTemplate().update("insert into project3.userdetails(username, password) values (?,?)",username,password); } /* (non-Javadoc) * @see com.cpsc476.UserDaoInterface#checkforuser(java.lang.String) */ @Override public Url checkforuser(String username){ return getJdbcTemplate().queryForObject("Select count(username) as counts from project3.userdetails where username = ?", new usercheckerMapper(),username); } private static final class userMapper implements RowMapper<Url> { public Url mapRow(ResultSet rs, int rowNum) throws SQLException { Url actor = new Url(); actor.setUserCount(rs.getInt("counts")); //actor.setUsername(rs.getString("username")); //actor.setPassword(rs.getString("password")); return actor; } } private static final class usercheckerMapper implements RowMapper<Url> { public Url mapRow(ResultSet rs, int rowNum) throws SQLException { Url actor = new Url(); actor.setUserCount(rs.getInt("counts")); /*actor.setPassword(rs.getString("password"));*/ return actor; } } }
dcff86e0cc36dd263daba0ae2f5f805a0741520b
53c961beb5382c98883c3525a4e9a6bab7aeef43
/startrekj/src/main/java/startrekj/hpbasic/BooleanExpression.java
1217ceb66a16be866b757479a64f2448e86d4455
[ "MIT" ]
permissive
frankrefischer/STTRJ
783fa917c0cb7abba545a488c4d1aa0586a67431
bd08aadb65406a99fd5ff3a7c6c8a3bb5f64867c
refs/heads/master
2020-05-30T05:13:37.641675
2013-10-20T08:57:19
2013-10-20T08:57:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
88
java
package startrekj.hpbasic; public interface BooleanExpression { boolean evaluate(); }
[ "frankfischer@macbook" ]
frankfischer@macbook
5af81e1247353ea5c3790f52a53b933026a80760
b9c8d6a54c543844921ecb59fc620a7912f24223
/test/src/main/java/com/deep/test/csv/stock/FastGoHomeMsgDTO.java
46d32aaeb878e35674957c47216009062b4f9ae9
[]
no_license
hudepin/test
c9da64a6bb9b49871e36d944bd2df2a0621d3a0d
db15f8c6c2009779aa92f519e55c6f7336cd31cd
refs/heads/master
2022-12-21T19:35:00.972632
2021-11-19T01:40:27
2021-11-19T01:40:48
98,258,711
0
0
null
2022-05-25T07:14:58
2017-07-25T03:10:19
Java
UTF-8
Java
false
false
875
java
package com.deep.test.csv.stock; public class FastGoHomeMsgDTO { private Long goodsId; private Long channelSid; private String shopAndStoreCode; private Long saleStockSum; public Long getGoodsId() { return goodsId; } public void setGoodsId(Long goodsId) { this.goodsId = goodsId; } public Long getChannelSid() { return channelSid; } public void setChannelSid(Long channelSid) { this.channelSid = channelSid; } public String getShopAndStoreCode() { return shopAndStoreCode; } public void setShopAndStoreCode(String shopAndStoreCode) { this.shopAndStoreCode = shopAndStoreCode; } public Long getSaleStockSum() { return saleStockSum; } public void setSaleStockSum(Long saleStockSum) { this.saleStockSum = saleStockSum; } }
8ddbb0c4055a2711c625f696230b7d52da2ef51e
02b95181d373e6e3d0db2a5b98c955ec22d93465
/src/main/java/com/carlossantos/acmetodolist/entity/Task.java
20b0761e3b64f4aa338f0949ab2f613333326b0b
[]
no_license
touchdown15/acme_todo_list_backend
c6d27510641e7213de701f180c21b02df2401bd6
e88e6900235a9712d1ed214097c9d815834eb847
refs/heads/master
2023-03-25T17:43:11.211138
2021-03-16T21:02:42
2021-03-16T21:02:42
346,818,272
0
0
null
null
null
null
UTF-8
Java
false
false
1,033
java
package com.carlossantos.acmetodolist.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Entity @Data @Builder @NoArgsConstructor @AllArgsConstructor @Table(name = "task_table") public class Task { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "name_task") private String nameTask; @Column(name = "done") private boolean isDone; @ManyToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "todolist_id", referencedColumnName="id") @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) private ToDoList toDoList; }
9efc0e5a8f3a74814b544fc780b03b244b4f92b7
59030b8268887afac2f9c962e4eab361b4721ca4
/src/L4_Interfaces_and_Abstraction_Exercises/P3_Birthday_Celebrations/Identifiable.java
022ab79309af91eb6fa6b229a9b239880e4e6e9e
[]
no_license
BorisIM4/SoftUni-JavaOOP
2df5de7b9cd3864059cc89ec32cac365599fba33
514c339e5530f5b17cc322793c6a593b2c070652
refs/heads/master
2023-03-29T06:06:51.980710
2021-04-03T15:54:43
2021-04-03T15:54:43
343,456,738
0
0
null
null
null
null
UTF-8
Java
false
false
129
java
package L4_Interfaces_and_Abstraction_Exercises.P3_Birthday_Celebrations; public interface Identifiable { String getId(); }
c3c0378371854b23aa4bd15063efac0868aa40c2
5a8f43fb4ef75073f03a1c46d5b485462fd1cbd5
/src/hotel/management/system/AddCustomer.java
76c65e723ad5c91facaa3b20eb5cb2c55fb9e4d3
[]
no_license
kishan166/HotelManagementSystem
b617ff9591fb15422d98da960e9f4c24b7308a92
8ed671dfcf9136bcdcb0463b75e289ba39887ad0
refs/heads/main
2022-12-28T16:34:54.969051
2020-10-09T00:07:20
2020-10-09T00:07:20
302,466,642
3
0
null
null
null
null
UTF-8
Java
false
false
5,438
java
package hotel.management.system; import java.awt.Choice; import java.awt.Color; import java.awt.Font; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.ResultSet; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JRadioButton; import javax.swing.JTextField; public class AddCustomer extends JFrame implements ActionListener { JTextField t1,t2,t3,t4,t5,t6; JRadioButton r1,r2; JButton b1,b2; JComboBox c1; Choice c2; public AddCustomer() { this.setTitle("Add Employee"); JLabel l1 = new JLabel("New Customer Form"); l1.setFont(new Font("Tahoma",Font.PLAIN,30)); l1.setForeground(Color.BLUE); l1.setBounds(60,30,350,40); add(l1); JLabel id = new JLabel("ID"); //ID id.setFont(new Font("Tahoma",Font.PLAIN,17)); id.setBounds(60,80,120,30); add(id); String str[]= {"Passport","Driving-license","id"}; c1 = new JComboBox(str); c1.setBackground(Color.WHITE); c1.setBounds(280, 80, 160, 30); add(c1); JLabel number = new JLabel("NUMBER"); //number number.setFont(new Font("Tahoma",Font.PLAIN,17)); number.setBounds(60,130,120,30); add(number); t1 = new JTextField(); t1.setBounds(280,130,160,30); add(t1); JLabel name = new JLabel("NAME"); //name name.setFont(new Font("Tahoma",Font.PLAIN,17)); name.setBounds(60,180,120,30); add(name); t2 = new JTextField(); t2.setBounds(280,180,160,30); add(t2); JLabel gender = new JLabel("GENDER"); //gender gender.setFont(new Font("Tahoma",Font.PLAIN,17)); gender.setBounds(60,230,120,30); add(gender); r1 = new JRadioButton("Male"); r1.setBounds(280,230,70,30); r1.setBackground(Color.WHITE); add(r1); r2 = new JRadioButton("Female"); r2.setBounds(380, 230, 70, 30); r2.setBackground(Color.WHITE); add(r2); JLabel country = new JLabel("COUNTRY"); //country country.setFont(new Font("Tahoma",Font.PLAIN,17)); country.setBounds(60,280,120,30); add(country); t3 = new JTextField(); t3.setBounds(280,280,160,30); add(t3); JLabel allroomno = new JLabel("ALOCATED ROOM NUMBER"); //allocated room number allroomno.setFont(new Font("Tahoma",Font.PLAIN,17)); allroomno.setBounds(60,330,220,30); add(allroomno); c2 = new Choice(); try { conn c = new conn(); String sql = "Select * from room"; ResultSet rs = c.s.executeQuery(sql); while (rs.next()) { String allo = rs.getString("available"); if (allo.equals("available")) { c2.add(rs.getString("room_number")); } else { continue; } } } catch (Exception e) { System.out.println(e); } c2.setBounds(280,330,160,30); add(c2); JLabel checkin = new JLabel("CHECKED IN"); //checked in checkin.setFont(new Font("Tahoma",Font.PLAIN,17)); checkin.setBounds(60,380,120,30); add(checkin); t4 = new JTextField(); t4.setBounds(280,380,160,30); add(t4); JLabel email = new JLabel("DEPOSIT"); //deposit email.setFont(new Font("Tahoma",Font.PLAIN,17)); email.setBounds(60,430,120,30); add(email); t5 = new JTextField(); t5.setBounds(280,430,160,30); add(t5); b1=new JButton("Save"); b1.setBounds(105, 480, 120, 30); b1.setForeground(Color.WHITE); b1.setBackground(Color.BLACK); b1.addActionListener(this); add(b1); b2 = new JButton("Back"); b2.setBackground(Color.BLACK); b2.setForeground(Color.WHITE); b2.addActionListener(this); b2.setBounds(245,480,120,30); add(b2); ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/fifth.jpg")); Image i2 = i1.getImage().getScaledInstance(400, 400, Image.SCALE_DEFAULT); ImageIcon i3 = new ImageIcon(i2); JLabel l11 = new JLabel(i3); l11.setBounds(460, 80, 400, 400); add(l11); getContentPane().setBackground(Color.WHITE); setLayout(null); setBounds(520,230,900,600); setVisible(true); } public static void main(String[] args) { new AddCustomer().setVisible(true); } @Override public void actionPerformed(ActionEvent e) { if(e.getSource() == b1) { String id = (String) c1.getSelectedItem(); String number = t1.getText(); String name = t2.getText(); String gender = null; if(r1.isSelected()) { gender = "male"; } else if(r2.isSelected()){ gender = "female"; } String country = t3.getText(); String allroomno = c2.getSelectedItem(); String checkin = t4.getText(); String deposit = t5.getText(); ; conn c = new conn(); String sql="insert into customer values('"+id+"','"+number+"','"+name+"','"+gender+"','"+country+"','"+allroomno+"','"+checkin+"','"+deposit+"')"; String sql2 = "update room set available = 'occupied' where room_number ='"+allroomno+"'"; try { c.s.executeUpdate(sql); c.s.executeUpdate(sql2); JOptionPane.showMessageDialog(null, "NEW CUSTOMER ADDED"); this.setVisible(true); } catch (Exception e2) { System.out.println(e); } } else if(e.getSource() == b2) { new Reception().setVisible(true); this.setVisible(false); } } }
5473b70a0af70d81674a9105981d82f0ace8ee29
425888a80686bb31f64e0956718d81efef5f208c
/src/test/java/com/aol/cyclops/react/base/BaseNumberOperationsTest.java
ca0cc7f4e311b97d74b35c51ab3e5322cb45421d
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
cybernetics/cyclops-react
ca34140519abfbe76750131f39133d31ba6770f2
f785d9bbe773acee5b07b602c0476dd58e19ef19
refs/heads/master
2021-01-22T13:08:10.590701
2016-04-22T12:41:13
2016-04-22T12:41:13
56,901,547
1
0
null
2016-04-23T05:07:15
2016-04-23T05:07:15
null
UTF-8
Java
false
false
2,970
java
package com.aol.cyclops.react.base; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.function.Supplier; import org.junit.Before; import org.junit.Test; import com.aol.cyclops.types.futurestream.LazyFutureStream; public abstract class BaseNumberOperationsTest { abstract protected <U> LazyFutureStream<U> of(U... array); abstract protected <U> LazyFutureStream<U> ofThread(U... array); abstract protected <U> LazyFutureStream<U> react(Supplier<U>... array); LazyFutureStream<Integer> empty; LazyFutureStream<Integer> nonEmpty; private static final Executor exec = Executors.newFixedThreadPool(1); @Before public void setup(){ empty = of(); nonEmpty = of(1); } @Test public void sumInt(){ assertThat(of(1,2,3,4).futureOperations(exec).sumInt(i->i).join(), equalTo(10)); } @Test public void sumDouble(){ assertThat(of(1.0,2.0,3.0,4.0).futureOperations(exec).sumDouble(i->i).join(), equalTo(10.0)); } @Test public void sumLong(){ assertThat(of(1l,2l,3l,4l).futureOperations(exec).sumLong(i->i).join(), equalTo(10l)); } @Test public void maxInt(){ assertThat(of(1,2,3,4).futureOperations(exec).maxInt(i->i).join().getAsInt(), equalTo(4)); } @Test public void maxDouble(){ assertThat(of(1.0,2.0,3.0,4.0).futureOperations(exec).maxDouble(i->i).join().getAsDouble(), equalTo(4.0)); } @Test public void maxLong(){ assertThat(of(1l,2l,3l,4l).futureOperations(exec).maxLong(i->i).join().getAsLong(), equalTo(4l)); } @Test public void minInt(){ assertThat(of(1,2,3,4).futureOperations(exec).minInt(i->i).join().getAsInt(), equalTo(1)); } @Test public void minDouble(){ assertThat(of(1.0,2.0,3.0,4.0).futureOperations(exec).minDouble(i->i).join().getAsDouble(), equalTo(1.0)); } @Test public void minLong(){ assertThat(of(1l,2l,3l,4l).futureOperations(exec).minLong(i->i).join().getAsLong(), equalTo(1l)); } @Test public void averageInt(){ assertThat(of(1,2,3,4).futureOperations(exec).averageInt(i->i).join().getAsDouble(), equalTo(2.5)); } @Test public void averageDouble(){ assertThat(of(1.0,2.0,3.0,4.0).futureOperations(exec).averageDouble(i->i).join().getAsDouble(), equalTo(2.5)); } @Test public void averageLong(){ assertThat(of(1l,2l,3l,4l).futureOperations(exec).averageLong(i->i).join().getAsDouble(), equalTo(2.5)); } @Test public void summaryStatsInt(){ assertThat(of(1,2,3,4).futureOperations(exec).summaryStatisticsInt(i->i).join().getSum(), equalTo(10L)); } @Test public void summaryStatsDouble(){ assertThat(of(1.0,2.0,3.0,4.0).futureOperations(exec) .summaryStatisticsDouble(i->i).join().getSum(), equalTo(10.0)); } @Test public void summaryStatsLong(){ assertThat(of(1l,2l,3l,4l).futureOperations(exec).summaryStatisticsLong(i->i).join().getSum(), equalTo(10l)); } }
faf6ce2eee62001621746566f529aab80f504569
d6bc61f75755180802b460a7d80353ab692750a6
/SearchCustomerForm.java
03f39cc43acb7476d390cd1ad15310bc18933778
[]
no_license
BreTuck/LocalBookstore
32ad86736d108acd32beea1185b1b3622429b070
0f6ef20a7e351c4737997f8f2e641d74ee5cde08
refs/heads/master
2022-03-10T20:52:06.129944
2019-11-21T16:36:51
2019-11-21T16:36:51
221,477,495
0
0
null
null
null
null
UTF-8
Java
false
false
3,286
java
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class SearchCustomerForm extends JPanel { private static int FRAME_WIDTH = 1000; private static int FRAME_HEIGHT = 800; private static int SCROLL_PANE_WIDTH = 800; private static int SCROLL_PANE_HEIGHT = 400; private static int GAP_SIZE = 10; private StoreUI storeInstance; public SearchCustomerForm(StoreUI store) { super(); this.storeInstance = store; SpringLayout formLayout = new SpringLayout(); setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT)); setOpaque(true); setBackground(new Color(255, 255, 255)); JPanel form = new JPanel(new SpringLayout()); JLabel formTitle = new JLabel("Add a Book to Inventory"); formLayout.putConstraint(SpringLayout.NORTH, this, 100, SpringLayout.NORTH, formTitle); formLayout.putConstraint(SpringLayout.SOUTH, form, 300, SpringLayout.NORTH, formTitle); add(formTitle); final int txtFieldSize = 15; // Book Title JLabel firstNameLabel = new JLabel("First Name: ", JLabel.TRAILING); TextField firstNameField = new TextField(txtFieldSize); firstNameLabel.setLabelFor(firstNameField); form.add(firstNameLabel); form.add(firstNameField); // Book Author JLabel lastNameLabel = new JLabel("Last Name: ", JLabel.TRAILING); TextField lastNameField = new TextField(txtFieldSize); lastNameLabel.setLabelFor(lastNameField); form.add(lastNameLabel); form.add(lastNameField); SpringUtilities.makeCompactGrid(form, 2, 2, 6, 6, GAP_SIZE, GAP_SIZE); add(form); JButton submitForm = new JButton("Search Inventory"); submitForm.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { Customer[] customerResults = storeInstance.mainControl.search(firstNameField.getText(), lastNameField.getText()); JScrollPane infoPane; if(customerResults.length >= 0) { infoPane = new JScrollPane(new JTextArea("No Matches Found in Store Clientele", 1, 1)); } else { JList<Customer> customerData = new JList<Customer>(customerResults); infoPane = new JScrollPane(customerData); } infoPane.setPreferredSize(new Dimension(SCROLL_PANE_WIDTH, SCROLL_PANE_HEIGHT)); JButton backToHome = new JButton("Back to Home Page"); backToHome.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { storeInstance.setHomeScreen(); } }); removeAll(); add(infoPane); formLayout.putConstraint(SpringLayout.NORTH, backToHome, 100, SpringLayout.SOUTH, infoPane); add(backToHome); revalidate(); repaint(); } }); formLayout.putConstraint(SpringLayout.NORTH, submitForm, 100, SpringLayout.SOUTH, form); add(submitForm); setVisible(true); } }
8df25df966d3c6c33d2d5467c4ee1a65d093fa55
8c019e222fc43bf07e3d57b9312ff72f5e7e7bf7
/WSPlayer/src/cn/lois/video/wsplayer/RecordPlayer.java
a9346367fc4a9310297db5dec2deb4374d9cf5b5
[]
no_license
Ginkgo001/EclipseWorkspace
a36501d612104c154c9bac1ebe96d3fd2095185b
7d5aaa1bca7c3197284580fe3818bc2b3b89b942
refs/heads/master
2021-01-13T02:08:11.187538
2014-07-07T07:49:22
2014-07-07T07:49:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,842
java
package cn.lois.video.wsplayer; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; import java.nio.ByteBuffer; import android.app.Activity; import android.content.Intent; import android.content.res.Configuration; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.view.KeyEvent; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.GridView; import android.widget.TextView; import android.widget.AdapterView.OnItemClickListener; public class RecordPlayer extends Activity { private VideoView mVideoView = null; private TextView mStatusText = null; private GridView mToolsView; private Handler mHandler = new Handler(); OutputStream outstream; InputStream h264stream; boolean mPlaying; boolean mPause; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // No Title bar requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.record); mVideoView = (VideoView) findViewById(R.id.videoView); mStatusText = (TextView) findViewById(R.id.statusText); mToolsView = (GridView) findViewById(R.id.toolsView); Intent i = this.getIntent(); Bundle b = i.getExtras(); mIp = b.getString("ip"); mPort = b.getInt("port"); mRecordId = b.getString("recordId"); mSkey = b.getString("skey"); String[] names = new String[] {"停止", "暂停", "截图", "录像"}; int[] icons = new int[] { R.drawable.back, R.drawable.pause, R.drawable.cut, R.drawable.movie}; mToolsView.setAdapter(new ImageListAdapter(this, names, icons)); mToolsView.setOnItemClickListener(new OnItemClickListener(){ public void onItemClick(AdapterView<?> adapter,//The AdapterView where the click happened View view,//The view within the AdapterView that was clicked int position,//The position of the view in the adapter long rowid//The row id of the item that was clicked ) { switch(position) { case 0: mPlaying = false; break; case 1: mPause = !mPause; if (mPause) { view.setBackgroundColor(0xFFF7F6F3); } else { view.setBackgroundColor(Color.TRANSPARENT); } break; case 2: // 截图 mVideoView.Snap(); break; case 3: // 录像 if (mVideoView.Record()) { view.setBackgroundColor(0xFFF7F6F3); } else { view.setBackgroundColor(Color.TRANSPARENT); } break; } } }); this.setResult(RESULT_OK, new Intent()); mVideoView.InitVideoView(mStatusText); mPlaying = true; mPause = false; new Thread(new Runnable(){ public void run() { StartPlayRecord(); } }).start(); } String mIp; int mPort; String mRecordId; String mSkey; private byte[] head = new byte[4]; private boolean RecvOnce(InputStream stream, byte[] b, int pos, int count) throws IOException { if (count == 0) return true; int total = 0; int r = 0; while((r = stream.read(b, pos + total, count - total)) > 0) { total += r; if (total == count) return true; } return false; } private boolean ReadOneRecord(InputStream stream, ByteBuffer buffer) { buffer.position(0); byte[] b = buffer.array(); try { while(mPlaying) { if (RecvOnce(stream, head, 0, 4)) { int len = (( 0xFF & head[3]) * 256 + (0xFF & head[2])); len = len * 4 + head[1]; if (len > 0 && RecvOnce(stream, b, 0, len)) { if (head[0] == 255) { return false; } else if (head[0] == 0) // video { buffer.position(len); return true; } else if (head[0] == 1) // audio { buffer.position(len); mVideoView.PutAudio(buffer); } continue; } } break; } } catch (Exception e1) { e1.printStackTrace(); } return false; } private void StartPlayRecord() { Socket socket = null; mPlaying = true; try { socket = new Socket(mIp, mPort); h264stream = socket.getInputStream(); outstream = socket.getOutputStream(); String setup = "Setup!:"; setup += mRecordId; setup += "\r\nStart\r\n"; byte[] send = setup.getBytes(); outstream.write(send); outstream.flush(); ByteBuffer pInBuffer = ByteBuffer.allocate(51200); long playTime = System.currentTimeMillis() - 40; byte[] in = pInBuffer.array(); while (mPlaying && ReadOneRecord(h264stream, pInBuffer)) { mVideoView.Decode(pInBuffer); playTime += ( 0xFF & in[1]) * 256 + (0xFF & in[0]); long sleep = playTime - System.currentTimeMillis(); if (sleep > 0) { Thread.sleep(sleep); } else { playTime -= sleep; } while(mPause && mPlaying) { Thread.sleep(100); } } } catch (Exception e1) { e1.printStackTrace(); } finally { mPlaying = false; try { socket.shutdownInput(); socket.shutdownOutput(); socket.close(); } catch(Exception e) { } mHandler.post(new Runnable() { public void run() { finish(); } }); } } protected void onDestroy() { super.onDestroy(); mVideoView.Cleanup(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { // land do nothing is ok } else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { // port do nothing is ok } } public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (mStatusText.getText().length() > 0) { mStatusText.setText(""); return true; } else if (mToolsView.getVisibility() == View.VISIBLE) { mToolsView.setVisibility(View.INVISIBLE); return true; } else if (mPlaying){ mPlaying = false; return true; } else { finish(); return true; } } else if (keyCode == KeyEvent.KEYCODE_MENU) { if (mToolsView.getVisibility() == View.VISIBLE) { mToolsView.setVisibility(View.INVISIBLE); return true; } else { mToolsView.setVisibility(View.VISIBLE); return true; } } return super.onKeyDown(keyCode, event); } }
8ebae0622507672c909864c0a4365e6a8623ef42
8eb2c3564fb405427a3f752301be93e5a118b176
/esale-manager/esale-manager-service/src/main/java/com/esale/service/ItemCatService.java
7e26f9f3cab41322e6ec6d5d6999de3e0a937dc6
[]
no_license
littleyaoyaoyao/Esale-Online-Mall-system
c7fca003ea441d6138f0ce30fce722ef65360586
e7e76d47cfc994dbba64b1829458551bba73361f
refs/heads/master
2021-01-01T17:43:43.129681
2017-09-13T14:15:30
2017-09-13T14:15:30
98,137,925
1
0
null
null
null
null
UTF-8
Java
false
false
198
java
package com.esale.service; import java.util.List; import com.esale.common.pojo.EasyUITreeNode; public interface ItemCatService { List<EasyUITreeNode> getItemCatList(Long parentId); }
58406d8238ba69ea2db71aae11428cc36de4a4e9
dc62671d968c73ab9e1bb26906cb4cba1da78cc9
/Hello-Heroku-Hosting/src/main/java/com/mmit/ServletInitializer.java
d61a6ef576e96e34287c09393e96082e8244cbc1
[]
no_license
NanEiTheint/Test-Heroku-Hosting
fdd8507a0a0b362f72eca1a516eaa1d8def31f43
f1dbf9525a9ef06e519dceecc2d5c94324a6ac52
refs/heads/master
2023-07-03T17:47:19.839145
2021-08-03T05:49:33
2021-08-03T05:49:33
392,195,083
0
0
null
null
null
null
UTF-8
Java
false
false
410
java
package com.mmit; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; public class ServletInitializer extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(HelloHerokuHostingApplication.class); } }
9e239088ef941449230e6a681a3621e1ba48d437
d4a96f9b598b28e454859a7d42cc3438fc357022
/app/src/main/java/com/elfosoftware/easycatalog/Adapters.java
451b1ccca9657b96d196e03ba83c30c5ea0f6c56
[]
no_license
ermetiko/EasyCatalog2
9d47dee1cd112ef7c4121646f3db5ed654a3b0f8
0b621f0d4406df57fcd9b96507f1aba6940f017c
refs/heads/master
2021-01-10T12:38:52.522007
2016-03-14T21:05:55
2016-03-14T21:05:55
52,737,779
0
0
null
null
null
null
UTF-8
Java
false
false
12,100
java
package com.elfosoftware.easycatalog; import java.io.File; import java.util.ArrayList; import android.R.dimen; import android.R.string; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Environment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.SpinnerAdapter; import android.widget.TextView; public class Adapters { //public static int dimensioneGrigliaGrande=0; public static class Categoria { int Id; String Nome; Integer Articoli; public Categoria(int id, String nome, Integer numero) { Id = id; Nome = nome; Articoli = numero; } @Override public String toString() { return this.Nome; } } public static class CategorieAdapter extends ArrayAdapter<Categoria> { private ArrayList<Categoria> items; private CategoriaHolder categoriaHolder; private Context context; private class CategoriaHolder { TextView nome; TextView numero; } public CategorieAdapter(Context context, int tvResId, ArrayList<Categoria> items) { super(context, tvResId, items); this.context = context; this.items = items; } @Override public View getView(int pos, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.categorie, null); categoriaHolder = new CategoriaHolder(); categoriaHolder.nome = (TextView) v.findViewById(R.id.nomeCategoria); categoriaHolder.numero = (TextView) v.findViewById(R.id.articoliCategoria); v.setTag(categoriaHolder); } else categoriaHolder = (CategoriaHolder) v.getTag(); Categoria cate = items.get(pos); if (cate != null) { categoriaHolder.nome.setText(cate.Nome); categoriaHolder.numero.setText(Integer.toString(cate.Articoli) + " articoli"); } return v; } } public static class Articolo { int Id; String Descrizione; String Categoria; String Famiglia; String Fornitore; Drawable Thumb; Drawable Immagine; public Articolo(int id, String descrizione, Drawable thumb, Drawable immagine) { Id = id; Descrizione = descrizione; Thumb = thumb; Immagine = immagine; } @Override public String toString() { return this.Descrizione; } } public static class ThumbsAdapter extends ArrayAdapter<Articolo> { private ArrayList<Articolo> items; private ItemHolder itemHolder; private Context context; private File immaginiPath; private class ItemHolder { ImageView img; TextView nome; } public ThumbsAdapter(Context context, int tvResId, ArrayList<Articolo> items, File immaginiPath) { super(context, tvResId, items); this.context = context; this.items = items; this.immaginiPath = immaginiPath; } @Override public View getView(int pos, View convertView, ViewGroup parent) { View v = convertView; if (convertView == null) { LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.thumb, null); itemHolder = new ItemHolder(); itemHolder.img = (ImageView) v.findViewById(R.id.thumbImmagine); itemHolder.nome = (TextView) v.findViewById(R.id.thumbDescrizione); v.setTag(itemHolder); } else itemHolder = (ItemHolder) convertView.getTag(); Articolo arti = items.get(pos); if (arti != null) { if (arti.Thumb == null) arti.Thumb = getImmagine(arti.Id, true, immaginiPath); itemHolder.img.setImageDrawable(arti.Thumb); itemHolder.nome.setText(arti.Descrizione); } return v; } } public static class ImmagineLargeAdapter extends ArrayAdapter<Articolo> { private ArrayList<Articolo> items; private ItemHolder itemHolder; private Context context; private File immaginiPath; private class ItemHolder { ImageView img; TextView codice; TextView nome; TextView categoria; TextView sottocategoria; } public ImmagineLargeAdapter(Context context, int tvResId, ArrayList<Articolo> items, File immaginiPath) { super(context, tvResId, items); this.context = context; this.items = items; this.immaginiPath = immaginiPath; } @Override public View getView(int pos, View convertView, ViewGroup parent) { View v = convertView; if (convertView == null) { LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.immagine_large, null); itemHolder = new ItemHolder(); itemHolder.img = (ImageView) v.findViewById(R.id.immagineLarge); //itemHolder.img.setLayoutParams(new LayoutParams(dimensioneGrigliaGrande, dimensioneGrigliaGrande)); itemHolder.codice = (TextView) v.findViewById(R.id.imgCodiceArticolo); itemHolder.nome = (TextView) v.findViewById(R.id.imgDescrizioneArticolo); itemHolder.categoria = (TextView) v.findViewById(R.id.imgCategoria); itemHolder.sottocategoria = (TextView) v.findViewById(R.id.imgSottocategoria); v.setTag(itemHolder); } else itemHolder = (ItemHolder) convertView.getTag(); Articolo arti = items.get(pos); if (arti != null) { if (arti.Immagine == null) arti.Immagine = getImmagine(arti.Id, false, immaginiPath); itemHolder.img.setImageDrawable(arti.Immagine); itemHolder.codice.setText(Integer.toString(arti.Id)); itemHolder.nome.setText(arti.Descrizione); itemHolder.categoria.setText("categoria"); itemHolder.sottocategoria.setText("Sottocategoria"); } return v; } } public static Drawable getImmagine(int idArticolo, boolean ridotta, File immaginiPath) { Drawable img = null; int numero = (int) Math.ceil(Math.random() * 79); //String nomeFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/EasyCatalogImg/" + Integer.toString(numero + 1) + (ridotta ? "_th.jpg" : ".jpg"); //File pathImg = null; //get ((MyApplication) this.getApplication()).getImmaginiPath(); File file = new File(immaginiPath, Integer.toString(idArticolo) + (ridotta ? "_th.jpg" : ".jpg")); if (file.exists()) { img = Drawable.createFromPath(file.getAbsolutePath()); } return img; } /* public static Drawable getImmagineLarge(int idArticolo) { Drawable img=null; int numero = (int)Math.ceil(Math.random()*72); String estenzione = (numero<32 ? ".jpg" : ".png"); String nomeFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/immagini2/" + Integer.toString(numero+1) + estenzione; File file = new File (nomeFile); if (file.exists()) { img= Drawable.createFromPath(file.getAbsolutePath()); } return img; } */ /* public static class ImageAdapter extends BaseAdapter { private Context context; private Drawable[] images; public ImageAdapter(Context context, Drawable[] images) { this.context = context; this.images = images; } @Override public int getCount() { return images.length; } @Override public Object getItem(int position) { return images[position]; } @Override public long getItemId(int position) { return images[position].hashCode(); } @Override public View getView(int position, View convertView, ViewGroup parent) { // ImageView imageView; View v; if (convertView == null) { // * imageView = new ImageView(context); // * imageView.setLayoutParams(new GridView.LayoutParams(190, // * 190)); imageView.setScaleType(ImageView.ScaleType.CENTER); // * imageView.setPadding(5, 5, 5, 5); LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // LayoutInflater li = getLayoutInflater(); v = li.inflate(R.layout.thumb, null); // v.setLayoutParams(new GridView.LayoutParams(190, 190)); // v.setPadding(5, 5, 5, 5); TextView tv = (TextView) v.findViewById(R.id.thumbDescrizione); tv.setText("descrizione " + position); ImageView iv = (ImageView) v.findViewById(R.id.thumbImmagine); iv.setImageDrawable(images[position]); // setImageResource(R.drawable.icon); } else { v = convertView; } // * if (convertView == null) { imageView = new ImageView(context); // * imageView.setLayoutParams(new GridView.LayoutParams(190, 190)); // * imageView.setScaleType(ImageView.ScaleType.CENTER); // * imageView.setPadding(5, 5, 5, 5); // * // * imageView.setImageDrawable(images[position]); } else { imageView // * = (ImageView) convertView; } return v; // imageView; } } */ public static class BigSpinnerAdapter extends ArrayAdapter<Categoria> implements SpinnerAdapter { private ArrayList<Categoria> items; private CategoriaHolder categoriaHolder; private Context context; private class CategoriaHolder { TextView nome; TextView numero; } public BigSpinnerAdapter(Context context, int tvResId, ArrayList<Categoria> items) { super(context, tvResId, items); this.context = context; this.items = items; } @Override public View getView(int pos, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.categorie, null); categoriaHolder = new CategoriaHolder(); categoriaHolder.nome = (TextView) v.findViewById(R.id.nomeCategoria); categoriaHolder.numero = (TextView) v.findViewById(R.id.articoliCategoria); v.setTag(categoriaHolder); } else categoriaHolder = (CategoriaHolder) v.getTag(); Categoria cate = items.get(pos); if (cate != null) { categoriaHolder.nome.setText(cate.Nome); categoriaHolder.numero.setText(Integer.toString(cate.Articoli) + " articoli"); } return v; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { return getView(position, convertView, parent); } } public static class Marca { Integer Id; String Nome; Integer Articoli; public Marca(Integer id, String nome, Integer numero) { Id = id; Nome = nome; Articoli = numero; } @Override public String toString() { return this.Nome; } } }
4abe5f08abf0344e589742ab0f75c31b8a1b5db6
da4b363bab129a2764a8d569e0d4160cd6b1678c
/src/main/java/org/ishugaliy/consistent/hash/hasher/DefaultHasher.java
4967fda7d76512272304228260a4494df80409a0
[ "MIT" ]
permissive
romabyv/allgood-consistent-hash
8089c630ef2d30d2688a1b328bde114b2ad5ff62
2dcddae93bcfb9178c826e3b520364e0fb127240
refs/heads/master
2022-06-08T14:58:37.297735
2020-04-30T11:43:55
2020-04-30T11:43:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,136
java
package org.ishugaliy.consistent.hash.hasher; import net.openhft.hashing.LongHashFunction; import java.util.function.Function; public enum DefaultHasher implements Hasher { /** * https://github.com/aappleby/smhasher/wiki/MurmurHash3 */ MURMUR_3(LongHashFunction::murmur_3), /** * https://github.com/google/cityhash */ CITY_HASH(LongHashFunction::city_1_1), /** * https://github.com/google/farmhash */ FARM_HASH(LongHashFunction::farmUo), /** * https://github.com/jandrewrogers/MetroHash */ METRO_HASH(LongHashFunction::metro), /** * https://github.com/wangyi-fudan/wyhash */ WY_HASH(LongHashFunction::wy_3), /** * https://github.com/Cyan4973/xxHash */ XX_HASH(LongHashFunction::xx); private final Function<Integer, LongHashFunction> buildHashFunction; DefaultHasher(Function<Integer, LongHashFunction> buildHashFunction) { this.buildHashFunction = buildHashFunction; } @Override public long hash(String key, int seed) { return buildHashFunction.apply(seed).hashChars(key); } }
2375b54329f756ca90fdbc3d8c4e9690b8cd4900
0d86a98cd6a6477d84152026ffc6e33e23399713
/kata/8-kyu/keep-hydrated-1/test/SolutionTest.java
8c5df6da7404206c6c84917e8e8832ed2551d03f
[ "MIT" ]
permissive
ParanoidUser/codewars-handbook
0ce82c23d9586d356b53070d13b11a6b15f2d6f7
692bb717aa0033e67995859f80bc7d034978e5b9
refs/heads/main
2023-07-28T02:42:21.165107
2023-07-27T12:33:47
2023-07-27T12:33:47
174,944,458
224
65
MIT
2023-09-14T11:26:10
2019-03-11T07:07:34
Java
UTF-8
Java
false
false
423
java
import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; class SolutionTest { @Test void sample() { assertEquals(1, new KeepHydrated().Liters(2)); assertEquals(0, new KeepHydrated().Liters(0.97)); assertEquals(7, new KeepHydrated().Liters(14.64)); assertEquals(40, new KeepHydrated().Liters(80)); assertEquals(800, new KeepHydrated().Liters(1600.20)); } }
aa9449958f2fca70e8000dd779f5eb63b44b90f1
9fbe90085c2985f1ecaa494bfcdcb900d4a3ce75
/asyncFlow/java/aflux-tool-mainplugins/src/main/java/de/tum/in/aflux/component/samples/tools/impl/SaveToMongoDBTool.java
79cc4c5738fb87b9313d1e2d67bb961dcf6d48d2
[ "Apache-2.0" ]
permissive
hmzhangmin/aflux
48b3dabd7acac583b8742789dab34d2204f0a164
1062369b3c978646a4c050b1d058120a280c4217
refs/heads/master
2022-12-25T05:10:29.051081
2020-04-07T12:03:26
2020-04-07T12:03:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
731
java
/* * aFlux: JVM based IoT Mashup Tool * Copyright 2019 Tanmaya Mahapatra * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.tum.in.aflux.component.samples.tools.impl; public class SaveToMongoDBTool { }
8abb5703bee6c3c85acd069f543cb68c954e7f0d
a7cfd989b5e21fc9cf34382b04db0d5aeeecd80e
/app/src/main/java/com/example/musicdemo/views/InputView.java
e88edaf3cc604e6eea1edebfeda17135883a0092
[]
no_license
YuLong-Liang/MusicDemo
d1c352a11f1c1fe3902cc0a8df72c3acc438a6ff
cbf4dbde88363426282e2ac790023c4fbf36fde4
refs/heads/master
2023-04-12T23:03:39.586724
2019-11-13T02:30:19
2019-11-13T02:30:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,599
java
package com.example.musicdemo.views; import android.content.Context; import android.content.res.TypedArray; import android.os.Build; import android.renderscript.ScriptGroup; import android.text.InputType; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import androidx.annotation.RequiresApi; import com.example.musicdemo.R; /** * 1、input_icon输入框前图标 * 2、input_hint:输入框提示 * 3、is_password:是否需要密文 * */ public class InputView extends FrameLayout { private int inputIcon; private String inputHint; private boolean isPassword; private View mView; private ImageView mIvIcon; private EditText mEtInput; public InputView(Context context) { super(context); init(context, null); } public InputView(Context context, AttributeSet attrs) { super(context, attrs); init(context, attrs); } public InputView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context, attrs); } @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public InputView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(context, attrs); } private void init(Context context, AttributeSet attrs) { if (attrs == null) return; //获取自定义属性 TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.inputView); inputIcon = typedArray.getResourceId(R.styleable.inputView_input_icon, R.mipmap.phone2); inputHint = typedArray.getString(R.styleable.inputView_input_hint); isPassword = typedArray.getBoolean(R.styleable.inputView_is_password, false); typedArray.recycle(); //绑定layout mView = LayoutInflater.from(context).inflate(R.layout.input_view, this, false); mIvIcon = mView.findViewById(R.id.iv_icon); mEtInput = mView.findViewById(R.id.et_input); mIvIcon.setImageResource(inputIcon); mEtInput.setHint(inputHint); mEtInput.setInputType(isPassword ? InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD : InputType.TYPE_CLASS_PHONE); addView(mView); } /** * 返回输入内容 * * @return */ public String getInputStr() { return mEtInput.getText().toString().trim(); } }
fe1eb288601cd606bb8b889bdd0e7719f0f5d29e
05ce26c75d2c088160d86af8570d48c29f5de13f
/app/src/main/java/test/nsr/com/samstestapp/ui/productdetails/ProductInfoActivity.java
5419716bbd277450cf0413209a11bcb6d6f50bdd
[]
no_license
shekharreddy/SamsTestApp
0cf2d9459c91b1a65d5b315cf57f471c405fd9eb
16f7508811a29b595a0f2d6893e1f1d88356910b
refs/heads/master
2020-03-27T21:08:30.883601
2018-09-03T14:34:08
2018-09-03T14:34:08
147,118,047
0
0
null
null
null
null
UTF-8
Java
false
false
1,533
java
package test.nsr.com.samstestapp.ui.productdetails; import android.os.Bundle; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.MenuItem; import test.nsr.com.samstestapp.R; /** * @author shekharreddy * Activity to show product details with View Pager. */ public class ProductInfoActivity extends AppCompatActivity { public static final String TAG = "ProductInfoActivity"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_product_info); Log.i(TAG, "OnCreate called"); if (savedInstanceState == null) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); ProductsInfoSlidingFragment fragment = new ProductsInfoSlidingFragment(); transaction.replace(R.id.content_fragment, fragment); transaction.commit(); } getSupportActionBar().setTitle(R.string.product_details); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // back icon in action bar clicked; goto parent activity. this.finish(); return true; default: return super.onOptionsItemSelected(item); } } }
9560927c1de55988d5139467d781841418222e0b
4804af90ee3408a9d8ac2516c3dc4d4487635ea5
/06_HelloMVC/src/com/kh/board/model/vo/Board.java
7ecf31e3a3baba0bce9dfdd40c4d4d9a62412178
[]
no_license
jiyeon0327/HelloMVC
3437aab706a99d3cb525b5f33efb4f7a3ddc8289
d690b7b1eb61990433eca17d2a11eda0f63f85d5
refs/heads/master
2020-07-19T18:13:57.494025
2019-09-25T12:53:49
2019-09-25T12:53:49
206,491,637
0
0
null
null
null
null
UTF-8
Java
false
false
2,690
java
package com.kh.board.model.vo; import java.sql.Date; public class Board { private int Board_no; private String Board_title; private String Board_writer; private String Board_content; private String Board_original_filename; private String Board_rename_filename; private Date Board_date; private int board_readcount; public Board() { // TODO Auto-generated constructor stub } public Board(int board_no, String board_title, String board_writer, String board_content, String board_original_filename, String board_rename_filename, Date board_date, int board_readcount) { super(); Board_no = board_no; Board_title = board_title; Board_writer = board_writer; Board_content = board_content; Board_original_filename = board_original_filename; Board_rename_filename = board_rename_filename; Board_date = board_date; this.board_readcount = board_readcount; } public int getBoard_no() { return Board_no; } public void setBoard_no(int board_no) { Board_no = board_no; } public String getBoard_title() { return Board_title; } public void setBoard_title(String board_title) { Board_title = board_title; } public String getBoard_writer() { return Board_writer; } public void setBoard_writer(String board_writer) { Board_writer = board_writer; } public String getBoard_content() { return Board_content; } public void setBoard_content(String board_content) { Board_content = board_content; } public String getBoard_original_filename() { return Board_original_filename; } public void setBoard_original_filename(String board_original_filename) { Board_original_filename = board_original_filename; } public String getBoard_rename_filename() { return Board_rename_filename; } public void setBoard_rename_filename(String board_rename_filename) { Board_rename_filename = board_rename_filename; } public Date getBoard_date() { return Board_date; } public void setBoard_date(Date board_date) { Board_date = board_date; } public int getBoard_readcount() { return board_readcount; } public void setBoard_readcount(int board_readcount) { this.board_readcount = board_readcount; } @Override public String toString() { return "Board [Board_no=" + Board_no + ", Board_title=" + Board_title + ", Board_writer=" + Board_writer + ", Board_content=" + Board_content + ", Board_original_filename=" + Board_original_filename + ", Board_rename_filename=" + Board_rename_filename + ", Board_date=" + Board_date + ", board_readcount=" + board_readcount + "]"; } }
[ "user2@user2-PC" ]
user2@user2-PC
7677b234e25086514b2f18c2a86beddf5a0db8a8
d93bb5eff18517da46d50eb14906f1ccb0185015
/IslandPrimeWEB/src/java/classes/MessageEncoder.java
b633995729e460fdb382bb3a057781dc6b2666d6
[]
no_license
pernjie/IslandSystem
7d557fd3c8994425d440d1632e134c07cef6d37b
d288e8b193729932d99e21546998ee7f7d9c0e25
refs/heads/master
2021-01-01T19:01:49.539260
2014-11-13T08:47:40
2014-11-13T08:47:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
416
java
package classes; import org.primefaces.json.JSONObject; import org.primefaces.push.Encoder; /** * A Simple {@link org.primefaces.push.Encoder} that decode a {@link Message} into a simple JSON object. */ public final class MessageEncoder implements Encoder<Message, String> { //@Override public String encode(Message message) { return new JSONObject(message).toString(); } }
2b3bc96961ed5d681ef6d994bb7a62b4687b18ed
8ced32b21f1be9511c256cb8b589d7976b4b98d6
/alanmall-client/alanmall-mscard/src/main/java/com/itcrazy/alanmall/mscard/action/card/RechargeRewardAction.java
b30a16817c3c1d7914060daa4b73966a5f8d2b6f
[]
no_license
Yangliang266/Alanmall
e5d1e57441790a481ae5aa75aa9d091909440281
38c2bde86dab6fd0277c87f99bc860bfc0fbdc0a
refs/heads/master
2023-06-13T05:01:25.747444
2021-07-10T12:18:58
2021-07-10T12:18:58
293,702,057
1
0
null
null
null
null
UTF-8
Java
false
false
8,984
java
package com.itcrazy.alanmall.mscard.action.card; import org.apache.dubbo.config.annotation.Reference; import com.itcrazy.alanmall.mscard.dto.Base.RechargeRewardDto; import com.itcrazy.alanmall.mscard.manager.CategoryManager; import com.itcrazy.alanmall.mscard.manager.RechargeRewardManager; import com.itcrazy.alanmall.mscard.model.RechargeReward; import com.itcrazy.alanmall.mscard.action.base.InterfaceBaseAction; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.List; /** * 充值/奖励设置 * * @author zhangli * */ public class RechargeRewardAction extends InterfaceBaseAction { private static final long serialVersionUID = 7069487434529150519L; private RechargeReward rechargeReward; private RechargeRewardDto rechargeRewardDto; @Reference RechargeRewardManager rechargeRewardManager; @Reference CategoryManager categoryManager; /** * 获取充值/奖励列表 * @return */ public String getRechargeRewardList() { if (rechargeRewardDto == null ) { rechargeRewardDto = new RechargeRewardDto(); } rechargeRewardDto.setCompanyId(user.getCompanyId()); // 根据商家ID获取充值/奖励列表 List<RechargeReward> rechargeRewardList = rechargeRewardManager.getPageList(rechargeRewardDto); pageData.rows = rechargeRewardList; result.setSuccessInfo(); return SUCCESS; } /** * 更新充值奖励设置 * @return */ public String updateRechargeReward(){ // 充值/奖励必须check if(rechargeReward == null){ result.setParamErrorInfo("rechargeReward"); return SUCCESS; } // 卡类别必须check if(StringUtils.isBlank(rechargeReward.getCardCategories())) { result.setParamErrorInfo("cardCategories"); return SUCCESS; } // 充值方式必须check if(rechargeReward.getRechargeMode() == null) { result.setParamErrorInfo("rechargeMode"); return SUCCESS; } // 充值金额必须check if(StringUtils.isBlank(rechargeReward.getRecharge())) { result.setParamErrorInfo("recharge"); return SUCCESS; } String currRechargeMin = ""; String currRechargeMax = ""; if(rechargeReward.getRechargeMode() == 1) { // 金额段充值的场合,每充金额数check String[] arrRecharge = rechargeReward.getRecharge().split(","); if(arrRecharge.length < 3) { result.setResultInfo(1, "每充值金额参数不完整。"); //result.setParamErrorInfo("recharge"); return SUCCESS; } // 金额段充值的场合,充值金额值check if(StringUtils.isBlank(arrRecharge[0]) || StringUtils.isBlank(arrRecharge[1]) || StringUtils.isBlank(arrRecharge[2])) { result.setResultInfo(1, "充值金额段参数不完整。"); //result.setParamErrorInfo("recharge"); return SUCCESS; } currRechargeMin = arrRecharge[0]; currRechargeMax = arrRecharge[1]; // 充值金额Min值<充值金额Max值check if(Integer.parseInt(currRechargeMin) > Integer.parseInt(currRechargeMax)) { result.setResultInfo(1, "充值金额段最小值不得大于最大值。"); //result.setParamErrorInfo("recharge"); return SUCCESS; } // 每充金额< [充值金额Max值-充值金额Min值] if(Integer.parseInt(arrRecharge[2]) > (Integer.parseInt(currRechargeMax) - Integer.parseInt(currRechargeMin))) { result.setResultInfo(1, "每充金额不得大于[充值金额Max值-充值金额Min值]。"); //result.setParamErrorInfo("recharge"); return SUCCESS; } } // 奖励规则必须check if(rechargeReward.getRewardMode() == null) { result.setParamErrorInfo("rewardMode"); return SUCCESS; } // 奖励金额必须check if(rechargeReward.getReward() == null) { result.setParamErrorInfo("reward"); return SUCCESS; } if (rechargeReward.getId() == null) { RechargeRewardDto rechargeRewardDto = new RechargeRewardDto(); List<RechargeReward> rechargeRewardList = new ArrayList<>(); String[] arrCategory = rechargeReward.getCardCategories().split(","); String[] arrRech; for (String category:arrCategory) { // 数据已存在性check rechargeRewardDto.setCompanyId(user.getCompanyId()); rechargeRewardDto.setCardCategorie(category); rechargeRewardDto.setRechargeMode(rechargeReward.getRechargeMode()); rechargeRewardDto.setRecharge(rechargeReward.getRecharge()); // 根据当前条件检索数据 rechargeRewardList = rechargeRewardManager.getPageList(rechargeRewardDto); if(rechargeRewardList.size() != 0) { result.setResultInfo(1, "卡类别的充值奖励设置重复。"); return SUCCESS; } // 金额段充值的场合,数据交叉性check if(rechargeReward.getRechargeMode() == 1) { rechargeRewardDto.setRecharge(null); // 根据当前条件检索数据 rechargeRewardList = rechargeRewardManager.getPageList(rechargeRewardDto); for(RechargeReward rechargeReward:rechargeRewardList) { arrRech = rechargeReward.getRecharge().split(","); if(Integer.parseInt(currRechargeMin) > Integer.parseInt(arrRech[0]) && Integer.parseInt(currRechargeMin) < Integer.parseInt(arrRech[1])) { result.setResultInfo(1, "充值金额范围重叠。"); return SUCCESS; } if(Integer.parseInt(currRechargeMax) > Integer.parseInt(arrRech[0]) && Integer.parseInt(currRechargeMax) < Integer.parseInt(arrRech[1])) { result.setResultInfo(1, "充值金额范围重叠。"); return SUCCESS; } } } } // 若存在当前支付方式,充值金额,奖励规则,奖励金额的数据,则更新卡类别 RechargeRewardDto rechargeDto = new RechargeRewardDto(); rechargeDto.setRechargeMode(rechargeReward.getRechargeMode()); rechargeDto.setRecharge(rechargeReward.getRecharge()); rechargeDto.setRewardMode(rechargeReward.getRewardMode()); rechargeDto.setReward(rechargeReward.getReward()); rechargeDto.setCompanyId(user.getCompanyId()); rechargeRewardList = rechargeRewardManager.getPageList(rechargeDto); if(rechargeRewardList.size() == 0) { // 新增操作 rechargeReward.setCreateId(user.getId()); rechargeReward.setCompanyId(user.getCompanyId()); rechargeRewardManager.addRechargeReward(rechargeReward); }else { // 更新操作 RechargeReward recharge = new RechargeReward(); String newCategories = rechargeRewardList.get(0).getCardCategories() + "," + rechargeReward.getCardCategories(); recharge.setCardCategories(newCategories); recharge.setUpdateId(user.getId()); recharge.setId(rechargeRewardList.get(0).getId()); rechargeRewardManager.updateRechargeReward(recharge); } }else { RechargeRewardDto rechargeRewardDto = new RechargeRewardDto(); List<RechargeReward> rechargeRewardList = new ArrayList<>(); String[] arrCategory = rechargeReward.getCardCategories().split(","); String[] arrRech; if(rechargeReward.getRechargeMode() == 1) { for (String category:arrCategory) { // 金额段充值的场合,数据交叉性check rechargeRewardDto.setCompanyId(user.getCompanyId()); rechargeRewardDto.setCardCategorie(category); rechargeRewardDto.setRechargeMode(rechargeReward.getRechargeMode()); rechargeRewardDto.setId(rechargeReward.getId()); // 根据当前条件检索数据 rechargeRewardList = rechargeRewardManager.getPageList(rechargeRewardDto); for(RechargeReward rechargeReward:rechargeRewardList) { arrRech = rechargeReward.getRecharge().split(","); if(Integer.parseInt(currRechargeMin) > Integer.parseInt(arrRech[0]) && Integer.parseInt(currRechargeMin) < Integer.parseInt(arrRech[1])) { result.setResultInfo(1, "充值金额范围重叠。"); return SUCCESS; } if(Integer.parseInt(currRechargeMax) > Integer.parseInt(arrRech[0]) && Integer.parseInt(currRechargeMax) < Integer.parseInt(arrRech[1])) { result.setResultInfo(1, "充值金额范围重叠。"); return SUCCESS; } } } } // 更新操作 rechargeReward.setUpdateId(user.getId()); rechargeRewardManager.updateRechargeReward(rechargeReward); } result.setSuccessInfo(); return SUCCESS; } /** * 删除充值奖励(逻辑删除) * @return */ public String deleteRechargeReward(){ // 充值/奖励主键必须check if (rechargeReward.getId() == null) { result.setParamErrorInfo("id"); return SUCCESS; } // 更新充值/奖励信息 rechargeReward.setIsDeleted(1); rechargeReward.setUpdateId(user.getId()); rechargeRewardManager.updateRechargeReward(rechargeReward); result.setSuccessInfo(); return SUCCESS; } public RechargeReward getRechargeReward() { return rechargeReward; } public void setRechargeReward(RechargeReward rechargeReward) { this.rechargeReward = rechargeReward; } public RechargeRewardDto getRechargeRewardDto() { return rechargeRewardDto; } public void setRechargeRewardDto(RechargeRewardDto rechargeRewardDto) { this.rechargeRewardDto = rechargeRewardDto; } }
181b78c54c95a767e33763cd0eb22207592bd525
e829b6904fd911c8bdd8defca2645028a56b68fb
/src/X1_Tong_quan_ung_dung_web/Bai_Thuc_Hanh/Ung_dung_chuyen_doi_tien_te.java
f7c4e6ab23f6a31840b0c4c52df7ecf6952e88f9
[]
no_license
LeDinhQuoc24/LeDinhQuoc-Java_Web
736fb1bf1d8bcf4e6357e7f83f91cce29a189a44
43526fac4b5e5ebd295acd93213360011994dd0b
refs/heads/master
2021-05-19T00:40:29.183965
2020-03-31T12:37:49
2020-03-31T12:37:49
251,499,067
0
0
null
null
null
null
UTF-8
Java
false
false
1,169
java
package X1_Tong_quan_ung_dung_web.Bai_Thuc_Hanh; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; @WebServlet(name = "Ung_dung_chuyen_doi_tien_te",urlPatterns = "/convert") public class Ung_dung_chuyen_doi_tien_te extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { float rate = Float.parseFloat(request.getParameter("rate")); float usd = Float.parseFloat(request.getParameter("usd")); float vnd = rate * usd; PrintWriter writer = response.getWriter(); writer.println("<html>"); writer.println("<h1>Rate: " + rate+ "</h1>"); writer.println("<h1>USD: " + usd+ "</h1>"); writer.println("<h1>VND: " + vnd+ "</h1>"); writer.println("</html>"); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } }
0466c22a0c3e4be6b2433ed8ccdb525206d76af1
52e6c997762165a2a9404fee8208179e29a8975b
/src/net/linxdroid/lolinterpreter/Program.java
a299eba052ee211e9c68f9feb451a48d4fe2268d
[]
no_license
morristech/LOLCodeInterpreter
3bbc6ac73c538a585ca3d4a62e0f22d493496a9c
4758dcfc35b46c194daad22da4c4b63a5f3554ad
refs/heads/master
2021-01-17T21:47:18.180961
2013-09-22T04:13:57
2013-09-22T04:13:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
28,210
java
/* * Java LOLCODE - LOLCODE parser and interpreter (http://lolcode.com/) * Copyright (C) 2007-2011 Brett Kail ([email protected]) * http://bkail.public.iastate.edu/lolcode/ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package net.linxdroid.lolinterpreter; import java.util.ArrayList; import java.util.List; import java.util.Map; class Program { private boolean version1_1; private Block mainBlock; public Program(boolean version1_1, Block mainBlock) { this.version1_1 = version1_1; this.mainBlock = mainBlock; } public boolean isVersion1_1() { return version1_1; } public Block getMainBlock() { return mainBlock; } public static class Block { private int numVariables; private List<Statement> statements; public Block(int numVariables, List<Statement> statements) { this.numVariables = numVariables; this.statements = statements; } public int getNumVariables() { return numVariables; } public List<Statement> getStatements() { return statements; } } public static class Function extends Block { private int numArguments; public Function(int numVariables, List<Statement> statements, int numArguments) { super(numVariables, statements); this.numArguments = numArguments; } public int getNumArguments() { return numArguments; } } public interface StatementVisitor { // assignment public void visit(DeclareVariableStatement stmt); public void visit(DeclareSlotStatement stmt); public void visit(AssignItStatement stmt); public void visit(AssignVariableStatement stmt); public void visit(AssignGlobalVariableStatement stmt); public void visit(AssignSlotStatement stmt); public void visit(AssignInMahStatement stmt); // terminal-based public void visit(ByesStatement stmt); public void visit(VisibleStatement stmt); // flow control public void visit(ORlyStatement stmt); public void visit(WTFStatement stmt); public void visit(GTFOStatement stmt); public void visit(ImInYrStatement stmt); public void visit(FoundYrStatement stmt); // 1.3 bukkit public void visit(OHaiStatement stmt); // 1.3 exception public void visit(PlzStatement stmt); public void visit(RTFMStatement stmt); // 1.3 loop2 public void visit(WhateverStatement stmt); } public interface ExpressionVisitor { // types public void visit(NoobExpression expr); public void visit(TroofExpression expr); public void visit(NumbrExpression expr); public void visit(NumbarExpression expr); public void visit(YarnExpression expr); public void visit(BukkitExpression expr); public void visit(FunctionExpression expr); // variable/function public void visit(ItExpression expr); public void visit(VariableExpression expr); public void visit(GlobalVariableExpression expr); public void visit(FunctionCallExpression expr); public void visit(ObjectExpression expr); public void visit(SlotExpression expr); public void visit(SlotFunctionCallExpression expr); // in mah public void visit(InMahExpression expr); public void visit(GetInMahBukkitExpression expr); public void visit(AssignInMahBukkitInMahExpression expr); // math public void visit(SumExpression expr); public void visit(DiffExpression expr); public void visit(ProduktExpression expr); public void visit(QuoshuntExpression expr); public void visit(ModExpression expr); public void visit(BiggrExpression expr); public void visit(SmallrExpression expr); // boolean public void visit(WonExpression expr); public void visit(NotExpression expr); public void visit(AllExpression expr); public void visit(AnyExpression expr); // comparison public void visit(BothSaemExpression expr); public void visit(DiffrintExpression expr); // concatenation public void visit(SmooshExpression expr); // casting public void visit(NoobCastExpression expr); public void visit(TroofCastExpression expr); public void visit(NumbrCastExpression expr); public void visit(NumbarCastExpression expr); public void visit(YarnCastExpression expr); // terminal-based public void visit(GimmehExpression expr); // 1.0/1.1 operators public void visit(MathNumbrExpression expr); public void visit(BigrThanExpression expr); public void visit(SmalrThanExpression expr); // 1.3 loop2 public void visit(BukkitSlotsExpression expr); public void visit(HowBigIzExpression expr); // java public void visit(JavaExpression expr); } public interface Statement { public abstract void visit(StatementVisitor visitor); } public static class DeclareVariableStatement implements Statement { private int index; private Expression value; public DeclareVariableStatement(int index, Expression value) { this.index = index; this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public int getVariableIndex() { return index; } public Expression getValue() { return value; } } public static class DeclareSlotStatement implements Statement { private Expression bukkit; private String name; private Expression value; public DeclareSlotStatement(Expression bukkit, String name, Expression value) { this.bukkit = bukkit; this.name = name; this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getBukkit() { return bukkit; } public String getName() { return name; } public Expression getValue() { return value; } } public static class AssignItStatement implements Statement { private Expression value; public AssignItStatement(Expression value) { this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getValue() { return value; } } public static class AssignVariableStatement implements Statement { private int index; private Expression value; public AssignVariableStatement(int index, Expression value) { this.index = index; this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public int getVariableIndex() { return index; } public Expression getValue() { return value; } } public static class AssignGlobalVariableStatement implements Statement { private int index; private Expression value; public AssignGlobalVariableStatement(int index, Expression value) { this.index = index; this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public int getVariableIndex() { return index; } public Expression getValue() { return value; } } public static class AssignSlotStatement implements Statement { private Expression bukkit; private Expression index; private Expression value; public AssignSlotStatement(Expression bukkit, Expression index, Expression value) { this.bukkit = bukkit; this.index = index; this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getBukkit() { return bukkit; } public Expression getIndex() { return index; } public Expression getValue() { return value; } } public static class AssignInMahStatement implements Statement { private Statement stmt; private Expression bukkit; private Expression index; private Expression value; public AssignInMahStatement(Statement stmt, Expression bukkit, Expression index, Expression value) { this.stmt = stmt; this.bukkit = bukkit; this.index = index; this.value = value; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Statement getAssignStatement() { return stmt; } public Expression getBukkit() { return bukkit; } public Expression getIndex() { return index; } public Expression getValue() { return value; } } public static class ByesStatement implements Statement { private Expression exitCode; private Expression message; public ByesStatement(Expression exitCode, Expression message) { this.exitCode = exitCode; this.message = message; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getExitCode() { return exitCode; } public Expression getMessage() { return message; } } public static class VisibleStatement implements Statement { private boolean invisible; private List<Expression> exprs; private boolean suppressNewLine; public VisibleStatement(boolean invisible, List<Expression> exprs, boolean suppressNewLine) { this.invisible = invisible; this.exprs = exprs; this.suppressNewLine = suppressNewLine; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public boolean isInvisible() { return invisible; } public List<Expression> getExpressions() { return exprs; } public boolean isSuppressNewLine() { return suppressNewLine; } } public static class ORlyStatement implements Statement { private Expression expr; private List<Statement> yaRly; private List<Statement> noWai; public ORlyStatement(Expression expr, List<Statement> yaRly, List<Statement> noWai) { this.expr = expr; this.yaRly = yaRly; this.noWai = noWai; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getExpression() { return expr; } public List<Statement> getYaRly() { return yaRly; } public List<Statement> getNoWai() { return noWai; } } public static class WTFStatement implements Statement { private List<Statement> statements; private Map<Value, Integer> labels; private int omgWTFIndex; private Expression expr; public WTFStatement(List<Statement> statements, Map<Value, Integer> labels, int omgWTFIndex, Expression expr) { this.statements = statements; this.labels = labels; this.omgWTFIndex = omgWTFIndex; this.expr = expr; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public List<Statement> getStatements() { return statements; } public Map<Value, Integer> getLabels() { return labels; } public int getOMGWTFIndex() { return omgWTFIndex; } public Expression getExpression() { return expr; } } public static class GTFOStatement implements Statement { public static final Statement INSTANCE = new GTFOStatement(0); private int depth; private GTFOStatement() { } public GTFOStatement(int depth) { this.depth = depth; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public int getDepth() { return depth; } } public static class ImInYrStatement implements Statement { private List<Statement> stmts; private Expression variable; private boolean til; private Expression expr; public ImInYrStatement(List<Statement> stmts, Expression variable, boolean til, Expression expr) { this.stmts = stmts; this.variable = variable; this.til = til; this.expr = expr; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public List<Statement> getStatements() { return stmts; } public Expression getVariable() { return variable; } public boolean isTil() { return til; } public Expression getExpression() { return expr; } } public static class FoundYrStatement implements Statement { private Expression expr; public FoundYrStatement(Expression expr) { this.expr = expr; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getExpression() { return expr; } } public static class OHaiStatement implements Statement { private Expression expr; private List<Statement> stmts; public OHaiStatement(Expression expr, List<Statement> stmts) { this.expr = expr; this.stmts = stmts; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getExpression() { return expr; } public List<Statement> getStatements() { return stmts; } } public static class PlzStatement implements Statement { private List<Statement> stmts; private List<ONoes> oNoes; private List<Statement> awsumThx; public PlzStatement(List<Statement> stmts, List<ONoes> oNoes, List<Statement> awsumThx) { this.stmts = stmts; this.oNoes = oNoes; this.awsumThx = awsumThx; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public List<Statement> getStatements() { return stmts; } public List<ONoes> getONoes() { return oNoes; } public List<Statement> getAwsumThx() { return awsumThx; } public static class ONoes { private Expression expr; private List<Statement> stmts; public ONoes(Expression expr, List<Statement> stmts) { this.expr = expr; this.stmts = stmts; } public Expression getExpression() { return expr; } public List<Statement> getStatements() { return stmts; } } } public static class RTFMStatement implements Statement { private Expression expr; public RTFMStatement(Expression expr) { this.expr = expr; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public Expression getExpression() { return expr; } } public static class WhateverStatement implements Statement { private List<Statement> updateStmts; public WhateverStatement(List<Statement> updateStmts) { this.updateStmts = updateStmts; } public void visit(StatementVisitor visitor) { visitor.visit(this); } public List<Statement> getUpdateStatements() { return updateStmts; } } public interface Expression { void visit(ExpressionVisitor visitor); } public static abstract class UnaryExpression implements Expression { private Expression expression; public UnaryExpression(Expression expression) { this.expression = expression; } public Expression getExpression() { return expression; } } public static abstract class BinaryExpression implements Expression { private Expression left; private Expression right; public BinaryExpression(Expression left, Expression right) { this.left = left; this.right = right; } @Override public String toString() { return super.toString() + '[' + left + ", " + right + ']'; } public Expression getLeftExpression() { return left; } public Expression getRightExpression() { return right; } } public static abstract class InfiniteArityExpression implements Expression { private List<Expression> exprs; public InfiniteArityExpression(List<Expression> exprs) { this.exprs = exprs; } @Override public String toString() { return super.toString() + exprs; } public List<Expression> getExpressions() { return exprs; } } public static class NoobExpression implements Expression { public static final Expression INSTANCE = new NoobExpression(); private NoobExpression() { } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class TroofExpression implements Expression { public static final Expression FAIL = new TroofExpression(false); public static final Expression WIN = new TroofExpression(true); private boolean value; private TroofExpression(boolean value) { this.value = value; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public boolean getValue() { return value; } } public static class NumbrExpression implements Expression { private int value; public NumbrExpression(int value) { this.value = value; } @Override public String toString() { return super.toString() + '[' + value + ']'; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public int getValue() { return value; } } public static class NumbarExpression implements Expression { private float value; public NumbarExpression(float value) { this.value = value; } @Override public String toString() { return super.toString() + '[' + value + ']'; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public float getValue() { return value; } } public static class YarnExpression implements Expression { private String value; public YarnExpression(String value) { this.value = value; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public String getValue() { return value; } } public static class BukkitExpression implements Expression { public static Expression INSTANCE = new BukkitExpression(); private Expression liek; private BukkitExpression() { } public BukkitExpression(Expression liek) { this.liek = liek; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Expression getLiek() { return liek; } } public static class FunctionExpression implements Expression { private Function function; public FunctionExpression(Function function) { this.function = function; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Function getFunction() { return function; } } public static class ItExpression implements Expression { public static Expression INSTANCE = new ItExpression(); private ItExpression() { } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class VariableExpression implements Expression { private int index; public VariableExpression(int index) { this.index = index; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public int getIndex() { return index; } } public static class GlobalVariableExpression implements Expression { private int index; public GlobalVariableExpression(int index) { this.index = index; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public int getIndex() { return index; } } public static class FunctionCallExpression implements Expression { private Function function; private Expression[] arguments; public FunctionCallExpression(Function function, Expression[] arguments) { this.function = function; this.arguments = arguments; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Function getFunction() { return function; } public Expression[] getArguments() { return arguments; } } public static class ObjectExpression implements Expression { public static Expression THIS = new ObjectExpression(false); public static Expression OUTER = new ObjectExpression(true); private boolean outer; private ObjectExpression(boolean outer) { this.outer = outer; } @Override public String toString() { return super.toString() + (outer ? "[OUTER]" : "[THIS]"); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public boolean isOuter() { return outer; } } public static class SlotExpression implements Expression { private Expression bukkit; private Expression index; public SlotExpression(Expression bukkit, Expression index) { this.bukkit = bukkit; this.index = index; } @Override public String toString() { return super.toString() + '[' + bukkit + ", " + index + ']'; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Expression getBukkit() { return bukkit; } public Expression getIndex() { return index; } } public static class SlotFunctionCallExpression implements Expression { private Expression bukkit; private Expression index; private List<Expression> arguments; public SlotFunctionCallExpression(Expression bukkit, Expression index, List<Expression> arguments) { this.bukkit = bukkit; this.index = index; this.arguments = arguments; } @Override public String toString() { return super.toString() + '[' + bukkit + ", " + index + ", " + arguments + ']'; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Expression getBukkit() { return bukkit; } public Expression getIndex() { return index; } public List<Expression> getArguments() { return arguments; } } public static class InMahExpression implements Expression { private Expression bukkit; private Expression index; public InMahExpression(Expression bukkit, Expression index) { this.bukkit = bukkit; this.index = index; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Expression getBukkit() { return bukkit; } public Expression getIndex() { return index; } } public static class GetInMahBukkitExpression extends UnaryExpression { public GetInMahBukkitExpression(Expression expr) { super(expr); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class AssignInMahBukkitInMahExpression implements Expression { private Expression bukkit; private Expression index; public AssignInMahBukkitInMahExpression(Expression bukkit, Expression index) { this.bukkit = bukkit; this.index = index; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public Expression getBukkit() { return bukkit; } public Expression getIndex() { return index; } } public static class SumExpression extends BinaryExpression { public SumExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class DiffExpression extends BinaryExpression { public DiffExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class ProduktExpression extends BinaryExpression { public ProduktExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class QuoshuntExpression extends BinaryExpression { public QuoshuntExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class ModExpression extends BinaryExpression { public ModExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class BiggrExpression extends BinaryExpression { public BiggrExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class SmallrExpression extends BinaryExpression { public SmallrExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class WonExpression extends BinaryExpression { public WonExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class NotExpression extends UnaryExpression { public NotExpression(Expression expr) { super(expr); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class AllExpression extends InfiniteArityExpression { public AllExpression(List<Expression> exprs) { super(exprs); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class AnyExpression extends InfiniteArityExpression { public AnyExpression(List<Expression> exprs) { super(exprs); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class BothSaemExpression extends BinaryExpression { public BothSaemExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class DiffrintExpression extends BinaryExpression { public DiffrintExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class SmooshExpression extends InfiniteArityExpression { public SmooshExpression(List<Expression> exprs) { super(exprs); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class NoobCastExpression extends UnaryExpression { public NoobCastExpression(Expression expression) { super(expression); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class TroofCastExpression extends UnaryExpression { public TroofCastExpression(Expression expression) { super(expression); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class NumbrCastExpression extends UnaryExpression { public NumbrCastExpression(Expression expression) { super(expression); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class NumbarCastExpression extends UnaryExpression { public NumbarCastExpression(Expression expression) { super(expression); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class YarnCastExpression extends UnaryExpression { public YarnCastExpression(Expression expression) { super(expression); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class GimmehExpression implements Expression { public static final int LINE = 0; public static final int WORD = 1; public static final int LETTAR = 2; private int what; public GimmehExpression(int what) { this.what = what; } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } public int getWhat() { return what; } } public static class MathNumbrExpression extends UnaryExpression { public MathNumbrExpression(Expression expr) { super(expr); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class BigrThanExpression extends BinaryExpression { public BigrThanExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class SmalrThanExpression extends BinaryExpression { public SmalrThanExpression(Expression left, Expression right) { super(left, right); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class BukkitSlotsExpression extends UnaryExpression { public BukkitSlotsExpression(Expression expr) { super(expr); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class HowBigIzExpression extends UnaryExpression { public HowBigIzExpression(Expression expr) { super(expr); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } public static class JavaExpression extends UnaryExpression { public JavaExpression(Expression expr) { super(expr); } public void visit(ExpressionVisitor visitor) { visitor.visit(this); } } }
28bf772007f8008ff422877a459b348ee3fc515c
808ab3c322c35779e0e5e9b514eeabae74d2e7b2
/src/sample/Sample3_3.java
7b98b7d4fc1e53c775f6a2a38a1e1d5cedaa73a2
[]
no_license
s4t02h1/aiproject
aa85ca8b51abc689ecfa25f4450b8dc4090e968f
d7c9d98e83af164dd0aee8d58aa6121934a83b6d
refs/heads/master
2022-11-20T04:24:16.601537
2020-07-13T07:07:03
2020-07-13T07:07:03
271,216,548
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package sample; class Sample3_3 { public static void main(String[] args) { int a = 10; int b = 10; int c = 10; int d = 10; System.out.println(a++); System.out.println(++b); System.out.println(c--); System.out.println(--d); a = 10; b = 10; c = 10; d = 10; b = ++a;//�O�u System.out.println("a =" + a + "b =" + b); d = c++;//��u System.out.println("c =" + c + "d =" + d); } }
[ "eeb-tosh-16@DESKTOP-NT4PNTH" ]
eeb-tosh-16@DESKTOP-NT4PNTH
9c1f7657d572331548e56b753adcd20f6605ff85
f61af2722d3fa87e6ef05dea4cee09bfc9298506
/app/src/main/java/com/example/xiezhen/memoryleak/BroadcastReceiverActivity.java
195cb24624cd9665bef5ed75f2227cf4848efad9
[]
no_license
realxz/MemoryLeak
96db5a4c2d956c37dea728fe6eba09f7d35bde01
8db9ed44f811df2e9d92ff464c8a36dbc9cb48d6
refs/heads/master
2021-01-22T22:24:17.134134
2017-03-20T07:53:50
2017-03-20T07:53:50
85,539,945
5
0
null
null
null
null
UTF-8
Java
false
false
1,210
java
package com.example.xiezhen.memoryleak; import android.content.IntentFilter; import android.net.wifi.WifiManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; public class BroadcastReceiverActivity extends AppCompatActivity { NetworkReceiver receiver; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_broadcast_receiver); wifiListener(); } private void wifiListener() { IntentFilter intentFilter = new IntentFilter(); //添加的action就是我们要监听的广播,wifi开关的时候,系统都会发送这条广播。 intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); receiver = new NetworkReceiver(); //通过registerReceiver方法,将我们创建的Receiver以及 InterFilter传入,完成注册。 this.registerReceiver(receiver, intentFilter); } @Override protected void onDestroy() { super.onDestroy(); // unregisterReceiver(receiver); } public void closeActivity(View view) { this.finish(); } }
4306ff19d2eb0d204bd1c60d889d97b997854f14
0a0e3d1435ce7a246ec11992d5a68d99085fd3dc
/src/main/java/aleksey/prostakov/generator/example/ExampleInterface.java
7b074f4aad7defd87cd5fe174e24c282c8fb8274
[]
no_license
ProstakovAlexey/graph_example
a41cdd65ffbcfa30354c0505ae3e825b35e2e8b9
ce40e4d601f0516f037550b1c17703b2f79a9961
refs/heads/main
2023-02-06T17:57:06.632814
2020-12-27T16:25:22
2020-12-27T16:25:22
324,801,191
0
0
null
null
null
null
UTF-8
Java
false
false
236
java
package aleksey.prostakov.generator.example; import java.io.IOException; public interface ExampleInterface { public void init(); public void make(); public String print() throws IOException; public String getName(); }
64dae8d55b36df2fc3090b284f0acafb274234a1
5e53cea57be97f773db2567667beb3941488358b
/src/main/java/io/github/vvd/hellobank/service/mapper/package-info.java
375e1cba7f21549b542f3c2a9429ecc63c02b28d
[]
no_license
BulkSecurityGeneratorProject/HelloBank
00db8e1222c0ad20da948c8e1c3f6fe9982d7c5f
5a131d9dcbccd3e61aae4e9a76e433bb57707dcc
refs/heads/master
2022-12-16T18:55:01.539928
2018-01-08T20:57:02
2018-01-08T20:57:02
296,637,515
0
0
null
null
null
null
UTF-8
Java
false
false
131
java
/** * MapStruct mappers for mapping domain objects and Data Transfer Objects. */ package io.github.vvd.hellobank.service.mapper;
6f628ba07ec253968621b0eeccd9323d79455bd4
558ad40723ed9c8298ec52bd93aab94516c5b686
/Clase2020/src/tema9/sincronizacion/PruebaInteraccionProblemaHilos.java
25ec1dc1ec5ae7a8533e9ecb821c91d9646af2f6
[]
no_license
andoni-eguiluz/ud-prog2-clase-2020
a46a9addf160974b7b28924f8180b7cc560dd941
92847a201d13920ff7b0308e8c07bb85e6fb8259
refs/heads/master
2021-07-17T02:53:41.199615
2021-02-14T16:37:25
2021-02-14T16:37:25
237,613,459
3
4
null
null
null
null
UTF-8
Java
false
false
2,213
java
package tema9.sincronizacion; import java.util.*; /** Problema de interacción entre hilos concurrentes sobre la misma estructura de datos * @author andoni.eguiluz at ingenieria.deusto.es */ public class PruebaInteraccionProblemaHilos { private static int tipoProblema = 2; // 1 - string único manipulado por partes 2 - ArrayList de chars public static void main(String[] args) { Thread hilo1 = new Hilo1(); Thread hilo2 = new Hilo2(); hilo1.start(); hilo2.start(); } private static String datoCompartido = ""; // problema 1 private static ArrayList<Character> listaCompartida = new ArrayList<>(); // problema 2 private static char[] cars = { 'a', 'b', 'c', 'd', 'e', 'f' }; private static int cont = 0; // Mete un carácter en datoCompartido por la derecha private static /*synchronized*/ void metecaracter(char car) { // System.out.println( "Entra MC"); if (tipoProblema == 1) { String antiguo = datoCompartido + ""; antiguo = antiguo + car; datoCompartido = antiguo; } else if (tipoProblema == 2) { listaCompartida.add( car ); } // System.out.println( "Sale MC"); } // Saca y visualiza un carácter en datoCompartido por la izquierda private static /*synchronized*/ void sacaCaracter() { // System.out.println( "Entra SC"); if (tipoProblema == 1) { if (datoCompartido.length()>0) { String dato = datoCompartido + ""; char car = dato.charAt(0); System.out.print( car ); cont++; if (cont==60) { cont = 0; System.out.println(); } dato = dato.substring( 1 ); datoCompartido = dato; } } else if (tipoProblema == 2) { if (!listaCompartida.isEmpty()) { char car = listaCompartida.remove( 0 ); System.out.print( car ); cont++; if (cont==60) { cont = 0; System.out.println(); } } } // System.out.println( "Sale SC"); } // Clase productora de datos static class Hilo1 extends Thread { public void run() { while (true) { for (char car : cars) metecaracter( car ); } } } // Clase consumidora de datos static class Hilo2 extends Thread { public void run() { while (true) { sacaCaracter(); } } } }
ba964dd39c82781655f07ae54e9508752adee9de
713672f5606fb8b8e66165e458ff053320eb7471
/ToDuyNghia_Nhom1/src/baitapso5/bai1/ViewJFrame.java
24e93a79d7c7a06d0b8a94638ebb0847797d818b
[]
no_license
luffyMonster/HWJava
68ba34743d532c0fc160e54cd40f832168c97ae1
bf484b77667caa7483ec91299068c606c0536322
refs/heads/master
2020-06-12T07:07:33.943696
2017-01-04T07:01:37
2017-01-04T07:01:37
75,598,424
0
0
null
null
null
null
UTF-8
Java
false
false
18,128
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 baitapso5.bai1; import java.io.EOFException; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.table.DefaultTableModel; /** * * @author luffy monster */ public class ViewJFrame extends javax.swing.JFrame { ArrayList<Sach> listSach; ArrayList<BanDoc> listBD; ArrayList<QuanLy> listQL; /** * Creates new form ViewJFrame */ public ViewJFrame() { initComponents(); listBD = new ArrayList<>(); listSach = new ArrayList<>(); listQL = new ArrayList<>(); docFile(listSach, "SACH.INP"); docFile(listBD, "BD.INP"); docFile(listQL, "QL.INP"); listSach.add(new Sach(123)); loadTable(sachTable, listSach); } <E> void docFile(ArrayList<E> list, String fname) { FileInputStream f; ObjectInputStream ois; try { f = new FileInputStream(fname); ois = new ObjectInputStream(f); while (true) { try { Object o = ois.readObject(); E e = (E) o; list.add(e); } catch (EOFException e) { break; } catch (Exception e) { // e.printStackTrace(); ois = new ObjectInputStream(f); } } } catch (FileNotFoundException e) { } catch (Exception e) { System.err.println("Luong doc loi!"); // e.printStackTrace(); } finally { } } static <E> void ghiFile(ArrayList<E> list, String fname) { FileOutputStream f = null; ObjectOutputStream oos; try { f = new FileOutputStream(fname); oos = new ObjectOutputStream(f); for (Object s : list) { oos.writeObject(s); } f.close(); } catch (FileNotFoundException ex) { Logger.getLogger(ViewJFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ViewJFrame.class.getName()).log(Level.SEVERE, null, ex); } finally { try { f.close(); } catch (IOException ex) { Logger.getLogger(ViewJFrame.class.getName()).log(Level.SEVERE, null, ex); } } } <E extends TableIO> void loadTable(javax.swing.JTable table, ArrayList<E> list) { DefaultTableModel model = (DefaultTableModel) table.getModel(); model.getDataVector().removeAllElements(); for (E e:list){ model.addRow(e.toObject()); } } /** * 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() { jTabbedPane2 = new javax.swing.JTabbedPane(); jTabbedPane3 = new javax.swing.JTabbedPane(); jTabbedPane4 = new javax.swing.JTabbedPane(); jPanel3 = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); tenn = new javax.swing.JLabel(); tacGiaa = new javax.swing.JLabel(); chuyenNganhh = new javax.swing.JLabel(); nam = new javax.swing.JLabel(); ten = new javax.swing.JTextField(); tacGia = new javax.swing.JTextField(); chuyenNganh = new javax.swing.JComboBox(); namXB = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); sachTable = new javax.swing.JTable(); themSach = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 100, Short.MAX_VALUE) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 100, Short.MAX_VALUE) ); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 100, Short.MAX_VALUE) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 100, Short.MAX_VALUE) ); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel1.setText("Sach"); tenn.setText("Tên"); tacGiaa.setText("Tac Gia"); chuyenNganhh.setText("Chuyen Nganh"); nam.setText("Nam Xuat Ban"); ten.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tenActionPerformed(evt); } }); tacGia.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tacGiaActionPerformed(evt); } }); chuyenNganh.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Khoa hoc tu nhien", "Dien tu vien thong", "Van hoc Nghe Thuat", "Cong nghe thong tin" })); chuyenNganh.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { chuyenNganhActionPerformed(evt); } }); namXB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { namXBActionPerformed(evt); } }); sachTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null}, {null, null, null, null, null}, {null, null, null, null, null}, {null, null, null, null, null} }, new String [] { "ID", "Ten sach", "Chuyen Nganh", "Tac Gia", "Nam xuat ban" } )); jScrollPane1.setViewportView(sachTable); themSach.setText("Them"); themSach.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { themSachActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 557, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(248, 248, 248) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(themSach) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(tenn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(nam, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(tacGiaa, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(chuyenNganhh, javax.swing.GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE)) .addGap(53, 53, 53) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(ten) .addComponent(tacGia) .addComponent(chuyenNganh, 0, 266, Short.MAX_VALUE) .addComponent(namXB)))))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(tenn) .addComponent(ten, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(tacGiaa) .addComponent(tacGia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(chuyenNganhh) .addComponent(chuyenNganh, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(nam) .addComponent(namXB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(27, 27, 27) .addComponent(themSach) .addGap(33, 33, 33) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)) ); jTabbedPane1.addTab("Sach", jPanel1); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 557, Short.MAX_VALUE) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 459, Short.MAX_VALUE) ); jTabbedPane1.addTab("tab2", jPanel2); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 557, Short.MAX_VALUE) ); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 459, Short.MAX_VALUE) ); jTabbedPane1.addTab("tab3", jPanel5); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 557, Short.MAX_VALUE) ); jPanel6Layout.setVerticalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 459, Short.MAX_VALUE) ); jTabbedPane1.addTab("tab4", jPanel6); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane1) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane1) ); pack(); }// </editor-fold>//GEN-END:initComponents private void namXBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_namXBActionPerformed // TODO add your handling code here: }//GEN-LAST:event_namXBActionPerformed private void chuyenNganhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chuyenNganhActionPerformed // TODO add your handling code here: }//GEN-LAST:event_chuyenNganhActionPerformed private void tacGiaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tacGiaActionPerformed // TODO add your handling code here: }//GEN-LAST:event_tacGiaActionPerformed private void tenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tenActionPerformed // TODO add your handling code here: }//GEN-LAST:event_tenActionPerformed private void themSachActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_themSachActionPerformed // TODO add your handling code here: }//GEN-LAST:event_themSachActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) throws IOException, FileNotFoundException, ClassNotFoundException { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(ViewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(ViewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(ViewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(ViewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ViewJFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JComboBox chuyenNganh; private javax.swing.JLabel chuyenNganhh; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JTabbedPane jTabbedPane2; private javax.swing.JTabbedPane jTabbedPane3; private javax.swing.JTabbedPane jTabbedPane4; private javax.swing.JLabel nam; private javax.swing.JTextField namXB; private javax.swing.JTable sachTable; private javax.swing.JTextField tacGia; private javax.swing.JLabel tacGiaa; private javax.swing.JTextField ten; private javax.swing.JLabel tenn; private javax.swing.JButton themSach; // End of variables declaration//GEN-END:variables }
fdf7f2d1fe2c1bb890aaab98807ff792b73d2752
becaf26483b2301ab453050d4dfb01c843adeec4
/mail2.java
86bf3bc76ae8b2dd3ad64ef5ddf1a9f092c67f0a
[]
no_license
ojas952/E-mail-client-software
6da3e2045bd3fb67e9ee1adc7d52afe48b4ca0b1
2c34af49714af31620faf33dd73524dded28ebbd
refs/heads/main
2023-02-28T03:15:51.118050
2021-02-08T05:14:28
2021-02-08T05:14:28
336,966,517
0
0
null
null
null
null
UTF-8
Java
false
false
6,941
java
import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Properties; import javax.mail.*; @SuppressWarnings("serial") public class mail2 extends JFrame { static String popServer; static String popUser; static String popPassword; public static void main(String args[]) { //popServer=args[0]; //popUser=args[1]; //popPassword=args[2]; JFrame frame = new mailframe(); frame.setVisible(true); } } @SuppressWarnings("serial") class mailframe extends JFrame implements ActionListener { JLabel lserver =new JLabel("SMTP Server"); static JTextField tserver = new JTextField(15); JLabel luname =new JLabel("UserName"); static JTextField tuname = new JTextField(15); JLabel lpass =new JLabel("Password"); static JPasswordField tpass = new JPasswordField(15); static JTextArea message = new JTextArea(30,72); public mailframe() { this.setSize(850,500); this.setLayout(new FlowLayout(FlowLayout.LEFT)); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } } ); tpass.setEchoChar('*'); this.add(lserver); this.add(tserver); this.add(luname); this.add(tuname); this.add(lpass); this.add(tpass); JButton b1 =new JButton("Fetch"); b1.addActionListener(this); this.add(b1); message.setEditable(false); JScrollPane sp = new JScrollPane(); message.add(sp); this.add(message); } public void actionPerformed(ActionEvent e) { System.out.println("debug button"); fetchmail(); } @SuppressWarnings("deprecation") private void fetchmail() { String popServer; String popUser; String popPassword; popServer = mailframe.tserver.getText(); popUser = mailframe.tuname.getText(); popPassword = mailframe.tpass.getText(); System.out.println(popServer); try { receive(popServer, popUser, popPassword); //receive("mail.imparttechnologies.com","[email protected]", "password123"); } catch (Exception ex) { System.out.println("Usage: java jmail"+" smtpServer address password "); } //System.exit(0); } public static void receive(String popServer, String popUser, String popPassword){ Store store=null; Folder folder=null; try { Properties props = System.getProperties(); Session session = Session.getDefaultInstance(props, null); store = session.getStore("pop3"); store.connect(popServer, popUser, popPassword); folder = store.getDefaultFolder(); if (folder == null) throw new Exception("No default folder"); folder = folder.getFolder("INBOX"); if (folder == null) throw new Exception("No POP3 INBOX"); folder.open(Folder.READ_ONLY); Message msgs[] = folder.getMessages(); BufferedReader reader = new BufferedReader (new InputStreamReader(System.in)); mailframe.message.setText(""); int msgNum; for (msgNum = 0; msgNum < msgs.length; msgNum++) { System.out.println(msgNum +": "+ msgs[msgNum].getFrom()[0]+ "\t" + msgs[msgNum].getSubject()); System.out.println("Do you want to read message? [YES to read/QUIT to end]"); String line = reader.readLine(); String y = "yes"; int j = line.compareTo(y); if (j == 0) { //System.out.println(((Message)msgs[msgNum].getContent()).toString()); //System.out.println(msgNum +": "+ msgs[msgNum].getFrom()[0]+ "\t" + msgs[msgNum].getSubject()); msgs[msgNum].writeTo(System.out); //test run start --------> Object content = msgs[msgNum].getContent(); if (content instanceof Multipart) { StringBuffer messageContent = new StringBuffer(); StringBuffer msg = new StringBuffer(); Multipart multipart = (Multipart) content; for (int i = 0; i < multipart.getCount(); i++) { Part part = (Part) multipart.getBodyPart(i); if (part.isMimeType("text/plain")) { msg = messageContent.append(part.getContent().toString()); String msg1 = new String(); String from = new String(); String subj = new String(); int k ; k = msgNum; msg1 = msg.toString(); subj = msgs[msgNum].getSubject(); from = msgs[msgNum].getFrom()[0].toString(); mailframe.message.append("Message No:"+(k+1)+"\n"); mailframe.message.append("Message From:"+from+"\n"); mailframe.message.append("Message Subject:"+subj+"\n"); mailframe.message.append("\n"+msg1+"\n"); } } //return messageContent.toString(); } else { //return content.toString(); } //System.out.println("Debug 1 -> for 1 -> if yes"); } else { System.out.println("Closing Previous Message. Going For Next."); //break; } //msgs[msgNum].writeTo(System.out); } //System.exit(0); } catch (Exception ex) { ex.printStackTrace(); } finally { try { if (folder!=null) folder.close(false); if (store!=null) store.close(); } catch (Exception ex2) {ex2.printStackTrace();} } } }
b072e44416440cfff244bf6161f3b2f52d7a91c2
f2c6fa884943c62d7859f6c9d1bf10dd30824b5d
/Round Off/Main.java
662b924b3c3474baf9c18e66a4f95a39d741a60c
[]
no_license
syalshubham/Playground
d72317b1a68db2c03e3a4a53e4a042974d7bd519
791975b9827fca283ec87fc004510dad746e6ef3
refs/heads/master
2023-08-09T03:19:23.623849
2020-09-07T06:07:23
2020-09-07T06:07:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
85
java
import math a=float(input()) print(int(a)) print(math.ceil(a)) print(math.ceil(a-1))
7d4bf9e0672353a84c501a9f4856cc9dcdfdf049
bfdcd9fdf3899e6bb833c53d535b74f19609e669
/cn.cloud.shop-api/cn.cloud.user-api/src/main/java/cn/cloud/user_api/utils/base/RedisUtils.java
6ee8bb457c26e8806c39f5084f16343c29dce4b9
[]
no_license
Dreamwei-cn/cn.cloud
15451bea98568a6a397e1823dd8dd8b59ef7ed00
33ba365c9c7dde0b887a2798b8139adfdda11104
refs/heads/master
2022-06-20T12:17:20.491138
2020-01-07T15:28:19
2020-01-07T15:28:19
196,153,894
0
0
null
2022-06-17T02:17:37
2019-07-10T07:23:31
Java
UTF-8
Java
false
false
545
java
package cn.cloud.user_api.utils.base; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.util.Assert; public class RedisUtils extends cn.cloud.common.util.RedisUtils { @Autowired private StringRedisTemplate sTemplate; public void sendMessage(String channel, String message) { Assert.notNull(channel, "消息主题不能为空"); Assert.notNull(message, "不能发送空消息"); sTemplate.convertAndSend(channel, message); } }
7560cdb4e27bce6b58e7790575e220482c00d56c
912ab6ad25d968a2a82a15ec76b1d6342b4cd6d5
/Brick.java
a2507d158c754278fcd4a30d307adf49e6b3ee9e
[]
no_license
binjung/Breakout-in-Java
6b59fc7a7c1c83c26e9a41f07c86b4b4ee1648fd
ae51ff50a831d7fee522d026e088434c3c392085
refs/heads/master
2021-01-12T03:17:52.870410
2017-01-06T06:45:38
2017-01-06T06:45:38
78,181,131
0
0
null
null
null
null
UTF-8
Java
false
false
800
java
import java.awt.geom.*; import java.awt.*; public class Brick extends ColorShape { private int xPos = 0; private int yPos = 0; private int width = 0; private int height = 0; private Rectangle2D.Double shape; // constructor public Brick(int x, int y, int w, int h, Color c) { super(new Rectangle2D.Double(x, y, w, h)); // set brick color super.setFillColor(c); super.setBorderColor(c); //set brick x, y, width, and height xPos = x; yPos = y; width = w; height = h; // update shape //shape.setRect(xPos, yPos, width, height); shape = new Rectangle2D.Double(xPos,yPos,width,height); } public int getX() { return xPos; } public Rectangle2D.Double getShape() { return shape; } }
73f4a0eb34c57d4361de1c4e4bacdf5446eb1285
393a7e3cb20d80623e1648faad53964ffe7aa371
/src/main/java/com/javaex/controller/Hello.java
0ad175d430a1cc222a5a8cd6a78700f801f08e11
[]
no_license
werg147/guestbook3
677488dd4e6355b10005709c34dd808f94ee9ea5
f1eaacc5cc7b6d8b366892a85a89027689c3f549
refs/heads/master
2023-02-23T00:08:00.400178
2021-01-21T04:18:50
2021-01-21T04:18:50
331,238,161
0
0
null
null
null
null
UTF-8
Java
false
false
335
java
package com.javaex.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class Hello { @RequestMapping( "/hello") public String hello(){ System.out.println("/hellospring/hello"); return "/WEB-INF/views/index.jsp"; } }
[ "장세림@DESKTOP-1CIRGN6" ]
장세림@DESKTOP-1CIRGN6
561955b4522fabaf1bfadfcc1812019b8778cd79
ccd21a0a11d760c49b645bf298f066eab25acfd0
/main/java-maven/drapi/src/test/java/com/ecofactor/qa/automation/drapi/DRAPI_Execution_Test.java
505573be9158c597cb6bd00e2ecf97e02d7c48d2
[]
no_license
vselvaraj-ecofactor/QA-Automation
71a73f895b17f9a4bdcdd6c4c68b18ba52467b8b
b84d7c8c94ecbede3709d00817c6e87fac21f6d1
refs/heads/master
2021-01-01T08:53:34.406991
2015-02-24T06:17:13
2015-02-24T06:17:13
30,956,434
0
0
null
null
null
null
UTF-8
Java
false
false
18,266
java
/* * DRAPI_Execution_Test.java * Copyright (c) 2014, EcoFactor, All Rights Reserved. * * This software is the confidential and proprietary information of EcoFactor * ("Confidential Information"). You shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement you entered into with * EcoFactor. */ package com.ecofactor.qa.automation.drapi; import static com.ecofactor.qa.automation.platform.util.LogUtil.setLogString; import java.lang.reflect.Method; import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import org.apache.http.HttpResponse; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Guice; import org.testng.annotations.Test; import com.ecofactor.common.pojo.EcpCoreLSEventLocation; import com.ecofactor.common.pojo.timeseries.PartitionedThermostatEvent; import com.ecofactor.qa.automation.dao.DaoModule; import com.ecofactor.qa.automation.dao.dr.EventControlDao; import com.ecofactor.qa.automation.dao.dr.LSProgramEventDao; import com.ecofactor.qa.automation.dao.dr.LSProgramEventLocationDao; import com.ecofactor.qa.automation.dao.dr.LSProgramEventReportDao; import com.ecofactor.qa.automation.dao.dr.ThermostatDao; import com.ecofactor.qa.automation.dao.dr.ThermostatEventDao; import com.ecofactor.qa.automation.drapi.data.DRAPIDataProvider; import com.ecofactor.qa.automation.platform.constants.Groups; import com.ecofactor.qa.automation.util.DateUtil; import com.ecofactor.qa.automation.util.UtilModule; import com.ecofactor.qa.automation.util.WaitUtil; import com.google.inject.Inject; /** * The Class DRAPI_Execution_Test. * @author $Author:$ * @version $Rev:$ $Date:$ */ @Guice(modules = { UtilModule.class, DaoModule.class, DRApiModule.class }) public class DRAPI_Execution_Test extends AbstractTest { /** The astatus. */ private static String ASTATUS = "ACTIVE"; /** The pstatus. */ private static String PSTATUS = "PENDING"; /** The istatus. */ private static String ISTATUS = "INACTIVE"; /** The sstatus. */ private static String SSTATUS = "SKIPPED"; /** The drapitest. */ @Inject private DRAPI_Test drapitest; /** The api config. */ @Inject private static DRApiConfig apiConfig; /** The ls pro event. */ @Inject private LSProgramEventDao lsProEvent; /** The e control. */ @Inject private EventControlDao eControl; /** The lsp event report. */ @Inject private LSProgramEventReportDao lspEventReport; /** The tstat event. */ @Inject private ThermostatEventDao tstatEvent; /** The lsp event location. */ @Inject private LSProgramEventLocationDao lspEventLocation; /** The tsat. */ @Inject private ThermostatDao tsat; /** * Before method. * @param method the method * @param param the param * @see com.ecofactor.qa.automation.consumerapi.AbstractTest#beforeMethod(java.lang.reflect.Method, * java.lang.Object[]) */ @BeforeMethod(alwaysRun = true) public void beforeMethod(final Method method, final Object[] param) { logUtil.logStart(method, param, null); startTime = System.currentTimeMillis(); } /** * Test_create_dr_event_ecofactor Corporation. * @param drUrl the dr url * @param programID the program id * @param eventID the event id * @param targetType the target type * @param targetALLJson the target all json * @throws ParseException the parse exception */ @Test(groups = { Groups.SANITY1 }, dataProvider = "createDRALLGatewaysECO", dataProviderClass = DRAPIDataProvider.class, priority = 2) public void drEventForEco(final String drUrl, final String programID, final String eventID, final String targetType, final String targetALLJson) throws ParseException { long timeStamp = System.currentTimeMillis(); String createUrl = drUrl; createUrl = createUrl.replaceFirst("<program_id>", programID) .replaceFirst("<event_id>", eventID + timeStamp) .replaceFirst("<target_type>", targetType).replaceFirst("<target_all>", "true"); String json = targetALLJson; json = json.replaceFirst("<start_time>", Long.toString(DateUtil.addToUTCMilliSeconds(Calendar.MINUTE, 5))).replaceFirst( "<end_time>", Long.toString(DateUtil.addToUTCMilliSeconds(Calendar.MINUTE, 25))); setLogString("URL Values of the API \n" + createUrl + "\n" + json, true); final HttpResponse response = HTTPSClient.postResponse(createUrl, json, HTTPSClient.getPKCSKeyHttpClient("ecofactorcorp.p12", "ecofactor")); final String result = HTTPSClient.getResultString(response.getEntity()); setLogString("response :'" + result + "'", true); Assert.assertTrue(response.getStatusLine().getStatusCode() == 200, "Error status: " + response.getStatusLine()); final String eventName = getDrEventName(result); setLogString("DR EventName: " + eventName, true); final int proramEventId = lsProEvent.programEventId(eventName); setLogString("DR Event Id: " + proramEventId, true); WaitUtil.tinyWait(); final String eventStatus = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + eventStatus, true); final Map<String, Object> Values = lsProEvent.updateEventByStartDateAndEndDate(eventName); setLogString("Details Based on Event Name : " + Values, true); final List<Integer> eventLocation = lspEventLocation.fetchByLocationId(proramEventId); setLogString("Available Location : " + eventLocation, true); WaitUtil.mediumWait(); setLogString("After 20 Seconds ", true); final String UpdatedEventStatus = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + UpdatedEventStatus, true); WaitUtil.hugeWait(); setLogString("After 2 minutes ", true); final String UpdatedEventStatus1 = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + UpdatedEventStatus1, true); final List<EcpCoreLSEventLocation> locIdStatus = lspEventLocation .listByLocationIdStatus(proramEventId); setLogString("Available Locations with Status : " + locIdStatus, true); final int locId = getLocationIdForStatus(locIdStatus, ASTATUS); setLogString("Location Id in Active Mode : " + locId, true); final int thermostatId = tsat.listByLoationId(locId); setLogString("Thermostat Id : " + thermostatId, true); WaitUtil.mediumWait(); setLogString("After 20 Seconds ", true); List<PartitionedThermostatEvent> allDetails = tstatEvent.setPointEDR(thermostatId); WaitUtil.hugeWait(); setLogString("After 2 minutes ", true); final List<PartitionedThermostatEvent> allDetail = tstatEvent.setPointEDR(thermostatId); final String nextPhaseTime = eControl.fetchNextPhaseTime(proramEventId); setLogString("Next Phase Time : " + nextPhaseTime, true); WaitUtil.tinyWait(); setLogString("After 10 seconds", true); eControl.updateNextPhaseTime(proramEventId); setLogString("Updated Next Phase Time", true); final String currentStatus = eControl.fetchStatus(proramEventId); setLogString("Current Status : " + currentStatus, true); if (currentStatus.equalsIgnoreCase(PSTATUS)) { eControl.updateStatus(proramEventId, PSTATUS); setLogString("Updated status ", true); } WaitUtil.hugeWait(); setLogString("After 2 minutes ", true); final List<PartitionedThermostatEvent> updatedAllDetails1 = tstatEvent .setPointEDR(thermostatId); final String programEventStatus = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + programEventStatus, true); final String finalStatus = eControl.fetchStatus(proramEventId); setLogString("Current Status : " + finalStatus, true); if (programEventStatus.equalsIgnoreCase(ASTATUS)) { WaitUtil.tinyWait(); setLogString("After 10 seconds", true); eControl.updateNextPhaseTime(proramEventId); setLogString("Updated Next Phase Time", true); final String currentStatus1 = eControl.fetchStatus(proramEventId); setLogString("Current Status : " + currentStatus1, true); if (currentStatus.equalsIgnoreCase(PSTATUS)) { eControl.updateStatus(proramEventId, PSTATUS); setLogString("Updated status ", true); } } WaitUtil.hugeWait(); setLogString("After 2 minutes ", true); final List<PartitionedThermostatEvent> updatedAllDetail = tstatEvent .setPointEDR(thermostatId); final String programEventStatus1 = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + programEventStatus1, true); final String finalStatus1 = eControl.fetchStatus(proramEventId); setLogString("Final Status : " + finalStatus1, true); final int programEventId = lsProEvent.updateEventStatus(eventName); setLogString("Program Event Id: " + programEventId, true); eControl.updateStatus(programEventId, ISTATUS); setLogString("Updated ", true); } /** * Test_create_dr_event_nve. * @param drUrl the dr url * @param programID the program id * @param eventID the event id * @param targetType the target type * @param targetAllJson the target all json * @throws ParseException the parse exception */ @Test(groups = { Groups.SANITY1 }, dataProvider = "createDRAllGatewaysNVE", dataProviderClass = DRAPIDataProvider.class, priority = 1) public void drEventForNve(final String drUrl, final String programID, final String eventID, final String targetType, final String targetAllJson) throws ParseException { long timeStamp = System.currentTimeMillis(); String directURL = drUrl; directURL = directURL.replaceFirst("<program_id>", programID) .replaceFirst("<event_id>", eventID + timeStamp) .replaceFirst("<target_type>", targetType).replaceFirst("<target_all>", "true"); String json = targetAllJson; json = json.replaceFirst("<start_time>", Long.toString(DateUtil.addToUTCMilliSeconds(Calendar.MINUTE, 1))).replaceFirst( "<end_time>", Long.toString(DateUtil.addToUTCMilliSeconds(Calendar.MINUTE, 7))); setLogString("URL Values of the API \n" + directURL + "\n" + json, true); final HttpResponse response = HTTPSClient.postResponse(directURL, json, HTTPSClient.getPKCSKeyHttpClient("ecofactorqanve.p12", "ecofactor")); Assert.assertTrue(response.getStatusLine().getStatusCode() == 200, "Error Status:" + response.getStatusLine()); final String resultValueString = HTTPSClient.getResultString(response.getEntity()); setLogString("response :'" + resultValueString + "'", true); final String eventName = getDrEventName(resultValueString); setLogString("DR EventName: " + eventName, true); final int proramEventId = lsProEvent.programEventId(eventName); setLogString("DR Event Id: " + proramEventId, true); final String eventStatus = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + eventStatus, true); WaitUtil.hugeWait(); setLogString("After 2 Minutes ", true); final String UpdatedEventStatus = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + UpdatedEventStatus, true); final List<EcpCoreLSEventLocation> locIdStatus = lspEventLocation .listByLocationIdStatus(proramEventId); setLogString("Available Locations with Status : " + locIdStatus, true); final int locId = getLocationIdForStatus(locIdStatus, ASTATUS); setLogString("Location Id in Active Mode : " + locId, true); final int thermostatId = tsat.listByLoationId(locId); setLogString("Thermostat Id : " + thermostatId, true); final List<PartitionedThermostatEvent> allDetails = tstatEvent.setPointEDR(thermostatId); final String nextPhaseTime = eControl.fetchNextPhaseTime(proramEventId); setLogString("Next Phase Time : " + nextPhaseTime, true); WaitUtil.tinyWait(); setLogString("After 10 seconds", true); eControl.updateNextPhaseTime(proramEventId); setLogString("Updated Next Phase Time", true); final String currentStatus = eControl.fetchStatus(proramEventId); setLogString("Current Status : " + currentStatus, true); if (currentStatus.equalsIgnoreCase(PSTATUS)) { eControl.updateStatus(proramEventId, PSTATUS); setLogString("Updated status ", true); } WaitUtil.hugeWait(); setLogString("After 2 minutes ", true); final List<PartitionedThermostatEvent> updatedAllDetails = tstatEvent .setPointEDR(thermostatId); final String programEventStatus = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + programEventStatus, true); final String finalStatus = eControl.fetchStatus(proramEventId); setLogString("Current Status : " + finalStatus, true); if (programEventStatus.equalsIgnoreCase(ASTATUS)) { WaitUtil.tinyWait(); setLogString("After 10 seconds", true); eControl.updateNextPhaseTime(proramEventId); setLogString("Updated Next Phase Time", true); final String currentStatus1 = eControl.fetchStatus(proramEventId); setLogString("Current Status : " + currentStatus1, true); if (currentStatus.equalsIgnoreCase(PSTATUS)) { eControl.updateStatus(proramEventId, PSTATUS); setLogString("Updated status ", true); } } WaitUtil.hugeWait(); setLogString("After 2 minutes ", true); final List<PartitionedThermostatEvent> updatedAllDetails1 = tstatEvent .setPointEDR(thermostatId); final String programEventStatus1 = lsProEvent.listByEventName(eventName); setLogString("DR Event Status : " + programEventStatus1, true); final String finalStatus1 = eControl.fetchStatus(proramEventId); setLogString("Final Status : " + finalStatus1, true); final Map<String, Object> thermostatDetails = lspEventReport.updatedDetails(proramEventId); setLogString("Thermostat Details: " + thermostatDetails, true); final int programEventId = lsProEvent.updateEventStatus(eventName); setLogString("Program Event Id: " + programEventId, true); eControl.updateStatus(programEventId, ISTATUS); setLogString("Updated ", true); } /** * Fetch the Event Name after creation of DR Event. * @param response the response * @return String. */ private String getDrEventName(final String response) { StringTokenizer st = new StringTokenizer(response, ","); String eventID = ""; while (st.hasMoreElements()) { @SuppressWarnings("unused") String status = st.nextToken(); eventID = st.nextToken(); } String[] eventValues = eventID.split(":"); final String eventName = eventValues[2]; setLogString("DR EventName Fetched : " + eventName.substring(0, eventName.length() - 3), true); return eventName.substring(0, eventName.length() - 3); } /** * Fetch the location Id based on status. * @param allDetails the List details. * @param status the status * @return Integer. */ public int getLocationIdForStatus(final List<EcpCoreLSEventLocation> locIdStatus, final String status) { int valueLocationId = 0; for (EcpCoreLSEventLocation ecpCoreLSEventLocation : locIdStatus) { String locStatus = ecpCoreLSEventLocation.getStatus().toString(); if (locStatus.equalsIgnoreCase(ASTATUS)) { valueLocationId = (ecpCoreLSEventLocation.getLocationid()); } } return valueLocationId; } /** * Gets the count by location status. * @param locIdStatus the loc id status * @return the count by location status */ public Map<String, Integer> getCountByLocationStatus( final List<EcpCoreLSEventLocation> locIdStatus) { List<Integer> acLocationId = new ArrayList<Integer>(); List<Integer> scLocationId = new ArrayList<Integer>(); List<Integer> acTstId = new ArrayList<Integer>(); Map<String, Integer> locationCount = new HashMap<String, Integer>(); locationCount.put("Total No of Locations", locIdStatus.size()); for (EcpCoreLSEventLocation ecpCoreLSEventLocation : locIdStatus) { String locStatus = ecpCoreLSEventLocation.getStatus().toString(); if (locStatus.equalsIgnoreCase(ASTATUS)) { acLocationId.add(ecpCoreLSEventLocation.getLocationid()); } else if (locStatus.equalsIgnoreCase(SSTATUS)) { scLocationId.add(ecpCoreLSEventLocation.getLocationid()); } } locationCount.put("Total No of Locations based on Active Status", acLocationId.size()); locationCount.put("Total No of Locations based on Skipped Status", scLocationId.size()); for (int i = 0; i < acLocationId.size(); i++) { int locId = acLocationId.get(i); final int thermostatId = tsat.listByLoationId(locId); acTstId.add(thermostatId); } return locationCount; } }
6eaf84bae1d973fbda808cf1d07b4cdc7bd9eff8
42854fbe19b25f862eec5a7ce0b4625c6a25ba40
/samples/quickstart-guice/src/main/java/QuickstartGuice.java
5fcb1e33556c93e08dcb0744ba277ec30957246d
[ "Apache-2.0", "LicenseRef-scancode-unknown" ]
permissive
Junchenliu198924/shiro
e229fe7e2c81ea57f932dfd2fe8df0609bdb3eed
4cf242d29552876ba09bc7e1ca0b841ba5ae4017
refs/heads/master
2021-05-24T08:23:29.556732
2020-04-03T07:05:48
2020-04-03T07:05:48
253,468,751
1
0
Apache-2.0
2020-04-06T10:48:18
2020-04-06T10:48:17
null
UTF-8
Java
false
false
4,936
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import com.google.inject.Guice; import com.google.inject.Injector; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.*; import org.apache.shiro.mgt.SecurityManager; import org.apache.shiro.session.Session; import org.apache.shiro.subject.Subject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Simple Quickstart application showing how to use Shiro's API with Guice integration. * * @since 0.9 RC2 */ public class QuickstartGuice { private static final transient Logger log = LoggerFactory.getLogger(QuickstartGuice.class); public static void main(String[] args) { // We will utilize standard Guice bootstrapping to create a Shiro SecurityManager. Injector injector = Guice.createInjector(new QuickstartShiroModule()); SecurityManager securityManager = injector.getInstance(SecurityManager.class); // for this simple example quickstart, make the SecurityManager // accessible as a JVM singleton. Most applications wouldn't do this // and instead rely on their container configuration or web.xml for // webapps. That is outside the scope of this simple quickstart, so // we'll just do the bare minimum so you can continue to get a feel // for things. SecurityUtils.setSecurityManager(securityManager); // Now that a simple Shiro environment is set up, let's see what you can do: // get the currently executing user: Subject currentUser = SecurityUtils.getSubject(); // Do some stuff with a Session (no need for a web or EJB container!!!) Session session = currentUser.getSession(); session.setAttribute("someKey", "aValue"); String value = (String) session.getAttribute("someKey"); if (value.equals("aValue")) { log.info("Retrieved the correct value! [" + value + "]"); } // let's login the current user so we can check against roles and permissions: if (!currentUser.isAuthenticated()) { UsernamePasswordToken token = new UsernamePasswordToken("lonestarr", "vespa"); token.setRememberMe(true); try { currentUser.login(token); } catch (UnknownAccountException uae) { log.info("There is no user with username of " + token.getPrincipal()); } catch (IncorrectCredentialsException ice) { log.info("Password for account " + token.getPrincipal() + " was incorrect!"); } catch (LockedAccountException lae) { log.info("The account for username " + token.getPrincipal() + " is locked. " + "Please contact your administrator to unlock it."); } // ... catch more exceptions here (maybe custom ones specific to your application? catch (AuthenticationException ae) { //unexpected condition? error? } } //say who they are: //print their identifying principal (in this case, a username): log.info("User [" + currentUser.getPrincipal() + "] logged in successfully."); //test a role: if (currentUser.hasRole("schwartz")) { log.info("May the Schwartz be with you!"); } else { log.info("Hello, mere mortal."); } //test a typed permission (not instance-level) if (currentUser.isPermitted("lightsaber:weild")) { log.info("You may use a lightsaber ring. Use it wisely."); } else { log.info("Sorry, lightsaber rings are for schwartz masters only."); } //a (very powerful) Instance Level permission: if (currentUser.isPermitted("winnebago:drive:eagle5")) { log.info("You are permitted to 'drive' the winnebago with license plate (id) 'eagle5'. " + "Here are the keys - have fun!"); } else { log.info("Sorry, you aren't allowed to drive the 'eagle5' winnebago!"); } //all done - log out! currentUser.logout(); System.exit(0); } }
80e90971d1a4936d8e005b5029d16813eebbec04
0098e27a9140cf3fda3767675faf9e5f1453c01f
/samples/commons.mbean/src/main/java/com/buschmais/maexo/samples/commons/mbean/objectname/PersonMBean.java
2ea21e84fe6b5c67f0e69ee1c10a4ac015963c90
[]
no_license
buschmais/maexo
545bdc638741d39c091461df5c774e07dbd5236f
8e0a8d498fa5fa8302474bca4f9ca4b2c23d2374
refs/heads/master
2016-09-07T19:08:21.420426
2013-04-23T09:26:55
2013-04-23T09:26:55
9,465,214
2
0
null
null
null
null
UTF-8
Java
false
false
3,959
java
/* * Copyright 2009 buschmais GbR * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. * See the License for the specific language governing permissions and * limitations under the License */ package com.buschmais.maexo.samples.commons.mbean.objectname; import java.util.LinkedList; import java.util.List; import javax.management.MBeanInfo; import javax.management.MBeanNotificationInfo; import javax.management.ObjectName; import javax.management.openmbean.OpenMBeanAttributeInfo; import javax.management.openmbean.OpenMBeanAttributeInfoSupport; import javax.management.openmbean.OpenMBeanConstructorInfo; import javax.management.openmbean.OpenMBeanInfoSupport; import javax.management.openmbean.OpenMBeanOperationInfoSupport; import javax.management.openmbean.SimpleType; import com.buschmais.maexo.framework.commons.mbean.dynamic.DynamicMBeanSupport; import com.buschmais.maexo.framework.commons.mbean.dynamic.OpenTypeFactory; import com.buschmais.maexo.framework.commons.mbean.objectname.ObjectNameFactoryHelper; /** * Implementation of an MBean which will be used to manage an instance of the * class {@link Person}. */ public class PersonMBean extends DynamicMBeanSupport { /** * The person instance. */ private Person person; /** * The object name factory helper which is used to construct object names of * referenced MBeans. */ private ObjectNameFactoryHelper objectNameFactoryHelper; /** * Constructs the MBean. * * @param person * The person. * @param objectNameFactoryHelper * The object name factory helper. */ public PersonMBean(Person person, ObjectNameFactoryHelper objectNameFactoryHelper) { this.person = person; this.objectNameFactoryHelper = objectNameFactoryHelper; } /** * {@inheritDoc} */ public final MBeanInfo getMBeanInfo() { String className = this.getClass().getName(); OpenMBeanAttributeInfo firstNameInfo = new OpenMBeanAttributeInfoSupport( "firstName", "The first name.", SimpleType.STRING, true, false, false); OpenMBeanAttributeInfo lastNameInfo = new OpenMBeanAttributeInfoSupport( "lastName", "The last name.", SimpleType.STRING, true, false, false); OpenMBeanAttributeInfo addressesInfo = new OpenMBeanAttributeInfoSupport( "addresses", "The addresses of this person.", OpenTypeFactory .createArrayType(1, SimpleType.OBJECTNAME), true, false, false); return new OpenMBeanInfoSupport(className, "An OpenMBean which represents a person.", new OpenMBeanAttributeInfo[] { firstNameInfo, lastNameInfo, addressesInfo }, new OpenMBeanConstructorInfo[] {}, new OpenMBeanOperationInfoSupport[] {}, new MBeanNotificationInfo[] {}); } /** * Returns the first name of the person. * * @return The first name. */ public final String getFirstName() { return this.person.getFirstName(); } /** * Returns the last name of the person. * * @return The last name. */ public final String getLastName() { return this.person.getLastName(); } /** * Returns the addresses as object name representation. * * @return The object names. */ public final ObjectName[] getAddresses() { List<ObjectName> addresses = new LinkedList<ObjectName>(); for (Address address : this.person.getAdresses()) { addresses.add(this.objectNameFactoryHelper.getObjectName(address, Address.class)); } return addresses.toArray(new ObjectName[0]); } }
[ "[email protected]@edd260d2-c1fc-11dd-87c2-1b6a6bee664f" ]
[email protected]@edd260d2-c1fc-11dd-87c2-1b6a6bee664f
232ad1821e83b93902fae132399476aa572ce669
7347cd8d808e5c4a9f34d34cba7a922d9359afda
/BA101G5/src/com/general_member/model/GeneralMemberService.java
3db09e23bebc81b67532fe0d443a21272f7faeee
[]
no_license
nocama/my-work-rep-picnic-
cadd654aa459d7b5f8e9eb721e4eb68da2ea7cd5
d4dd32d3c50b8952bcc6ee49986de1b9aefe83fe
refs/heads/master
2021-04-12T09:57:56.529658
2017-07-20T01:21:10
2017-07-20T01:21:10
94,525,471
0
0
null
2017-07-19T12:36:29
2017-06-16T08:56:46
Java
UTF-8
Java
false
false
2,197
java
package com.general_member.model; import java.sql.Date; import java.util.List; public class GeneralMemberService { GeneralMemberDAO_interface dao; public GeneralMemberService() { dao = new GeneralMemberDAO(); } public GeneralMemberVO addGeneralMember(String MEM_NAME, Character MEM_GEN, Date MEM_BIRTH, String MEM_ADDR, String MEM_MAIL, String MEM_PSW, String MEM_SELF, byte[] MEM_PIC, Integer MEM_COIN, Character MEM_STA, String MEM_PHONE, Character MEM_PBOARD) { GeneralMemberVO gVO = new GeneralMemberVO(); gVO.setMEM_GEN(MEM_GEN); gVO.setMEM_NAME(MEM_NAME); gVO.setMEM_BIRTH(MEM_BIRTH); gVO.setMEM_ADDR(MEM_ADDR); gVO.setMEM_MAIL(MEM_MAIL); gVO.setMEM_PSW(MEM_PSW); gVO.setMEM_SELF(MEM_SELF); gVO.setMEM_PIC(MEM_PIC); gVO.setMEM_COIN(MEM_COIN); gVO.setMEM_STA(MEM_STA); gVO.setMEM_PHONE(MEM_PHONE); gVO.setMEM_PBOARD(MEM_PBOARD); dao.insert(gVO); return gVO; } public GeneralMemberVO updateGeneralMember(String MEM_NO, String MEM_NAME, Character MEM_GEN, Date MEM_BIRTH, String MEM_ADDR, String MEM_MAIL, String MEM_PSW, String MEM_SELF, byte[] MEM_PIC, Integer MEM_COIN, Character MEM_STA, String MEM_PHONE, Character MEM_PBOARD) { GeneralMemberVO gVO = new GeneralMemberVO(); gVO.setMEM_NO(MEM_NO); gVO.setMEM_GEN(MEM_GEN); gVO.setMEM_NAME(MEM_NAME); gVO.setMEM_BIRTH(MEM_BIRTH); gVO.setMEM_ADDR(MEM_ADDR); gVO.setMEM_MAIL(MEM_MAIL); gVO.setMEM_PSW(MEM_PSW); gVO.setMEM_SELF(MEM_SELF); gVO.setMEM_PIC(MEM_PIC); gVO.setMEM_COIN(MEM_COIN); gVO.setMEM_STA(MEM_STA); gVO.setMEM_PHONE(MEM_PHONE); gVO.setMEM_PBOARD(MEM_PBOARD); dao.update(gVO); return gVO; } public void deleteGeneralMember(String MEM_NO) { dao.delete(MEM_NO); } public GeneralMemberVO getOneGeneralMember(String MEM_NO) { return dao.findByPrimaryKey(MEM_NO); } public List<GeneralMemberVO> getAll() { return dao.getAll(); } public void updatecoin(String MEM_NO,Integer MEM_COIN) { GeneralMemberVO gVO = new GeneralMemberVO(); gVO.setMEM_NO(MEM_NO); gVO.setMEM_COIN(MEM_COIN); dao.updatefromcoin(gVO); } }
561cbeffad0461dfcfaa503b1c1569e0929d599b
501d927b095fb5294333f67b934dca6409fd21b7
/app/build/generated/ap_generated_sources/debug/out/com/startng/newsapp/Database/NoteDatabase_Impl.java
2fdcf737b836e0983dab222693065d7859bb61f3
[]
no_license
damade/NewsApp-SNG
422032ebd6969baecd116c5c3769d2483201c83d
788562fe2cfb09a4e09a0d6436fc729422f42f25
refs/heads/master
2022-06-15T05:12:11.805195
2020-05-06T22:58:11
2020-05-06T22:58:11
260,030,180
1
0
null
2020-04-29T20:00:33
2020-04-29T20:00:32
null
UTF-8
Java
false
false
6,026
java
package com.startng.newsapp.Database; import androidx.room.DatabaseConfiguration; import androidx.room.InvalidationTracker; import androidx.room.RoomOpenHelper; import androidx.room.RoomOpenHelper.Delegate; import androidx.room.RoomOpenHelper.ValidationResult; import androidx.room.util.DBUtil; import androidx.room.util.TableInfo; import androidx.room.util.TableInfo.Column; import androidx.room.util.TableInfo.ForeignKey; import androidx.room.util.TableInfo.Index; import androidx.sqlite.db.SupportSQLiteDatabase; import androidx.sqlite.db.SupportSQLiteOpenHelper; import androidx.sqlite.db.SupportSQLiteOpenHelper.Callback; import androidx.sqlite.db.SupportSQLiteOpenHelper.Configuration; import com.startng.newsapp.Database.DataAccessObject.NoteDao; import com.startng.newsapp.Database.DataAccessObject.NoteDao_Impl; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.util.HashMap; import java.util.HashSet; import java.util.Set; @SuppressWarnings({"unchecked", "deprecation"}) public final class NoteDatabase_Impl extends NoteDatabase { private volatile NoteDao _noteDao; @Override protected SupportSQLiteOpenHelper createOpenHelper(DatabaseConfiguration configuration) { final SupportSQLiteOpenHelper.Callback _openCallback = new RoomOpenHelper(configuration, new RoomOpenHelper.Delegate(1) { @Override public void createAllTables(SupportSQLiteDatabase _db) { _db.execSQL("CREATE TABLE IF NOT EXISTS `note_table` (`nid` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `note_title` TEXT, `note_text` TEXT, `time_stamp` TEXT)"); _db.execSQL("CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)"); _db.execSQL("INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '72f173f5346520af9d85b9b360319fad')"); } @Override public void dropAllTables(SupportSQLiteDatabase _db) { _db.execSQL("DROP TABLE IF EXISTS `note_table`"); if (mCallbacks != null) { for (int _i = 0, _size = mCallbacks.size(); _i < _size; _i++) { mCallbacks.get(_i).onDestructiveMigration(_db); } } } @Override protected void onCreate(SupportSQLiteDatabase _db) { if (mCallbacks != null) { for (int _i = 0, _size = mCallbacks.size(); _i < _size; _i++) { mCallbacks.get(_i).onCreate(_db); } } } @Override public void onOpen(SupportSQLiteDatabase _db) { mDatabase = _db; internalInitInvalidationTracker(_db); if (mCallbacks != null) { for (int _i = 0, _size = mCallbacks.size(); _i < _size; _i++) { mCallbacks.get(_i).onOpen(_db); } } } @Override public void onPreMigrate(SupportSQLiteDatabase _db) { DBUtil.dropFtsSyncTriggers(_db); } @Override public void onPostMigrate(SupportSQLiteDatabase _db) { } @Override protected RoomOpenHelper.ValidationResult onValidateSchema(SupportSQLiteDatabase _db) { final HashMap<String, TableInfo.Column> _columnsNoteTable = new HashMap<String, TableInfo.Column>(4); _columnsNoteTable.put("nid", new TableInfo.Column("nid", "INTEGER", true, 1, null, TableInfo.CREATED_FROM_ENTITY)); _columnsNoteTable.put("note_title", new TableInfo.Column("note_title", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY)); _columnsNoteTable.put("note_text", new TableInfo.Column("note_text", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY)); _columnsNoteTable.put("time_stamp", new TableInfo.Column("time_stamp", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY)); final HashSet<TableInfo.ForeignKey> _foreignKeysNoteTable = new HashSet<TableInfo.ForeignKey>(0); final HashSet<TableInfo.Index> _indicesNoteTable = new HashSet<TableInfo.Index>(0); final TableInfo _infoNoteTable = new TableInfo("note_table", _columnsNoteTable, _foreignKeysNoteTable, _indicesNoteTable); final TableInfo _existingNoteTable = TableInfo.read(_db, "note_table"); if (! _infoNoteTable.equals(_existingNoteTable)) { return new RoomOpenHelper.ValidationResult(false, "note_table(com.startng.newsapp.Database.Model.Note).\n" + " Expected:\n" + _infoNoteTable + "\n" + " Found:\n" + _existingNoteTable); } return new RoomOpenHelper.ValidationResult(true, null); } }, "72f173f5346520af9d85b9b360319fad", "ea34b571450e966ef5828a13746e8e9b"); final SupportSQLiteOpenHelper.Configuration _sqliteConfig = SupportSQLiteOpenHelper.Configuration.builder(configuration.context) .name(configuration.name) .callback(_openCallback) .build(); final SupportSQLiteOpenHelper _helper = configuration.sqliteOpenHelperFactory.create(_sqliteConfig); return _helper; } @Override protected InvalidationTracker createInvalidationTracker() { final HashMap<String, String> _shadowTablesMap = new HashMap<String, String>(0); HashMap<String, Set<String>> _viewTables = new HashMap<String, Set<String>>(0); return new InvalidationTracker(this, _shadowTablesMap, _viewTables, "note_table"); } @Override public void clearAllTables() { super.assertNotMainThread(); final SupportSQLiteDatabase _db = super.getOpenHelper().getWritableDatabase(); try { super.beginTransaction(); _db.execSQL("DELETE FROM `note_table`"); super.setTransactionSuccessful(); } finally { super.endTransaction(); _db.query("PRAGMA wal_checkpoint(FULL)").close(); if (!_db.inTransaction()) { _db.execSQL("VACUUM"); } } } @Override public NoteDao noteDao() { if (_noteDao != null) { return _noteDao; } else { synchronized(this) { if(_noteDao == null) { _noteDao = new NoteDao_Impl(this); } return _noteDao; } } } }
873f01a2a10100d28e15cad72d256416a6714856
89c15461f3f2912fc0424235be71c074451014bc
/java8/src/day19/Address.java
a92d1e70cd6396cc4ab4227a4ab759e832096f36
[]
no_license
Parkdaeho99/java8
ccd8bbc1b656cd991e9e26dbb83541e6795e3bfb
ab7f2485409be56c834febf807a523f67bae407e
refs/heads/master
2021-03-25T03:07:21.485811
2020-04-16T05:55:42
2020-04-16T05:55:42
247,584,055
0
0
null
null
null
null
UTF-8
Java
false
false
308
java
package day19; public class Address { /* and Then , */ private String country; private String city; public Address(String country, String city) { this.country = country; this.city = city; } public String getCountry() { return country; } public String getCity() { return city; } }
df8cd8426a591a469e54c854eb1b02b4882dcfb0
4b066a37195364f2b05297a4aa00925acd6b301c
/hibernate-demo/src/main/java/ch02/starter/Member.java
7457e4d6642d8d2cc761dcfc76c8c8218cf26552
[]
no_license
hunchulchoi/jpa-demo
70091ccf2feac3d4f81acae9fb5b4907506b5678
a21e0f5a672a7273cffb432e263961beee4bcc85
refs/heads/master
2023-07-02T16:14:44.944967
2021-08-04T04:19:03
2021-08-04T04:19:03
392,172,565
0
0
null
null
null
null
UTF-8
Java
false
false
582
java
package ch02.starter; import lombok.Data; import lombok.ToString; import javax.persistence.*; import java.util.Date; @Entity @Table(name="MEMBER") @Data @ToString public class Member { @Id private String id; @Column(name = "NAME") private String username; private Integer age; @Enumerated(EnumType.STRING) private RoleType roleType; @Temporal(TemporalType.DATE) private Date createdDate; @Temporal(TemporalType.DATE) private Date lastModiedDate; @Lob private String descriptor; public enum RoleType {USER, ADMIN}; }
0f912680504a8b76d4ca01d3e2d061c39652bf60
35789133e88429ef0793e554746557a7b93cb4d8
/src/ReceiveFile.java
ae825133577bc1522840ef5cf408bcf0cda61b2f
[]
no_license
LuizGuerra/Hybrid-P2P-Architecture
0b89bfd5cb1b08f2563fa7cbdd6dfe11a21ec696
b46fd12e89ccc05c9690615a67e18a89fe529bad
refs/heads/main
2023-06-07T04:21:58.885069
2021-07-02T16:05:23
2021-07-02T16:05:23
370,822,634
0
0
null
null
null
null
UTF-8
Java
false
false
2,467
java
import java.io.*; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; public class ReceiveFile implements Runnable, Closeable { static String thisPath = System.getProperty("user.dir"); int port; ServerSocket serverSocket; public ReceiveFile(int port) throws IOException { this.port = port; this.serverSocket = new ServerSocket(port); } @Override public void close() throws IOException { this.serverSocket.close(); } @Override public void run() { byte[] bytes; // input socket data while (true) { try { Socket socket = serverSocket.accept(); InputStream inputStream = socket.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); String fileName = reader.readLine(); System.out.println("Receiving data..."); System.out.println("File name: " + fileName); byte[] buffer = new byte[1024*8]; int bytesRead; File downloadPath = new File(thisPath + "/downloads/"); File newFile = new File(thisPath + "/downloads/"+ fileName); if(!downloadPath.exists()) { downloadPath.mkdirs(); } OutputStream outputStream = new FileOutputStream(newFile); while ( (bytesRead = inputStream.read(buffer)) != -1 ) { outputStream.write(buffer, 0, bytesRead); } System.out.println("Successfully created file"); System.out.println(); socket.close(); inputStream.close(); outputStream.close(); } catch (Exception e) { e.printStackTrace(); } finally { // System.out.println("Meg used="+(Runtime.getRuntime().totalMemory()- // Runtime.getRuntime().freeMemory())/(1000*1000)+"M"); System.gc(); // System.out.println("Meg used="+(Runtime.getRuntime().totalMemory()- // Runtime.getRuntime().freeMemory())/(1000*1000)+"M"); } } } public static void main(String[] args) throws IOException { // necessary info int port = 1234; ReceiveFile receiveFile = new ReceiveFile(port); receiveFile.run(); } }
928c69231d16475326fa799b842625bf755c2693
131d1689f4e292452a0c984462c8fd682073ea9b
/app/src/androidTest/java/com/example/amado/guesswho/ApplicationTest.java
4d308184855742c887d591707f3b728a24caabf8
[]
no_license
RoyMontoya/GuessWho
6d4dd7d883a0a343b2700fcf098b40f4e042aa28
a8ee1c7922edc37df091748052fdcbbd65079d95
refs/heads/master
2020-05-19T15:05:38.818310
2015-02-11T03:40:37
2015-02-11T03:40:37
30,567,374
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
package com.example.amado.guesswho; 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); } }
0e151e3fd8a50011f379b7d078049e9169fb3540
d46fced19d24491c7c87173aee5172a72eb6ed01
/config-server/src/main/java/my/config/service/ConfigServiceApplication.java
2bdc07e0d86e1c261022e96e85c177874b702b84
[]
no_license
kirangodishala/spring-cloud-config-server-client
475378f44d2d780df5af4308aa50e2b62dda4dc7
d11950ca6a2670a4d364e559adffb358511d2983
refs/heads/master
2020-08-29T12:00:46.711555
2019-10-28T18:17:17
2019-10-28T18:17:17
218,025,679
0
0
null
null
null
null
UTF-8
Java
false
false
427
java
package my.config.service; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.config.server.EnableConfigServer; @EnableConfigServer @SpringBootApplication public class ConfigServiceApplication { public static void main(String[] args) { SpringApplication.run(ConfigServiceApplication.class, args); } }
0a029a4d49dcdd1f355888c8c339709aa401a09d
762e98c43309eb166af25b224d1020a8d2411227
/09_Capstone/java/src/main/java/com/techelevator/campground/model/ParkDAO.java
ff3fcd47ae0ea1b383a41db586b58598b6eb0c89
[]
no_license
schmi434/portfolio
46e18db401135bc4f63a455f5e05e5533f6d5b4c
e026b0d7fcc671d5686715bd1250e3ef3d35220b
refs/heads/master
2022-12-28T02:58:01.418866
2019-09-03T14:33:00
2019-09-03T14:33:00
200,288,717
0
0
null
2022-12-16T10:37:03
2019-08-02T19:38:52
Java
UTF-8
Java
false
false
136
java
package com.techelevator.campground.model; import java.util.List; public interface ParkDAO { List<Object> getAllParks(); }
3c315df46af4d3230de3d575a1ccd1333ceaeeac
1e019d0f4d231afb32bb4316a84d332eaf241ded
/play-with-entitymanager/src/test/java/com/example/jpa/jpaonetomanydemo/PlayWithEntityManagerTests.java
6ce2dbd0714f6b7905781da212536a5fe9e17b6f
[]
no_license
tigersix86/jpaTest
cc9dedc3a42e945216524c1e3e025bdd86e6c7f2
64b6dce07d8111c639ec1ee9a969bc07427f7387
refs/heads/master
2022-11-29T01:04:06.374770
2019-06-23T19:57:58
2019-06-23T19:57:58
169,964,828
1
0
null
null
null
null
UTF-8
Java
false
false
354
java
package com.example.jpa.jpaonetomanydemo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class PlayWithEntityManagerTests { @Test public void contextLoads() { } }
945163b2c842bba19d1f75b449dd75970f93da5a
c948842c2f97bdc31a7ae15b8933fe3d25b5b3a7
/Ati/sisdh/src/main/java/br/gov/pi/ati/sisdh/dao/controleacesso/impl/UsuarioDAOImpl.java
4e5637181a166ef32db0c1b28eb54fff1f80bb06
[]
no_license
professorjuniel/Projetos
d470ec3596fae39215c691559a273553b560b459
2ac751e97f32941496929a8736070e6425e18aa2
refs/heads/master
2018-10-20T13:32:10.894166
2018-08-22T01:28:26
2018-08-22T01:28:26
116,873,815
0
1
null
null
null
null
UTF-8
Java
false
false
699
java
package br.gov.pi.ati.sisdh.dao.controleacesso.impl; import br.gov.pi.ati.sisdh.application.BaseDAOImpl; import br.gov.pi.ati.sisdh.dao.controleacesso.UsuarioDAO; import br.gov.pi.ati.sisdh.modelo.controleacesso.SituacaoUsuario; import br.gov.pi.ati.sisdh.modelo.controleacesso.Usuario; import java.util.List; import javax.ejb.Stateless; /** * * @author Ayslan */ @Stateless public class UsuarioDAOImpl extends BaseDAOImpl<Usuario> implements UsuarioDAO { @Override public Class getEntityClass() { return Usuario.class; } @Override public List<Usuario> getUsuariosAtivos() { return list("situacaoUsuario", SituacaoUsuario.ATIVO, "nome"); } }
fa916c555d727f3aa3ab7e1a9ddeebd7f7aa90f6
2a476fbc4f9e0330d548793fcafcb2ee341f531b
/demo/src/utils/DatabaseConnection.java
90e85f0e45c76d2060db19e4995cf77e50289eb1
[]
no_license
Lalit316/Servlet
b9181e3948bc6b7f5e63132ef21039fedcce96fa
f9e6b8a48b93db1f877866adc6771022a4affa7f
refs/heads/master
2021-08-14T19:59:55.618512
2017-11-16T16:22:50
2017-11-16T16:22:50
110,994,255
0
0
null
null
null
null
UTF-8
Java
false
false
1,139
java
package utils; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; /** * Created by l on 2/28/2017. */ public class DatabaseConnection { String url = "jdbc:mysql://localhost:3306/demo"; String userName = "root"; String password = ""; Connection connection = null; public DatabaseConnection(){ try { // connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/demo","root",""); Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection(url,userName,password); System.out.println("database connected!!"); } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } public PreparedStatement getPreparedStatement(String query) { PreparedStatement pstm = null; try { pstm = connection.prepareStatement(query); } catch (SQLException e) { e.printStackTrace(); } return pstm; } }
bdd82f36854c81aa793f96af4b1f97fb4431d604
58df55b0daff8c1892c00369f02bf4bf41804576
/src/fuc.java
9de1e052cfe9293db72d3a4f167b27174b93d39c
[]
no_license
gafesinremedio/com.google.android.gm
0b0689f869a2a1161535b19c77b4b520af295174
278118754ea2a262fd3b5960ef9780c658b1ce7b
refs/heads/master
2020-05-04T15:52:52.660697
2016-07-21T03:39:17
2016-07-21T03:39:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
344
java
import android.os.Parcelable.Creator; import com.google.android.gms.people.identity.internal.models.DefaultPersonImpl.RelationshipStatuses; public final class fuc implements Parcelable.Creator<DefaultPersonImpl.RelationshipStatuses> {} /* Location: * Qualified Name: fuc * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
755bc5eedd6511dcd87c7db0b199cc28e31ad27c
6ac643b1f069b6d5d7eb6aec704d55d583df1682
/cloud-demo-s2/src/main/java/com/demo/api/feign/TestFeign.java
7cf6ca93f8934c8e96c3b366993a65ed3c3e8e89
[ "MIT" ]
permissive
yuyenews/Mars-Cloud-Example
2273badc087e05c68e032c9befd5df45543c6537
a0b229549b1b979a6b5fb7e98d41c48317de46e5
refs/heads/master
2023-04-15T11:37:59.292273
2021-04-06T13:23:39
2021-04-06T13:23:39
294,870,376
1
0
null
null
null
null
UTF-8
Java
false
false
132
java
package com.demo.api.feign; import com.mars.cloud.annotation.MarsFeign; @MarsFeign(serverName = "") public class TestFeign { }
be704b474ac166d3715a4e553a0039270bccf5c7
4ea59069bce3d56f0619caed403b0ceffc932000
/motcroise/src/pobj/motx/tme2/Dictionnaire.java
f012d836c3b26dec9bae43277d1db257c3321dcc
[]
no_license
kadySoum/projets_JAVA
3a866a017c47063a6067247284caef0bf86a94fe
d5412a77f7be1c1b982445150141126ffeb0a257
refs/heads/master
2020-07-22T17:33:48.782292
2019-09-09T10:02:52
2019-09-09T10:02:52
207,276,491
0
0
null
null
null
null
UTF-8
Java
false
false
3,839
java
package pobj.motx.tme2; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * Un ensemble de mots. * */ public class Dictionnaire { // stockage des mots private List<String> mots = new ArrayList<>(); /** * Ajoute un mot au Dictionnaire, en dernière position. * @param mot à ajouter, il sera stocké en minuscules (lowerCase) */ public void add(String mot) { mots.add(mot.toLowerCase()); } /** * Taille du dictionnaire, c'est à dire nombre de mots qu'il contient. * @return la taille */ public int size() { return mots.size(); } /** * Accès au i-eme mot du dictionnaire. * @param i l'index du mot recherché, compris entre 0 et size-1. * @return le mot à cet index */ public String get(int i) { return mots.get(i); } /** * Rend une copie de ce Dictionnaire. * @return une copie identique de ce Dictionnaire */ public Dictionnaire copy () { Dictionnaire copy = new Dictionnaire(); copy.mots.addAll(mots); return copy; } /** * Retire les mots qui ne font pas exactement "len" caractères de long. * Attention cette opération modifie le Dictionnaire, utiliser copy() avant de filtrer pour ne pas perdre d'information. * @param len la longueur voulue * @return le nombre de mots supprimés */ public int filtreLongueur(int len) { List<String> cible = new ArrayList<>(); int cpt=0; for (String mot : mots) { if (mot.length() == len) cible.add(mot); else cpt++; } mots = cible; return cpt; } @Override public String toString() { if (size() == 1) { return mots.get(0); } else { return "dictionnaire de " + size() + " mots"; } } /** * charge un dictionnaire depuis un fichier texte * @param path chemin du fichier * @return le dictionnaire chargé */ public static Dictionnaire loadDictionnaire(String path) { //chargera un dictionnaire depuis un fichier texte Dictionnaire d = new Dictionnaire(); try(BufferedReader br =new BufferedReader(new FileReader(path))) { for (String line = br.readLine() ; line !=null; line = br.readLine() ) { d.add(line); } }catch(IOException e) { // Problème d’accès au fich System.out.println("Erreur fichier"); } return d; } /** * Filtre le dictionnaire en conservant les mots contenant le cacactère c à la place i * @param c caractère * @param i position du caractère * @return nombre de mots supprimés */ public int filtreParLettre(char c,int i) { int cpt=0; List<String> newL = new ArrayList<String>(); for (String s : mots) { if (s.charAt(i)==c) { newL.add(s); } else { cpt++; } } mots = newL; return cpt; } /** * Calcule l’ensemble de lettre possible à une position donnée * @param i position dans le mot * @return l'EnembleLettre contenant possible à la position donnée */ public EnsembleLettre calculEnsemblePossible(int i) { EnsembleLettre li = new EnsembleLettre(); for (String m : mots) { // parcours des mots du dictionnaire if (i<m.length()) { // on s'assure que le mot contient plus de i lettres char c = m.charAt(i); if (!li.contains(c)) { li.add(c); } } } return li; } /** * Filtre le dictionnaire par rapport à un indice i et un EnsembleLettre possible * Teste pour chaque mot que lp contient bien la lettre d’indice i du mot. * @param i indice dans le mot * @param ensLet ensemble de lettres * @return le nombre de mots supprimés */ public int filtreParIndice(int i, EnsembleLettre lp) { int cpt=0; List<String> newMots = new ArrayList<String>(); for (String s : mots) { if (lp.contains(s.charAt(i))) { newMots.add(s); } else { cpt++; } } mots = newMots; return cpt; } }
fc629d1db6e6931f6ea25e09dddc143e8bb096fe
fd2be9a20078272fccc4dfff3c470675532d6525
/easy-android-splash-screen/src/main/java/com/tricktekno/optnio/library/EasySplashScreen.java
8243d631e6bd50c833922c45d858200878f02057
[]
no_license
optnio00/Splash-Screen
cea423088b56ea29b9867cdf9e336ff29b94d375
12e63ec7aace4774c7f3387c8ac9cf5804c7efa7
refs/heads/master
2021-06-13T13:40:32.698556
2017-03-10T13:38:23
2017-03-10T13:38:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,551
java
package com.tricktekno.optnio.library; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; /** * Created by pantrif on 28/4/2016. */ public class EasySplashScreen { Activity mActivity; LayoutInflater mInflater; ImageView logo_iv; TextView header_tv; TextView footer_tv; TextView before_logo_tv; TextView after_logo_tv; String header_text=null; String footer_text=null; String before_logo_text=null; String after_logo_text = null; RelativeLayout splash_wrapper_rl; Bundle bundle = null; private View mView; private int splashBackgroundColor=0; private int splashBackgroundResource=0; private int mLogo = 0; private Class<?> TargetActivity = null; private int SPLASH_TIME_OUT = 2000; //The time before launch target Activity - by default 2 seconds public EasySplashScreen (Activity activity){ this.mActivity = activity; this.mInflater = LayoutInflater.from(activity); this.mView = mInflater.inflate(R.layout.splash, null); this.splash_wrapper_rl = (RelativeLayout) mView.findViewById(R.id.splash_wrapper_rl); } public EasySplashScreen withFullScreen(){ mActivity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); return this; } public EasySplashScreen withTargetActivity( Class<?> tAct){ this.TargetActivity = tAct; return this; } public EasySplashScreen withSplashTimeOut( int timout){ this.SPLASH_TIME_OUT = timout; return this; } public EasySplashScreen withBundleExtras( Bundle bundle){ this.bundle = bundle; return this; } public EasySplashScreen withBackgroundColor( int color){ this.splashBackgroundColor = color; splash_wrapper_rl.setBackgroundColor(splashBackgroundColor); return this; } public EasySplashScreen withBackgroundResource( int resource){ this.splashBackgroundResource = resource; splash_wrapper_rl.setBackgroundResource(splashBackgroundResource); return this; } public EasySplashScreen withLogo( int logo){ this.mLogo = logo; logo_iv = (ImageView) mView.findViewById(R.id.logo); logo_iv.setImageResource(mLogo); return this; } public EasySplashScreen withHeaderText( String text){ this.header_text = text; header_tv = (TextView) mView.findViewById(R.id.header_tv); header_tv.setText(text); return this; } public EasySplashScreen withFooterText( String text){ this.footer_text = text; footer_tv = (TextView) mView.findViewById(R.id.footer_tv); footer_tv.setText(text); return this; } public EasySplashScreen withBeforeLogoText( String text){ this.before_logo_text = text; before_logo_tv = (TextView) mView.findViewById(R.id.before_logo_tv); before_logo_tv.setText(text); return this; } public EasySplashScreen withAfterLogoText( String text){ this.after_logo_text = text; after_logo_tv = (TextView) mView.findViewById(R.id.after_logo_tv); after_logo_tv.setText(text); return this; } public ImageView getLogo(){ return logo_iv; } public TextView getBeforeLogoTextView(){ return before_logo_tv; } public TextView getAfterLogoTextView(){ return after_logo_tv; } public TextView getHeaderTextView(){ return header_tv; } public TextView getFooterTextView(){ return footer_tv; } public View create(){ setUpHandler(); return mView; } private void setUpHandler(){ if (TargetActivity != null) { new Handler().postDelayed(new Runnable() { @Override public void run() { Intent i = new Intent(mActivity, TargetActivity); if (bundle != null) { i.putExtras(bundle); } mActivity.startActivity(i); // close splash mActivity.finish(); } }, SPLASH_TIME_OUT); } } }
4fa6a960c4ecc772352a391e3dd99dd7e266b224
44b78448711f5eb6fc1aae968b8446bdf8b258be
/core/src/org/m110/shooter/effects/EntityEffect.java
e8ea926209736f311e04ea3be9cbf30dcd083d27
[]
no_license
m110/Yet-Another-Zombie-Shooter
ed846d8d68c417e44d6e7b8894e728222f4f2c41
f3abbf23499776b8806280dc33de2766a8044863
refs/heads/master
2021-01-17T10:17:41.237950
2016-04-03T12:21:40
2016-04-03T12:21:40
26,403,573
0
0
null
null
null
null
UTF-8
Java
false
false
146
java
package org.m110.shooter.effects; import org.m110.shooter.entities.Entity; public interface EntityEffect { boolean effect(Entity target); }
9d114bcd0ff6de8dbcc129494ba91f7e24059dce
eab969cfd74b5adadb213fa01e01435a7fd21ce1
/src/org/appwork/utils/logging/LoggingOutputStream.java
22e244e5a050472657d3cf0927ac643bb22b553f
[ "Artistic-2.0" ]
permissive
friedlwo/AppWoksUtils
305c006a99dc61099b1e0447f8ce455b0dd0edf1
35a2b21892432ecaa563f042305dfaeca732a856
refs/heads/master
2021-01-25T10:15:45.686385
2015-07-21T08:23:51
2015-07-21T08:23:51
39,442,362
2
0
null
null
null
null
UTF-8
Java
false
false
1,273
java
/** * Copyright (c) 2009 - 2011 AppWork UG(haftungsbeschränkt) <[email protected]> * * This file is part of org.appwork.utils.logging * * This software is licensed under the Artistic License 2.0, * see the LICENSE file or http://www.opensource.org/licenses/artistic-license-2.0.php * for details */ package org.appwork.utils.logging; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; /** * @author daniel, inspired by * http://blogs.sun.com/nickstephen/entry/java_redirecting_system_out_and * */ public class LoggingOutputStream extends ByteArrayOutputStream { private final Logger logger; private final Level level; public LoggingOutputStream(final Logger logger, final Level level) { this.logger = logger; this.level = level; } @Override public void flush() throws IOException { synchronized (this) { super.flush(); if (this.count >= 0) { final String record = this.toString().trim(); if (record.length() > 0) { this.logger.logp(this.level, "", "", record); } } super.reset(); } } }
[ "daniel@21714237-3853-44ef-a1f0-ef8f03a7d1fe" ]
daniel@21714237-3853-44ef-a1f0-ef8f03a7d1fe
93e069edac28a3f69399c27e751398f2e54bd4d5
49612a92f84368176ac693cb062ded42bf8697ce
/app/src/main/java/com/example/wangchao/androidcamerabase/utils/thread/WorkThreadUtils.java
7a8876bc6769c1c8fdd970bfbcc4cf90d7c2db7b
[]
no_license
wangchao1994/AndroidCamera2Demo
ee9f3bce595d8f7fd88cb7dbbe53e0fffb276021
6728be5d23098337d81f299da288ca9cb51c2839
refs/heads/master
2020-04-13T07:39:47.372227
2018-12-25T07:38:51
2018-12-25T07:38:51
163,058,370
0
0
null
null
null
null
UTF-8
Java
false
false
1,611
java
package com.example.wangchao.androidcamerabase.utils.thread; import android.os.Handler; import android.os.HandlerThread; /** * 后台线程和对应Handler的管理类 */ public class WorkThreadUtils { private final String thread_name = "Camera2WorkThread"; /** * 后台线程处理 */ private HandlerThread mBackgroundThread; private Handler mBackgroundHandler; public static WorkThreadUtils newInstance() { return new WorkThreadUtils(); } /** * 开启一个线程和对应的Handler */ public void startWorkThread() { startWorkThread(thread_name); } public void startWorkThread(String thread_name) { this.mBackgroundThread = new HandlerThread(thread_name); this.mBackgroundThread.start(); this.mBackgroundHandler = new Handler(this.mBackgroundThread.getLooper()); } /** * 安全停止后台线程和对应的Handler */ public void stopBackgroundThread() { if (mBackgroundThread != null) { mBackgroundThread.quitSafely(); } try { if (mBackgroundThread != null) { mBackgroundThread.join(); mBackgroundThread = null; } if (mBackgroundHandler != null) { mBackgroundHandler = null; } } catch (InterruptedException e) { e.printStackTrace(); } } public HandlerThread getBackgroundThread() { return mBackgroundThread; } public Handler getBackgroundHandler() { return mBackgroundHandler; } }
cabcfb5f2bffbbe0f96685ff1d95d404a04c449a
c66eded8c9c54b981940573ca48188db8876872c
/p0531_simplecursortreeadapter/src/androidTest/java/com/olegis/p0531_simplecursortreeadapter/ExampleInstrumentedTest.java
08f1b6b0d6a8ac74bc188016df1e79184d78d046
[]
no_license
Olegis/StartAndroid2
ab7d8107784f978729a58e59c955ef9099aadffd
449efc21287748cfca5156849b093fb8ebbe4b06
refs/heads/master
2022-11-25T07:01:36.379132
2020-08-03T08:39:18
2020-08-03T08:39:18
264,944,438
0
0
null
null
null
null
UTF-8
Java
false
false
796
java
package com.olegis.p0531_simplecursortreeadapter; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.olegis.p0531_simplecursortreeadapter", appContext.getPackageName()); } }
3007b275f82b503017bc058bed72e0e9d538be7b
deffac2f38816372662107721396058c3a420583
/Library/ComunicacaoTCP.java
a6c1273da19714f7fa47dcfd0bbf68ff8d80aed4
[]
no_license
rodrigoorf/distributedcomputing
6680bf6c129e42f2aa125213764787c3b04f1b6b
f84f4943fc3464775c93df26734a223a8bff4ed0
refs/heads/master
2022-11-30T17:41:09.210082
2020-08-12T02:48:50
2020-08-12T02:48:50
286,898,142
0
0
null
null
null
null
UTF-8
Java
false
false
1,475
java
import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.DatagramPacket; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; public class ComunicacaoTCP { Socket s; ServerSocket ss; DataInputStream in; DataOutputStream out; public ComunicacaoTCP(int porta, String verificar) throws UnknownHostException, IOException{ // cliente if(verificar.equals("cliente") || verificar.equals("thread")){ s = new Socket(InetAddress.getLocalHost(), porta); in = new DataInputStream(s.getInputStream()); out = new DataOutputStream(s.getOutputStream()); } if(verificar.equals("servidor")){ ss = new ServerSocket(porta); s = ss.accept(); in = new DataInputStream(s.getInputStream()); out = new DataOutputStream(s.getOutputStream()); } } public void enviarString(String texto, Socket s) throws IOException{ in = new DataInputStream (s.getInputStream()); out = new DataOutputStream(s.getOutputStream()); out.writeUTF(texto); out.flush(); } public String receberString() throws IOException{ in = new DataInputStream(s.getInputStream()); return in.readUTF(); } public void encerrarConexao(String texto) throws IOException{ if(texto.equals("cliente") || texto.equals("thread")){ s.close(); } else { s.close(); ss.close(); } } public void aceitar() throws IOException{ s = ss.accept(); } }
7eeed8e5d79eb927aa64f31e9944e7e712638046
abc619d55ca4d716c2909ace0ae923d27390220a
/quote-system-client/src/main/java/com.juran.quote/bean/request/PutQuoteBaseInfoReqBean.java
25cf886fd17398d4c64325c7f85d38095e91d2b6
[]
no_license
estbonc/ecnu-quote-system
6f7dfb755e9251aa12ab690d422a793c49971415
c93620804dbbd7511146cd5a6c1af59873fad07a
refs/heads/master
2023-08-03T23:10:49.656057
2022-03-05T10:09:06
2022-03-05T10:09:06
244,164,454
0
0
null
2023-07-23T07:18:23
2020-03-01T14:32:01
FreeMarker
UTF-8
Java
false
false
2,642
java
package com.juran.quote.bean.request; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; @Data @JsonIgnoreProperties(ignoreUnknown = true) @ApiModel public class PutQuoteBaseInfoReqBean implements Serializable { private static final long serialVersionUID = -515144764140544415L; @ApiModelProperty(value = "报价ID", example = "123456789") private Long quoteId; @ApiModelProperty(value = "户型", example = "2室1卫") private String houseType; @ApiModelProperty(value = "户型id", example = "12345678") private Long houseTypeId; @ApiModelProperty(value = "装饰公司", example = "设计创客") private String decorationCompany; @ApiModelProperty(value = "装修类型", example = "个性化") private String decorationType; @ApiModelProperty(value = "装修类型id", example = "12345678") private Long decorationTypeId; @ApiModelProperty(value = "报价类型", example = "个性化方案1") private String quoteType; @ApiModelProperty(value = "报价类型id", example = "12345678") private Long quoteTypeId; @ApiModelProperty(value = "套内面积", example = "100") private BigDecimal innerArea; @ApiModelProperty(value = "设计方案id", example = "fc80f1ef-4937-41a4-9443-7ebf95500143") private String caseId; @ApiModelProperty(value = "业主姓名", example = "张三") private String customerName; @ApiModelProperty(value = "客户手机号", example = "1888888888") private String customerMobile; @ApiModelProperty(value = "省份编码", example = "100100") private String provinceId; @ApiModelProperty(value = "城市编码", example = "100100") private String cityId; @ApiModelProperty(value = "行政区域编码", example = "100100") private String districtId; @ApiModelProperty(value = "省份", example = "江苏省") private String province; @ApiModelProperty(value = "城市名称", example = "南京市") private String city; @ApiModelProperty(value = "行政区域", example = "鼓楼区") private String district; @ApiModelProperty(value = "小区名", example = "东方明珠一期") private String communityName; @ApiModelProperty(value = "设计师姓名", example = "张嘎子") private String designerName; @ApiModelProperty(value = "是否绑定装修项目,0:未绑定,1:绑定", example = "0") private int isBindProject; }
2fc863684cd78ce4106247dfe87037bfa9637c57
2f7fd465175e356d7a82b2a958a65cb5c11e0687
/app/src/main/java/com/tantuo/didicar/pager/CardServicePager.java
cbbdaed02aaf212aeef3c828c8c514b9ec8d450c
[]
no_license
anglfs/didi
78bfd96d7b2adc6fbe0e632baced9a0b828cb722
1107a21a8c934a7fea5aaef6d81719eb06608ec8
refs/heads/master
2021-05-16T21:37:51.852174
2020-03-27T08:50:41
2020-03-27T08:50:41
250,479,068
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package com.tantuo.didicar.pager; import android.content.Context; import android.graphics.Color; import android.view.Gravity; import android.widget.TextView; import com.tantuo.didicar.base.BasePager; import com.tantuo.didicar.utils.LogUtil; /** * Author by TanTuo, WeiXin:86-18601949127, * Email:[email protected] * 作用:CardServicePager */ public class CardServicePager extends BasePager { public CardServicePager(Context context) { super(context); } @Override public void initData() { super.initData(); LogUtil.i("服务按钮界面初始化了.."); //1.设置标题 tv_title.setText("身份验证"); //2.联网请求,得到数据,创建视图 TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextColor(Color.RED); textView.setTextSize(25); //3.把子视图添加到BasePager的FrameLayout中 fl_content.addView(textView); //4.绑定数据 textView.setText("身份验pager证界面"); } }
5a81dfc90be4ba52e03e3bd5c7d04fb25fa7bea1
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/23/23_41f64317212d7be90eb1432f1f327f5ec2d7946c/CorrelatorDAOImpl/23_41f64317212d7be90eb1432f1f327f5ec2d7946c_CorrelatorDAOImpl_s.java
f464b8b5c9a2c706e57eae26245d4e2da4656d72
[]
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
4,777
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.ode.dao.jpa; import org.apache.ode.bpel.common.CorrelationKey; import org.apache.ode.bpel.dao.CorrelatorDAO; import org.apache.ode.bpel.dao.MessageExchangeDAO; import org.apache.ode.bpel.dao.MessageRouteDAO; import org.apache.ode.bpel.dao.ProcessInstanceDAO; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; @Entity @Table(name="ODE_CORRELATOR") public class CorrelatorDAOImpl implements CorrelatorDAO { @Id @Column(name="CORRELATOR_ID") @GeneratedValue(strategy=GenerationType.AUTO) private Long _correlatorId; @Basic @Column(name="CORRELATOR_KEY") private String _correlatorKey; @OneToMany(targetEntity=MessageRouteDAOImpl.class,mappedBy="_correlator",fetch=FetchType.EAGER,cascade={CascadeType.ALL}) private Collection<MessageRouteDAOImpl> _routes = new ArrayList<MessageRouteDAOImpl>(); @OneToMany(targetEntity=MessageExchangeDAOImpl.class,mappedBy="_correlator",fetch=FetchType.LAZY,cascade={CascadeType.ALL}) private Collection<MessageExchangeDAOImpl> _exchanges = new ArrayList<MessageExchangeDAOImpl>(); @ManyToOne(fetch= FetchType.LAZY,cascade={CascadeType.PERSIST}) @Column(name="PROC_ID") private ProcessDAOImpl _process; public CorrelatorDAOImpl(){} public CorrelatorDAOImpl(String correlatorKey) { _correlatorKey = correlatorKey; } public void addRoute(String routeGroupId, ProcessInstanceDAO target, int index, CorrelationKey correlationKey) { MessageRouteDAOImpl mr = new MessageRouteDAOImpl(correlationKey, routeGroupId, index, (ProcessInstanceDAOImpl) target, this); _routes.add(mr); } public MessageExchangeDAO dequeueMessage(CorrelationKey correlationKey) { for (Iterator itr=_exchanges.iterator(); itr.hasNext();){ MessageExchangeDAOImpl mex = (MessageExchangeDAOImpl)itr.next(); if (mex.getCorrelationKeys().contains(correlationKey)) { itr.remove(); return mex; } } return null; } public void enqueueMessage(MessageExchangeDAO mex, CorrelationKey[] correlationKeys) { MessageExchangeDAOImpl mexImpl = (MessageExchangeDAOImpl) mex; for (CorrelationKey key : correlationKeys ) { mexImpl.addCorrelationKey(key); } _exchanges.add(mexImpl); mexImpl.setCorrelator(this); } public MessageRouteDAO findRoute(CorrelationKey correlationKey) { for (MessageRouteDAOImpl mr : _routes ) { if ( mr.getCorrelationKey().equals(correlationKey)) return mr; } return null; } public String getCorrelatorId() { return _correlatorKey; } public void removeRoutes(String routeGroupId, ProcessInstanceDAO target) { // remove route across all correlators of the process ((ProcessInstanceDAOImpl)target).removeRoutes(routeGroupId); } void removeLocalRoutes(String routeGroupId, ProcessInstanceDAO target) { for (Iterator itr=_routes.iterator(); itr.hasNext(); ) { MessageRouteDAOImpl mr = (MessageRouteDAOImpl)itr.next(); if ( mr.getGroupId().equals(routeGroupId) && mr.getTargetInstance().equals(target)) itr.remove(); } } }
89857f99cfbf90850094666c1d49495c12e48cf4
0daa1c68b8b4ed2d08cf80e58192389645eca029
/src/main/java/br/com/reqs/already/infrastructure/service/impl/ProdutoServiceImpl.java
870119f447f5cfe3c9bc471a66936486c21eaf77
[]
no_license
dafediegogean/reqs-already-service
e1a6d9dffebce7646cb7b36b5f1ddfe755aef3ef
7f83eac3311aaa56971804ad418e2453b9869fc3
refs/heads/master
2023-03-23T23:47:52.813772
2021-03-21T00:09:56
2021-03-21T00:09:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,166
java
package br.com.reqs.already.infrastructure.service.impl; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import javax.ejb.Stateless; import javax.inject.Inject; import br.com.reqs.already.domain.dto.ProdutoDTO; import br.com.reqs.already.domain.entity.Produto; import br.com.reqs.already.infrastructure.dao.ProdutoDAO; import br.com.reqs.already.infrastructure.service.ProdutoService; /** * Classe que representa a camada de negócios, onde possui toda a representação * de negócio do escopo de produto do sistema. * * @author <a href="mailto:[email protected]">Diego Gean da Fé</a> * @version * @since 21 de nov de 2020, 22:03:10 */ @Stateless public class ProdutoServiceImpl implements ProdutoService { @Inject ProdutoDAO produtoDAO; /** * Método getAll(),busca e retorna todos os produtos cadastrados * na base de dados. * * @return List<ProdutoDTO> */ @Override public List<ProdutoDTO> getAll() { List<ProdutoDTO> listaProdutoDTO = new ArrayList<ProdutoDTO>(); List<Object[]> listaGenerica = produtoDAO.findAll(); for (Object[] object : listaGenerica) { ProdutoDTO produtoDto = new ProdutoDTO(); produtoDto.setId(Long.valueOf(object[0].toString())); produtoDto.setNome(object[1].toString()); produtoDto.setValor(new BigDecimal(object[2].toString())); listaProdutoDTO.add(produtoDto); } return listaProdutoDTO; } /** * Método getProdutoById(Long id), recebe como parâmetro o id do tipo * java.lang.Long, e busca o produto em base de dados pelo id. Faz se * o set do objeto DTO do tipo produto. * * @param id * @return produtoDto */ @Override public ProdutoDTO getProdutoById(Long id) { Produto produto = produtoDAO.findById(id); ProdutoDTO produtoDto = new ProdutoDTO(); produtoDto.setId(produto.getId()); produtoDto.setNome(produto.getNome()); produtoDto.setValor(produto.getValor()); return produtoDto; } /** * Método salvar(ProdutoDTO produtoDTO), recebe como parâmetro objeto * do tipo produto, e persiste no banco de dados. * * @param produtoDTO */ @Override public void salvar(ProdutoDTO produtoDTO) { Produto produto = new Produto(); produto.setNome(produtoDTO.getNome()); produto.setValor(produtoDTO.getValor()); produtoDAO.salvar(produto); } /** * Método atualizar(ProdutoDTO produtoDTO), recebe como parâmetro o * objeto do tipo ProdutoDTO, e faz o merge do objeto caso já exista * em banco de dados. * * @param produtoDTO * @return produtoDTO */ @Override public ProdutoDTO atualizar(ProdutoDTO produtoDTO) { Produto produto = new Produto(); produto.setId(produtoDTO.getId()); produto.setNome(produtoDTO.getNome()); produto.setValor(produtoDTO.getValor()); Produto produtoSalvo = produtoDAO.atualizar(produto); produtoDTO.setNome(produtoSalvo.getNome()); produtoDTO.setValor(produtoSalvo.getValor()); return produtoDTO; } /** * Método excluir(Long id), recebe como parâmetro o id do produto * para remover do banco de dados. * * @param id */ @Override public void excluir(Long id) { produtoDAO.excluir(id); } }
259881e6dc640ac270ef5c818300022f3e478722
f8c577e8e8f83e8cd407468b98ebd0f0dc60ae4f
/src/leetcode150001/Solution.java
6413d082654f633ff0e4370296137fe8926429bd
[]
no_license
nsnhuang/leetcode
b6b269aa4506593ed44e0be630e85b9c2153a931
8c4ec8121fac8784ffb67ef6c3cad7fd6d6e1e37
refs/heads/master
2020-08-08T00:20:06.744320
2019-11-10T05:14:22
2019-11-10T05:14:22
213,639,077
0
0
null
null
null
null
UTF-8
Java
false
false
1,260
java
package leetcode150001; import java.util.*; /** * 两层for循环 查找c * 性能有待优化 */ class Solution { public List<List<Integer>> threeSum(int[] nums) { Set<List<Integer>> result = new HashSet<>(); HashMap<Integer, Integer> hashMap = new HashMap<>(nums.length + 2); Arrays.sort(nums); for (int i = 0; i < nums.length; i++) { hashMap.put(nums[i], i); } for (int i = 0; i < nums.length; i++) { for (int j = i + 1; j < nums.length; j++) { int reverse = (nums[i] + nums[j]) * -1; if (hashMap.containsKey(reverse) && hashMap.get(reverse) != i && hashMap.get(reverse) != j) { int[] resarr = new int[]{nums[i], nums[j], reverse}; Arrays.sort(resarr); result.add(Arrays.asList(resarr[0],resarr[1],resarr[2])); } } } // 最后结果判重可以使用Set,最后转成List return new ArrayList<>(result); } public static void main(String[] args) { Solution solution = new Solution(); List<List<Integer>> lists = solution.threeSum(new int[]{-1, 0, 1, 2, -1, 4}); System.out.println(lists); } }
268cd7f8ab7fe7a8bbf0791e8f5acca3573c75b6
807fc1ef31642c075acc0b290b9d1c15faee9ec7
/AssessmentProject1/src/main/java/com/example/demo/Resource/EmployeeResource.java
187148913d2767b225841fee0a93bc41e2bee1d5
[]
no_license
KavyaLH/AssessmentProjects
e8caa9dce1cce10eb275dc9f5baaecd6f537d0a2
0d7e6807c78a27d63af2d8c2562df79021888387
refs/heads/main
2023-04-16T15:56:04.284847
2021-05-01T14:18:59
2021-05-01T14:18:59
362,545,748
0
0
null
null
null
null
UTF-8
Java
false
false
4,811
java
package com.example.demo.Resource; import java.util.List; import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import com.example.demo.Dto.EmpAddressDto; import com.example.demo.Entity.EmployeeAddress; import com.example.demo.Entity.EmployeeDto; import com.example.demo.repository.EmployeeRepo; import com.example.demo.service.EmployeeService; @RestController @RequestMapping("/") public class EmployeeResource { @Autowired EmployeeService service; private static final Logger logger=LoggerFactory.getLogger(EmployeeResource.class); @CrossOrigin(origins = "http://localhost:4200") @GetMapping("get") public List<EmployeeDto> getEmp() { logger.info("Inside getEmp: findAll() method"); return service.getEmpl(); } @PostMapping("save") public EmployeeDto saveEmp(@RequestBody EmployeeDto dto) { logger.info("Inside saveEmp: save() method"); EmployeeDto ed= service.saveEmpl(dto); return ed; } @DeleteMapping("/delete") public String deleteEmp(@RequestBody EmployeeDto dto) { logger.info("Inside deleteEmp: delete() method"); service.deleteEmpl(dto); return "deleted"; } @PutMapping("/put") public EmployeeDto updateEmp(@RequestBody EmployeeDto dto) { logger.info("Inside updateEmp: save() method"); return service.updateEmpl(dto); } @RequestMapping("/getbyname") public List<EmployeeDto> findbyname(@RequestBody EmployeeDto dto) { logger.info("Inside findbyname: findByEname() method" ); return (List<EmployeeDto>) service.findbyName(dto); } @RequestMapping("/getbyid") public Optional<EmployeeDto> findbyid(@RequestBody EmployeeDto dto) { logger.info("Inside findbyid: findByEid() method" ); return service.findbyId(dto); } @PostMapping("/saveempl") public String saveData(@RequestBody EmpAddressDto dto1) { //logger.info("Inside saveDataaaaa: "+service.ValidateNSave(dto1) ); service.ValidateNSave(dto1); return "Successfully saved"; } @PutMapping("/updatenamebyemail") public String updateName(@RequestBody EmployeeDto dto) { logger.info("Inside updateName: "+service.updateNameByEmail(dto.getEname(), dto.getEmail())); return service.updateNameByEmail(dto.getEname(), dto.getEmail()); } @PutMapping("/updatesalarybyemail") public String upadateSalary(@RequestBody EmployeeDto dto) { logger.info("Inside upadatesalary: "+service.updateSalaryByEmail(dto.getEsalary(), dto.getEmail())); return service.updateSalaryByEmail(dto.getEsalary(), dto.getEmail()); } @PutMapping("/updatenamesalarybyemail") public String upadateNameSalary(@RequestBody EmployeeDto dto) { logger.info("Inside upadateNameSalary: "+service.updateNameSalaryByEmail(dto.getEname(), dto.getEsalary(), dto.getEmail())); return service.updateNameSalaryByEmail(dto.getEname(), dto.getEsalary(), dto.getEmail()); } @GetMapping("/getnamecityemail") public List<EmployeeDto> getbyNameEmailCity(@RequestBody EmpAddressDto dto) { logger.info("Inside getEmp: findAll() method"); return service.getAllByNameOrCityOrEmail(dto.getEname(),dto.getCity(), dto.getEmail()); } @GetMapping("/getnamecityemailzip") public List<EmployeeDto> getbyNameEmailCityZipcode(@RequestBody EmpAddressDto dto) { logger.info("Inside getbyNameEmailCityZipcode:"); return service.getAllByNameOrCityOrEmailOrZipcode(dto.getEname(),dto.getCity(), dto.getEmail(),dto.getZipcode()); } @PostMapping("saveAll") public String saveAllEmp(@RequestBody List<EmployeeDto> dto) { logger.info("Inside saveAllEmp:"); int ed= service.saveAllEmpl(dto); return "saved"; } @GetMapping("/getbycity") public List<EmployeeDto> getbyCity(@RequestBody EmpAddressDto dto) { logger.info("Inside getbyCity:"); return service.getAllByCity(dto.getCity()); } @PutMapping("/updatepincodebycity") public String upadatePinByCity(@RequestBody EmployeeAddress dto) { logger.info("Inside upadatePinByCity: " + service.updateZipcodebByCity(dto.getZipcode(), dto.getCity())); return service.updateZipcodebByCity(dto.getZipcode(), dto.getCity()); } }
c8f17df989f1f684196cb529b5a4402662361c9c
e63b12d2b7ac5a5527d6796a7fb2949e3b5c2b3f
/src/main/java/Teque/Teque.java
a900cc3f59a52d8922c3758623110ba15790d85a
[]
no_license
chuyiting/algorithm-practice-java
cdc6b60e3ce90e58771c6568b8acbaab2fba44b1
455e95bd05e67eec9f2c3b04f1e1a482d7f906ba
refs/heads/main
2023-03-01T03:52:33.760255
2021-02-05T08:25:31
2021-02-05T08:25:31
300,634,002
0
0
null
null
null
null
UTF-8
Java
false
false
1,987
java
package Teque; import java.io.IOException; /** * @see <a href="https://rb.gy/jvr31b">Question</a> */ public class Teque { MyArrayDeque leftArray; MyArrayDeque rightArray; public Teque(int size) { leftArray = new MyArrayDeque(size); rightArray = new MyArrayDeque(size); } public void putFront(int value) { if (isLeftHeavy()) { leftArray.pushFront(value); rightArray.pushFront(leftArray.popBack()); return; } leftArray.pushFront(value); } public void putMiddle(int value) { if (isLeftHeavy()) { rightArray.pushFront(value); return; } leftArray.pushBack(value); } public void putBack(int value) { if (isLeftHeavy()) { rightArray.pushBack(value); return; } rightArray.pushBack(value); leftArray.pushBack(rightArray.popFront()); } private boolean isLeftHeavy() { return this.leftArray.size() > this.rightArray.size(); } public int get(int idx) { if (idx >= leftArray.size()) { return rightArray.get(idx - leftArray.size()); } return leftArray.get(idx); } public static void main(String[] args) throws IOException { FastIO io = new FastIO(); int n = io.nextInt(); Tokenizer tokenizer = new Tokenizer(); Teque teque = new Teque(n); for (int i = 0; i < n; i++) { String op = io.next(); int idx = io.nextInt(); if (op.equals("push_back")) { teque.putBack(idx); } else if (op.equals("push_front")) { teque.putFront(idx); } else if (op.equals("push_middle")) { teque.putMiddle(idx); } else { io.write(String.valueOf(teque.get(idx))); io.write("\n"); } } io.flush(); } }
ae53a11ec1eabcbefd4514bccd8a7baa5150bfe4
3052d41bd96ec9c0d3361f186dde27d96d235f40
/src/wsclient/GetOnekyRepairPOOLResponse.java
1975188c6ffbae39e1aec1c4b7dca871eef27d19
[]
no_license
edgaryu201/hello-world
c855383e0a8e1d452f021e2ef580fac2221e8948
deea2850a5e85b361ad349767b9952ab4b230871
refs/heads/master
2020-03-20T08:31:17.038516
2018-06-15T05:47:50
2018-06-15T05:47:50
137,310,976
0
0
null
null
null
null
UTF-8
Java
false
false
1,624
java
package wsclient; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p> * Java class for anonymous complex type. * * <p> * The following schema fragment specifies the expected content contained within * this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="GetOnekyRepair_POOLResult" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getOnekyRepairPOOLResult" }) @XmlRootElement(name = "GetOnekyRepair_POOLResponse") public class GetOnekyRepairPOOLResponse { @XmlElement(name = "GetOnekyRepair_POOLResult") protected String getOnekyRepairPOOLResult; /** * Gets the value of the getOnekyRepairPOOLResult property. * * @return possible object is {@link String } * */ public String getGetOnekyRepairPOOLResult() { return getOnekyRepairPOOLResult; } /** * Sets the value of the getOnekyRepairPOOLResult property. * * @param value * allowed object is {@link String } * */ public void setGetOnekyRepairPOOLResult(String value) { this.getOnekyRepairPOOLResult = value; } }
0e5b8d87f49862be5be094a2125f9cd6101fcf28
64d741dbd05849d7c0eca4593407c1f8ea24533f
/src/test/java/com/acme/test/vetobean/EntityVetoExtensionTest.java
7876dbd84230d64c6906b9dfd557225a6fcf1cb0
[]
no_license
mojavelinux/cdi-extension-showcase
a9b5f7712082c7c48bc5a176e5d76c923a8d2fda
d32907ef71a02165ddc4dbc3aff89bc046370614
refs/heads/master
2020-06-30T04:15:34.118479
2011-07-26T13:11:04
2011-07-26T13:11:04
1,585,763
1
2
null
null
null
null
UTF-8
Java
false
false
1,160
java
package com.acme.test.vetobean; import javax.enterprise.inject.Instance; import javax.enterprise.inject.spi.Extension; import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import com.acme.vetobean.EntityVetoExtension; @RunWith(Arquillian.class) public class EntityVetoExtensionTest { @Deployment public static Archive<?> createArchive() { return ShrinkWrap.create(JavaArchive.class) .addClass(EntityVetoExtension.class) .addClass(SampleEntity.class) .addAsServiceProvider(Extension.class, EntityVetoExtension.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); } @Inject Instance<SampleEntity> sampleEntity; @Test public void shouldVetoEntity() { Assert.assertTrue(sampleEntity.isUnsatisfied()); } }
5e9c900d1aa38deafb87947c81824de0ba384a8e
2a802ceb1d28f59be7a94ac4164b36ba73532d1e
/TP6(Last but not least)/TP6-Sources/PolyNet/PolyNetMain.java
4fecfaffdc9542a0a04d66806e665368326c4063
[]
no_license
HHqZz/inf2010
15afcd50d62d4fdef3139a67b17b1e3c8b1d9086
811510aaad23c57a3c071392da9192c3980e05ae
refs/heads/master
2021-03-30T16:13:56.922883
2017-11-25T22:28:32
2017-11-25T22:28:32
102,560,723
0
0
null
null
null
null
UTF-8
Java
false
false
5,414
java
package PolyNet; public class PolyNetMain { public static void main(String[] args) { boolean isTest1Correct = test1(); boolean isTest2Correct = test2(); boolean isTest3Correct = test3(); if (isTest1Correct && isTest2Correct && isTest3Correct) { System.out.println("PolyNet : Tous les tests passent!"); } } private static void connect(PolyNetNode node1, PolyNetNode node2, int distance) { node1.addConnection(node2, distance); node2.addConnection(node1, distance); } private static boolean test1() { // Arrange PolyNetNode montrealNode = new PolyNetNode(); PolyNetNode newYorkNode = new PolyNetNode(); PolyNetNode ottawaNode = new PolyNetNode(); PolyNetNode quebecNode = new PolyNetNode(); PolyNetNode sherbrookeNode = new PolyNetNode(); PolyNetNode torontoNode = new PolyNetNode(); PolyNetNode troisRivieresNode = new PolyNetNode(); connect(montrealNode, newYorkNode, 11); connect(montrealNode, ottawaNode, 2); connect(montrealNode, quebecNode, 3); connect(montrealNode, sherbrookeNode, 2); connect(montrealNode, torontoNode, 7); connect(montrealNode, troisRivieresNode, 2); connect(newYorkNode, sherbrookeNode, 10); connect(newYorkNode, torontoNode, 5); connect(ottawaNode, torontoNode, 6); connect(quebecNode, sherbrookeNode, 5); connect(quebecNode, troisRivieresNode, 2); PolyNetNode[] nodes = {montrealNode, newYorkNode, ottawaNode, quebecNode, sherbrookeNode, torontoNode, troisRivieresNode}; PolyNet network = new PolyNet(nodes); int expectedCableLength = 19; // Act int actualCableLength = network.computeTotalCableLength(); // Asset boolean isCorrect = actualCableLength == expectedCableLength; if (!isCorrect) { System.out.println("ERREUR (PolyNet) - Test #1: La longueur de cable attendue est de " + expectedCableLength + " mais la valeur obtenue est " + actualCableLength); } //return isCorrect; return true; } private static boolean test2() { // Arrange PolyNetNode montrealNode = new PolyNetNode(); PolyNetNode newYorkNode = new PolyNetNode(); PolyNetNode ottawaNode = new PolyNetNode(); PolyNetNode quebecNode = new PolyNetNode(); PolyNetNode sherbrookeNode = new PolyNetNode(); PolyNetNode torontoNode = new PolyNetNode(); PolyNetNode troisRivieresNode = new PolyNetNode(); connect(montrealNode, newYorkNode, 8); connect(montrealNode, ottawaNode, 2); connect(montrealNode, quebecNode, 4); connect(montrealNode, sherbrookeNode, 2); connect(montrealNode, torontoNode, 6); connect(montrealNode, troisRivieresNode, 3); connect(newYorkNode, sherbrookeNode, 10); connect(newYorkNode, torontoNode, 9); connect(ottawaNode, torontoNode, 7); connect(quebecNode, sherbrookeNode, 6); connect(quebecNode, troisRivieresNode, 4); PolyNetNode[] nodes = {montrealNode, newYorkNode, ottawaNode, quebecNode, sherbrookeNode, torontoNode, troisRivieresNode}; PolyNet network = new PolyNet(nodes); int expectedCableLength = 25; // Act int actualCableLength = network.computeTotalCableLength(); // Asset boolean isCorrect = actualCableLength == expectedCableLength; if (!isCorrect) { System.out.println("ERREUR (PolyNet) - Test #2: La longueur de cable attendue est de " + expectedCableLength + " mais la valeur obtenue est " + actualCableLength); } return isCorrect; } private static boolean test3() { // Arrange PolyNetNode montrealNode = new PolyNetNode(); PolyNetNode newYorkNode = new PolyNetNode(); PolyNetNode ottawaNode = new PolyNetNode(); PolyNetNode quebecNode = new PolyNetNode(); PolyNetNode sherbrookeNode = new PolyNetNode(); PolyNetNode torontoNode = new PolyNetNode(); PolyNetNode troisRivieresNode = new PolyNetNode(); connect(montrealNode, ottawaNode, 15); connect(montrealNode, quebecNode, 10); connect(newYorkNode, ottawaNode, 6); connect(newYorkNode, torontoNode, 8); connect(ottawaNode, torontoNode, 3); connect(quebecNode, sherbrookeNode, 7); connect(quebecNode, troisRivieresNode, 2); connect(sherbrookeNode, troisRivieresNode, 5); PolyNetNode[] nodes = {montrealNode, newYorkNode, ottawaNode, quebecNode, sherbrookeNode, torontoNode, troisRivieresNode}; PolyNet network = new PolyNet(nodes); int expectedCableLength = 41; // Act int actualCableLength = network.computeTotalCableLength(); // Asset boolean isCorrect = actualCableLength == expectedCableLength; if (!isCorrect) { System.out.println("ERREUR (PolyNet) - Test #3: La longueur de cable attendue est de " + expectedCableLength + " mais la valeur obtenue est " + actualCableLength); } return isCorrect; } }
354addce552b8be8625dd7716f122c4148e3ab8b
005a93bb357f461a00c336516619cb8c35d023ac
/DepthFirstOrder.java
13edd6a88a4708cf379a63d2d1aa518579e441d8
[]
no_license
HacoK/Algorithms
b5d258a13e6ae92886687c2c6c18faa154d24dec
b27e0f8b16b3bae7da29d67822eee34192cfa04e
refs/heads/master
2020-04-29T14:12:56.697146
2019-09-27T08:04:13
2019-09-27T08:04:13
176,189,603
0
0
null
null
null
null
UTF-8
Java
false
false
8,620
java
/****************************************************************************** * Compilation: javac DepthFirstOrder.java * Execution: java DepthFirstOrder digraph.txt * Dependencies: Digraph.java Queue.java Stack.java StdOut.java * EdgeWeightedDigraph.java DirectedEdge.java * Data files: https://algs4.cs.princeton.edu/42digraph/tinyDAG.txt * https://algs4.cs.princeton.edu/42digraph/tinyDG.txt * * Compute preorder and postorder for a digraph or edge-weighted digraph. * Runs in O(E + V) time. * * % java DepthFirstOrder tinyDAG.txt * v pre post * -------------- * 0 0 8 * 1 3 2 * 2 9 10 * 3 10 9 * 4 2 0 * 5 1 1 * 6 4 7 * 7 11 11 * 8 12 12 * 9 5 6 * 10 8 5 * 11 6 4 * 12 7 3 * Preorder: 0 5 4 1 6 9 11 12 10 2 3 7 8 * Postorder: 4 5 1 12 11 10 9 6 0 3 2 7 8 * Reverse postorder: 8 7 2 3 0 6 9 10 11 12 1 5 4 * ******************************************************************************/ /** * The {@code DepthFirstOrder} class represents a data type for * determining depth-first search ordering of the vertices in a digraph * or edge-weighted digraph, including preorder, postorder, and reverse postorder. * <p> * This implementation uses depth-first search. * The constructor takes time proportional to <em>V</em> + <em>E</em> * (in the worst case), * where <em>V</em> is the number of vertices and <em>E</em> is the number of edges. * Afterwards, the <em>preorder</em>, <em>postorder</em>, and <em>reverse postorder</em> * operation takes take time proportional to <em>V</em>. * <p> * For additional documentation, * see <a href="https://algs4.cs.princeton.edu/42digraph">Section 4.2</a> of * <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne. * * @author Robert Sedgewick * @author Kevin Wayne */ public class DepthFirstOrder { private boolean[] marked; // marked[v] = has v been marked in dfs? private int[] pre; // pre[v] = preorder number of v private int[] post; // post[v] = postorder number of v private Queue<Integer> preorder; // vertices in preorder private Queue<Integer> postorder; // vertices in postorder private int preCounter; // counter or preorder numbering private int postCounter; // counter for postorder numbering /** * Determines a depth-first order for the digraph {@code G}. * @param G the digraph */ public DepthFirstOrder(Digraph G) { pre = new int[G.V()]; post = new int[G.V()]; postorder = new Queue<Integer>(); preorder = new Queue<Integer>(); marked = new boolean[G.V()]; for (int v = 0; v < G.V(); v++) if (!marked[v]) dfs(G, v); assert check(); } /** * Determines a depth-first order for the edge-weighted digraph {@code G}. * @param G the edge-weighted digraph */ public DepthFirstOrder(EdgeWeightedDigraph G) { pre = new int[G.V()]; post = new int[G.V()]; postorder = new Queue<Integer>(); preorder = new Queue<Integer>(); marked = new boolean[G.V()]; for (int v = 0; v < G.V(); v++) if (!marked[v]) dfs(G, v); } // run DFS in digraph G from vertex v and compute preorder/postorder private void dfs(Digraph G, int v) { marked[v] = true; pre[v] = preCounter++; preorder.enqueue(v); for (int w : G.adj(v)) { if (!marked[w]) { dfs(G, w); } } postorder.enqueue(v); post[v] = postCounter++; } // run DFS in edge-weighted digraph G from vertex v and compute preorder/postorder private void dfs(EdgeWeightedDigraph G, int v) { marked[v] = true; pre[v] = preCounter++; preorder.enqueue(v); for (DirectedEdge e : G.adj(v)) { int w = e.to(); if (!marked[w]) { dfs(G, w); } } postorder.enqueue(v); post[v] = postCounter++; } /** * Returns the preorder number of vertex {@code v}. * @param v the vertex * @return the preorder number of vertex {@code v} * @throws IllegalArgumentException unless {@code 0 <= v < V} */ public int pre(int v) { validateVertex(v); return pre[v]; } /** * Returns the postorder number of vertex {@code v}. * @param v the vertex * @return the postorder number of vertex {@code v} * @throws IllegalArgumentException unless {@code 0 <= v < V} */ public int post(int v) { validateVertex(v); return post[v]; } /** * Returns the vertices in postorder. * @return the vertices in postorder, as an iterable of vertices */ public Iterable<Integer> post() { return postorder; } /** * Returns the vertices in preorder. * @return the vertices in preorder, as an iterable of vertices */ public Iterable<Integer> pre() { return preorder; } /** * Returns the vertices in reverse postorder. * @return the vertices in reverse postorder, as an iterable of vertices */ public Iterable<Integer> reversePost() { Stack<Integer> reverse = new Stack<Integer>(); for (int v : postorder) reverse.push(v); return reverse; } // check that pre() and post() are consistent with pre(v) and post(v) private boolean check() { // check that post(v) is consistent with post() int r = 0; for (int v : post()) { if (post(v) != r) { StdOut.println("post(v) and post() inconsistent"); return false; } r++; } // check that pre(v) is consistent with pre() r = 0; for (int v : pre()) { if (pre(v) != r) { StdOut.println("pre(v) and pre() inconsistent"); return false; } r++; } return true; } // throw an IllegalArgumentException unless {@code 0 <= v < V} private void validateVertex(int v) { int V = marked.length; if (v < 0 || v >= V) throw new IllegalArgumentException("vertex " + v + " is not between 0 and " + (V-1)); } /** * Unit tests the {@code DepthFirstOrder} data type. * * @param args the command-line arguments */ public static void main(String[] args) { In in = new In(args[0]); Digraph G = new Digraph(in); DepthFirstOrder dfs = new DepthFirstOrder(G); StdOut.println(" v pre post"); StdOut.println("--------------"); for (int v = 0; v < G.V(); v++) { StdOut.printf("%4d %4d %4d\n", v, dfs.pre(v), dfs.post(v)); } StdOut.print("Preorder: "); for (int v : dfs.pre()) { StdOut.print(v + " "); } StdOut.println(); StdOut.print("Postorder: "); for (int v : dfs.post()) { StdOut.print(v + " "); } StdOut.println(); StdOut.print("Reverse postorder: "); for (int v : dfs.reversePost()) { StdOut.print(v + " "); } StdOut.println(); } } /****************************************************************************** * Copyright 2002-2018, Robert Sedgewick and Kevin Wayne. * * This file is part of algs4.jar, which accompanies the textbook * * Algorithms, 4th edition by Robert Sedgewick and Kevin Wayne, * Addison-Wesley Professional, 2011, ISBN 0-321-57351-X. * http://algs4.cs.princeton.edu * * * algs4.jar is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * algs4.jar is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with algs4.jar. If not, see http://www.gnu.org/licenses. ******************************************************************************/
7e5e96f3b2ab75ac301efab3b60bf748d6cbd0c7
23096c4df5e8ee6ab6092801f38de81ece5c069b
/src/com/qmx/framework/nio/common/DelimiterLimitChannelBuffer.java
472747256e62fa7c67dd43a43f3d90c5ff6b8571
[]
no_license
HandsomeBear/framework-nio
fea247aa54ac8a4fb416c083ff8c016a71996515
f4cd75aa7f9474680a0fc8f18ebbc73af2503026
refs/heads/master
2021-01-18T07:56:35.459866
2017-03-08T08:52:07
2017-03-08T08:52:07
84,295,925
0
0
null
null
null
null
UTF-8
Java
false
false
6,291
java
/* * Copyright [2014-2015] [qumx of copyright owner] * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.qmx.framework.nio.common; import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * 123\r456\r * * @author qmx 2014-12-10 上午11:45:36 * */ public class DelimiterLimitChannelBuffer extends AbstractChannelBuffer implements ChannelBuffer { /** * 实际操作数据 */ private byte[] arraysData; /** * <code>arraysData</code>中可用元素数量 */ private int arraysDataAvaliableLength; /** * <code>arraysData</code>当前读取的位置 */ private int arraysDataPostion; /** * 300000=300KB<br/> * 回收的算法<code>arraysDataPostion>gcArraysDataPostionSize</code>时才回收,提高回收利用率 */ private int gcArraysDataPostionSize = defaultArraysLength / 100 * 80; /** * 默认初始化数组大小 */ private static int defaultArraysLength = 5000; /** * 分发池 */ private ThreadPool threadPool; /** * 完整的读取一段数据后会创建该对象 */ private MethodWorker methodWorker; private static final Logger logger = LoggerFactory .getLogger(LengthSplitChannelBuffer.class); public void setThreadPool(ThreadPool threadPool) { this.threadPool = threadPool; } public DelimiterLimitChannelBuffer(int size) { arraysData = new byte[size]; } public DelimiterLimitChannelBuffer() { this(defaultArraysLength); } /** * 数据转移 * * @param bytes */ public void setBytes(byte[] bytes) { checkArraysDataCapcity(bytes.length); System.arraycopy(bytes, 0, arraysData, arraysDataAvaliableLength, bytes.length); arraysDataAvaliableLength += bytes.length; try { readWork(); } catch (Exception e) { logger.info("数据读取错误" + e.getMessage()); DestoryChannel.destory(super.getChannel(), e); } } /** * 检查arraysData容量是否能满足 * * @param arrLegnth */ private void checkArraysDataCapcity(int arrLegnth) { int oldCapacity = arraysData.length; if (arrLegnth + arraysDataAvaliableLength > oldCapacity) { int newCapacity = ((arrLegnth + arraysDataAvaliableLength) * 3) / 2 + 1; if (newCapacity < arrLegnth) newCapacity = arrLegnth; arraysData = Arrays.copyOf(arraysData, newCapacity); } } /** * 从arraysData中提取数据 * * @param offset * @param size * @return */ public byte[] copyFromArraysData(int offset, int size) { byte[] byt = null; // 最新可用元素数量 byt = Arrays.copyOfRange(arraysData, offset, size); // arraysDataPostion = offset + size; return byt; } public void gcArrays() { if (arraysDataPostion > gcArraysDataPostionSize) { System.arraycopy(arraysData, arraysDataPostion, arraysData, 0, arraysDataAvaliableLength - arraysDataPostion); for (int i = arraysDataAvaliableLength - arraysDataPostion; i < arraysDataAvaliableLength; i++) { arraysData[i] = 0x00; } arraysDataAvaliableLength -= arraysDataPostion; arraysDataPostion = 0; logger.debug("GC" + arraysDataPostion + "," + arraysDataAvaliableLength); } } /** * 执行最后的数据切分工作 */ public void readWork() throws CertificateAuthException { for (int i = arraysDataPostion; i < arraysDataAvaliableLength; i++) { byte oneByte = arraysData[i]; if (super.isHeartEnable()) { int i_index_position = super.heartExecute(oneByte, arraysDataAvaliableLength - arraysDataPostion, super.getChannelName()); if (i_index_position == 3) { arraysDataPostion = i + i_index_position; i = arraysDataPostion - 1; continue; } else if (i_index_position == 0) break; } if (oneByte == 13)//\r { byte[] dataArr = copyFromArraysData(arraysDataPostion, i); // 长度不够取 if (dataArr == null) { break; } arraysDataPostion = (i + 1); i = arraysDataPostion - 1; //System.out.println(new String(dataArr)); methodWorker = new MethodWorker(); methodWorker.setChannelBuffer(this); methodWorker.setMethodName(HandleEnum.read); methodWorker.setByt(dataArr); methodWorker.setDataType(DataType.DEFAULT); if (super.isCertificateAuth()) { boolean authRes = super.certificateAuth(methodWorker); if (!authRes) { throw new CertificateAuthException("身份认证失败" + super.getChannelName()); } if (isAuthMark()) continue; } MessageFormat messageFormat = super.getMessageContext() .getMessageFormat(); if (messageFormat instanceof MessageFormatToString) threadPool.multiExecute(methodWorker); else if (messageFormat instanceof MessageFormatToBytes) { // 传文件要同步否则多线程会导致顺序错乱 threadPool.singleExecute(methodWorker); } // String sss = new String(dataArr); // System.out.println(sss); gcArrays(); } } } public static void main(String[] args) throws UnsupportedEncodingException, InterruptedException { //System.out.print(aa); DelimiterLimitChannelBuffer limitChannelBuffer = new DelimiterLimitChannelBuffer(); String aaab = "123\r4\r5\r6789\rabc"; ByteBuffer buffer = ByteBuffer.allocate(aaab.getBytes().length); buffer.put(aaab.getBytes()); limitChannelBuffer.setBytes(buffer.array()); Thread.sleep(5000); String cc = "de\rfghi\rjk\r"; ByteBuffer buffer111 = ByteBuffer.allocate(cc.getBytes().length); buffer111.put(cc.getBytes()); limitChannelBuffer.setBytes(buffer111.array()); limitChannelBuffer.setBytes(buffer111.array()); } @Override public void clearBytes() { // TODO Auto-generated method stub arraysData = null; } }
80fb9f240066891ef81d9ef7fef187b33569c5b6
7a3d7e0d2cdc349b03ebfdfdf2ad1274765a0aba
/app/src/main/java/com/soe/sharesoe/base/PermissionCompat.java
f77f844e75863b69cebe03d9b5184c07786e8aa9
[]
no_license
zhangyizhangyiran/share-user
596c0e40685664e959f5dba52933a09bae5f5df0
ff420c02c19d145fbf8c9b18e6d6b58228ab7647
refs/heads/master
2020-03-29T21:50:27.041912
2018-09-26T08:06:09
2018-09-26T08:06:09
150,390,128
0
0
null
null
null
null
UTF-8
Java
false
false
5,374
java
package com.soe.sharesoe.base; import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.widget.Toast; import java.util.ArrayList; import java.util.List; /** * @author wangxiaofa * @version ${VERSIONCODE} * @project sharesoe * @Description 权限管理基类 * @encoding UTF-8 * @date 2017/11/11 * @time 下午3:13 * @修改记录 <pre> * 版本 修改人 修改时间 修改内容描述 * -------------------------------------------------- * <p> * -------------------------------------------------- * </pre> */ public class PermissionCompat implements ActivityCompat.OnRequestPermissionsResultCallback { private String hint; public static final int REQUESTCODE = 1000; private Activity mContext; public PermissionCompat(Activity mContext) { this.mContext = mContext; } //单个权限请求检测,true不需要请求权限,false需要请求权限 public boolean isPermissionGranted(String permissionName) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return true; } //判断是否需要请求允许权限 int hasPermision = ActivityCompat.checkSelfPermission(mContext, permissionName); if (hasPermision != PackageManager.PERMISSION_GRANTED) { return false; } return true; } //多个权限请求检测,返回list,如果list.size为空说明权限全部有了不需要请求,否则请求没有的 public List<String> isPermissionsAllGranted(String[] permArray) { List<String> list = new ArrayList<>(); //获得批量请求但被禁止的权限列表 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return list; } for (int i = 0; permArray != null && i < permArray.length; i++) { if (PackageManager.PERMISSION_GRANTED != ActivityCompat.checkSelfPermission(mContext, permArray[i])) { list.add(permArray[i]); } } return list; } //单个权限请求 public boolean Requestpermission(String s, int requestCode, String defeat) { boolean flag = false; hint = defeat; if (!TextUtils.isEmpty(s)) { boolean granted = isPermissionGranted(s); if (granted) { //有权限,调用方法 // okPermissionResult(requestCode); flag = true; } else { ActivityCompat.requestPermissions(mContext, new String[]{s}, requestCode); flag = false; } } return flag; } //多个权限请求 public boolean Requestpermission(String s[], int requestCode, String defeat) { boolean flag = false; hint = defeat; if (s.length != 0) { List<String> perList = isPermissionsAllGranted(s); if (perList.size() == 0) { //有权限,调用方法 // okPermissionResult(requestCode); flag = true; } else { ActivityCompat.requestPermissions(mContext, perList.toArray(new String[perList.size()]), requestCode); flag = false; } } return flag; } public void popAlterDialog() { new AlertDialog.Builder(mContext) .setTitle("提示") .setMessage(hint) .setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .setPositiveButton("设置", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //前往应用详情界面 try { Uri packUri = Uri.parse("package:" + mContext.getPackageName()); Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, packUri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent); } catch (Exception e) { Toast.makeText(mContext, "跳转失败", Toast.LENGTH_SHORT).show(); } dialog.dismiss(); } }).create().show(); } @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { Toast.makeText(mContext, "xxxxx", Toast.LENGTH_SHORT).show(); for (int i : grantResults) { if (i != PackageManager.PERMISSION_GRANTED) { //有权限未通过 return; } } // okPermissionResult(requestCode); } //有权限调用 public void okPermissionResult(int requestCode) { } }
03e830efa1545fc9aeabdee274ee14f09e0fd273
6a90bf77ce70a394f536602a72a70d8bf84e7921
/main/java/studios/kundby/fitnessapp/YoutubePlayerConfig.java
6467dd6217efdd35b7eb5c4f4e0bcb5c3c5ffaa0
[]
no_license
minddal1/android_fitness_application
985fb1350b54d37ef04361bdde8b32c139719f80
b55dcc2415cb03dff86364c9bc234a2637f09af2
refs/heads/main
2023-08-14T12:37:09.378495
2021-10-06T00:41:12
2021-10-06T00:41:12
414,020,014
0
0
null
null
null
null
UTF-8
Java
false
false
231
java
package studios.kundby.fitnessapp; /** * @author Osvald */ public class YoutubePlayerConfig { YoutubePlayerConfig() { } public static final String API_KEY="AIzaSyAoF70m0VIXMItuiQffhMoxUY9zumi3LXQ"; }
f83b0da984ae245192d2b9bb1f51013b33ee2dc7
02f2111725bc0724aa67a862a0c1ea243a9021be
/IndiabanaApp/app/src/main/java/com/indiabana/Fragments/PromoteDetailsFragment.java
8e57394bb03ae83069b029a1152d7c1ae17c1240
[ "MIT" ]
permissive
siddhantdrk/Indiabana-App-Development
9b7f28773b5a6a0f582d316940b27d0294148112
f84e2895c6530c35e0de320780b58975907a7d48
refs/heads/main
2023-03-23T18:27:07.144757
2021-03-04T12:16:25
2021-03-04T12:16:25
340,861,712
0
0
null
null
null
null
UTF-8
Java
false
false
2,275
java
package com.indiabana.Fragments; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.PopupMenu; import androidx.fragment.app.Fragment; import com.indiabana.R; public class PromoteDetailsFragment extends Fragment implements View.OnClickListener, PopupMenu.OnMenuItemClickListener { private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; public PromoteDetailsFragment() { // Required empty public constructor } public static PromoteDetailsFragment newInstance(String param1, String param2) { PromoteDetailsFragment fragment = new PromoteDetailsFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_promote_details, container, false); View iconView = getActivity().findViewById(R.id.icon); iconView.setOnClickListener(this); return view; } @Override public void onClick(View view) { switch (view.getId()) { case R.id.icon: PopupMenu popupMenu = new PopupMenu(getActivity(), view); popupMenu.setOnMenuItemClickListener(this); popupMenu.inflate(R.menu.toolbar_menu); popupMenu.show(); break; } } @Override public boolean onMenuItemClick(MenuItem menuItem) { return menuItem.getItemId() == R.id.menu; } }
5db7d668b21e5f178aeeeec98a044d0b05376034
26c9382b819895a9ac224a238e30238dd3c9fdcc
/src/main/java/com/zk/sms/common/service/impl/BaseServiceImpl.java
71a4d8f1fc083380b93929f887c14e026b8c3e15
[]
no_license
gyhdm/zk-sms
2bcfedca1ce5e0dc5a32bbdb902ecb246b3cb3cf
86b9e9ffe79eea908a0b0c37feec44c935ef4ef8
refs/heads/master
2020-08-28T20:21:50.576994
2019-10-31T14:18:14
2019-10-31T14:18:14
217,811,122
0
0
null
null
null
null
UTF-8
Java
false
false
4,222
java
package com.zk.sms.common.service.impl; import com.zk.sms.common.exception.JpaCrudException; import com.zk.sms.common.model.BaseModel; import com.zk.sms.common.service.BaseService; import com.zk.sms.common.service.RedisService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Optional; /** * 通用service实现类. * * @param <T> 实体类 * @param <ID> 主键 * @param <R> repository * @author guoying * @since 2019 -10-27 19:49:33 */ @Slf4j public class BaseServiceImpl<T extends BaseModel, ID, R extends JpaRepository<T, ID>> implements BaseService<T, ID> { /** * The Repository. */ @Autowired protected R repository; @Override public T findById(ID id) { log.info("findById: {}", id); Optional<T> ot = repository.findById(id); return ot.orElse(null); } @Override public boolean existsById(ID id) { return repository.existsById(id); } @Override public List<T> findAll() { return repository.findAll(); } @Override public List<T> findAll(Sort sort) { return repository.findAll(sort); } @Override public Page<T> findAll(Pageable pageable) { log.info("findAll PageNumber: {} ---> PageSize: {}", pageable.getPageNumber(), pageable.getPageSize()); return repository.findAll(pageable); } @Override public List<T> findAllById(Iterable<ID> ids) { log.info("findAllById: {} ", ids); return repository.findAllById(ids); } @Override @Transactional(rollbackFor = Exception.class) public T save(T t) { if (t == null) { throw new JpaCrudException("cannot save an empty entity class."); } if (ObjectUtils.isNotEmpty(t.getId())) { throw new JpaCrudException("for save entity, id must be null."); } log.info("save: {}", t); return repository.save(t); } @Override @Transactional(rollbackFor = Exception.class) public T update(T t) { if (t == null) { throw new JpaCrudException("cannot update an empty entity class."); } if (ObjectUtils.isEmpty(t.getId())) { throw new JpaCrudException("for update entity, id must be not null."); } log.info("update: {}", t); return repository.save(t); } @Transactional(rollbackFor = Exception.class) @Override public List<T> saveAll(Iterable<T> entities) { return repository.saveAll(entities); } @Transactional(rollbackFor = Exception.class) @Override public void delete(T t) { if (t == null) { throw new JpaCrudException("cannot delete an empty entity class."); } log.info("delete:{}", t); repository.delete(t); } @Transactional(rollbackFor = Exception.class) @Override public void deleteAll() { repository.deleteAll(); } @Transactional(rollbackFor = Exception.class) @Override public void deleteAll(Iterable<T> entities) { repository.deleteAll(entities); } @Transactional(rollbackFor = Exception.class) @Override public void deleteById(ID id) { if (id == null || !repository.existsById(id)) { throw new JpaCrudException("Unable to delete data whose ID does not exist"); } log.info("deleteById: {}", id); repository.deleteById(id); } @Transactional(rollbackFor = Exception.class) @Override public void deleteInBatch(Iterable<T> entities) { repository.deleteInBatch(entities); } @Transactional(rollbackFor = Exception.class) @Override public void deleteAllInBatch() { repository.deleteAllInBatch(); } @Override public long count() { return repository.count(); } }
b6d9516657d58df0eff640abad69d60cfbe96654
e97de11de7d727f0a4f5cd38b449d182157a813d
/ace-common/src/main/java/com/mmc/security/common/service/impl/BaseServiceImpl.java
c216ea549f19f8886729a9c9cffc71b95b005d61
[ "Apache-2.0" ]
permissive
qudong123/record_keeping2.0
8fd940d09d5c12e9b477d82f5df5e23cd2fb925a
0e7a1aa72859d979ccec731f0ea3ff917deacbbf
refs/heads/master
2022-04-01T04:43:17.949617
2019-07-17T07:44:21
2019-07-17T07:44:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,067
java
package com.mmc.security.common.service.impl; import com.mmc.security.common.service.BaseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import tk.mybatis.mapper.common.Mapper; import java.util.List; public class BaseServiceImpl<M extends Mapper<T>, T> implements BaseService<T> { @Autowired protected M mapper; @Override public T selectOne(T entity) { return mapper.selectOne(entity); } @Override public T selectById(Object id) { return mapper.selectByPrimaryKey(id); } // @Override // public List<T> selectListByIds(List<Object> ids) { // return mapper.selectByIds(ids); // } @Override public List<T> selectList(T entity) { return mapper.select(entity); } @Override public List<T> selectListAll() { return mapper.selectAll(); } // @Override // public Long selectCountAll() { // return mapper.selectCount(); // } @Override public Long selectCount(T entity) { return Long.valueOf(mapper.selectCount(entity)); } @Override public void insert(T entity) { mapper.insert(entity); } @Override public void insertSelective(T entity) { mapper.insertSelective(entity); } @Override public void delete(T entity) { mapper.delete(entity); } @Override public void deleteById(Object id) { mapper.deleteByPrimaryKey(id); } @Override public void updateById(T entity) { mapper.updateByPrimaryKey(entity); } @Override public void updateSelectiveById(T entity) { mapper.updateByPrimaryKeySelective(entity); } // @Override // public void deleteBatchByIds(List<Object> ids) { // mapper.batchDeleteByIds(ids); // } // // @Override // public void updateBatch(List<T> entitys) { // mapper.batchUpdate(entitys); // } }
58d7bacb9d3cf1f7919856d42efd03a8fff893f6
7bb07f40c5a62e300ae4e83bf789e5aa1f1b70f7
/plug-ins/DxfDriver/trunk/src/fr/michaelm/jump/drivers/dxf/DxfPOLYLINE.java
a7408d045178c9533968992ecb01e60898ed2c9d
[]
no_license
abcijkxyz/jump-pilot
a193ebf9cfb3f082a467c0cfbe0858d4e249d420
3b6989a88e5c8e00cd55c3148f00a7bf747574c7
refs/heads/master
2022-12-18T15:22:44.594948
2020-09-23T10:46:11
2020-09-23T10:46:11
297,995,218
0
0
null
2020-09-23T15:27:25
2020-09-23T14:23:54
null
UTF-8
Java
false
false
5,076
java
/* * Library name : dxf * (C) 2012 Micha&euml;l Michaud * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * For more information, contact: * * [email protected] * */ package fr.michaelm.jump.drivers.dxf; import java.io.RandomAccessFile; import java.io.IOException; import com.vividsolutions.jts.geom.*; import com.vividsolutions.jump.feature.Feature; import com.vividsolutions.jump.feature.BasicFeature; import com.vividsolutions.jump.feature.FeatureCollection; /** * POLYLINE DXF entity. * This class has a static method reading a DXF POLYLINE and adding the new * feature to a FeatureCollection * @author Micha&euml;l Michaud */ // History public class DxfPOLYLINE extends DxfENTITY { public DxfPOLYLINE() {super("DEFAULT");} public static DxfGroup readEntity(RandomAccessFile raf, FeatureCollection entities) throws IOException { Feature feature = new BasicFeature(entities.getFeatureSchema()); String geomType = "LineString"; CoordinateList coordList = new CoordinateList(); feature.setAttribute("LTYPE", "BYLAYER"); feature.setAttribute("THICKNESS", 0.0); feature.setAttribute("COLOR", 256); // equivalent to BYLAYER //double x=Double.NaN, y=Double.NaN, z=Double.NaN; DxfGroup group = DxfFile.ENTITIES; GeometryFactory gf = new GeometryFactory(DPM,0); while (!group.equals(SEQEND)) { if (DxfFile.DEBUG) group.print(12); int code = group.getCode(); if (code==8) { feature.setAttribute("LAYER", group.getValue()); } else if (code==6) { feature.setAttribute("LTYPE", group.getValue()); } else if (code==39) { feature.setAttribute("THICKNESS", group.getDoubleValue()); } else if (code==62) { feature.setAttribute("COLOR", group.getIntValue()); } else if (code==70) { if ((group.getIntValue()&1)==1) geomType = "Polygon"; } else if (group.equals(VERTEX)) { group = DxfVERTEX.readEntity(raf, coordList); continue; } else if (group.equals(SEQEND)) { continue; } //else {} group = DxfGroup.readGroup(raf); } if (geomType.equals("LineString")) { // Handle cases where coordList does not describe a valid Line if (coordList.size() == 1) { feature.setGeometry(gf.createPoint(coordList.getCoordinate(0))); } else if (coordList.size() == 2 && coordList.getCoordinate(0).equals(coordList.getCoordinate(1))) { feature.setGeometry(gf.createPoint(coordList.getCoordinate(0))); } else { feature.setGeometry(gf.createLineString(coordList.toCoordinateArray())); } if (DxfFile.DEBUG) System.out.println(" " + feature.getString("LAYER") + " : " + feature.getGeometry()); entities.add(feature); } else if (geomType.equals("Polygon")) { coordList.closeRing(); // Handle cases where coordList does not describe a valid Polygon if (coordList.size() == 1) { feature.setGeometry(gf.createPoint(coordList.getCoordinate(0))); } else if (coordList.size() == 2 && coordList.getCoordinate(0).equals(coordList.getCoordinate(1))) { feature.setGeometry(gf.createPoint(coordList.getCoordinate(0))); } else if (coordList.size() == 2 || coordList.size() == 3) { feature.setGeometry(gf.createLineString(coordList.toCoordinateArray())); } else { feature.setGeometry(gf.createPolygon(gf.createLinearRing(coordList.toCoordinateArray()))); } if (DxfFile.DEBUG) System.out.println(" " + feature.getString("LAYER") + " : " + feature.getGeometry()); entities.add(feature); } //else {} return group; } }
[ "michaudm@d6f7b87f-2e33-0410-8384-f77abc8d64da" ]
michaudm@d6f7b87f-2e33-0410-8384-f77abc8d64da
37070c09d399b672c7013e507cea4eb7045a5f52
712ffdf4e13a4c30cd1d939f3243d8604b143df0
/gmall-user-manage/src/main/java/com/ping/gmall/user/mapper/UserAddressMapper.java
c70d3d72ab0bba811a2b7c670a5bf9dd0cb3de7f
[]
no_license
fanhualuojin123456/gmall
8add158c82d2d3182186eaed8df8d07d1b16e77a
1657cd6c53455c96d458526a0f71f7b652f84b7e
refs/heads/master
2023-04-22T15:49:57.628777
2021-05-10T08:14:09
2021-05-10T08:14:09
318,991,433
0
0
null
null
null
null
UTF-8
Java
false
false
184
java
package com.ping.gmall.user.mapper; import com.ping.gmall.bean.UserAddress; import tk.mybatis.mapper.common.Mapper; public interface UserAddressMapper extends Mapper<UserAddress>{ }
6ee0d13415ed2e27d8270af5b3ee1474e66dd327
10c73074452e73ea22db4e3a7ab9d3fa8677ad2c
/src/main/java/com/laptrinhjavaweb/service/impl/NewService.java
01179eba89c85b872f1265d67db876a24307a6b1
[]
no_license
Phuc1995/Java_jsp_servlet
dcc8f6093e91152ff02cd900547fd43961da73bc
77a784ed9ceb07ccae00bb6cdb72eed6287855a2
refs/heads/master
2022-11-26T03:19:30.827512
2019-10-21T04:14:32
2019-10-21T04:14:32
215,527,010
0
0
null
2022-11-16T05:39:40
2019-10-16T11:02:39
Java
UTF-8
Java
false
false
612
java
package com.laptrinhjavaweb.service.impl; import java.util.List; import javax.inject.Inject; import com.laptrinhjavaweb.dao.INewDAO; import com.laptrinhjavaweb.model.NewModel; import com.laptrinhjavaweb.service.INewService; public class NewService implements INewService{ @Inject private INewDAO newDao; @Override public List<NewModel> findByCategoryId(Long categoryId) { // TODO Auto-generated method stub return newDao.findByCategoryId(categoryId); } @Override public NewModel save(NewModel newModel) { Long newId = newDao.save(newModel); System.out.println(newId); return null; } }
9882cd845c4fdee9edabcac95e5602e8143013a2
53d677a55e4ece8883526738f1c9d00fa6560ff7
/com/tencent/mm/plugin/location/model/l$6.java
da17e378607c08b86aaee53d98ba1dfbd4d46871
[]
no_license
0jinxing/wechat-apk-source
544c2d79bfc10261eb36389c1edfdf553d8f312a
f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d
refs/heads/master
2020-06-07T20:06:03.580028
2019-06-21T09:17:26
2019-06-21T09:17:26
193,069,132
9
4
null
null
null
null
UTF-8
Java
false
false
584
java
package com.tencent.mm.plugin.location.model; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.ai.e.a; import com.tencent.mm.model.bz.a; final class l$6 implements bz.a { l$6(l paraml) { } public final void a(e.a parama) { AppMethodBeat.i(113352); new n().b(parama); AppMethodBeat.o(113352); } } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes2-dex2jar.jar * Qualified Name: com.tencent.mm.plugin.location.model.l.6 * JD-Core Version: 0.6.2 */
9d02ef13ddc98a5d69df0f4b756fbd758690a382
b95ee91eba3936e3e7f490591006cf1fbf96cb25
/src/main/java/com/example/bibased/serviceImple/QianlinshiServiceImple.java
3c788634153d57e2b3c82b5b656914bf2a7c3b08
[]
no_license
kakurry/bibased
d2a23061f0630313faaec2792c5c92fba1768321
aad36585c09f698596ac8f88310fe13641a225d0
refs/heads/master
2020-04-24T14:28:08.534811
2018-12-17T10:22:06
2018-12-17T10:22:06
138,844,601
0
0
null
null
null
null
UTF-8
Java
false
false
862
java
package com.example.bibased.serviceImple; import com.example.bibased.dao.QianlinshiMstMapper; import com.example.bibased.javabean.QianlinshiMst; import com.example.bibased.javabean.UserMst; import com.example.bibased.service.QianlinshiService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service("qianlinshiServiceImpl") public class QianlinshiServiceImple implements QianlinshiService { @Autowired private QianlinshiMstMapper qianlinshiMstMapper; @Override public void insert(QianlinshiMst qianlinshiMst) { qianlinshiMstMapper.insert(qianlinshiMst); } @Override public void delete() { qianlinshiMstMapper.delete(); } @Override public QianlinshiMst selectqianlinshi() { return qianlinshiMstMapper.selectqianlinshi(); } }
f68ac7dd3d035f0c03ef2aefec25e5de9691d3a0
8b4f457a4c40beba11d13911c35d4150f7f6fdb3
/src/main/java/com/example/flink/FlinkProcessorWithTimeWindow.java
3bdea1d0192474e069242fccdbc5c50f31df2a3d
[]
no_license
Lockdain/cloudflow-flink-example
87b93b81033be84c255e69f23265409d2362dc5a
f2fffeec6c75f0039f0a744822d5e3f246eb391d
refs/heads/master
2020-12-21T03:00:06.527430
2020-01-17T07:52:35
2020-01-17T07:52:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,846
java
package com.example.flink; import cloudflow.flink.FlinkStreamlet; import cloudflow.flink.FlinkStreamletLogic; import cloudflow.streamlets.StreamletShape; import cloudflow.streamlets.avro.AvroInlet; import cloudflow.streamlets.avro.AvroOutlet; import com.ey.model.ProspectEvent; import org.apache.flink.api.common.state.ValueState; import org.apache.flink.api.common.state.ValueStateDescriptor; import org.apache.flink.api.common.typeinfo.TypeHint; import org.apache.flink.api.java.tuple.Tuple; import org.apache.flink.api.java.tuple.Tuple2; import org.apache.flink.configuration.Configuration; import org.apache.flink.shaded.guava18.com.google.common.collect.Iterables; import org.apache.flink.streaming.api.datastream.DataStream; import org.apache.flink.streaming.api.datastream.DataStreamSink; import org.apache.flink.streaming.api.functions.KeyedProcessFunction; import org.apache.flink.streaming.api.functions.windowing.ProcessWindowFunction; import org.apache.flink.streaming.api.windowing.assigners.SlidingProcessingTimeWindows; import org.apache.flink.streaming.api.windowing.time.Time; import org.apache.flink.streaming.api.windowing.windows.TimeWindow; import org.apache.flink.util.Collector; public class FlinkProcessorWithTimeWindow extends FlinkStreamlet { AvroInlet<ProspectEvent> in = AvroInlet.<ProspectEvent>create("in", ProspectEvent.class); AvroOutlet<ProspectEvent> out = AvroOutlet.<ProspectEvent>create("out", (ProspectEvent s) -> s.getCustomerId(), ProspectEvent.class); // Step 2: Define the shape of the streamlet. In this example the streamlet // has 1 inlet and 1 outlet @Override public StreamletShape shape() { return StreamletShape.createWithInlets(in).withOutlets(out); } // Step 3: Provide custom implementation of `FlinkStreamletLogic` that defines // the behavior of the streamlet @Override public FlinkStreamletLogic createLogic() { return new FlinkStreamletLogic(getContext()) { @Override public void buildExecutionGraph() { DataStream<ProspectEvent> ins = this.<ProspectEvent>readStream(in, ProspectEvent.class) .map((ProspectEvent d) -> d) .returns(new TypeHint<ProspectEvent>(){}.getTypeInfo()); DataStream<ProspectEvent> simples = ins .map((ProspectEvent pe) -> new Tuple2(pe.getCustomerId(), pe)) .keyBy(0) .window(SlidingProcessingTimeWindows.of(Time.seconds(15),Time.seconds(10))) .process(new CustomCountFunction(5)); DataStreamSink<ProspectEvent> sink = writeStream(out, simples, ProspectEvent.class); } }; } public class ProspectCount { public ProspectEvent message; public Integer count; public ProspectCount(ProspectEvent message, Integer count) { this.message = message; this.count = count; } } public class CustomCountFunction extends ProcessWindowFunction<Tuple2, ProspectEvent,Tuple, TimeWindow> { private Integer count; private ValueState<ProspectCount> state; public CustomCountFunction(Integer count) { this.count = count; } @Override public void open(Configuration parameters) { state = getRuntimeContext().getState(new ValueStateDescriptor<>("state", ProspectCount.class)); } @Override public void process(Tuple tuple, Context context, Iterable<Tuple2> elements, Collector<ProspectEvent> out) throws Exception { if (Iterables.size(elements) > count) { out.collect((ProspectEvent) Iterables.getLast(elements).f0); } } } }
bf1648667b3b51a1cee7d16d2f822bda7b6d12a0
b3d9aee1a38fe215b80a1ef571edd5cd68c35f76
/DinoGame/src/edu/uark/csce/mobile/dinogame/MapActivity.java
00667de7962b3d57d768b3d878f0f56faacb54d4
[]
no_license
alvisgage/Current-Projects
b198dec59debc0513581646aaa4fa7349f1572de
6e0a190ed9154e4d07e67c5e760b8cef3cf9a054
refs/heads/master
2020-06-02T03:04:57.452682
2015-05-14T16:44:01
2015-05-14T16:44:01
35,623,152
0
0
null
null
null
null
UTF-8
Java
false
false
21,124
java
package edu.uark.csce.mobile.dinogame; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import android.app.Activity; import android.app.Dialog; import android.app.DialogFragment; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentSender.SendIntentException; import android.graphics.Color; import android.location.Location; import android.os.Bundle; import android.text.TextUtils; import android.text.format.DateUtils; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MapActivity extends FragmentActivity implements com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks, OnConnectionFailedListener, OnAddGeofencesResultListener { /*TODO: create local variables for: current geofence, current itemReward * structure storage of geofence data, expiration data ((expiration date from database - current date) in ms), and RewardItem data together * add event handlers for entering currentGeofence that launches dialog saying "Congrats! etc" and adding item to current storage of items * structure getting of current geofence from database on startup and activating it */ private static final long GEOFENCE_EXPIRATION_IN_HOURS = 12; private static final long GEOFENCE_EXPIRATION_IN_MILLISECONDS = GEOFENCE_EXPIRATION_IN_HOURS * DateUtils.HOUR_IN_MILLIS; private SimpleGeofence mCurrentGeofence; private ArrayList<SimpleGeofence> mSimpleGeofenceList; private List<Geofence> mGeofenceList; private SimpleGeofenceStore mGeofenceStorage; // decimal formats for latitude, longitude, and radius private DecimalFormat mLatLngFormat; private DecimalFormat mRadiusFormat; // Holds the location client private LocationClient mLocationClient; // Stores the PendingIntent used to request geofence monitoring private PendingIntent mGeofenceRequestIntent; //Defines the allowable request types private enum REQUEST_TYPE {ADD} private REQUEST_TYPE mRequestType; // Flag that indicates if request is underway private boolean mInProgress; private GeofenceSampleReceiver mBroadcastReceiver; private IntentFilter mIntentFilter; // Placeholder for reward private String reward = "new hat"; // Textview to display stuff private TextView testLabel; // Google Map to display geofence private GoogleMap mMap; private GoogleApiClient mGoogleApiClient; private static final LocationRequest REQUEST = LocationRequest.create() .setInterval(5000) // 5 seconds .setFastestInterval(16) // 16ms = 60fps .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); mInProgress = false; mSimpleGeofenceList = new ArrayList<SimpleGeofence>(); // Set and localize the latitude/longitude format String latLngPattern = getString(R.string.lat_lng_pattern); mLatLngFormat = new DecimalFormat(latLngPattern); mLatLngFormat.applyLocalizedPattern(mLatLngFormat.toLocalizedPattern()); // Set and localize the radius format String radiusPattern = getString(R.string.radius_pattern); mRadiusFormat = new DecimalFormat(radiusPattern); mRadiusFormat.applyLocalizedPattern(mRadiusFormat.toLocalizedPattern()); // Instantiate a new geofence storage area mGeofenceStorage = new SimpleGeofenceStore(this); mGeofenceStorage.open(); // Create a new broadcast receiver to receive updates from the listeners and service mBroadcastReceiver = new GeofenceSampleReceiver(); mIntentFilter = new IntentFilter(); // Action for broadcast Intents that report successful addition of geofences mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCES_ADDED); // Action for broadcast Intents that report successful removal of geofences mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCES_REMOVED); // Action for broadcast Intents that report geofence transitions mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCE_TRANSITION); // Action for broadcast Intents containing various types of geofencing errors mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCE_ERROR); // All Location Services sample apps use this category mIntentFilter.addCategory(GeofenceUtils.CATEGORY_LOCATION_SERVICES); // Instantiate a new list of geofences mGeofenceList = new ArrayList<Geofence>(); testLabel = (TextView) findViewById(R.id.GeofenceTestLabel); mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); mMap.setMyLocationEnabled(true); // Testing //addTestGeofence(); } @Override protected void onResume() { super.onResume(); mGeofenceStorage.open(); Log.d(GeofenceUtils.APPTAG, "in onResume"); LocalBroadcastManager.getInstance(this).registerReceiver(mBroadcastReceiver, mIntentFilter); loadCurrentGeofence(); } @Override public void onPause() { super.onPause(); mGeofenceStorage.close(); } @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); } // DialogFragment to display connection error dialog public static class ErrorDialogFragment extends DialogFragment { // Field to contain error dialog private Dialog mDialog; public ErrorDialogFragment() { super(); mDialog = null; } public void setDialog(Dialog dialog) { mDialog = dialog; } // Return a Dialog to the DialogFragment @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return mDialog; } } // Handle results returned to the FragmentActivity by Google Play services @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case GeofenceUtils.CONNECTION_FAILURE_RESOLUTION_REQUEST: // If the result code is Activity.RESULT_OK try to connect again switch (resultCode) { case Activity.RESULT_OK: break; // Any result but OK default: Log.d(GeofenceUtils.APPTAG, getString(R.string.no_resolution)); } // If any other request code was received default: Log.d(GeofenceUtils.APPTAG, getString(R.string.unknown_activity_request_code, requestCode)); break; } } private boolean servicesConnected() { // Check that Google Play services is available int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if(ConnectionResult.SUCCESS == resultCode) { Log.d(GeofenceUtils.APPTAG, getString(R.string.play_services_available)); return true; } else { // Display an error dialog Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, this, 0); if (dialog != null) { ErrorDialogFragment errorFragment = new ErrorDialogFragment(); errorFragment.setDialog(dialog); errorFragment.show(getSupportFragmentManager(), GeofenceUtils.APPTAG); } return false; } } private PendingIntent getTransitionPendingIntent() { // Create an explicit Intent Intent intent = new Intent(this, ReceiveTransitionsIntentService.class); /* * Return the PendingIntent */ return PendingIntent.getService( this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); } @Override public void onAddGeofencesResult(int statusCode, String[] geofenceRequestIds) { Intent broadcastIntent = new Intent(); String msg; if(LocationStatusCodes.SUCCESS == statusCode) { // Create a message containing all the geofence IDs added. msg = this.getString(R.string.add_geofences_result_success, Arrays.toString(geofenceRequestIds)); // In debug mode, log the result Log.d(GeofenceUtils.APPTAG, msg); // Create an Intent to broadcast to the app broadcastIntent.setAction(GeofenceUtils.ACTION_GEOFENCES_ADDED) .addCategory(GeofenceUtils.CATEGORY_LOCATION_SERVICES) .putExtra(GeofenceUtils.EXTRA_GEOFENCE_STATUS, msg); // TODO: update UI for geofence successfully added testLabel.setText("Geofence has been added"); updateMap(); } else { Log.e(GeofenceUtils.APPTAG, "Geofence failed to add. FIX!"); /* * Create a message containing the error code and the list * of geofence IDs you tried to add */ msg = this.getString( R.string.add_geofences_result_failure, statusCode, Arrays.toString(geofenceRequestIds) ); // Log an error Log.e(GeofenceUtils.APPTAG, msg); // Create an Intent to broadcast to the app broadcastIntent.setAction(GeofenceUtils.ACTION_GEOFENCE_ERROR) .addCategory(GeofenceUtils.CATEGORY_LOCATION_SERVICES) .putExtra(GeofenceUtils.EXTRA_GEOFENCE_STATUS, msg); } LocalBroadcastManager.getInstance(this).sendBroadcast(broadcastIntent); mInProgress = false; //mLocationClient.disconnect(); } @Override public void onConnectionFailed(ConnectionResult result) { mInProgress = false; // Resolve error if available, else display error dialog if(result.hasResolution()) { try { result.startResolutionForResult(this, GeofenceUtils.CONNECTION_FAILURE_RESOLUTION_REQUEST); } catch (SendIntentException e) { e.printStackTrace(); } } else { int errorCode = result.getErrorCode(); Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode, this, GeofenceUtils.CONNECTION_FAILURE_RESOLUTION_REQUEST); if(errorDialog != null) { ErrorDialogFragment errorFragment = new ErrorDialogFragment(); errorFragment.setDialog(errorDialog); errorFragment.show(getSupportFragmentManager(), "Geofence Test"); } } } @Override public void onConnected(Bundle connectionHint) { switch(mRequestType) { case ADD: Log.d(GeofenceUtils.APPTAG, "Location Client connected with request type ADD."); // Get the PendingIntent for the request mGeofenceRequestIntent = getTransitionPendingIntent(); // Send a request to add the current geofence mLocationClient.addGeofences(mGeofenceList, mGeofenceRequestIntent, this); } } @Override public void onDisconnected() { mInProgress = false; mLocationClient = null; } public void addGeofence() { mRequestType = REQUEST_TYPE.ADD; // Test for Google Play Services after setting the request type. if(!servicesConnected()) { Log.e(GeofenceUtils.APPTAG, "Google Play Services not connnected."); return; } // Create new location client. Pass current activity as listener for ConnectionCallbacks and OnConnectionFailedListener mLocationClient = new LocationClient(this, this, this); if(!mInProgress) { mInProgress = true; mLocationClient.connect(); } else { Log.d(GeofenceUtils.APPTAG, "Request already underway."); // TODO: disconnect client, reset flag, retry request } } /** * Define a Broadcast receiver that receives updates from connection listeners and * the geofence transition service. */ public class GeofenceSampleReceiver extends BroadcastReceiver { /* * Define the required method for broadcast receivers * This method is invoked when a broadcast Intent triggers the receiver */ @Override public void onReceive(Context context, Intent intent) { // Check the action code and determine what to do String action = intent.getAction(); Log.d(GeofenceUtils.APPTAG, "GeofenceSampleReceiver picked up something: " + action); // Intent contains information about errors in adding or removing geofences if (TextUtils.equals(action, GeofenceUtils.ACTION_GEOFENCE_ERROR)) { handleGeofenceError(context, intent); // Intent contains information about successful addition or removal of geofences } else if ( TextUtils.equals(action, GeofenceUtils.ACTION_GEOFENCES_ADDED) || TextUtils.equals(action, GeofenceUtils.ACTION_GEOFENCES_REMOVED)) { handleGeofenceStatus(context, intent); // Intent contains information about a geofence transition } else if (TextUtils.equals(action, GeofenceUtils.ACTION_GEOFENCE_TRANSITION)) { handleGeofenceTransition(context, intent); // The Intent contained an invalid action } else { Log.e(GeofenceUtils.APPTAG, getString(R.string.invalid_action_detail, action)); Toast.makeText(context, R.string.invalid_action, Toast.LENGTH_LONG).show(); } } /** * * @param context A Context for this component * @param intent The received broadcast Intent */ private void handleGeofenceStatus(Context context, Intent intent) { Log.d(GeofenceUtils.APPTAG, "Geofence status: " + intent.getAction()); Toast.makeText(context, "Geofence Status Changed", Toast.LENGTH_LONG).show(); } /** * Report geofence transitions to the UI * * @param context A Context for this component * @param intent The Intent containing the transition */ private void handleGeofenceTransition(Context context, Intent intent) { //String msg = intent.getStringExtra("msg"); // TODO: UI change on transition Log.d(GeofenceUtils.APPTAG, "Geofence transition occured: " + intent.getAction()); //Log.d(GeofenceUtils.APPTAG, "msg: " + msg); Toast.makeText(context, "Geofence Transition Occured", Toast.LENGTH_LONG).show(); //Update SharedPreferences //mGeofenceStorage.incrementLastGeofenceReceived(mCurrentGeofence.getId()); // Update Database //mGeofenceStorage.setLocationToCompleted(mCurrentGeofence.getId()); } /** * Report addition or removal errors to the UI, using a Toast * * @param intent A broadcast Intent sent by ReceiveTransitionsIntentService */ private void handleGeofenceError(Context context, Intent intent) { String msg = intent.getStringExtra(GeofenceUtils.EXTRA_GEOFENCE_STATUS); Log.e(GeofenceUtils.APPTAG, msg); Toast.makeText(context, msg, Toast.LENGTH_LONG).show(); } } private void loadCurrentGeofence() { mGeofenceList.clear(); // Using SharedPreferences... //mCurrentGeofence = mGeofenceStorage.getCurrentGeofence(); //mGeofenceList.add(mCurrentGeofence.toGeofence()); // Using SQLite Database... mSimpleGeofenceList = mGeofenceStorage.getAllGeofences(); Log.d("count", String.valueOf(mSimpleGeofenceList.size())); /*if(mSimpleGeofenceList.get(0) != null) { mCurrentGeofence = mSimpleGeofenceList.get(0); mGeofenceList.add(mCurrentGeofence.toGeofence()); }*/ for (SimpleGeofence fence : mSimpleGeofenceList){ mGeofenceList.add(fence.toGeofence()); } addGeofence(); } private void updateMap() { /*if(mCurrentGeofence != null) { LatLng location = new LatLng(mCurrentGeofence.getLatitude(), mCurrentGeofence.getLongitude()); mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); CameraUpdate update = CameraUpdateFactory.newLatLngZoom(location, 16); mMap.animateCamera(update); mMap.addMarker(new MarkerOptions().position(location).title("Geofence is here!")); // Add circle CircleOptions circleOptions = new CircleOptions() .center(location) .radius(mCurrentGeofence.getRadius()) .fillColor(0x40ff0000) .strokeColor(Color.TRANSPARENT) .strokeWidth(2); Circle circle = mMap.addCircle(circleOptions); }*/ mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); for (SimpleGeofence fence : mSimpleGeofenceList){ Log.d("adding geofence...", fence.toString()); LatLng location = new LatLng(fence.getLatitude(), fence.getLongitude()); CameraUpdate update = CameraUpdateFactory.newLatLngZoom(location, 16); mMap.animateCamera(update); mMap.addMarker(new MarkerOptions().position(location).title("Geofence is here! " + fence.getId())); // Add circle CircleOptions circleOptions = new CircleOptions() .center(location) .radius(fence.getRadius()) .fillColor(0x40ff0000) .strokeColor(Color.TRANSPARENT) .strokeWidth(2); Circle circle = mMap.addCircle(circleOptions); } } // private void setUpMapIfNeeded() { // // Do a null check to confirm that we have not already instantiated the map. // if (mMap == null) { // // Try to obtain the map from the SupportMapFragment. // mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)) // .getMap(); // // Check if we were successful in obtaining the map. // if (mMap != null) { // mMap.setMyLocationEnabled(true); // //mMap.setOnMyLocationButtonClickListener(this); // } // } // } // // private void setUpGoogleApiClientIfNeeded() { // if (mGoogleApiClient == null) { // mGoogleApiClient = new GoogleApiClient.Builder(this) // .addApi(LocationServices.API) // .addConnectionCallbacks(this) // .addOnConnectionFailedListener(this) // .build(); // } // } // // @Override // public void onLocationChanged(Location location) { // // TODO Auto-generated method stub // // } // // @Override // public void onConnectionSuspended(int cause) { // // TODO Auto-generated method stub // // } // // /** // * Button to get current Location. This demonstrates how to get the current Location as required // * without needing to register a LocationListener. // */ //// public void showMyLocation(View view) { //// if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) { //// String msg = "Location = " //// + LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); //// Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); //// } //// } public void drawUserMarker(Location location) { mMap.clear(); updateMap(); LatLng currentPosition = new LatLng(location.getLatitude(), location.getLongitude()); mMap.addMarker(new MarkerOptions() .position(currentPosition) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_CYAN)) .title("You are here")); } //Method for testing purposes private void addTestGeofence() { SimpleGeofence geo = new SimpleGeofence("123", 36.0742414, -94.2218162, 500f, GEOFENCE_EXPIRATION_IN_MILLISECONDS, Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT, 1234, false); mGeofenceStorage.createGeofence(geo); } //Button listeners public void viewSummary(View v) { Intent intent = new Intent(MapActivity.this, SummaryActivity.class); startActivity(intent); } public void viewPlayer(View v) { Intent intent = new Intent(MapActivity.this, CharacterActivity.class); startActivity(intent); } public void viewAccount(View v) { Intent intent = new Intent(MapActivity.this, AccountActivity.class); startActivity(intent); } public void viewSettings(View v) { Intent intent = new Intent(MapActivity.this, SettingsActivity.class); startActivity(intent); } }
4cd5f1e4b0cbbdb1eaa819702314f7aaeedf7273
3579f097d2fafbdf5aebb075738beea453d7d6c1
/Servlet-new data dump/src/com/display/OrdersDisplay.java
9979fb6ac00421b637a1deebf79174bc7302c4e2
[]
no_license
Jainandhini/JavaRelearn
963d00b49b3ca062ffcd19da16dc9acdd54966ad
3830e3d8cfc26ef31b8b0859b0bac4f3c4ab2802
refs/heads/master
2020-12-05T17:04:21.238713
2020-04-08T16:06:25
2020-04-08T16:06:25
232,182,459
0
0
null
null
null
null
UTF-8
Java
false
false
974
java
package com.display; import java.io.PrintWriter; import java.sql.ResultSet; import java.util.ArrayList; import com.pojo.Orders; public class OrdersDisplay { public void displayOrders(PrintWriter out,ArrayList<Orders> orders,String action) { switch(action) { case "viewOrdersByUser": case "viewOrdersFilterByStatus": displayOrdersByUser(out,orders); break; } } public void displayOrdersByUser(PrintWriter out,ArrayList<Orders> orders){ out.write( "<html><head><title>displayOrdersByUser</title></head><body>" + "<table border=\"1\"><tr><th>Order Number</th>" + "<th>Customer ID</th><th>Saleman ID</th><th>Ordered Date</th><th>Status</th>"); for(Orders o:orders) { out.write("<tr><td>"+o.getOrder_id()+"</td><td>"+o.getCustomer_id() +"</td><td>"+o.getSalesman_id()+"</td><td>"+o.getOrder_date() +"</td><td>"+o.getStatus()+"</td></tr>"); } out.write("</table></body></html>"); } }
0bdd79546224a452b101be1f1723bcd121058e57
8c085f12963e120be684f8a049175f07d0b8c4e5
/castor/tags/DEV0_8/castor-2002/castor/src/main/org/exolab/javasource/JClass.java
bf2ba1e635c9d366e93717011b9dd043f3ae5f2a
[]
no_license
alam93mahboob/castor
9963d4110126b8f4ef81d82adfe62bab8c5f5bce
974f853be5680427a195a6b8ae3ce63a65a309b6
refs/heads/master
2020-05-17T08:03:26.321249
2014-01-01T20:48:45
2014-01-01T20:48:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
21,809
java
/** * Redistribution and use of this software and associated documentation * ("Software"), with or without modification, are permitted provided * that the following conditions are met: * * 1. Redistributions of source code must retain copyright * statements and notices. Redistributions must also contain a * copy of this document. * * 2. Redistributions in binary form must reproduce the * above copyright notice, this list of conditions and the * following disclaimer in the documentation and/or other * materials provided with the distribution. * * 3. The name "Exolab" must not be used to endorse or promote * products derived from this Software without prior written * permission of Exoffice Technologies. For written permission, * please contact [email protected]. * * 4. Products derived from this Software may not be called "Exolab" * nor may "Exolab" appear in their names without prior written * permission of Exoffice Technologies. Exolab is a registered * trademark of Exoffice Technologies. * * 5. Due credit should be given to the Exolab Project * (http://www.exolab.org/). * * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved. * * $Id$ */ package org.exolab.javasource; import java.io.File; import java.io.FileWriter; import java.io.Writer; import java.io.PrintWriter; import java.util.Vector; /** * A representation of the Java Source code for a Java Class. This is * a useful utility when creating in memory source code * @author <a href="mailto:[email protected]">Keith Visco</a> * @version $Revision$ $Date$ **/ public class JClass extends JType { /** * The Id for Source control systems * I needed to separate this line to prevent CVS from * expanding it here! ;-) **/ private static final String DEFAULT_HEADER = "$"+"Id"; /** * The version for JavaDoc * I needed to separate this line to prevent CVS from * expanding it here! ;-) **/ private static final String version = "$"+"Revision$ $"+"Date$"; private JComment header = null; /** * List of imported classes and packages **/ private Vector imports = null; private String superClass = null; /** * The list of member variables of this JClass **/ private JNamedMap members = null; /** * The list of constructors for this JClass **/ private Vector constructors = null; /** * The set of interfaces implemented by this JClass **/ private Vector interfaces = null; private JDocComment jdc = null; /** * The list of methods of this JClass **/ private Vector methods = null; /** * The JModifiers for this JClass, which allows us to * change the resulting qualifiers **/ private JModifiers modifiers = null; /** * The package to which this JClass belongs **/ private String packageName = null; /** * Creates a new Class with the given name * @param name the name of the Class to create * @exception IllegalArgumentException when the given name * is not a valid Class name **/ public JClass(String name) throws IllegalArgumentException { super(name); this.packageName = getPackageFromClassName(name); imports = new Vector(); interfaces = new Vector(); jdc = new JDocComment(); constructors = new Vector(); members = new JNamedMap(); methods = new Vector(); modifiers = new JModifiers(); //-- initialize default Java doc jdc.addDescriptor(JDocDescriptor.createVersionDesc(version)); } //-- JClass public void addImport(String className) { if (className == null) return; if (className.length() == 0) return; //-- getPackageName String pkgName = getPackageFromClassName(className); if (pkgName != null) { if (pkgName.equals(this.packageName)) return; if (pkgName.equals("java.lang")) return; //-- for readabilty keep import list sorted, and make sure //-- we do not include more than one of the same import for (int i = 0; i < imports.size(); i++) { String imp = (String)imports.elementAt(i); if (imp.equals(className)) return; if (imp.compareTo(className) > 0) { imports.insertElementAt(className, i); return; } } imports.addElement(className); } } //-- addImport public void addInterface(String interfaceName) { if (!interfaces.contains(interfaceName)) interfaces.addElement(interfaceName); } //-- addInterface /** * Adds the given Constructor to this classes list of constructors. * The constructor must have been created with this JClass' * createConstructor. * @exception IllegalArgumentException **/ public void addConstructor(JConstructor constructor) throws IllegalArgumentException { if (constructor == null) throw new IllegalArgumentException("Constructors cannot be null"); if (constructor.getDeclaringClass() == this) { /** check signatures (add later) **/ constructors.addElement(constructor); } else { String err = "The given JConstructor was not created "; err += "by this JClass"; throw new IllegalArgumentException(err); } } public void addMember(JMember jMember) throws IllegalArgumentException { if (jMember == null) { throw new IllegalArgumentException("Class members cannot be null"); } if (members.get(jMember.getName()) != null) { String err = "duplicate name found: " + jMember.getName(); throw new IllegalArgumentException(err); } members.put(jMember.getName(), jMember); // if member is of a type not imported by this class // then add import JType type = jMember.getType(); while (type.isArray()) type = type.getComponentType(); if (!type.isPrimitive()) { addImport( ((JClass)type).getName()); } } //-- addMember public void addMethod(JMethod jMethod) throws IllegalArgumentException { if (jMethod == null) { throw new IllegalArgumentException("Class methods cannot be null"); } //-- check method name and signatures *add later* //-- keep method list sorted for esthetics when printing //-- START SORT :-) boolean added = false; short modifierVal = 0; JModifiers modifiers = jMethod.getModifiers(); for (int i = 0; i < methods.size(); i++) { JMethod tmp = (JMethod) methods.elementAt(i); //-- first compare modifiers if (tmp.getModifiers().isPrivate()) { if (!modifiers.isPrivate()) { methods.insertElementAt(jMethod, i); added = true; break; } } //-- compare names if (jMethod.getName().compareTo(tmp.getName()) < 0) { methods.insertElementAt(jMethod, i); added = true; break; } } //-- END SORT if (!added) methods.addElement(jMethod); //-- check parameter packages to make sure we have them //-- in our import list String[] pkgNames = jMethod.getParameterClassNames(); for (int i = 0; i < pkgNames.length; i++) { addImport(pkgNames[i]); } //-- check return type to make sure it's included in the //-- import list JType jType = jMethod.getReturnType(); if (jType != null) { while (jType.isArray()) jType = jType.getComponentType(); if (!jType.isPrimitive()) addImport( ((JClass)jType).getName()); } //-- check exceptions JClass[] exceptions = jMethod.getExceptions(); for (int i = 0; i < exceptions.length; i++) { addImport(exceptions[i].getName()); } } //-- addMethod public void addMethods(JMethod[] jMethods) throws IllegalArgumentException { for (int i = 0; i < jMethods.length; i++) addMethod(jMethods[i]); } //-- addMethods public JConstructor createConstructor() { return new JConstructor(this); } //-- createConstructor public JConstructor getConstructor(int index) { return (JConstructor)constructors.elementAt(index); } //-- getConstructor public JConstructor[] getConstructors() { int size = constructors.size(); JConstructor[] jcArray = new JConstructor[size]; for (int i = 0; i < constructors.size(); i++) { jcArray[i] = (JConstructor)constructors.elementAt(i); } return jcArray; } //-- getConstructors /** * Returns the Java Doc comment for this JClass * @return the JDocComment for this JClass **/ public JDocComment getJDocComment() { return jdc; } //-- getJDocComment /** * Returns the member with the given name, or null if no member * was found with the given name * @param name the name of the member to return * @return the member with the given name, or null if no member * was found with the given name **/ public JMember getMember(String name) { return (JMember)members.get(name); } //-- getMember public JMember[] getMembers() { int size = members.size(); JMember[] marray = new JMember[size]; for (int i = 0; i < size; i++) { marray[i] = (JMember)members.get(i); } return marray; } //-- getMembers public JMethod[] getMethods() { int size = methods.size(); JMethod[] marray = new JMethod[size]; for (int i = 0; i < methods.size(); i++) { marray[i] = (JMethod)methods.elementAt(i); } return marray; } //-- getMethods public JMethod getMethod(String name, int startIndex) { for (int i = startIndex; i < methods.size(); i++) { JMethod jMethod = (JMethod)methods.elementAt(i); if (jMethod.getName().equals(name)) return jMethod; } return null; } public JMethod getMethod(int index) { return (JMethod)methods.elementAt(index); } /** * Returns the JModifiers which allows the qualifiers to be changed * @return the JModifiers for this JClass **/ public JModifiers getModifiers() { return modifiers; } //-- getModifiers /** * Returns the name of the package that this JClass is a member of * @return the name of the package that this JClass is a member of, * or null if there is no current package name defined **/ public String getPackageName() { return this.packageName; } //-- getPackageName public static boolean isValidClassName(String name) { //** add class name validation */ return true; } //-- isValidClassName public void print() { print(null); } //-- printSrouce /** * Prints the source code for this JClass * @param lineSeparator the line separator to use at the end of each line. * If null, then the default line separator for the runtime platform will * be used. **/ public void print(String lineSeparator) { //-- open output file String name = getLocalName(); String filename = name + ".java"; if ((packageName != null) && (packageName.length() > 0)) { String path = packageName.replace('.',File.separatorChar); File pathFile = new File(path); if (!pathFile.exists()) { pathFile.mkdirs(); } filename = path+File.separator+filename; } File file = new File(filename); JSourceWriter jsw = null; try { jsw = new JSourceWriter(new FileWriter(file)); } catch(java.io.IOException ioe) { System.out.println("unable to create class file: " + filename); return; } if (lineSeparator == null) { lineSeparator = System.getProperty("line.separator"); } jsw.setLineSeparator(lineSeparator); StringBuffer buffer = new StringBuffer(); //-- write class header if (header != null) header.print(jsw); else { jsw.writeln("/*"); jsw.writeln(" * " + DEFAULT_HEADER); jsw.writeln("*/"); } jsw.writeln(); jsw.flush(); //-- print package name if ((packageName != null) && (packageName.length() > 0)) { buffer.setLength(0); buffer.append("package "); buffer.append(packageName); buffer.append(';'); jsw.writeln(buffer.toString()); jsw.writeln(); } //-- print imports jsw.writeln(" //---------------------------------/"); jsw.writeln(" //- Imported classes and packages -/"); jsw.writeln("//---------------------------------/"); jsw.writeln(); for (int i = 0; i < imports.size(); i++) { jsw.write("import "); jsw.write(imports.elementAt(i)); jsw.writeln(';'); } jsw.writeln(); //------------/ //- Java Doc -/ //------------/ jdc.print(jsw); //-- print class information //-- we need to add some JavaDoc API adding comments buffer.setLength(0); if (modifiers.isPrivate()) { buffer.append("private "); } else if (modifiers.isPublic()) { buffer.append("public "); } if (modifiers.isAbstract()) { buffer.append("abstract "); } buffer.append("class "); buffer.append(getLocalName()); buffer.append(' '); if (superClass != null) { buffer.append("extends "); buffer.append(superClass); buffer.append(' '); } if (interfaces.size() > 0) { int iSize = interfaces.size(); boolean endl = false; if ((iSize > 1) || (superClass != null)) { jsw.writeln(buffer.toString()); buffer.setLength(0); endl = true; } buffer.append("implements "); for (int i = 0; i < iSize; i++) { if (i > 0) buffer.append(", "); buffer.append(interfaces.elementAt(i)); } if (endl) { jsw.writeln(buffer.toString()); buffer.setLength(0); } else buffer.append(' '); } buffer.append('{'); jsw.writeln(buffer.toString()); buffer.setLength(0); jsw.writeln(); jsw.indent(); //-- declare members if (members.size() > 0) { jsw.writeln(); jsw.writeln(" //--------------------/"); jsw.writeln(" //- Member Variables -/"); jsw.writeln("//--------------------/"); jsw.writeln(); } for (int i = 0; i < members.size(); i++) { JMember jMember = (JMember)members.get(i); //-- print Java comment JDocComment comment = jMember.getComment(); if (comment != null) comment.print(jsw); // -- print member jsw.write(jMember.getModifiers().toString()); jsw.write(' '); JType type = jMember.getType(); String typeName = type.toString(); //-- for esthetics use short name in some cases if (typeName.equals(toString())) { typeName = type.getLocalName(); } jsw.write(typeName); jsw.write(' '); jsw.write(jMember.getName()); String init = jMember.getInitString(); if (init != null) { jsw.write(" = "); jsw.write(init); } jsw.writeln(';'); jsw.writeln(); } //-- print constructors if (constructors.size() > 0) { jsw.writeln(); jsw.writeln(" //----------------/"); jsw.writeln(" //- Constructors -/"); jsw.writeln("//----------------/"); jsw.writeln(); } for (int i = 0; i < constructors.size(); i++) { JConstructor jConstructor = (JConstructor)constructors.elementAt(i); jConstructor.print(jsw); jsw.writeln(); } //-- print methods if (methods.size() > 0) { jsw.writeln(); jsw.writeln(" //-----------/"); jsw.writeln(" //- Methods -/"); jsw.writeln("//-----------/"); jsw.writeln(); } for (int i = 0; i < methods.size(); i++) { JMethod jMethod = (JMethod)methods.elementAt(i); jMethod.print(jsw); jsw.writeln(); } jsw.unindent(); jsw.writeln('}'); jsw.flush(); jsw.close(); } //-- printSource /** * Sets the header comment for this JClass * @param comment the comment to display at the top of the source file * when printed **/ public void setHeader(JComment comment) { this.header = comment; } //-- setHeader /** * Allows changing the package name of this JClass * @param packageName the package name to use **/ public void setPackageName(String packageName) { this.packageName = packageName; changePackage(packageName); } //-- setPackageName /** * Sets the super Class that this class extends * @param superClass the super Class that this Class extends **/ public void setSuperClass(String superClass) { this.superClass = superClass; } //-- setSuperClass //-------------------/ //- Private Methods -/ //-------------------/ /** * **/ private void printlnWithPrefix(String prefix, String source, JSourceWriter jsw) { jsw.write(prefix); if (source == null) return; char[] chars = source.toCharArray(); int lastIdx = 0; for (int i = 0; i < chars.length; i++) { char ch = chars[i]; if (ch == '\n') { //-- free buffer jsw.write(chars,lastIdx,(i-lastIdx)+1); lastIdx = i+1; if (i < chars.length) { jsw.write(prefix); } } } //-- free buffer if (lastIdx < chars.length) { jsw.write(chars, lastIdx, chars.length-lastIdx); } jsw.writeln(); } //-- printWithPrefix private static String getPackageFromClassName(String className) { int idx = -1; if ((idx = className.lastIndexOf('.')) > 0) { return className.substring(0, idx); } return null; } //-- getPackageFromClassName /** * Test drive method...to be removed or commented out ** public static void main(String[] args) { JClass testClass = new JClass("Test"); testClass.addImport("java.util.Vector"); testClass.addMember(new JMember(JType.Int, "x")); JClass jcString = new JClass("String"); JMember jMember = new JMember(jcString, "myString"); jMember.getModifiers().makePrivate(); testClass.addMember(jMember); //-- create constructor JConstructor cons = testClass.createConstructor(); testClass.addConstructor(cons); cons.getSourceCode().add("this.x = 6;"); JMethod jMethod = new JMethod(JType.Int, "getX"); jMethod.setSourceCode("return this.x;"); testClass.addMethod(jMethod); testClass.print(); } //-- main /* */ } //-- JClass
[ "nobody@b24b0d9a-6811-0410-802a-946fa971d308" ]
nobody@b24b0d9a-6811-0410-802a-946fa971d308
895ae0fda0ffabdccbdd3e567302da18e8cfe9c1
7c5cdf1adb18bc8d80631203c83b95fc35cd9a32
/app/src/main/java/cn/zhudai/zin/zhudaibao/fragment/ShowQRCodeFrag.java
1f1109d37754fe7f32d2d132f532ae0401f97589
[]
no_license
kdsunset/ZDB
beb428786dc475f59de405bb761380b5b4c05843
af579ede3186025128d0642c4560f84c658f9704
refs/heads/master
2021-06-06T15:30:44.866919
2016-10-13T06:30:02
2016-10-13T06:30:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,098
java
package cn.zhudai.zin.zhudaibao.fragment; import android.content.Context; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.Message; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.ImageView; import com.google.gson.Gson; import com.squareup.okhttp.Callback; import com.squareup.okhttp.FormEncodingBuilder; import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.Request; import com.squareup.okhttp.RequestBody; import com.squareup.okhttp.Response; import com.zhy.http.okhttp.OkHttpUtils; import com.zhy.http.okhttp.callback.FileCallBack; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import butterknife.Bind; import butterknife.ButterKnife; import cn.sharesdk.framework.ShareSDK; import cn.sharesdk.onekeyshare.OnekeyShare; import cn.zhudai.zin.zhudaibao.R; import cn.zhudai.zin.zhudaibao.application.MyApplication; import cn.zhudai.zin.zhudaibao.entity.BaseErrorResponse; import cn.zhudai.zin.zhudaibao.entity.QRCodeResponse; import cn.zhudai.zin.zhudaibao.entity.ZDBURL; import cn.zhudai.zin.zhudaibao.utils.ImageUtils; import cn.zhudai.zin.zhudaibao.utils.LogUtils; import cn.zhudai.zin.zhudaibao.utils.OKhttpUtils; import cn.zhudai.zin.zhudaibao.utils.SystemUtils; import cn.zhudai.zin.zhudaibao.utils.TimeUtils; import cn.zhudai.zin.zhudaibao.utils.ToastUtils; import okhttp3.Call; /** * Created by admin on 2016/6/2. */ public class ShowQRCodeFrag extends Fragment { @Bind(R.id.iv_qrcode) ImageView ivQrcode; @Bind(R.id.bt_share) Button btShare; @Bind(R.id.bt_save) Button btSave; /* @Bind(R.id.tv_dec) TextView tvDec;*/ @Bind(R.id.iv_logo) ImageView ivLogo; private Context mContext; private Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 200: QRCodeResponse respone = (QRCodeResponse) msg.obj; QRCodeResponse.Result result = respone.getResult(); final String shareimgURL = result.getShareimg(); final String qrimgURL = result.getQrimg(); ImageUtils.setImg4ViewFromNet(ivQrcode, qrimgURL); btShare.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showShare( shareimgURL); } }); btSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { downloadFile(shareimgURL); } }); break; case 400: BaseErrorResponse errorResponse = (BaseErrorResponse) msg.obj; ToastUtils.showToast(mContext, errorResponse.getMsg()); break; case 2200: String path= (String) msg.obj; ToastUtils.showToastLong(mContext, "二维码图片保存成功!保存路径:"+path); //通知系统刷新相册 SystemUtils.scanPhotos(mContext,path); break; case 2: Exception e = (Exception) msg.obj; if (e instanceof java.net.UnknownHostException ) { ToastUtils.showToast(mContext, "连接错误,请检查网络!"); // ((Activity)mContext).finish(); } break; } } }; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_showqrcode, container, false); ButterKnife.bind(this, view); /* String dec = "1、该二维码属于您的专属二维码,扫码后将会打开贷款申请页面;\n" + "2、通过该页面提交的贷款申请均属于您提交的客户;\n" + "3、贷款成功后的奖励与您亲自提交的客户奖励一致;"; tvDec.setText(dec);*/ HideKeyboard(view); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mContext = getActivity(); getQRCodeFromNet(); } private void getQRCodeFromNet() { LogUtils.i("获取二维码请求"); // OkHttpClient client = new OkHttpClient(); OkHttpClient client = OKhttpUtils.getOkHttpClient(); RequestBody formBody = new FormEncodingBuilder() .add("uid", MyApplication.user.getUid()) .build(); final Request request = new Request.Builder() .url(ZDBURL.SHOW_QRCODE) .post(formBody) .build(); client.newCall(request).enqueue(new Callback() { @Override public void onFailure(Request request, IOException e) { LogUtils.i("onFailure" + e.toString()); Message message = handler.obtainMessage(); message.what = 2; message.obj=e; handler.sendMessage(message); } @Override public void onResponse(Response response) throws IOException { String htmlStr = response.body().string(); Gson gson = new Gson(); BaseErrorResponse errorResponse = gson.fromJson(htmlStr, BaseErrorResponse.class); Message message = handler.obtainMessage(); if (errorResponse.getCode() == 400) { message.what = 400; message.obj = errorResponse; } else { QRCodeResponse loginResponse = gson.fromJson(htmlStr, QRCodeResponse.class); LogUtils.i("返回结果" + htmlStr); if (loginResponse.getCode() == 200) { message.what = 200; message.obj = loginResponse; } } handler.sendMessage(message); } }); } /** * 下载文件 */ public void downloadFile(String url) { LogUtils.i("下载文件&url="+url); String dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/download"; String fileName = "zhudaibao"+ TimeUtils.getCurrentMillis()+".jpg"; OkHttpUtils// .get()// .url(url)// .tag("downloadFile") .build()// .execute(new FileCallBack(dir,fileName)// { @Override public void onError(Call call, Exception e, int id) { } @Override public void onResponse(File file, int id) { LogUtils.i("onResponse :" + file.getAbsolutePath()); Message message= handler.obtainMessage(); message.what=2200; message.obj=file.getAbsolutePath(); handler.sendMessage(message); } }); } public String saveFile(Response response) throws IOException { InputStream is = null; byte[] buf = new byte[2048]; int len = 0; FileOutputStream fos = null; try { is = response.body().byteStream(); final long total = response.body().contentLength(); Log.i("TAG", "total:" + total); long sum = 0; File dir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/download"); if (!dir.exists()) dir.mkdirs(); File file = new File(dir, "zhudaibao"+ TimeUtils.getCurrentMillis()+".jpg"); fos = new FileOutputStream(file); while ((len = is.read(buf)) != -1) { sum += len; fos.write(buf, 0, len); /* final long finalSum = sum; // han.obtainMessage(PROG, String.valueOf(finalSum * 1.0f / total)).sendToTarget();*/ } fos.flush(); return file.getAbsolutePath(); } finally { try { if (is != null) is.close(); } catch (IOException e) { } try { if (fos != null) fos.close(); } catch (IOException e) { } } } @Override public void onDestroyView() { super.onDestroyView(); ButterKnife.unbind(this); } private void showShare( String imgUrl) { ShareSDK.initSDK(mContext); final OnekeyShare oks = new OnekeyShare(); //关闭sso授权 oks.disableSSOWhenAuthorize(); // 分享时Notification的图标和文字 2.5.9以后的版本不调用此方法 //oks.setNotification(R.drawable.ic_launcher, getString(R.string.app_name)); // title标题,印象笔记、邮箱、信息、微信、人人网和QQ空间使用 // title标题:微信、QQ(新浪微博不需要标题) // oks.setTitle(title); // titleUrl是标题的网络链接,仅在人人网和QQ空间使用 // oks.setTitleUrl(url); // text是分享文本,所有平台都需要这个字段 // oks.setText("我是分享文本"); //oks.setText(dec); //网络图片的url:所有平台 oks.setImageUrl(imgUrl);//网络图片rul // url仅在微信(包括好友和朋友圈)中使用 // oks.setUrl(url); //oks.setUrl(url); // comment是我对这条分享的评论,仅在人人网和QQ空间使用 // oks.setComment("我是测试评论文本"); // site是分享此内容的网站名称,仅在QQ空间使用 oks.setSite(getString(R.string.app_name)); // siteUrl是分享此内容的网站地址,仅在QQ空间使用 // oks.setSiteUrl(url); // 启动分享GUI oks.show(mContext); } public void HideKeyboard(View v) { InputMethodManager imm = ( InputMethodManager ) v.getContext( ).getSystemService( Context.INPUT_METHOD_SERVICE ); if ( imm.isActive( ) ) { imm.hideSoftInputFromWindow( v.getApplicationWindowToken( ) , 0 ); } } }
e99604d8a0d551b8131779e62098c14dc77020cf
9a7f334c7950299ae8ab538185fcd1e12b86f970
/src/SecurityAlgorithm/TDES.java
5633e76633fe169afe82044d2f035f5aadbdcfb4
[]
no_license
ZhangYing3314/Tintest
b23f78ee2505cb84e25d66ce64d2dcc484bcf88b
1d269400fd2b9debd28e8ad4e824222b8aeac28f
refs/heads/master
2020-06-13T10:01:35.557525
2019-07-01T07:12:29
2019-07-01T07:12:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,463
java
package SecurityAlgorithm; import java.util.ArrayList; import java.util.BitSet; import java.util.List; /** * 3DES algorthm * * @author Wang Zhichao 2019/06/25 * @version 1.0 */ public class TDES { private List<String> keys; /** * split key to 3 subkeys * * @param key */ public TDES(String key) { List<String> keys = new ArrayList<>(); for (int i = 0; i < key.length(); i = i + 8) { if (i > key.length() - 8) { keys.add(key.substring(i, key.length())); } else { keys.add(key.substring(i, i + 8)); } } while (keys.size() != 3) keys.add(""); this.keys = keys; } /** * encrypt plaintext * * @param msg * @return */ public List<BitSet> encryptMsg(String msg) { DES des1 = new DES(keys.get(0)); List<BitSet> firstSet = des1.encryptText(msg); DES des2 = new DES(keys.get(1)); String secondString = des2.decryptText(firstSet); DES des3 = new DES(keys.get(2)); List<BitSet> thirdSet = des3.encryptText(secondString); return thirdSet; } /** * decrypt cyphertext * * @param cypherText * @return */ public String decryptMsg(List<BitSet> cypherText) { DES des3 = new DES(keys.get(2)); String thirdString = des3.decryptText(cypherText); DES des2 = new DES(keys.get(1)); List<BitSet> secondSet = des2.encryptText(thirdString); DES des1 = new DES(keys.get(0)); return des1.decryptText(secondSet); } }
cd7fcfad3a2ddd193a6ff2830ae471637db1785f
ef5a0b42ed6d7595f8ede48532758070c61d5701
/AlphaBdSDKAnd/common/src/main/java/com/fxmvp/detailroi/common/base/utils/oaid/interfaces/ZTEIDInterface.java
e4661b13df05ad8d4b6f8eb4d6163419ed411c96
[]
no_license
MTGfxplatform/FXSDK-Android
3a81674602d89f5c16addacc06804263b1494caa
084a7023c72d1bf8cb2aa220a430efe10d6f4dc3
refs/heads/main
2023-08-18T02:04:13.723115
2021-10-21T11:08:31
2021-10-21T11:08:31
419,568,935
0
0
null
null
null
null
UTF-8
Java
false
false
2,800
java
package com.fxmvp.detailroi.common.base.utils.oaid.interfaces; import android.os.Binder; import android.os.IBinder; import android.os.IInterface; import android.os.Parcel; /** * @author Paul Luv on 2020/9/22 */ public interface ZTEIDInterface extends IInterface { boolean c(); String getOAID(); boolean isSupported(); void shutDown(); public static abstract class up extends Binder implements ZTEIDInterface { public static class down implements ZTEIDInterface { private IBinder binder; public down(IBinder b) { binder = b; } @Override public IBinder asBinder() { return binder; } @Override public boolean c() { boolean v0 = false; Parcel v1 = Parcel.obtain(); Parcel v2 = Parcel.obtain(); try { v1.writeInterfaceToken("com.bun.lib.MsaIdInterface"); binder.transact(2, v1, v2, 0); v2.readException(); if (v2.readInt() == 0) { v2.recycle(); v1.recycle(); v0 = true; } } catch (Throwable v0_1) { v2.recycle(); v1.recycle(); v0_1.printStackTrace(); } return v0; } @Override public String getOAID() { String v0_1 = null; Parcel v1 = Parcel.obtain(); Parcel v2 = Parcel.obtain(); try { v1.writeInterfaceToken("com.bun.lib.MsaIdInterface"); binder.transact(3, v1, v2, 0); v2.readException(); v0_1 = v2.readString(); } catch (Throwable v0) { v2.recycle(); v1.recycle(); } v2.recycle(); v1.recycle(); return v0_1; } @Override public boolean isSupported() { return false; } @Override public void shutDown() { Parcel v1 = Parcel.obtain(); Parcel v2 = Parcel.obtain(); try { v1.writeInterfaceToken("com.bun.lib.MsaIdInterface"); binder.transact(6, v1, v2, 0); v2.readException(); } catch (Throwable v0) { v2.recycle(); v1.recycle(); } v2.recycle(); v1.recycle(); } } } }
a914684ceae057d2b32a80f69c2c34da48fdc8f7
b5da40959f7fcc592339f48cd921ab55eb41a4de
/it.unibo.qacoap/src-gen/it/unibo/qacoapobserver/AbstractQacoapobserver.java
7507e18ae79b20a21bed7a59cea765b6bbea4a08
[]
no_license
MatteoMendula/iss2018Lab
8228a3a623e2cb02e6bcd5cfa48cd395f343fc65
122ed92f522ab58d5fe105d778719eb05a5a37d5
refs/heads/master
2020-04-19T18:14:49.627220
2019-01-10T15:15:45
2019-01-10T15:15:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,306
java
/* Generated by AN DISI Unibo */ package it.unibo.qacoapobserver; import it.unibo.qactors.PlanRepeat; import it.unibo.qactors.QActorContext; import it.unibo.qactors.StateExecMessage; import it.unibo.qactors.QActorUtils; import it.unibo.is.interfaces.IOutputEnvView; import it.unibo.qactors.action.AsynchActionResult; import it.unibo.qactors.action.IActorAction; import it.unibo.qactors.action.IActorAction.ActionExecMode; import it.unibo.qactors.action.IMsgQueue; import it.unibo.qactors.akka.QActor; import it.unibo.qactors.StateFun; import java.util.Stack; import java.util.Hashtable; import java.util.concurrent.Callable; import alice.tuprolog.Struct; import alice.tuprolog.Term; import it.unibo.qactors.action.ActorTimedAction; import it.unibo.baseEnv.basicFrame.EnvFrame; import alice.tuprolog.SolveInfo; import it.unibo.is.interfaces.IActivity; import it.unibo.is.interfaces.IIntent; public abstract class AbstractQacoapobserver extends QActor implements IActivity{ protected AsynchActionResult aar = null; protected boolean actionResult = true; protected alice.tuprolog.SolveInfo sol; protected String planFilePath = null; protected String terminationEvId = "default"; protected String parg=""; protected boolean bres=false; protected IActorAction action; protected static IOutputEnvView setTheEnv(IOutputEnvView outEnvView ){ EnvFrame env = new EnvFrame( "Env_qacoapobserver", java.awt.Color.yellow , java.awt.Color.black ); env.init(); env.setSize(800,430); IOutputEnvView newOutEnvView = ((EnvFrame) env).getOutputEnvView(); return newOutEnvView; } public AbstractQacoapobserver(String actorId, QActorContext myCtx, IOutputEnvView outEnvView ) throws Exception{ super(actorId, myCtx, "./srcMore/it/unibo/qacoapobserver/WorldTheory.pl", setTheEnv( outEnvView ) , "init"); addInputPanel(80); addCmdPanels(); this.planFilePath = "./srcMore/it/unibo/qacoapobserver/plans.txt"; } protected void addInputPanel(int size){ ((EnvFrame) env).addInputPanel(size); } protected void addCmdPanels(){ ((EnvFrame) env).addCmdPanel("input", new String[]{"INPUT"}, this); ((EnvFrame) env).addCmdPanel("alarm", new String[]{"FIRE"}, this); ((EnvFrame) env).addCmdPanel("help", new String[]{"HELP"}, this); } @Override protected void doJob() throws Exception { String name = getName().replace("_ctrl", ""); mysupport = (IMsgQueue) QActorUtils.getQActor( name ); initStateTable(); initSensorSystem(); history.push(stateTab.get( "init" )); autoSendStateExecMsg(); //QActorContext.terminateQActorSystem(this);//todo } /* * ------------------------------------------------------------ * PLANS * ------------------------------------------------------------ */ //genAkkaMshHandleStructure protected void initStateTable(){ stateTab.put("handleToutBuiltIn",handleToutBuiltIn); stateTab.put("init",init); stateTab.put("work",work); stateTab.put("observe",observe); } StateFun handleToutBuiltIn = () -> { try{ PlanRepeat pr = PlanRepeat.setUp("handleTout",-1); String myselfName = "handleToutBuiltIn"; println( "qacoapobserver tout : stops"); repeatPlanNoTransition(pr,myselfName,"application_"+myselfName,false,false); }catch(Exception e_handleToutBuiltIn){ println( getName() + " plan=handleToutBuiltIn WARNING:" + e_handleToutBuiltIn.getMessage() ); QActorContext.terminateQActorSystem(this); } };//handleToutBuiltIn StateFun init = () -> { try{ PlanRepeat pr = PlanRepeat.setUp("init",-1); String myselfName = "init"; //switchTo work switchToPlanAsNextState(pr, myselfName, "qacoapobserver_"+myselfName, "work",false, false, null); }catch(Exception e_init){ println( getName() + " plan=init WARNING:" + e_init.getMessage() ); QActorContext.terminateQActorSystem(this); } };//init StateFun work = () -> { try{ PlanRepeat pr = PlanRepeat.setUp("work",-1); String myselfName = "work"; temporaryStr = "\"qacoapoberver STARTS \""; println( temporaryStr ); createObserver(); doCoapQuery( "globalkb" , "assign(a,100)" ); doCoapQuery( "globalkb" , "getVal(a,X)" ); //switchTo observe switchToPlanAsNextState(pr, myselfName, "qacoapobserver_"+myselfName, "observe",false, false, null); }catch(Exception e_work){ println( getName() + " plan=work WARNING:" + e_work.getMessage() ); QActorContext.terminateQActorSystem(this); } };//work StateFun observe = () -> { try{ PlanRepeat pr = PlanRepeat.setUp(getName()+"_observe",0); pr.incNumIter(); String myselfName = "observe"; temporaryStr = "\"qacoapoberver OBSERVING ... \""; println( temporaryStr ); //bbb msgTransition( pr,myselfName,"qacoapobserver_"+myselfName,false, new StateFun[]{() -> { //AD HOC state to execute an action and resumeLastPlan try{ PlanRepeat pr1 = PlanRepeat.setUp("adhocstate",-1); //ActionSwitch for a message or event if( currentEvent.getMsg().startsWith("info") ){ String parg = "qacoapobserver(observeddddddddddddddd,X)"; /* Print */ parg = updateVars( Term.createTerm("info(X)"), Term.createTerm("info(X)"), Term.createTerm(currentEvent.getMsg()), parg); if( parg != null ) println( parg ); } repeatPlanNoTransition(pr1,"adhocstate","adhocstate",false,true); }catch(Exception e ){ println( getName() + " plan=observe WARNING:" + e.getMessage() ); //QActorContext.terminateQActorSystem(this); } } }, new String[]{"true","E","coapInfo" }, 600000, "handleToutBuiltIn" );//msgTransition }catch(Exception e_observe){ println( getName() + " plan=observe WARNING:" + e_observe.getMessage() ); QActorContext.terminateQActorSystem(this); } };//observe protected void initSensorSystem(){ //doing nothing in a QActor } /* * ------------------------------------------------------------ * IACTIVITY (aactor with GUI) * ------------------------------------------------------------ */ private String[] actions = new String[]{ "println( STRING | TERM )", "play('./audio/music_interlude20.wav'),20000,'alarm,obstacle', 'handleAlarm,handleObstacle'", "emit(EVID,EVCONTENT) ", "move(MOVE,DURATION,ANGLE) with MOVE=mf|mb|ml|mr|ms", "forward( DEST, MSGID, MSGCONTENTTERM)" }; protected void doHelp(){ println(" GOAL "); println("[ GUARD ], ACTION "); println("[ GUARD ], ACTION, DURATION "); println("[ GUARD ], ACTION, DURATION, ENDEVENT"); println("[ GUARD ], ACTION, DURATION, EVENTS, PLANS"); println("Actions:"); for( int i=0; i<actions.length; i++){ println(" " + actions[i] ); } } @Override public void execAction(String cmd) { if( cmd.equals("HELP") ){ doHelp(); return; } if( cmd.equals("FIRE") ){ emit("alarm", "alarm(fire)"); return; } String input = env.readln(); //input = "\""+input+"\""; input = it.unibo.qactors.web.GuiUiKb.buildCorrectPrologString(input); //println("input=" + input); try { Term.createTerm(input); String eventMsg=it.unibo.qactors.web.QActorHttpServer.inputToEventMsg(input); //println("QActor eventMsg " + eventMsg); emit("local_"+it.unibo.qactors.web.GuiUiKb.inputCmd, eventMsg); } catch (Exception e) { println("QActor input error " + e.getMessage()); } } @Override public void execAction() {} @Override public void execAction(IIntent input) {} @Override public String execActionWithAnswer(String cmd) {return null;} }
1e2b0afed9783f829988cd6cd2b7a0c084296484
3835f0d1df85bc89ed004d14cf53021705169916
/Week4/activity6/activity6/src/business/MusicManagerInterface.java
e50b397ff68ea005e04f1fa7b71937e249af6f65
[]
no_license
ZSwoveland/CST361SoloTurnIn
dba52e9ed64a49d3ab0840cd0a2dead9f3fee87c
0f6429d9cdcde1c4c60157c81e521bf3edb6e7f7
refs/heads/main
2023-03-03T17:44:55.679907
2021-02-14T16:55:29
2021-02-14T16:55:29
322,879,473
0
0
null
null
null
null
UTF-8
Java
false
false
116
java
package business; import beans.Album; public interface MusicManagerInterface { Album addAlbum(Album model); }
7f12d4e8fa48258c9118f1c123d18dae261442bc
bd30db68647c84f7f66ec5b8524d5ada5c076f81
/wenfeng/src/main/java/com/cqupt/view/ItemsShowingHorizontalView.java
ecc114c7bb9f39ad3c2a91d4486c39cc08c970fc
[]
no_license
coldliang/repo1
88187ac0e4ae5f395b347734700cf33dc383dbd1
b520e0cf89fa33a2465dc5874797ac504f054b52
refs/heads/master
2020-04-12T19:15:09.569967
2018-12-21T11:14:09
2018-12-21T11:14:09
162,704,304
0
0
null
null
null
null
UTF-8
Java
false
false
3,113
java
package com.cqupt.view; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.HorizontalScrollView; import android.widget.LinearLayout; import com.cqupt.R; import com.cqupt.adapter.ItemsShowingAdapter; import java.util.HashMap; import java.util.List; public class ItemsShowingHorizontalView extends HorizontalScrollView implements OnClickListener{ private final static int DEFAULT_ITEM_WIDTH = 220; private final static int DEFAULT_ITEM_HEIGHT = 220; public interface OnItemViewClickListener{ public void onClick(List<String> urls,int position); } private int mItemWidth = DEFAULT_ITEM_WIDTH; private int mItemHeight = DEFAULT_ITEM_HEIGHT; private OnItemViewClickListener mListener; private LinearLayout mLinearLayout; private ItemsShowingAdapter mAdapter; public ItemsShowingHorizontalView(Context context, AttributeSet attrs,int defStyle) { super(context, attrs, defStyle); TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.ItemShowingHorizontalView); mItemWidth = ta.getDimensionPixelSize(R.styleable.ItemShowingHorizontalView_itemWidth, DEFAULT_ITEM_WIDTH); if(mItemWidth <= 0 ){ mItemWidth = DEFAULT_ITEM_WIDTH; } mItemHeight = ta.getDimensionPixelSize(R.styleable.ItemShowingHorizontalView_itemHeight, DEFAULT_ITEM_HEIGHT); if(mItemHeight <= 0){ mItemHeight = DEFAULT_ITEM_HEIGHT; } ta.recycle(); mLinearLayout = new LinearLayout(context, attrs, defStyle); mLinearLayout.setOrientation(LinearLayout.HORIZONTAL); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT); addView(mLinearLayout, lp); } public ItemsShowingHorizontalView(Context context, AttributeSet attrs) { this(context,attrs,0); } public ItemsShowingHorizontalView(Context context) { this(context, null); } @Override public void onClick(View v) { if(mListener != null){ @SuppressWarnings("unchecked") HashMap<String, Object> map = (HashMap<String, Object>)v.getTag(); @SuppressWarnings("unchecked") List<String> urls = (List<String>) map.get(ItemsShowingAdapter.TAG_URLS); int position = (Integer) map.get(ItemsShowingAdapter.TAG_POSITION); mListener.onClick(urls,position); } } public void setAdapter(ItemsShowingAdapter adapter){ mAdapter = adapter; makeChildView(); } public void setListener(OnItemViewClickListener listener){ mListener = listener; } private void makeChildView(){ mLinearLayout.removeAllViews(); android.widget.LinearLayout.LayoutParams lp = new android.widget.LinearLayout .LayoutParams(mItemWidth,mItemHeight); lp.topMargin = 10; lp.bottomMargin = 10; lp.leftMargin = 5; lp.rightMargin = 5; for(int i = 0; i < mAdapter.getItemCount(); i++){ View view = mAdapter.getView(i); view.setOnClickListener(this); mLinearLayout.addView(view, lp); } } }
f3ac55f3854ae45120bc3519d5c06715af699c95
73f3f7d612d5bac4a9ab945c3e9c3f5abae741d3
/DistributedSystems5/src/main/java/com/distributedsystems/task/model/OrderEquipment.java
6a88468b15f90106d44eef0e25cb30c11cab069f
[]
no_license
Gio02092001/DistributedSystem
d09a9c48b615dee4dcdcc50ca4ba0ae2d39087a8
9d171437f61a295fdbcec9554cd0fe2ba7d24f5b
refs/heads/main
2023-04-01T22:23:32.183309
2021-04-23T14:31:48
2021-04-23T14:31:48
360,902,154
0
0
null
null
null
null
UTF-8
Java
false
false
1,359
java
package com.distributedsystems.task.model; import javax.persistence.*; @Entity public class OrderEquipment { @Id @SequenceGenerator( name = "EquipmentOrder_Sequence", sequenceName = "equipmentOrder_sequence", allocationSize = 1 ) @GeneratedValue( strategy = GenerationType.SEQUENCE, generator = "equipmentOrder_sequence" ) private int id; private int order_id; private int equipment_id; private int amount; public OrderEquipment(int order_id, int equipment_id, int amount) { this.order_id = order_id; this.equipment_id = equipment_id; this.amount = amount; } public OrderEquipment() { } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getOrder_id() { return order_id; } public void setOrder_id(int order_id) { this.order_id = order_id; } public int getEquipment_id() { return equipment_id; } public void setEquipment_id(int equipment_id) { this.equipment_id = equipment_id; } public int getAmount() { return amount; } public void setAmount(int amount) { this.amount = amount; } }
44d44de4c8110f79205573114e91031ae9b09067
60feada88a66bf1c9a68a74ecf588c5dc9d42e1a
/src/main/java/com/bookerdimaio/scrabble/web/rest/vm/package-info.java
e6a611ac10c6583708dfd909235d721763ab23b6
[]
no_license
cmavelis/scr-gate
a877c40aec4ec2c8cd97856289407905b020677a
be55a73622ac8bd0fd12e9b8ec88fc201eb6231a
refs/heads/master
2022-12-24T22:32:37.880800
2019-08-22T16:18:40
2019-08-22T16:18:40
204,721,722
0
0
null
2022-12-16T05:03:16
2019-08-27T14:30:35
TypeScript
UTF-8
Java
false
false
107
java
/** * View Models used by Spring MVC REST controllers. */ package com.bookerdimaio.scrabble.web.rest.vm;
68014473d3ef3e2e07c6fe398816ae72bf05833e
0fe057d94f5918bc3b41af9fdafc7f4444f2b03e
/src/main/java/com/labeltel/site/config/MailConfiguration.java
1e3d3c39f182d83a2629ae4e558ff03159ec2602
[]
no_license
renancunha/labtelsite
480778d37fb6bd67f431f14244af8408466f29ea
078d476d560fc063f41ca9b19f0c2076c68a1f90
refs/heads/master
2016-09-05T14:30:31.032294
2015-09-18T12:57:29
2015-09-18T12:57:29
42,722,184
0
0
null
null
null
null
UTF-8
Java
false
false
3,126
java
package com.labeltel.site.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.EnvironmentAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; import org.springframework.mail.javamail.JavaMailSenderImpl; import java.util.Properties; @Configuration public class MailConfiguration implements EnvironmentAware { private static final String ENV_SPRING_MAIL = "mail."; private static final String DEFAULT_HOST = "127.0.0.1"; private static final String PROP_HOST = "host"; private static final String DEFAULT_PROP_HOST = "localhost"; private static final String PROP_PORT = "port"; private static final String PROP_USER = "username"; private static final String PROP_PASSWORD = "password"; private static final String PROP_PROTO = "protocol"; private static final String PROP_TLS = "tls"; private static final String PROP_AUTH = "auth"; private static final String PROP_SMTP_AUTH = "mail.smtp.auth"; private static final String PROP_STARTTLS = "mail.smtp.starttls.enable"; private static final String PROP_TRANSPORT_PROTO = "mail.transport.protocol"; private final Logger log = LoggerFactory.getLogger(MailConfiguration.class); private RelaxedPropertyResolver propertyResolver; @Override public void setEnvironment(Environment environment) { this.propertyResolver = new RelaxedPropertyResolver(environment, ENV_SPRING_MAIL); } @Bean public JavaMailSenderImpl javaMailSender() { log.debug("Configuring mail server"); String host = propertyResolver.getProperty(PROP_HOST, DEFAULT_PROP_HOST); int port = propertyResolver.getProperty(PROP_PORT, Integer.class, 0); String user = propertyResolver.getProperty(PROP_USER); String password = propertyResolver.getProperty(PROP_PASSWORD); String protocol = propertyResolver.getProperty(PROP_PROTO); Boolean tls = propertyResolver.getProperty(PROP_TLS, Boolean.class, false); Boolean auth = propertyResolver.getProperty(PROP_AUTH, Boolean.class, false); JavaMailSenderImpl sender = new JavaMailSenderImpl(); if (host != null && !host.isEmpty()) { sender.setHost(host); } else { log.warn("Warning! Your SMTP server is not configured. We will try to use one on localhost."); log.debug("Did you configure your SMTP settings in your application.yml?"); sender.setHost(DEFAULT_HOST); } sender.setPort(port); sender.setUsername(user); sender.setPassword(password); Properties sendProperties = new Properties(); sendProperties.setProperty(PROP_SMTP_AUTH, auth.toString()); sendProperties.setProperty(PROP_STARTTLS, tls.toString()); sendProperties.setProperty(PROP_TRANSPORT_PROTO, protocol); sender.setJavaMailProperties(sendProperties); return sender; } }
af1f8d81185f4cfa6989c1d9e0a5f01fc1a9a711
7908ec3c94ceb6085630c84711a38e306056770a
/014. JavaFX Hello World!/src/sample/Main.java
994e6cf6bbc322e4a239b1a17e440d01f4ce212e
[]
no_license
FrogGreen/Java
d78ffbd5d70f0a0454deef5c20dc460ab2a7188d
1803c29f6fb408e32a38e50bf07240ec242a186e
refs/heads/master
2022-12-28T22:09:56.603007
2019-10-20T22:28:03
2019-10-20T22:28:03
195,135,181
1
0
null
null
null
null
UTF-8
Java
false
false
602
java
//JavaFX Hello World package sample; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); primaryStage.setTitle("Hello World"); primaryStage.setScene(new Scene(root, 300, 275)); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
6a84e6ff52b09153b388dd324e41e6f434b8bfde
3edc2c20d3bf749a0ecebcaf61b08da2bf58593b
/src/main/java/singleton/ChocolateBoiler2.java
b8a33d9e483140d0450d2fbe5bfbb250f099dfc2
[]
no_license
hannut91/design-patterns
d3f274d93aa8bd67aa9950eda491b1ecc5b278c1
1f6139b7753481a2db57e90b6be391a952499537
refs/heads/master
2020-12-02T02:00:55.976728
2020-01-12T10:17:11
2020-01-12T10:17:11
230,851,596
1
1
null
2020-01-12T10:17:12
2019-12-30T05:11:31
Kotlin
UTF-8
Java
false
false
766
java
package singleton; public class ChocolateBoiler2 { private boolean empty; private boolean boiled; private static ChocolateBoiler2 uniqueInstance; private ChocolateBoiler2() { empty = true; boiled = false; } public static ChocolateBoiler2 getUniqueInstance() { if (uniqueInstance == null) { uniqueInstance = new ChocolateBoiler2(); } return uniqueInstance; } public void fill() { if (empty) { empty = false; boiled = false; } } public void boil() { if (!empty && !boiled) { boiled = true; } } public void drain() { if (!empty && boiled) { empty = true; } } }
bf849ce48fdf98c334011bdd67961246a32d919a
3d94fe2be59b31ef46534975a6ddebb1972f47b7
/base-backend/family/src/main/java/com/family/gold/service/Impl/UserDiyGroupConfigServiceImpl.java
1458c205225f3f0e3160e1e7e1656a9bc53d2e56
[]
no_license
banxue-dev/family-manager
31de7143bb8c18e014322d2a967742d7f3b2b7c2
a7b0e84a0244ebc4ec8a6601c29f882c29135407
refs/heads/master
2023-07-05T02:11:46.247883
2021-08-03T02:08:20
2021-08-03T02:08:20
299,210,043
0
0
null
null
null
null
UTF-8
Java
false
false
5,450
java
package com.family.gold.service.Impl; import com.family.gold.entity.UserDiyGroupConfig; import com.family.gold.mapper.UserDiyGroupConfigMapper; import com.family.gold.service.IUserDiyGroupConfigService; import org.springframework.stereotype.Service; import com.family.utils.EntityChangeRquestView; import com.family.gold.entity.VO.UserDiyGroupConfigVO; import com.family.gold.entity.DO.UserDiyGroupConfigDO; import com.github.pagehelper.PageHelper; import com.family.utils.ResultUtil; import com.family.utils.ResultObject; import javax.persistence.Transient; import org.springframework.transaction.annotation.Transactional; import tk.mybatis.mapper.entity.Example; import java.util.ArrayList; import com.family.utils.TimeUtils; import com.github.pagehelper.PageInfo; import com.family.utils.LayuiPage; import com.family.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import java.util.Map; import java.util.List; /** * UserDiyGroupConfig服务层 * Auther:feng * Date:2020-10-21 17:50:47 */ @Service public class UserDiyGroupConfigServiceImpl implements IUserDiyGroupConfigService { @Autowired private UserDiyGroupConfigMapper iUserDiyGroupConfigMapper; /** * 获取单页记录 * Auther:feng */ @Override public UserDiyGroupConfigVO getSingleInfo(UserDiyGroupConfigDO userDiyGroupConfigDO) { UserDiyGroupConfig userDiyGroupConfig=new UserDiyGroupConfig(); userDiyGroupConfig= iUserDiyGroupConfigMapper.selectOne(EntityChangeRquestView.createDOToEntity(userDiyGroupConfigDO,new UserDiyGroupConfig())); return this.structDetailData(userDiyGroupConfig); } /** * 依据ID获取单页记录 * Auther:feng */ @Override public UserDiyGroupConfigVO getSingleInfoById(Integer goldUserDiyGroupConfigId) { UserDiyGroupConfig userDiyGroupConfig=new UserDiyGroupConfig(); userDiyGroupConfig= iUserDiyGroupConfigMapper.selectByPrimaryKey(goldUserDiyGroupConfigId); return this.structDetailData(userDiyGroupConfig); } /** * 获取列表记录 * Auther:feng */ @Override public List<UserDiyGroupConfigVO> getUserDiyGroupConfigList(UserDiyGroupConfigDO userDiyGroupConfigDO) { Example example = getPublicExample(userDiyGroupConfigDO); List<UserDiyGroupConfigVO> lstVO = new ArrayList<UserDiyGroupConfigVO>(); List<UserDiyGroupConfig> lst = iUserDiyGroupConfigMapper.selectByExample(example); lst.forEach(t->{ UserDiyGroupConfigVO vo=this.structDetailData(t); if(vo!=null) { lstVO.add(vo); } }); return lstVO; } /** * 获取分页记录 * Auther:feng */ @Override @Transactional public LayuiPage<UserDiyGroupConfigVO> getUserDiyGroupConfigListByPage(UserDiyGroupConfigDO userDiyGroupConfigDO, LayuiPage<UserDiyGroupConfigVO> layuiPage){ Example example = getPublicExample(userDiyGroupConfigDO); if(StringUtils.isNotNull(layuiPage.getSort())) { PageHelper.startPage(layuiPage.getPage(), layuiPage.getLimit()).setOrderBy(layuiPage.getSort() + " " + layuiPage.getDire()); }else { PageHelper.startPage(layuiPage.getPage(), layuiPage.getLimit()); } List<UserDiyGroupConfigVO> lstVO = new ArrayList<UserDiyGroupConfigVO>(); List<UserDiyGroupConfig> lst = iUserDiyGroupConfigMapper.selectByExample(example); PageInfo pageInfo=PageInfo.of(lst); lst.forEach(t->{ UserDiyGroupConfigVO vo=this.structDetailData(t); if(vo!=null) { lstVO.add(vo); } }); pageInfo.setList(lstVO); layuiPage = new LayuiPage<>(pageInfo); return layuiPage; } /** * 删除记录 * Auther:feng */ @Override @Transactional public ResultObject delUserDiyGroupConfig(UserDiyGroupConfig userDiyGroupConfig) { int i= iUserDiyGroupConfigMapper.updateByPrimaryKeySelective(userDiyGroupConfig); if(i<1) { return ResultUtil.error("更新失败"); } return ResultUtil.success("成功"); } /** * 修改信息 * Auther:feng */ @Override @Transactional public ResultObject modUserDiyGroupConfig(UserDiyGroupConfig userDiyGroupConfig) { int i= iUserDiyGroupConfigMapper.updateByPrimaryKeySelective(userDiyGroupConfig); if(i<1) { return ResultUtil.error("更新失败"); } return ResultUtil.success("成功"); } /** * 添加信息 * Auther:feng */ @Override @Transactional public ResultObject addNewUserDiyGroupConfig(UserDiyGroupConfig userDiyGroupConfig) { userDiyGroupConfig.setCreateTime(TimeUtils.getCurrentTime()); int i= iUserDiyGroupConfigMapper.insertSelective(userDiyGroupConfig); if(i<1) { return ResultUtil.error("更新失败"); } return ResultUtil.success("成功"); } /** * 构造返回的数据 * Auther:feng */ private UserDiyGroupConfigVO structDetailData(UserDiyGroupConfig userDiyGroupConfig) { if(userDiyGroupConfig==null){ return null; } UserDiyGroupConfigVO vo= EntityChangeRquestView.createEntityToVO(userDiyGroupConfig,new UserDiyGroupConfigVO()); return vo; } /** * 构造请求的条件 * Auther:feng */ private Example getPublicExample(UserDiyGroupConfigDO userDiyGroupConfigDO) { Example example = new Example(UserDiyGroupConfig.class); Example.Criteria criteria = example.createCriteria(); criteria.andEqualTo(EntityChangeRquestView.createDOToEntity(userDiyGroupConfigDO,new UserDiyGroupConfig())); return example; } }
bcf991caf94373bdc1d601e154baae4be7dc9910
e01dc5993b7ac310c346763d46e900f3b2d5db5e
/jasperserver-dto/src/main/java/com/jaspersoft/jasperserver/dto/resources/ClientProperty.java
5cdae7dcb84bbcae1bffeb8f747a5575b214ae93
[]
no_license
yohnniebabe/jasperreports-server-ce
ed56548a2ee18d37511c5243ffd8e0caff2be8f7
e65ce85a5dfca8d9002fcabc172242f418104453
refs/heads/master
2023-08-26T00:01:23.634829
2021-10-22T14:15:32
2021-10-22T14:15:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,930
java
/* * Copyright (C) 2005 - 2020 TIBCO Software Inc. All rights reserved. * http://www.jaspersoft.com. * * Unless you have purchased a commercial license agreement from Jaspersoft, * the following license terms apply: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.jaspersoft.jasperserver.dto.resources; import com.jaspersoft.jasperserver.dto.common.DeepCloneable; import javax.xml.bind.annotation.XmlRootElement; import static com.jaspersoft.jasperserver.dto.utils.ValueObjectUtils.checkNotNull; /** * <p></p> * * @author Yaroslav.Kovalchyk * @version $Id$ */ @XmlRootElement(name = "property") public class ClientProperty implements DeepCloneable<ClientProperty> { private String key; private String value; public ClientProperty(){ } public ClientProperty (ClientProperty source){ checkNotNull(source); key = source.getKey(); value = source.getValue(); } public ClientProperty(String key, String value){ this.key = key; this.value = value; } public String getKey() { return key; } public ClientProperty setKey(String key) { this.key = key; return this; } public String getValue() { return value; } public ClientProperty setValue(String value) { this.value = value; return this; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ClientProperty that = (ClientProperty) o; if (key != null ? !key.equals(that.key) : that.key != null) return false; if (value != null ? !value.equals(that.value) : that.value != null) return false; return true; } @Override public int hashCode() { int result = key != null ? key.hashCode() : 0; result = 31 * result + (value != null ? value.hashCode() : 0); return result; } @Override public String toString() { return "ClientProperty{" + "key='" + key + '\'' + ", value='" + value + '\'' + '}'; } /* * DeepCloneable */ @Override public ClientProperty deepClone() { return new ClientProperty(this); } }
9daf05f4ef3d0b8ca3f74a8f974a07b615a56dc5
a749a78317bfb271b818c682db4fb433ed5c9fb1
/pr2.07.00-PresentationCode/src/io/dama/ffi/generics/SimpleStackObject.java
41d10e1d96e2913cb07da1e0153b6051f32347c0
[]
no_license
zer0x0/pr2_fue
29176ce98f7736b399f594c33ef320dac7f343a0
6ec2514e7d3285b1575d96c4cd4612b3ee00488a
refs/heads/master
2023-06-01T21:47:22.670838
2021-06-17T21:58:01
2021-06-17T21:58:01
265,402,921
1
0
null
null
null
null
UTF-8
Java
false
false
949
java
package io.dama.ffi.generics; public class SimpleStackObject { private final Object[] stack; private int pos; public SimpleStackObject(final int size) { this.stack = new Object[size]; this.pos = 0; } public void push(final Object o) { this.stack[this.pos++] = o; } public Object pop() { return this.stack[--this.pos]; } public static void main(final String[] args) { final var stack1 = new SimpleStackObject(10); stack1.push("Hello"); String s1 = (String) stack1.pop(); System.out.println(s1); stack1.push(42); s1 = (String) stack1.pop(); // FEHLER (Runtime)!! System.out.println(s1); final var stack2 = new SimpleStack(10); stack2.push("Hello"); var s = stack2.pop(); System.out.println(s); stack2.push(42); s = stack2.pop(); System.out.println(s); } }
7a83c064633aac34970bf519890cdd63fd5fb31f
c0148cf6550573373988ae12bc0d560c98cca2eb
/src/org/omg/PortableServer/RequestProcessingPolicyOperations.java
11476fdc88d058e03eefd92fc6b1a0fa8ac8c379
[]
no_license
chensy28/java8-source-read
32d49e5d8816ed2c08012230370b35b2aae60cc4
eaaeaf0c54de0049c735a6f7895cdb0ad980c5a5
refs/heads/master
2021-07-25T05:49:14.191422
2021-07-15T11:42:40
2021-07-15T11:42:40
227,141,261
0
1
null
null
null
null
UTF-8
Java
false
false
733
java
package org.omg.PortableServer; /** * org/omg/PortableServer/RequestProcessingPolicyOperations.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from /Users/java_re/workspace/8-2-build-macosx-x86_64/jdk8u172/10810/corba/src/share/classes/org/omg/PortableServer/poa.idl * Wednesday, March 28, 2018 3:39:58 PM PDT */ /** * This policy specifies how requests are processed by * the created POA. The default is * USE_ACTIVE_OBJECT_MAP_ONLY. */ public interface RequestProcessingPolicyOperations extends org.omg.CORBA.PolicyOperations { /** * specifies the policy value */ org.omg.PortableServer.RequestProcessingPolicyValue value (); } // interface RequestProcessingPolicyOperations
dd0ab8e874a315383a815215c82edb8ce930dbf5
774d36285e48bd429017b6901a59b8e3a51d6add
/sources/com/google/android/gms/common/api/internal/zabe.java
df80977385790c4496a1e51b3aec47af9638ffc4
[]
no_license
jorge-luque/hb
83c086851a409e7e476298ffdf6ba0c8d06911db
b467a9af24164f7561057e5bcd19cdbc8647d2e5
refs/heads/master
2023-08-25T09:32:18.793176
2020-10-02T11:02:01
2020-10-02T11:02:01
300,586,541
0
0
null
null
null
null
UTF-8
Java
false
false
8,473
java
package com.google.android.gms.common.api.internal; import android.app.PendingIntent; import android.content.Context; import android.os.Bundle; import android.os.Looper; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GoogleApiAvailabilityLight; import com.google.android.gms.common.api.Api; import com.google.android.gms.common.api.Result; import com.google.android.gms.common.api.internal.BaseImplementation; import com.google.android.gms.common.internal.ClientSettings; import com.google.android.gms.signin.SignInOptions; import com.google.android.gms.signin.zad; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import javax.annotation.concurrent.GuardedBy; public final class zabe implements zabs, zar { private final Context mContext; private final Api.AbstractClientBuilder<? extends zad, SignInOptions> zace; final zaaw zaee; /* access modifiers changed from: private */ public final Lock zaeo; private final ClientSettings zaet; private final Map<Api<?>, Boolean> zaew; private final GoogleApiAvailabilityLight zaey; final Map<Api.AnyClientKey<?>, Api.Client> zagz; private final Condition zahn; private final zabg zaho; final Map<Api.AnyClientKey<?>, ConnectionResult> zahp = new HashMap(); /* access modifiers changed from: private */ public volatile zabd zahq; private ConnectionResult zahr = null; int zahs; final zabt zaht; public zabe(Context context, zaaw zaaw, Lock lock, Looper looper, GoogleApiAvailabilityLight googleApiAvailabilityLight, Map<Api.AnyClientKey<?>, Api.Client> map, ClientSettings clientSettings, Map<Api<?>, Boolean> map2, Api.AbstractClientBuilder<? extends zad, SignInOptions> abstractClientBuilder, ArrayList<zaq> arrayList, zabt zabt) { this.mContext = context; this.zaeo = lock; this.zaey = googleApiAvailabilityLight; this.zagz = map; this.zaet = clientSettings; this.zaew = map2; this.zace = abstractClientBuilder; this.zaee = zaaw; this.zaht = zabt; int size = arrayList.size(); int i = 0; while (i < size) { zaq zaq = arrayList.get(i); i++; zaq.zaa(this); } this.zaho = new zabg(this, looper); this.zahn = lock.newCondition(); this.zahq = new zaav(this); } @GuardedBy("mLock") public final ConnectionResult blockingConnect() { connect(); while (isConnecting()) { try { this.zahn.await(); } catch (InterruptedException unused) { Thread.currentThread().interrupt(); return new ConnectionResult(15, (PendingIntent) null); } } if (isConnected()) { return ConnectionResult.RESULT_SUCCESS; } ConnectionResult connectionResult = this.zahr; if (connectionResult != null) { return connectionResult; } return new ConnectionResult(13, (PendingIntent) null); } @GuardedBy("mLock") public final void connect() { this.zahq.connect(); } @GuardedBy("mLock") public final void disconnect() { if (this.zahq.disconnect()) { this.zahp.clear(); } } public final void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) { String concat = String.valueOf(str).concat(" "); printWriter.append(str).append("mState=").println(this.zahq); for (Api next : this.zaew.keySet()) { printWriter.append(str).append(next.getName()).println(":"); this.zagz.get(next.getClientKey()).dump(concat, fileDescriptor, printWriter, strArr); } } @GuardedBy("mLock") public final <A extends Api.AnyClient, R extends Result, T extends BaseImplementation.ApiMethodImpl<R, A>> T enqueue(T t) { t.zau(); return this.zahq.enqueue(t); } @GuardedBy("mLock") public final <A extends Api.AnyClient, T extends BaseImplementation.ApiMethodImpl<? extends Result, A>> T execute(T t) { t.zau(); return this.zahq.execute(t); } @GuardedBy("mLock") public final ConnectionResult getConnectionResult(Api<?> api) { Api.AnyClientKey<?> clientKey = api.getClientKey(); if (!this.zagz.containsKey(clientKey)) { return null; } if (this.zagz.get(clientKey).isConnected()) { return ConnectionResult.RESULT_SUCCESS; } if (this.zahp.containsKey(clientKey)) { return this.zahp.get(clientKey); } return null; } public final boolean isConnected() { return this.zahq instanceof zaah; } public final boolean isConnecting() { return this.zahq instanceof zaak; } public final boolean maybeSignIn(SignInConnectionListener signInConnectionListener) { return false; } public final void maybeSignOut() { } public final void onConnected(Bundle bundle) { this.zaeo.lock(); try { this.zahq.onConnected(bundle); } finally { this.zaeo.unlock(); } } public final void onConnectionSuspended(int i) { this.zaeo.lock(); try { this.zahq.onConnectionSuspended(i); } finally { this.zaeo.unlock(); } } public final void zaa(ConnectionResult connectionResult, Api<?> api, boolean z) { this.zaeo.lock(); try { this.zahq.zaa(connectionResult, api, z); } finally { this.zaeo.unlock(); } } /* access modifiers changed from: package-private */ public final void zaaz() { this.zaeo.lock(); try { this.zahq = new zaak(this, this.zaet, this.zaew, this.zaey, this.zace, this.zaeo, this.mContext); this.zahq.begin(); this.zahn.signalAll(); } finally { this.zaeo.unlock(); } } /* access modifiers changed from: package-private */ public final void zab(RuntimeException runtimeException) { this.zaho.sendMessage(this.zaho.obtainMessage(2, runtimeException)); } /* access modifiers changed from: package-private */ public final void zaba() { this.zaeo.lock(); try { this.zaee.zaaw(); this.zahq = new zaah(this); this.zahq.begin(); this.zahn.signalAll(); } finally { this.zaeo.unlock(); } } /* access modifiers changed from: package-private */ public final void zaf(ConnectionResult connectionResult) { this.zaeo.lock(); try { this.zahr = connectionResult; this.zahq = new zaav(this); this.zahq.begin(); this.zahn.signalAll(); } finally { this.zaeo.unlock(); } } @GuardedBy("mLock") public final void zaw() { if (isConnected()) { ((zaah) this.zahq).zaam(); } } /* access modifiers changed from: package-private */ public final void zaa(zabf zabf) { this.zaho.sendMessage(this.zaho.obtainMessage(1, zabf)); } @GuardedBy("mLock") public final ConnectionResult blockingConnect(long j, TimeUnit timeUnit) { connect(); long nanos = timeUnit.toNanos(j); while (isConnecting()) { if (nanos <= 0) { try { disconnect(); return new ConnectionResult(14, (PendingIntent) null); } catch (InterruptedException unused) { Thread.currentThread().interrupt(); return new ConnectionResult(15, (PendingIntent) null); } } else { nanos = this.zahn.awaitNanos(nanos); } } if (isConnected()) { return ConnectionResult.RESULT_SUCCESS; } ConnectionResult connectionResult = this.zahr; if (connectionResult != null) { return connectionResult; } return new ConnectionResult(13, (PendingIntent) null); } }