blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
listlengths 1
1
| author
stringlengths 0
161
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
79dde393d63260278714260cc79fb72fd3839dbb
|
6625de4d02febcdd9467fc64b8886fe423441118
|
/dawara/src/main/java/dev/mvc/categrp/CategrpProc.java
|
f456b70a3c99a6b28231b8bea754713d0acd5bee
|
[] |
no_license
|
youknow933/test
|
a4f822b948939953b70200c4c02beab8a7f93c3d
|
f5b521cafb32aeaee68a4837b5cc17e516c218aa
|
refs/heads/master
| 2020-03-12T03:48:02.780730 | 2019-03-23T02:26:35 | 2019-03-23T02:26:35 | 130,431,803 | 0 | 0 | null | null | null | null |
UHC
|
Java
| false | false | 1,708 |
java
|
package dev.mvc.categrp;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@Component("dev.mvc.categrp.CategrpProc")
public class CategrpProc implements CategrpProcInter {
@Autowired
@Qualifier("dev.mvc.categrp.CategrpDAO") // 할당되는 Class 객체의 이름
// @Qualifier("dev.mvc.categrp.CategrpDAO2016") // 할당되는 Class 객체의 이름
// @Qualifier("dev.mvc.categrp.CategrpDAO2017") // 할당되는 Class 객체의 이름
private CategrpDAOInter categrpDAO = null;
public CategrpProc() {
System.out.println("--> CategrpProc created.");
}
@Override
public int create(CategrpVO categrpVO) {
int count = categrpDAO.create(categrpVO);
return count;
}
@Override
public List<CategrpVO> list() {
List<CategrpVO> list = categrpDAO.list();
return list;
}
@Override
public int update(CategrpVO categrpVO) {
int count = categrpDAO.update(categrpVO);
return count;
}
@Override
public CategrpVO read(int grp_no) {
CategrpVO categrpVO = categrpDAO.read(grp_no);
return categrpVO;
}
@Override
public int delete(int grp_no) {
int count = categrpDAO.delete(grp_no);
return count;
}
@Override
public int update_seqno_up(int grp_no) {
int count = categrpDAO.update_seqno_up(grp_no);
return count;
}
@Override
public int update_seqno_down(int grp_no) {
int count = categrpDAO.update_seqno_down(grp_no);
return count;
}
}
|
[
"good@DESKTOP-RKBMVSE"
] |
good@DESKTOP-RKBMVSE
|
a67b93814c2131335e7f73616fbd75a2ded09a5d
|
f0dac03171d113413828dd220755b8efbb216a83
|
/TrendDetectionStreamflowBrazil/src/util/ST_pegarMaximoDiaMes.java
|
f113f978d1066f894cdc0ea74a6a1e0b65e65d5a
|
[
"CC0-1.0"
] |
permissive
|
sauloaires/software_codes-Trend-detection-in-annual-streamflow-extremes-in-Brazil
|
f7738bd7bc247ed35390410c826dd68e6df27f7c
|
6c67de23bb0f4b060c70527ccc37801f8f34b94d
|
refs/heads/main
| 2023-04-08T01:06:19.768027 | 2022-05-18T16:03:20 | 2022-05-18T16:03:20 | 491,789,566 | 0 | 0 |
CC0-1.0
| 2022-05-18T16:03:10 | 2022-05-13T06:53:51 |
Java
|
UTF-8
|
Java
| false | false | 543 |
java
|
package util;
import java.util.Calendar;
public class ST_pegarMaximoDiaMes {
public static int ndias(int year,int mes) {
// Calendar cal = (Calendar) Calendar.getInstance().clone();
//cal.set(Calendar.YEAR, year);
// cal.set(Calendar.MONTH, mes-1); // Fevereiro
// return cal.getActualMaximum(Calendar.DAY_OF_MONTH);
Calendar clStart = Calendar.getInstance();
clStart.set(year,mes-1,1);
return clStart.getActualMaximum(Calendar.DAY_OF_MONTH);
}
}
|
[
"[email protected]"
] | |
c1c20913368c6215d1b67f601fd14a00e8d4385f
|
be73270af6be0a811bca4f1710dc6a038e4a8fd2
|
/crash-reproduction-moho/results/XWIKI-14263-30-8-MOEAD-WeightedSum:TestLen:CallDiversity/org/xwiki/velocity/internal/DefaultVelocityEngine_ESTest_scaffolding.java
|
dfae28aeabfc99c87f0ada1b93ac4456b158d47e
|
[] |
no_license
|
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
|
cf118b23ecb87a8bf59643e42f7556b521d1f754
|
3bb39683f9c343b8ec94890a00b8f260d158dfe3
|
refs/heads/master
| 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 453 |
java
|
/**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu Apr 09 02:46:09 UTC 2020
*/
package org.xwiki.velocity.internal;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class DefaultVelocityEngine_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
|
[
"[email protected]"
] | |
23da9443355a1057a333a2065f61c4d78ec1d2d5
|
dfcb99fd9feb71da35182811ed5f32bf69cd2bbf
|
/src/simulations/electrical-simple-simulations/src/main/java/de/iwes/elsim/hmswitchbox/InternalRelay.java
|
416c356cad1a201869219ed0bb88d8a5a9bd4a45
|
[
"Apache-2.0"
] |
permissive
|
ogema/ogema-widgets
|
99d544d0ec6aebf68fd846fe2c08f5ac5dee7790
|
3adac6461c52555a42a4f1837267380adce293fb
|
refs/heads/public
| 2022-11-29T21:33:14.704989 | 2019-12-09T08:25:41 | 2019-12-09T08:25:41 | 124,270,200 | 0 | 1 |
Apache-2.0
| 2022-11-16T06:25:46 | 2018-03-07T17:23:28 |
JavaScript
|
UTF-8
|
Java
| false | false | 2,095 |
java
|
/**
* Copyright 2014-2018 Fraunhofer-Gesellschaft zur Förderung der angewandten Wissenschaften e.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Copyright 2009 - 2016
*
* Fraunhofer-Gesellschaft zur Förderung der angewandten Wissenschaften e.V.
*
* Fraunhofer IWES
*
* All Rights reserved
*/
/**
* Copyright 2009 - 2014
*
* Fraunhofer-Gesellschaft zur Förderung der angewandten Wissenschaften e.V.
*
* Fraunhofer IIS Fraunhofer ISE Fraunhofer IWES
*
* All Rights reserved
*/
package de.iwes.elsim.hmswitchbox;
import java.util.HashMap;
import java.util.Map;
import org.ogema.core.model.simple.BooleanResource;
import org.ogema.tools.simulation.service.api.model.SimulationComplexConfiguration;
public class InternalRelay implements SimulationComplexConfiguration {
private final BooleanResource stateFeedback;
@Override
public String getValue() {
return stateFeedback.getValue()?"true":"false";
}
@Override
public boolean setValue(String value) {
try {
boolean val = Boolean.parseBoolean(value);
return stateFeedback.setValue(val);
} catch(NumberFormatException e) {
return false;
}
}
public InternalRelay(BooleanResource stateFeedback) {
this.stateFeedback = stateFeedback;
}
@Override
public String getId() {
return "Set switchbox state";
}
@Override
public String getDescription() {
return "Set switchbox internal relay";
}
@Override
public Map<String,String> getOptions() {
Map<String, String> res = new HashMap<>();
res.put("true", "on");
res.put("false", "off");
return res;
}
}
|
[
"[email protected]"
] | |
eaabfcaea03e7dcc17e3a4f0d8420fd0c4dbb1e0
|
59e2daaef35900f1f2a1a22d4e28f871c532773a
|
/src/main/java/com/rdms/sys/service/impl/PageServiceImpl.java
|
fc15a31a0247e40580a53a181d718ec462729b2d
|
[] |
no_license
|
ZzzCrazyPig/rdms
|
ed4cb9dc44d4919fd51770e8d7c91a0b5ce6e234
|
4174ab9ca83f74711db82e3603d70a2921d32e8b
|
refs/heads/master
| 2021-01-01T08:55:48.819892 | 2015-08-19T15:28:52 | 2015-08-19T15:28:52 | 32,442,426 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 805 |
java
|
package com.rdms.sys.service.impl;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.rdms.base.service.impl.BaseServiceImpl;
import com.rdms.sys.dao.PageDao;
import com.rdms.sys.domain.Page;
import com.rdms.sys.service.PageService;
@Service("pageService")
public class PageServiceImpl extends BaseServiceImpl<Page> implements PageService {
private PageDao pageDao;
@Resource(name="pageDao")
public void setPageDao(PageDao pageDao) {
super.setBaseDAO(pageDao);
this.pageDao = pageDao;
}
public PageDao getPageDao() {
return pageDao;
}
public boolean isAvailable(String code) throws Exception {
return this.pageDao.isAvailable(code);
}
public Page findByCode(String code) throws Exception {
return this.pageDao.findByCode(code);
}
}
|
[
"[email protected]"
] | |
17f1735f324a77f834509878c4522920ea3e9f4c
|
d465bd0cb300e9fad836cbd40b517cde264b0c34
|
/src/com/zy/proposal/dao/ProposalTradeCustomDao.java
|
2bf75d2ed91723aa4f3a79101be6dbeaab28e980
|
[] |
no_license
|
wsw2008new/zy_proposal
|
5c6feaa1077d16bece93b0e039a1896ae3595c94
|
435ca5c5cbfebbcf4db98e73a52309b8a2960efa
|
refs/heads/master
| 2016-10-11T23:18:05.983075 | 2015-11-15T15:28:48 | 2015-11-15T15:28:48 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 312 |
java
|
package com.zy.proposal.dao;
import java.util.Map;
import com.zy.common.entity.PageModel;
import com.zy.proposal.entity.ProposalTrade;
public interface ProposalTradeCustomDao {
public PageModel<ProposalTrade> findPageModel(Map<String, Object> params, Integer currentPage, Integer pageSize);
}
|
[
"[email protected]"
] | |
37f54f19f3d0502b3a6fb062070ac3e2aec4e45e
|
6694ce55549dd09411ad506aed5b1813c1959e32
|
/mvn/goldilocks-domain/src/main/java/goldilocks/util/domain/LocalTimePeriod.java
|
49d18039dd5c7536dce9df2f9ee0259e424ad24e
|
[
"MIT"
] |
permissive
|
antonywilkins/goldilocks
|
f037557c33dde42ffdad9f16356591a9e2afa368
|
7997a74aeed668fdf525ca828e8c0a825fe6a270
|
refs/heads/master
| 2016-08-12T04:32:48.860850 | 2015-11-01T19:55:06 | 2015-11-01T19:55:06 | 45,301,278 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,146 |
java
|
package goldilocks.util.domain;
import java.io.Serializable;
import java.time.Duration;
import java.time.LocalTime;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Embeddable
public class LocalTimePeriod extends DomainTypeBase implements Serializable, Comparable<LocalTimePeriod> {
private static final long serialVersionUID = 1L;
@Column(nullable = false)
private LocalTime start;
@Column(nullable = false)
private LocalTime end;
public LocalTimePeriod() {
super();
}
public LocalTimePeriod(LocalTime start, LocalTime end) {
super();
this.start = start;
this.end = end;
}
@Override
public int compareTo(LocalTimePeriod o) {
int c = CompareUtil.compare(start, o.start);
if (c != 0) {
return c;
}
c = CompareUtil.compare(end, o.end);
return c;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
LocalTimePeriod other = (LocalTimePeriod) obj;
if (end == null) {
if (other.end != null) {
return false;
}
} else if (!end.equals(other.end)) {
return false;
}
if (start == null) {
if (other.start != null) {
return false;
}
} else if (!start.equals(other.start)) {
return false;
}
return true;
}
@JsonIgnore
public Duration getDuration() {
if (start == null || end == null) {
return Duration.ofDays(Long.MAX_VALUE);
}
return Duration.between(start, end);
}
public LocalTime getEnd() {
return end;
}
public LocalTime getStart() {
return start;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((end == null) ? 0 : end.hashCode());
result = prime * result + ((start == null) ? 0 : start.hashCode());
return result;
}
public void setEnd(LocalTime end) {
this.end = end;
}
public void setStart(LocalTime start) {
this.start = start;
}
@Override
public String toString() {
return String.format("LocalTimePeriod [start=%s, end=%s]", start, end);
}
}
|
[
"[email protected]"
] | |
9d708d8dc9d0c12b8a3716a277d1958835197ee2
|
a62fdd243ba79afefb8a3e9b62a95ca2905edf6a
|
/src/main/java/com/xml/agentback/model/Advertisement.java
|
14f162c9aa6455a54154b651b7f9248d3ee643ca
|
[] |
no_license
|
JelenaGaric/xml-agent-back
|
d6b5a1507afe366ee3b28b429c2fa89a02da9729
|
0f06cc507289bc0959fe37cb615c463bee485588
|
refs/heads/master
| 2022-11-21T18:30:25.900740 | 2020-06-20T20:36:50 | 2020-06-20T20:36:50 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 643 |
java
|
package com.xml.agentback.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
import java.util.Date;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Entity
public class Advertisement {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JoinColumn(name = "car_id", nullable = false) //zeza table name dont know why, tried everything
private Car car;
@Column
private Long advertiserId;
@Column
private Date startDate;
@Column
private Date endDate;
}
|
[
"[email protected]"
] | |
08910866209c26fed08d13ba5478a1b2158a6271
|
c6bebf190d9f87d6bc3973e89506340842a0a256
|
/app/src/test/java/com/example/saravanakumars/githubvcs/ExampleUnitTest.java
|
e054d9ad687c64d775bada8de6d68b958534feb5
|
[] |
no_license
|
Zaravana/GithubVCS
|
a5ded165de6654592069df3cef62eb8eef806035
|
dac490a36782e18b1301847dbb6dcd037cfe8bf5
|
refs/heads/master
| 2021-05-02T14:11:54.499348 | 2018-02-08T05:40:55 | 2018-02-08T05:40:55 | 120,715,803 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 414 |
java
|
package com.example.saravanakumars.githubvcs;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"[email protected]"
] | |
fef898c9a3d3d7c4d4db96c19fb88461e85cecee
|
01c121add9ca210cad84f2b4df1a8d1289bb49c3
|
/src/main/java/com/example/demo/config/SwaggerConfig.java
|
3c32d83581504cb6393aa1c83de18d15b1b2e8c7
|
[] |
no_license
|
DFClimate/demo
|
4ad19d0dbbe5396b18d9caecb46b496cb25f535e
|
c538d0d42020cdf01d2a98e6375cae4797047891
|
refs/heads/master
| 2022-11-17T22:13:19.795829 | 2020-07-14T07:22:45 | 2020-07-14T07:22:45 | 279,511,042 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,369 |
java
|
package com.example.demo.config;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("用户管理")
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.example.demo.controller"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("接口文档")
.description("demo")
.termsOfServiceUrl("http://localhost:8088/")
.version("1.0")
.build();
}
}
|
[
"[email protected]"
] | |
efa25b44d4dd9c36079d453cd867c9290e6bb87f
|
df7a589d95b4d8d3b18bc1f46a7159088895f354
|
/src/com/nhance/assignment/game/Main.java
|
216aabdb43a82f598f0a85eb9dfcb2cea42b77f5
|
[] |
no_license
|
poojadubey39/GameAPI
|
a8a1ab09cb3fdd246719dce72338d2e62f74ddf1
|
63cd06ba2449227201a0b21765cec4666ab847fa
|
refs/heads/master
| 2021-01-19T23:00:55.895795 | 2018-05-03T05:28:26 | 2018-05-03T05:28:26 | 101,260,477 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,872 |
java
|
package com.nhance.assignment.game;
import java.awt.Container;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import com.nhance.assignment.datastore.GameDetails;
public class Main {
private JFrame jFrame;
private Container container;
private JLabel userIdLabel;
private JLabel scoreLabel;
private JLabel gameResultLabel;
private JTextField scoreTxt;
private JTextField userIdTxt;
private JButton startBtn;
private JButton submitBtn;
private JTextArea resultArea;
private Game game;
public static void main(String[] args) throws Exception {
new Main().createUI();
}
private void createUI() {
jFrame = new JFrame();
userIdLabel = new JLabel("Enter User Id: ");
userIdLabel.setBounds(10, 10, 130, 25);
userIdTxt = new JTextField(10);
userIdTxt.setBounds(100, 10, 100, 25);
startBtn = new JButton("Start Game");
startBtn.setBounds(210, 10, 100, 25);
scoreLabel = new JLabel("Enter Score:");
scoreLabel.setBounds(10, 50, 130, 25);
scoreTxt = new JTextField(10);
scoreTxt.setBounds(100, 50, 100, 25);
submitBtn = new JButton("Submit");
submitBtn.setBounds(210, 50, 100, 25);
gameResultLabel = new JLabel("Next Game Info:");
gameResultLabel.setBounds(10, 85, 130, 25);
resultArea = new JTextArea();
resultArea.setBounds(10, 125, 300, 600);
resultArea.setLineWrap(true);
resultArea.setWrapStyleWord(true); // word wrapping enabled
submitBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
long gameScore = Long.parseLong(scoreTxt.getText());
scoreTxt.setText("");
try {
User user = game.submitScore(gameScore);
GameDetails currentGame = user.getCurrentGame();
double progressPercentage = user.getProgressPercentage();
long userScore = user.getScore();
if(currentGame != null ){
resultArea.append("Total Score: "+userScore+"\n\n");
resultArea.append("Progress % : "+progressPercentage+"\n\n");
resultArea.append("Next Game: "+currentGame+"\n"
+ "=====================================\n");
}else{
JOptionPane.showMessageDialog(jFrame,
"User has completed all the levels.", "INFO",
JOptionPane.INFORMATION_MESSAGE);
resultArea.setText("Final Score: "+userScore+"\n\n");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(jFrame, e.getMessage(),"ERROR",
JOptionPane.ERROR_MESSAGE);
}
}
});
startBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
int userID = Integer.parseInt(userIdTxt.getText());
game = Game.getInstance();
User user = game.startGame(userID);
userIdTxt.setEditable(false);
startBtn.setEnabled(false);
jFrame.setTitle("UserId : "+userID);
resultArea.append("Next Game: "+user.getCurrentGame()+"\n"
+ "=====================================\n");
}
});
jFrame.setResizable(false);
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
container = jFrame.getContentPane();
container.setLayout(null);
container.add(userIdLabel);
container.add(userIdTxt);
container.add(startBtn);
container.add(scoreLabel);
container.add(scoreTxt);
container.add(submitBtn);
container.add(gameResultLabel);
container.add(resultArea);
Insets insets = jFrame.getInsets();
jFrame.setSize(340 + insets.left + insets.right, 800 + insets.top + insets.bottom);
jFrame.setVisible(true);
}
}
|
[
"[email protected]"
] | |
5ec01c10fbd31e99e48d4051cc8dc4033a792d96
|
43420afbd7df9a42fde971c92e93984093180d50
|
/src/org/andengine/limbo/mesh/dynamic/xy/DynamicXYProviderStrip.java
|
56646c2e0422c7aa542ff8c8751b55a8a66fa9f2
|
[] |
no_license
|
lmsf/AndEngineLimbo
|
dc4eb04caaeaf1b6d0d5adcdf34ddef39402e1d0
|
573583bbb876550abd14c486ca8292552c29465c
|
refs/heads/master
| 2021-01-16T17:45:35.728185 | 2014-12-23T00:25:18 | 2014-12-23T00:25:18 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,582 |
java
|
package org.andengine.limbo.mesh.dynamic.xy;
public class DynamicXYProviderStrip extends DynamicXYProvider {
// ===========================================================
// Constants
// ===========================================================
public static final int VERTICES_STEP = 2;
public static final int MINIMUM_VERTICES = 4;
// ===========================================================
// Fields
// ===========================================================
protected float mLength;
protected float mHeight;
protected float mCalculatedLengthEven;
protected float mCalculatedLengthOdd;
// ===========================================================
// Constructors
// ===========================================================
public DynamicXYProviderStrip(final float length, final float height, int pVertexCount) {
super(pVertexCount);
this.mLength = length;
this.mHeight = height;
if (pVertexCount %2 != 0) {
throw new RuntimeException("Strip must have even number of vertices!");
}
if (pVertexCount < MINIMUM_VERTICES) {
throw new RuntimeException("Strip must have at least " + MINIMUM_VERTICES + " vertices (" + pVertexCount + " were given)");
}
buildStrip(mLength, mHeight, getNumberOfVerticesMax());
}
// ===========================================================
// Getter & Setter
// ===========================================================
public float getLength() {
return mLength;
}
public float getHeight() {
return mHeight;
}
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void onUpdate(float pSecondsElapsed) {
//Log.e("onUpdate", "elapsed=" + pSecondsElapsed);
if (isDirty() || (mModifiers != null && !mModifiers.isEmpty())) {
calculateXY();
}
if (mModifiers != null) {
mModifiers.onUpdate(pSecondsElapsed);
}
}
@Override
public void calculateXY() {
if (mModifiers != null && !mModifiers.isEmpty()) {
buildStrip(mLength, mHeight, getNumberOfVerticesMax());
calculateLengths();
}
}
// ===========================================================
// Methods
// ===========================================================
protected void calculateLengths() {
int segments = getNumberOfVertices()/2 - 1;
mCalculatedLengthEven = 0;
mCalculatedLengthOdd = 0;
for (int i = 0; i < segments; i++) {
int even = i*VERTICES_STEP + 0;
int odd = even + 1;
mCalculatedLengthEven += calculateSegmenLength(even, even + VERTICES_STEP);
mCalculatedLengthOdd += calculateSegmenLength(odd, odd + VERTICES_STEP);
}
}
protected void buildStrip(float length, float height, int vertices) {
if (length == 0 || height == 0)
return;
int segments = vertices/2;
float segmentLength = length / (float)segments;
float x = -length/2;
float yEven = height/2;
float yOdd = -yEven;
mX.clear();
mY.clear();
mX.set(0, x);
mY.set(0, yEven);
mX.set(1, x);
mY.set(1, yOdd);
for (int i = 1; i < segments; i++) {
x = x + segmentLength;
int even = i*VERTICES_STEP + 0;
int odd = even + 1;
mX.set(even, x);
mY.set(even, yEven);
mX.set(odd, x);
mY.set(odd, yOdd);
}
}
public float getLengthEven() {
return mCalculatedLengthEven;
}
public float getLengthOdd() {
return mCalculatedLengthOdd;
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
|
[
"[email protected]"
] | |
388fa67649abfab4ccc14554c95e3c1bd17c4bb8
|
79abdf0ce4437a4dd1dc7970028588fe7ef280c6
|
/src/main/java/Utils/NumbericListUtils.java
|
fe91b010b29b49c77f2866dc8a1b5d75ce106b3d
|
[] |
no_license
|
gggho0806/WordTest
|
d790fdd2b6a654ad98ae113b57acd799ee776332
|
128ad5a0dca1fb2dfaa8f207fdb6d08c1712732a
|
refs/heads/master
| 2020-03-27T23:08:11.430567 | 2018-09-12T07:44:01 | 2018-09-12T07:44:01 | 147,294,032 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,329 |
java
|
package Utils;
import java.math.BigInteger;
import org.apache.poi.xwpf.usermodel.XWPFAbstractNum;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFNumbering;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAbstractNum;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTInd;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLvl;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STNumberFormat;
public class NumbericListUtils {
/**
* @param document
* @param stNumberFormat
* @param lvlTexts
* @param baseMarginLeft 每一層編號都往右移多少
* @param abstractNumId 摘要的編號
* @param start
* @return
*/
public static BigInteger addAbstractNum(XWPFDocument document, STNumberFormat.Enum stNumberFormat, String[] lvlTexts,
int baseMarginLeft, BigInteger abstractNumId, BigInteger start) {
//
CTAbstractNum ctAbstractNum = CTAbstractNum.Factory.newInstance();
/*
* 分成多個AbstractNum,要注意的是如果該編號可對應到存在的AbstractNum,
* 那之後的變動會對此AbstractNum造成影響,但不包括重置編號
*/
ctAbstractNum.setAbstractNumId(abstractNumId);
for(int i=0;i<lvlTexts.length;i++) {
// 建立每一層的樣式
String replace = "%"+(i+1);
String lvlPattern = lvlTexts[i].replace("{num}", replace);
// 取得層級
CTLvl ctLvl = getCTLvl(ctAbstractNum, i);
// 設定層級的編號
BigInteger lvlNum = BigInteger.valueOf(i);
ctLvl.setIlvl(lvlNum);
// 設定編號數字部分的樣式
ctLvl.addNewNumFmt().setVal(stNumberFormat);
// 設定整體編號樣式,像是%1、為一、二、...
ctLvl.addNewLvlText().setVal(lvlPattern);
// 設定起始編號
ctLvl.addNewStart().setVal(start);
// 設定編號與左邊的邊距
CTPPr ppr = getCTLvlCTPPr(ctLvl);
CTInd ind = getCTPPrCTInd(ppr);
BigInteger marginLeft = BigInteger.valueOf(i * baseMarginLeft);
ind.setLeft(marginLeft);
}
// 將編號設定加入word
XWPFAbstractNum abstractNum = new XWPFAbstractNum(ctAbstractNum);
XWPFNumbering numbering = getXWPFNumbering(document);
// 取得編號設定的起始號碼,每當paragraph加入此號碼,會自動往上加1
BigInteger abstractNumID = numbering.addAbstractNum(abstractNum);
BigInteger numID = numbering.addNum(abstractNumID);
return numID;
}
public static CTInd getCTPPrCTInd(CTPPr ppr) {
CTInd ind = ppr.isSetInd() ? ppr.getInd() : ppr.addNewInd();
return ind;
}
public static CTPPr getCTLvlCTPPr(CTLvl ctLvl) {
CTPPr ppr = ctLvl.getPPr() == null ? ctLvl.addNewPPr() : ctLvl.getPPr();
return ppr;
}
public static CTLvl getCTLvl(CTAbstractNum ctAbstractNum, int index) {
CTLvl ctLvl = ctAbstractNum.getLvlList().size()<=index?ctAbstractNum.addNewLvl() : ctAbstractNum.getLvlArray(index);
return ctLvl;
}
public static XWPFNumbering getXWPFNumbering(XWPFDocument document) {
XWPFNumbering numbering = null;
if (document.getNumbering() == null) {
numbering = document.createNumbering();
} else {
numbering = document.getNumbering();
}
return numbering;
}
}
|
[
"[email protected]"
] | |
80b6dcdc7d8f248a39ef101385ea6c65f0fef640
|
863abb993d321d4d24510209dc59eeaed6056f08
|
/src/pages/SearchProduct.java
|
20c8e47fc034bfa55575aa54d2022844d877336d
|
[] |
no_license
|
virgosolramazan/AmazonTestProject
|
5aeab0dcf098ce0ea864d89f9a2e4d668be742f2
|
82043747ad07dfa838f5982f52d52023259d8b38
|
refs/heads/master
| 2023-02-22T18:04:06.905821 | 2021-01-25T15:16:46 | 2021-01-25T15:16:46 | 332,700,886 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,354 |
java
|
package pages;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class SearchProduct {
WebDriver driver;
public SearchProduct(WebDriver driver){
this.driver = driver;
}
By search_input = By.id("twotabsearchtextbox");
By search_btn = By.id("nav-search-submit-button");
By sort_btn = By.xpath("//*[@id=\"search\"]/span/div/span/h1/div/div[2]/div/div/form/span");
By select_sort_btn = By.xpath("//*[@id=\"s-result-sort-select_1\"]");
public void search(String searchText){
driver.findElement(search_input).sendKeys(searchText);
}
public void clickSearchBtn(Boolean ClickMethod){
if(ClickMethod){
driver.findElement(search_btn).click();
}
else if(!ClickMethod){
driver.findElement(search_btn).sendKeys(Keys.RETURN);
}
}
public void sort(){
driver.findElement(sort_btn).click();
}
public void select_sort(){
WebDriverWait wait = new WebDriverWait(driver,60);
wait.until(ExpectedConditions.visibilityOfElementLocated(select_sort_btn));
driver.findElement(select_sort_btn).click();
}
}
|
[
"[email protected]"
] | |
71788c8c24d6805b1e5547c1a1c38e148918a543
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/3/3_70fd506d82c8debe4fe0124d9db81666f4986336/ExchangeMetricWriter/3_70fd506d82c8debe4fe0124d9db81666f4986336_ExchangeMetricWriter_t.java
|
2e00fdbce22e6fa0cd20b84918b275761f22e8b9
|
[] |
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 | 21,873 |
java
|
package com.trendmicro.tme.portal;
import java.io.File;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.MimeMessage;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.openmbean.CompositeData;
import javax.management.remote.JMXConnector;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.protobuf.TextFormat;
import com.googlecode.jmxtrans.model.Query;
import com.googlecode.jmxtrans.model.Result;
import com.googlecode.jmxtrans.model.output.RRDToolWriter;
import com.googlecode.jmxtrans.util.BaseOutputWriter;
import com.googlecode.jmxtrans.util.LifecycleException;
import com.googlecode.jmxtrans.util.ValidationException;
import com.sun.messaging.AdminConnectionConfiguration;
import com.sun.messaging.AdminConnectionFactory;
import com.trendmicro.codi.CachedZNode;
import com.trendmicro.codi.ZNode;
import com.trendmicro.tme.mfr.Exchange;
import com.trendmicro.tme.mfr.ExchangeFarm;
import com.trendmicro.mist.proto.ZooKeeperInfo;
public class ExchangeMetricWriter extends BaseOutputWriter {
static class Record {
private long msgIn = 0;
private long msgOut = 0;
private long msgInSize = 0;
private long msgOutSize = 0;
private long msgDrop = 0;
private long timestamp = 0;
public long getMsgIn() {
return msgIn;
}
public void setMsgIn(long msgIn) {
this.msgIn = msgIn;
}
public long getMsgOut() {
return msgOut;
}
public void setMsgOut(long msgOut) {
this.msgOut = msgOut;
}
public long getMsgDrop() {
return msgDrop;
}
public void setMsgDrop(long msgDrop) {
this.msgDrop = msgDrop;
}
public long getMsgInSize() {
return msgInSize;
}
public void setMsgInSize(long msgInSize) {
this.msgInSize = msgInSize;
}
public long getMsgOutSize() {
return msgOutSize;
}
public void setMsgOutSize(long msgOutSize) {
this.msgOutSize = msgOutSize;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
}
static class Config {
private String limitBehavior;
private long maxNumMsgs;
private long maxTotalMsgBytes;
public String getLimitBehavior() {
return limitBehavior;
}
public void setLimitBehavior(String limitBehavior) {
this.limitBehavior = limitBehavior;
}
public long getMaxNumMsgs() {
return maxNumMsgs;
}
public void setMaxNumMsgs(long maxNumMsgs) {
this.maxNumMsgs = maxNumMsgs;
}
public long getMaxTotalMsgBytes() {
return maxTotalMsgBytes;
}
public void setMaxTotalMsgBytes(long maxTotalMsgBytes) {
this.maxTotalMsgBytes = maxTotalMsgBytes;
}
}
private static final Logger logger = LoggerFactory.getLogger(ExchangeMetricWriter.class);
private static final String[] MBEAN_INVOKE_SIG = new String[] {
String.class.getName()
};
private static final ObjectName consumerManagerName;
private static final ObjectName producerManagerName;
private String templateFile = "";
private String outputPath = "";
private Pattern namePattern = Pattern.compile(".*,name=\"([^\"]*)\",.*");
private Pattern typePattern = Pattern.compile(".*desttype=(.),.*");
private Pattern configPattern = Pattern.compile(".*,subtype=Config,.*");
private ObjectMapper mapper = new ObjectMapper();
private HashMap<String, Record> lastRecords = new HashMap<String, Record>();
private HashMap<String, Config> lastConfigs = new HashMap<String, Config>();
private HashMap<String, Long> lastAlertTs = new HashMap<String, Long>();
private Map<String, RRDToolWriter> writerMap = new HashMap<String, RRDToolWriter>();
private int alertIntervalSec;
private CachedZNode smtpNode;
private CachedZNode fromNode;
private CachedZNode receiverNode;
private ExchangeFarm exchangeFarm = new ExchangeFarm();
static {
try {
consumerManagerName = new ObjectName("com.sun.messaging.jms.server:type=ConsumerManager,subtype=Monitor");
producerManagerName = new ObjectName("com.sun.messaging.jms.server:type=ProducerManager,subtype=Monitor");
}
catch(Exception e) {
throw new RuntimeException(e);
}
}
public ExchangeMetricWriter(int alertIntervalSec) {
this.alertIntervalSec = alertIntervalSec;
smtpNode = new CachedZNode("/global/mail_smtp", 5000);
fromNode = new CachedZNode("/global/mail_sender", 5000);
receiverNode = new CachedZNode("/global/mail_alert", 5000);
}
private RRDToolWriter getWriter(String broker, String exchangeName, boolean isQueue) throws LifecycleException {
String key = broker + exchangeName + (isQueue ? "queue": "topic");
if(!writerMap.containsKey(key)) {
RRDToolWriter writer = new RRDToolWriter();
writer.addSetting(RRDToolWriter.TEMPLATE_FILE, templateFile);
writer.addSetting(RRDToolWriter.OUTPUT_FILE, String.format("%s/%s-%s.rrd", outputPath, isQueue ? "queue": "topic", exchangeName));
writer.addSetting(RRDToolWriter.BINARY_PATH, "/usr/bin");
writer.addSetting(RRDToolWriter.DEBUG, true);
writer.addSetting(RRDToolWriter.GENERATE, false);
writerMap.put(key, writer);
}
return writerMap.get(key);
}
private void queryClients(String broker, String typeName, ExchangeMetric metric) throws Exception {
JMXConnector connector;
MBeanServerConnection connection;
AdminConnectionFactory acf;
acf = new AdminConnectionFactory();
acf.setProperty(AdminConnectionConfiguration.imqAddress, broker);
connector = acf.createConnection();
try {
connection = connector.getMBeanServerConnection();
ObjectName exchangeManagerName = new ObjectName("com.sun.messaging.jms.server:" + typeName);
String[] consumerIDs = (String[]) connection.invoke(exchangeManagerName, "getConsumerIDs", null, null);
if(consumerIDs != null) {
for(String consumerID : consumerIDs) {
if(consumerID != null) {
try {
CompositeData info = (CompositeData) connection.invoke(consumerManagerName, "getConsumerInfoByID", new Object[] {
consumerID
}, MBEAN_INVOKE_SIG);
if(info != null) {
metric.addConsumer(info.get("Host").toString());
}
}
catch(Exception e) {
logger.warn("cannot get info of consumer ID {}", consumerID);
}
}
}
}
String[] producerIDs = (String[]) connection.invoke(exchangeManagerName, "getProducerIDs", null, null);
if(producerIDs != null) {
for(String producerID : producerIDs) {
if(producerID != null) {
try {
CompositeData info = (CompositeData) connection.invoke(producerManagerName, "getProducerInfoByID", new Object[] {
producerID
}, MBEAN_INVOKE_SIG);
if(info != null) {
metric.addProducer(info.get("Host").toString());
}
}
catch(Exception e) {
logger.warn("cannot get info of producer ID {}", producerID);
}
}
}
}
}
finally {
connector.close();
}
}
private void storeExchangeConfig(String exchangeName, Query q) {
if(!lastConfigs.containsKey(exchangeName)) {
lastConfigs.put(exchangeName, new Config());
}
Config c = lastConfigs.get(exchangeName);
for(Result res : q.getResults()) {
if(res.getAttributeName().equals("LimitBehavior")) {
c.setLimitBehavior(res.getValues().get("LimitBehavior").toString());
}
else if(res.getAttributeName().equals("MaxTotalMsgBytes")) {
c.setMaxTotalMsgBytes((Long) res.getValues().get("MaxTotalMsgBytes"));
}
else if(res.getAttributeName().equals("MaxNumMsgs")) {
c.setMaxNumMsgs((Long) res.getValues().get("MaxNumMsgs"));
}
}
}
private void alert(String exchangeName, ExchangeMetric metric) {
if(!lastAlertTs.containsKey(exchangeName)) {
lastAlertTs.put(exchangeName, System.currentTimeMillis());
return;
}
if(System.currentTimeMillis() - lastAlertTs.get(exchangeName) > alertIntervalSec * 1000) {
lastAlertTs.put(exchangeName, System.currentTimeMillis());
String subject = String.format("[Alert] Exchange %s has not been consumed", exchangeName);
logger.warn(subject);
try {
if(!smtpNode.exists()) {
return;
}
String receiverStr = receiverNode.getContentString();
ZNode limitNode = new ZNode("/global/alert_limit_exchange/" + exchangeName);
if(limitNode.exists()) {
ZooKeeperInfo.AlertConfig.Builder alertBuilder = ZooKeeperInfo.AlertConfig.newBuilder();
TextFormat.merge(limitNode.getContentString(), alertBuilder);
ZooKeeperInfo.AlertConfig alertConfig = alertBuilder.build();
if(!(Long.valueOf(metric.getMetrics().get("Pending")) > Long.valueOf(alertConfig.getCount()))) {
return;
}
if(!alertConfig.getReceiver().isEmpty()) {
receiverStr = alertConfig.getReceiver();
}
}
Properties mailProps = new Properties();
mailProps.put("mail.smtp.host", smtpNode.getContentString());
mailProps.put("mail.from", fromNode.getContentString());
Session mailSession = Session.getInstance(mailProps, null);
StringBuilder msgBuilder = new StringBuilder();
msgBuilder.append(String.format("[Alert] Exchange %s has not been consumed:\n\n", exchangeName));
msgBuilder.append(String.format("Pending: %s / %s\n", metric.getMetrics().get("Pending"), metric.getMetrics().get("Max Pending")));
msgBuilder.append(String.format("Pending for ACK: %s\n", metric.getMetrics().get("Pending ACK")));
msgBuilder.append(String.format("Pending Size: %s / %s\n", metric.getMetrics().get("Pending Size"), metric.getMetrics().get("Max Pending Size")));
msgBuilder.append(String.format("Consumer: %s, Producer: %s", metric.getMetrics().get("Consumers"), metric.getMetrics().get("Producers")));
for(String receiver : receiverStr.split(";")) {
MimeMessage mail = new MimeMessage(mailSession);
mail.setFrom();
mail.setRecipients(Message.RecipientType.TO, receiver);
mail.setSubject(subject);
mail.setSentDate(new Date());
mail.setText(msgBuilder.toString());
Transport.send(mail);
}
}
catch(Exception e) {
logger.error(e.getMessage(), e);
return;
}
}
}
@Override
public void doWrite(Query q) throws Exception {
if(q.getResults().isEmpty()) {
logger.error("Empty query result!");
return;
}
Matcher m = namePattern.matcher(q.getResults().get(0).getTypeName());
if(!m.matches()) {
logger.error("Name parsing error: {}", q.getResults().get(0).getTypeName());
return;
}
String exchangeName = m.group(1);
if(exchangeName.equals("mq.sys.dmq")) {
return;
}
String currentBroker = exchangeFarm.getCurrentExchangeHost(new Exchange(exchangeName));
if(!q.getServer().getHost().equals(currentBroker)){
logger.warn(String.format("current broker of %s is %s instead of %s, ignore", exchangeName, currentBroker, q.getServer().getHost()));
return;
}
if(configPattern.matcher(q.getResults().get(0).getTypeName()).matches()) {
storeExchangeConfig(exchangeName, q);
return;
}
m = typePattern.matcher(q.getResults().get(0).getTypeName());
if(!m.matches()) {
logger.error("Type parsing error: {}", q.getResults().get(0).getTypeName());
return;
}
boolean isQueue = m.group(1).equals("q");
RRDToolWriter writer = getWriter(q.getServer().getHost(), exchangeName, isQueue);
ExchangeMetric metric = new ExchangeMetric(q.getServer().getHost(), isQueue ? "queue": "topic", exchangeName, String.format("%s/%s-%s.rrd", outputPath, isQueue ? "queue": "topic", exchangeName));
try {
queryClients(q.getServer().getHost(), q.getResults().get(0).getTypeName(), metric);
}
catch(Exception e) {
logger.error("Cannot obtain consumer and producer information for exchange {} on broker {}", q.getServer().getHost(), exchangeName);
logger.error(e.getMessage(), e);
}
Record lastRecord = lastRecords.get(exchangeName);
long timestamp = System.currentTimeMillis();
long numMsgs = 0;
long totalMsgBytes = 0;
long numMsgsIn = 0;
long numMsgsOut = 0;
long lastConsumed = 0;
long lastProduced = 0;
long lastConsumedSize = 0;
long lastProducedSize = 0;
Record currentRecord = new Record();
currentRecord.setTimestamp(timestamp);
for(Result res : q.getResults()) {
if(res.getAttributeName().equals("NumMsgs")) {
numMsgs = (Long) res.getValues().get("NumMsgs");
metric.addMetric("Pending", res.getValues().get("NumMsgs").toString());
}
else if(res.getAttributeName().equals("NumMsgsIn")) {
numMsgsIn = (Long) res.getValues().get("NumMsgsIn");
metric.addMetric("Enqueue", res.getValues().get("NumMsgsIn").toString());
if(lastRecord == null || lastRecord.getMsgIn() > numMsgsIn) {
res.addValue("NumMsgsIn", "0");
}
else {
lastProduced = numMsgsIn - lastRecord.getMsgIn();
res.addValue("NumMsgsIn", String.valueOf((long) ((float) lastProduced / (timestamp - lastRecord.getTimestamp()) * 1000)));
}
metric.addMetric("Last Enqueue", Long.toString(lastProduced));
currentRecord.setMsgIn(numMsgsIn);
}
else if(res.getAttributeName().equals("NumMsgsOut")) {
numMsgsOut = (Long) res.getValues().get("NumMsgsOut");
metric.addMetric("Dequeue", res.getValues().get("NumMsgsOut").toString());
if(lastRecord == null || lastRecord.getMsgOut() > numMsgsOut) {
res.addValue("NumMsgsOut", "0");
}
else {
lastConsumed = numMsgsOut - lastRecord.getMsgOut();
res.addValue("NumMsgsOut", String.valueOf((long) ((float) lastConsumed / (timestamp - lastRecord.getTimestamp()) * 1000)));
}
metric.addMetric("Last Dequeue", Long.toString(lastConsumed));
currentRecord.setMsgOut(numMsgsOut);
}
else if(res.getAttributeName().equals("NumMsgsPendingAcks")) {
metric.addMetric("Pending ACK", res.getValues().get("NumMsgsPendingAcks").toString());
}
else if(res.getAttributeName().equals("NumConsumers")) {
metric.addMetric("Consumers", res.getValues().get("NumConsumers").toString());
}
else if(res.getAttributeName().equals("NumProducers")) {
metric.addMetric("Producers", res.getValues().get("NumProducers").toString());
}
else if(res.getAttributeName().equals("MsgBytesIn")) {
long numMsgsInSize = (Long) res.getValues().get("MsgBytesIn");
metric.addMetric("Enqueue Size", res.getValues().get("MsgBytesIn").toString());
if(lastRecord == null || lastRecord.getMsgInSize() > numMsgsInSize) {
res.addValue("MsgBytesIn", "0");
}
else {
lastProducedSize = numMsgsInSize - lastRecord.getMsgInSize();
res.addValue("MsgBytesIn", String.valueOf((long) ((float) lastProducedSize / (timestamp - lastRecord.getTimestamp()) * 1000)));
}
metric.addMetric("Last Enqueue Size", Long.toString(lastProducedSize));
currentRecord.setMsgInSize(numMsgsInSize);
}
else if(res.getAttributeName().equals("MsgBytesOut")) {
long numMsgsOutSize = (Long) res.getValues().get("MsgBytesOut");
metric.addMetric("Dequeue Size", res.getValues().get("MsgBytesOut").toString());
if(lastRecord == null || lastRecord.getMsgOutSize() > numMsgsOutSize) {
res.addValue("MsgBytesOut", "0");
}
else {
lastConsumedSize = numMsgsOutSize - lastRecord.getMsgOutSize();
res.addValue("MsgBytesOut", String.valueOf((long) ((float) lastConsumedSize / (timestamp - lastRecord.getTimestamp()) * 1000)));
}
metric.addMetric("Last Dequeue Size", Long.toString(lastConsumedSize));
currentRecord.setMsgOutSize(numMsgsOutSize);
}
else if(res.getAttributeName().equals("TotalMsgBytes")) {
totalMsgBytes = (Long) res.getValues().get("TotalMsgBytes");
metric.addMetric("Pending Size", Long.toString(totalMsgBytes));
}
}
Config c = lastConfigs.get(exchangeName);
if(c != null) {
metric.addMetric("Limit Behavior", c.getLimitBehavior());
metric.addMetric("Max Pending", Long.toString(c.getMaxNumMsgs()));
metric.addMetric("Max Pending Size", Long.toString(c.getMaxTotalMsgBytes()));
}
if(numMsgs > 0 && lastConsumed == 0) {
alert(exchangeName, metric);
}
else {
lastAlertTs.remove(exchangeName);
}
long numMsgsDropped = numMsgsIn - numMsgsOut - numMsgs;
metric.addMetric("Dropped", String.valueOf(numMsgsDropped));
if(lastRecord == null || lastRecord.getMsgDrop() > numMsgsDropped) {
q.getResults().get(0).addValue("NumMsgDropped", "0");
}
else {
q.getResults().get(0).addValue("NumMsgDropped", String.valueOf((long) ((float) (numMsgsDropped - lastRecord.getMsgDrop()) / (timestamp - lastRecord.getTimestamp()) * 1000)));
}
currentRecord.setMsgDrop(numMsgsDropped);
lastRecords.put(exchangeName, currentRecord);
writer.validateSetup(q);
writer.doWrite(q);
File file = new File(String.format("%s/%s-%s.json", outputPath, isQueue ? "queue": "topic", exchangeName));
FileChannel channel = new RandomAccessFile(file, "rw").getChannel();
try {
FileLock lock = channel.lock();
try {
mapper.writeValue(file, metric);
}
catch(Exception e) {
logger.error("write metric error: ", e);
}
lock.release();
}
catch(Exception e) {
logger.error("Cannot lock file {}", file.getAbsolutePath());
}
finally {
channel.close();
}
}
@Override
public void validateSetup(Query q) throws ValidationException {
try {
templateFile = (String) getSettings().get("templateFile");
outputPath = (String) getSettings().get("outputPath");
}
catch(Exception e) {
throw new ValidationException(e.getMessage(), q);
}
}
}
|
[
"[email protected]"
] | |
1bd6d1bd9ea24c113e78d9aecd3357b7336edea2
|
0ae1e98f99eed0eee07a6459b33eca34983cf5f3
|
/app/src/main/java/com/jm/newvista/mvp/view/TopSellingView.java
|
2dfe26ea08b9c5b776b6b061987aca03a1e5abd2
|
[
"MIT"
] |
permissive
|
RanjitPati/NewVista-for-Customer
|
6a228faee6313bdf49ca5232c060f94e0bd37268
|
3558d7b3d590dbc33527df88c1fd291d45d68dfb
|
refs/heads/master
| 2021-09-17T03:31:31.200642 | 2018-06-27T09:27:20 | 2018-06-27T09:27:20 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 307 |
java
|
package com.jm.newvista.mvp.view;
import com.jm.newvista.mvp.base.BaseView;
import com.jm.newvista.ui.adapter.TopSellingRecyclerViewAdapter;
public interface TopSellingView extends BaseView {
TopSellingRecyclerViewAdapter onGetTopSellingRecyclerViewAdapter();
void onMakeToast(String message);
}
|
[
"[email protected]"
] | |
ca60b3d6ad3dcc200be684fbb6d6cbd7b9b57ede
|
f1be7c4ba9291368667bed8f17ce9f004e757821
|
/src/info/model/InfoContent.java
|
0edcfb2864dfb28d8f7bca36fa4d5ab9cb5e1854
|
[] |
no_license
|
wkdalswn11/myproject
|
5d0f6d9fcea36c1dfc7d2b576b9a86d5c76d4371
|
5cf6b42e5eb4f59b8b8babd30863b038b6e2bb4e
|
refs/heads/master
| 2023-03-06T23:26:47.246279 | 2021-02-01T05:59:13 | 2021-02-01T05:59:13 | 334,842,243 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 331 |
java
|
package info.model;
public class InfoContent {
private Integer number;
private String content;
public InfoContent(Integer number, String content) {
super();
this.number = number;
this.content = content;
}
public Integer getNumber() {
return number;
}
public String getContent() {
return content;
}
}
|
[
"[email protected]"
] | |
648ba44d77a87183d3f76d7824e3f9c7eea9feb4
|
1301830aa1c09e8a0b18d86e4d466ff031e1dcac
|
/ProjetosWeb/jpa_hibernate/financas/src/br/com/caelum/financas/teste/TesteJPARelacionamento.java
|
6c4956e40aea78405fb81b633791b9866e2ff6a8
|
[] |
no_license
|
gustavoclay/JavaStudy
|
4aa7912bdd67a84407d59e7a60d236318db53369
|
6e29e4e8be1559c34134bc8e0be3ca473c90a490
|
refs/heads/master
| 2020-03-28T12:40:54.274475 | 2018-10-23T14:11:33 | 2018-10-23T14:11:33 | 148,323,189 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 957 |
java
|
package br.com.caelum.financas.teste;
import java.math.BigDecimal;
import java.util.Calendar;
import javax.persistence.EntityManager;
import br.com.caelum.financas.modelo.Conta;
import br.com.caelum.financas.modelo.Movimentacao;
import br.com.caelum.financas.modelo.TipoMovimentacao;
import br.com.caelum.financas.util.JPAUtil;
public class TesteJPARelacionamento {
public static void main(String[] args) {
Conta conta = new Conta();
conta.setAgencia("0102");
conta.setBanco("Itau");
conta.setNumero("1234");
conta.setTitular("Leonardo");
Movimentacao mov = new Movimentacao();
mov.setConta(conta);
mov.setData(Calendar.getInstance());
mov.setDescricao("Churrascaria");
mov.setTipo(TipoMovimentacao.SAIDA);
mov.setValor(new BigDecimal("200.00"));
EntityManager em = new JPAUtil().getEntityManager();
em.getTransaction().begin();
em.persist(conta);
em.persist(mov);
em.getTransaction().commit();
em.close();
}
}
|
[
"[email protected]"
] | |
008b8a2ef1361b01b6c934e2ebc8b821435d3788
|
165ac3ec05107d09f7ac066106ce0c4db4d95977
|
/CBMetricsJPA/src/main/java/dev/richardnewman/cbmetrics/entities/Product.java
|
9d0da8df436d7e0ac01ac6111947f03a944c6fd7
|
[] |
no_license
|
richardanewman/CBMetrics
|
9c8c9aade29add56efeedde297a3743f6449eb08
|
c4a2ca41ed940b890175ad31d262a94aa31b9965
|
refs/heads/master
| 2022-06-22T21:33:04.011966 | 2020-02-24T07:48:44 | 2020-02-24T07:48:44 | 242,061,307 | 0 | 0 | null | 2022-04-29T06:07:11 | 2020-02-21T05:24:59 |
Java
|
UTF-8
|
Java
| false | false | 9,506 |
java
|
package dev.richardnewman.cbmetrics.entities;
import java.time.LocalDate;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
@Entity
public class Product {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
@Column(name="cb_id")
private String cbID;
@Column(name="popularity_rank")
private int popularityRank;
private String title;
private String description;
@Column(name="has_recurring_products")
private boolean hasRecurringProducts;
private double gravity;
@Column(name="percent_per_sale")
private double percentPerSale;
@Column(name="percent_per_rebill")
private double percentPerRebill;
@Column(name="average_earnings_per_sale")
private double avgEarningsPerSale;
@Column(name="initial_earnings_per_sale")
private double initialEarningsPerSale;
@Column(name="total_rebill_amt")
private double totalRebillAmt;
private double referred;
private int commission;
@Column(name="active_date")
private LocalDate activeDate;
@LazyCollection(LazyCollectionOption.FALSE)
@ManyToMany(cascade = { CascadeType.PERSIST}, mappedBy="products")
private List<Category> categories;
public Product(int id, String cbID, int popularityRank, String title, String description,
boolean hasRecurringProducts, double gravity, double percentPerSale, double percentPerRebill,
double avgEarningsPerSale, double initialEarningsPerSale, double totalRebillAmt, double referred,
int commission, LocalDate activeDate, List<Category> categories) {
super();
this.id = id;
this.cbID = cbID;
this.popularityRank = popularityRank;
this.title = title;
this.description = description;
this.hasRecurringProducts = hasRecurringProducts;
this.gravity = gravity;
this.percentPerSale = percentPerSale;
this.percentPerRebill = percentPerRebill;
this.avgEarningsPerSale = avgEarningsPerSale;
this.initialEarningsPerSale = initialEarningsPerSale;
this.totalRebillAmt = totalRebillAmt;
this.referred = referred;
this.commission = commission;
this.activeDate = activeDate;
this.categories = categories;
}
public Product() {
super();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCbID() {
return cbID;
}
public void setCbID(String cbID) {
this.cbID = cbID;
}
public int getPopularityRank() {
return popularityRank;
}
public void setPopularityRank(int popularityRank) {
this.popularityRank = popularityRank;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isHasRecurringProducts() {
return hasRecurringProducts;
}
public void setHasRecurringProducts(boolean hasRecurringProducts) {
this.hasRecurringProducts = hasRecurringProducts;
}
public double getGravity() {
return gravity;
}
public void setGravity(double gravity) {
this.gravity = gravity;
}
public double getPercentPerSale() {
return percentPerSale;
}
public void setPercentPerSale(double percentPerSale) {
this.percentPerSale = percentPerSale;
}
public double getPercentPerRebill() {
return percentPerRebill;
}
public void setPercentPerRebill(double percentPerRebill) {
this.percentPerRebill = percentPerRebill;
}
public double getAvgEarningsPerSale() {
return avgEarningsPerSale;
}
public void setAvgEarningsPerSale(double avgEarningsPerSale) {
this.avgEarningsPerSale = avgEarningsPerSale;
}
public double getInitialEarningsPerSale() {
return initialEarningsPerSale;
}
public void setInitialEarningsPerSale(double initialEarningsPerSale) {
this.initialEarningsPerSale = initialEarningsPerSale;
}
public double getTotalRebillAmt() {
return totalRebillAmt;
}
public void setTotalRebillAmt(double totalRebillAmt) {
this.totalRebillAmt = totalRebillAmt;
}
public double getReferred() {
return referred;
}
public void setReferred(double referred) {
this.referred = referred;
}
public int getCommission() {
return commission;
}
public void setCommission(int commission) {
this.commission = commission;
}
public LocalDate getActiveDate() {
return activeDate;
}
public void setActiveDate(LocalDate activeDate) {
this.activeDate = activeDate;
}
public List<Category> getCategories() {
return categories;
}
public void setCategories(List<Category> categories) {
this.categories = categories;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Product [id=");
builder.append(id);
builder.append(", cbID=");
builder.append(cbID);
builder.append(", popularityRank=");
builder.append(popularityRank);
builder.append(", title=");
builder.append(title);
builder.append(", description=");
builder.append(description);
builder.append(", hasRecurringProducts=");
builder.append(hasRecurringProducts);
builder.append(", gravity=");
builder.append(gravity);
builder.append(", percentPerSale=");
builder.append(percentPerSale);
builder.append(", percentPerRebill=");
builder.append(percentPerRebill);
builder.append(", avgEarningsPerSale=");
builder.append(avgEarningsPerSale);
builder.append(", initialEarningsPerSale=");
builder.append(initialEarningsPerSale);
builder.append(", totalRebillAmt=");
builder.append(totalRebillAmt);
builder.append(", referred=");
builder.append(referred);
builder.append(", commission=");
builder.append(commission);
builder.append(", activeDate=");
builder.append(activeDate);
builder.append(", categories=");
builder.append(categories);
builder.append("]");
return builder.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((activeDate == null) ? 0 : activeDate.hashCode());
long temp;
temp = Double.doubleToLongBits(avgEarningsPerSale);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result + ((categories == null) ? 0 : categories.hashCode());
result = prime * result + ((cbID == null) ? 0 : cbID.hashCode());
result = prime * result + commission;
result = prime * result + ((description == null) ? 0 : description.hashCode());
temp = Double.doubleToLongBits(gravity);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result + (hasRecurringProducts ? 1231 : 1237);
result = prime * result + id;
temp = Double.doubleToLongBits(initialEarningsPerSale);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(percentPerRebill);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(percentPerSale);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result + popularityRank;
temp = Double.doubleToLongBits(referred);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result + ((title == null) ? 0 : title.hashCode());
temp = Double.doubleToLongBits(totalRebillAmt);
result = prime * result + (int) (temp ^ (temp >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Product other = (Product) obj;
if (activeDate == null) {
if (other.activeDate != null)
return false;
} else if (!activeDate.equals(other.activeDate))
return false;
if (Double.doubleToLongBits(avgEarningsPerSale) != Double.doubleToLongBits(other.avgEarningsPerSale))
return false;
if (categories == null) {
if (other.categories != null)
return false;
} else if (!categories.equals(other.categories))
return false;
if (cbID == null) {
if (other.cbID != null)
return false;
} else if (!cbID.equals(other.cbID))
return false;
if (commission != other.commission)
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (Double.doubleToLongBits(gravity) != Double.doubleToLongBits(other.gravity))
return false;
if (hasRecurringProducts != other.hasRecurringProducts)
return false;
if (id != other.id)
return false;
if (Double.doubleToLongBits(initialEarningsPerSale) != Double.doubleToLongBits(other.initialEarningsPerSale))
return false;
if (Double.doubleToLongBits(percentPerRebill) != Double.doubleToLongBits(other.percentPerRebill))
return false;
if (Double.doubleToLongBits(percentPerSale) != Double.doubleToLongBits(other.percentPerSale))
return false;
if (popularityRank != other.popularityRank)
return false;
if (Double.doubleToLongBits(referred) != Double.doubleToLongBits(other.referred))
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
if (Double.doubleToLongBits(totalRebillAmt) != Double.doubleToLongBits(other.totalRebillAmt))
return false;
return true;
}
}
|
[
"[email protected]"
] | |
7ee2a02a007e278c3742bea738a0f20716692de0
|
76024cdda70bdd101dabfe7c662beccf59c72a8d
|
/V2/src/main/java/com/hbbproject/echo/alice/Verbs.java
|
becb7b41fa5c1fd48d7c8f5578e3f4b256581732
|
[] |
no_license
|
b845548/ECHO-AI
|
b99cd858fe411af8f6fb680bbb10317ba381e03c
|
76daeffa0d27eed10b0575d7cc0a40386f3abb20
|
refs/heads/master
| 2021-01-21T06:18:37.028915 | 2017-02-26T12:48:35 | 2017-02-26T12:48:35 | 83,207,687 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,233 |
java
|
package com.hbbproject.echo.alice;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
public class Verbs {
static Set<String> es = Utilities.stringSet("sh","ch","th","ss","x");
static Set<String> ies = Utilities.stringSet("ly","ry","ny","fy","dy","py");
static Set<String> ring = Utilities.stringSet("be","me","re","se","ve","de","le","ce","ze","ke","te","ge","ne","pe","ue");
static Set<String> bing = Utilities.stringSet("ab","at","op","el","in","ur","op","er","un","in","it","et","ut","im","id","ol","ig");
static Set<String> notBing = Utilities.stringSet("der","eat","ber","ain","sit","ait","uit","eet","ter","lop","ver","wer","aim","oid","eel","out","oin","fer","vel","mit");
public static HashSet<String> irregular = new HashSet<String>();
public static HashMap<String, String> be2was = new HashMap<String, String>();
public static HashMap<String, String> be2been = new HashMap<String, String>();
public static HashMap<String, String> be2is = new HashMap<String, String>();
public static HashMap<String, String> be2being = new HashMap<String, String>();
public static HashSet<String> allVerbs = new HashSet<String>();
public static String endsWith(String verb, Set<String> endings) {
for (String x : endings) { if (verb.endsWith(x)) return x;}
return null;
}
public static String is(String verb) {
String ending;
if (irregular.contains(verb)) return be2is.get(verb);
if (verb.endsWith("go")) return verb+"es";
if ((ending = endsWith(verb, es)) != null) return verb+"es";
if ((ending = endsWith(verb, ies)) != null) return verb.substring(0, verb.length()-1)+"ies";
return verb+"s";
}
public static String was(String verb) {
String ending;
verb = verb.trim();
if (verb.equals("admit")) return "admitted";
if (verb.equals("commit")) return "committed";
if (verb.equals("die")) return "died";
if (verb.equals("agree")) return "agreed";
if (verb.endsWith("efer")) return verb+"red";
if (irregular.contains(verb)) {return be2was.get(verb); }
if ((ending = endsWith(verb, ies)) != null) {return verb.substring(0, verb.length()-1)+"ied";}
if ((ending = endsWith(verb, ring)) != null) {return verb+"d"; }
if ((ending = endsWith(verb, bing)) != null && (null==endsWith(verb, notBing))) {return verb+ending.substring(1,2)+"ed";}
return verb+"ed";
}
public static String being(String verb) {
String ending;
if (irregular.contains(verb)) return be2being.get(verb);
if (verb.equals("admit")) return "admitting";
if (verb.equals("commit")) return "committing";
if (verb.equals("quit")) return "quitting";
if (verb.equals("die")) return "dying";
if (verb.equals("lie")) return "lying";
if (verb.endsWith("efer")) return verb+"ring";
if ((ending = endsWith(verb, ring)) != null) { return verb.substring(0, verb.length()-1)+"ing";}
if ((ending = endsWith(verb, bing)) != null && (null==endsWith(verb, notBing))) { return verb+ending.substring(1,2)+"ing";}
return verb+"ing";
}
public static String been(String verb) {
if (irregular.contains(verb)) return(be2been.get(verb));
return was(verb);
}
public static void getIrregulars() {
// Do, Did, Done, Does, Doing
// be, was, been, is, being
String irrFile = Utilities.getFile("c:/ab/data/irrverbs.txt");
String[] triples = irrFile.split("\n");
for (String x : triples) {
x = x.toLowerCase();
String[] triple = x.split(",");
if (triple.length==5) {
irregular.add(triple[0]);
allVerbs.add(triple[0]);
be2was.put(triple[0], triple[1]);
be2been.put(triple[0], triple[2]);
be2is.put(triple[0], triple[3]);
be2being.put(triple[0], triple[4]);
}
}
}
public static void makeVerbSetsMaps (Bot bot) {
getIrregulars();
String verbFile = Utilities.getFile("c:/ab/data/verb300.txt");
String[] verbs = verbFile.split("\n");
for (String verb : verbs) {
allVerbs.add(verb);
}
AIMLSet be = new AIMLSet("be", bot);
AIMLSet is = new AIMLSet("is", bot);
AIMLSet was = new AIMLSet("was", bot);
AIMLSet been = new AIMLSet("been", bot);
AIMLSet being = new AIMLSet("being", bot);
AIMLMap is2be = new AIMLMap("is2be", bot);
AIMLMap be2is = new AIMLMap("be2is", bot);
AIMLMap was2be = new AIMLMap("was2be", bot);
AIMLMap be2was = new AIMLMap("be2was", bot);
AIMLMap been2be = new AIMLMap("been2be", bot);
AIMLMap be2been = new AIMLMap("be2been", bot);
AIMLMap be2being = new AIMLMap("be2being", bot);
AIMLMap being2be = new AIMLMap("being2be", bot);
for (String verb : allVerbs) {
String beForm = verb;
String isForm = is(verb);
String wasForm = was(verb);
String beenForm = been(verb);
String beingForm = being(verb);
System.out.println(verb+","+isForm+","+wasForm+","+beingForm+","+beenForm);
be.add(beForm);
is.add(isForm);
was.add(wasForm);
been.add(beenForm);
being.add(beingForm);
be2is.put(beForm, isForm);
is2be.put(isForm, beForm);
be2was.put(beForm, wasForm);
was2be.put(wasForm, beForm);
be2been.put(beForm, beenForm);
been2be.put(beenForm, beForm);
be2being.put(beForm, beingForm);
being2be.put(beingForm, beForm);
}
be.writeAIMLSet();
is.writeAIMLSet();
was.writeAIMLSet();
been.writeAIMLSet();
being.writeAIMLSet();
be2is.writeAIMLMap();
is2be.writeAIMLMap();
be2was.writeAIMLMap();
was2be.writeAIMLMap();
be2been.writeAIMLMap();
been2be.writeAIMLMap();
be2being.writeAIMLMap();
being2be.writeAIMLMap();
}
}
|
[
"[email protected]"
] | |
2f9a482ba79190a5342bb370f557df0f4eebeb2b
|
7853f365d5ea0c0faef07f551605a7e58695ae80
|
/app/src/main/java/com/insuleto/koloroapp/model/InAppBilling.java
|
24e6a3811d5b3e9cc7dcd5c8ab9f277ece1e0575
|
[] |
no_license
|
jamesp-kelly/koloro
|
5846703738931d48cdba867cf626a671193a6427
|
83f3cb4b304a80c0e8b99cfaaa4974a8106f91af
|
refs/heads/master
| 2021-01-20T02:37:37.763409 | 2017-05-10T13:39:38 | 2017-05-10T13:39:38 | 58,073,729 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 321 |
java
|
package com.insuleto.koloroapp.model;
public class InAppBilling {
public static final String SKU_PREMIUM = "koloro_premium";
public static final int PREMIUM_RC = 1054;
public static final String TEST_PURCHASED = "android.test.purchased";
public static final String TEST_CANCELLED = "android.test.cancelled";
}
|
[
"[email protected]"
] | |
56ed1defda6545fa170a00c8935da429d937e69f
|
0329b522ae3c47ddca502e947d5e817cd20937ad
|
/src/main/java/de/simonsator/partyandfriends/extensions/PokeCommand.java
|
e8d82b51906675e81248a5ad72db1a840b46394a
|
[] |
no_license
|
Tominous/Poke-for-Party-and-Friends
|
759e24620889ddf4e157c9386efff9bf9f48d02b
|
0755dbd19ee2243c50810f65dd7119319882845c
|
refs/heads/master
| 2020-05-05T03:58:25.237009 | 2018-05-18T11:10:28 | 2018-05-18T11:10:28 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,237 |
java
|
package de.simonsator.partyandfriends.extensions;
import de.simonsator.partyandfriends.api.friends.abstractcommands.FriendSubCommand;
import de.simonsator.partyandfriends.api.pafplayers.OnlinePAFPlayer;
import de.simonsator.partyandfriends.api.pafplayers.PAFPlayer;
import de.simonsator.partyandfriends.api.pafplayers.PAFPlayerManager;
import de.simonsator.partyandfriends.main.Main;
import de.simonsator.partyandfriends.utilities.PatterCollection;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.config.Configuration;
import java.util.List;
import java.util.regex.Matcher;
/**
* @author simonbrungs
* @version 1.0.0 25.01.17
*/
public class PokeCommand extends FriendSubCommand {
private final Matcher POKE_MESSAGE;
private final Matcher POKED_MESSAGE;
protected PokeCommand(List<String> pCommands, int pPriority, String pHelp, Configuration pMessages, String pPermission) {
super(pCommands, pPriority, pHelp, pPermission);
POKE_MESSAGE = PatterCollection.PLAYER_PATTERN.matcher(pMessages.getString("Messages.Poke"));
POKED_MESSAGE = PatterCollection.PLAYER_PATTERN.matcher(pMessages.getString("Messages.Poked"));
}
@Override
public void onCommand(OnlinePAFPlayer pPlayer, String[] args) {
if (!isPlayerGiven(pPlayer, args))
return;
PAFPlayer playerQuery = PAFPlayerManager.getInstance().getPlayer(args[1]);
if (!isPlayerOnline(pPlayer, playerQuery))
return;
if (!isAFriendOf(pPlayer, playerQuery, args))
return;
if (!allowsWriteTo(pPlayer, playerQuery))
return;
pPlayer.sendMessage(PREFIX + POKED_MESSAGE.replaceFirst(playerQuery.getDisplayName()));
playerQuery.sendMessage(PREFIX + POKE_MESSAGE.replaceFirst(pPlayer.getDisplayName()));
}
private boolean isPlayerOnline(OnlinePAFPlayer pSender, PAFPlayer pQueryPlayer) {
if (!pQueryPlayer.isOnline()) {
sendError(pSender, "Friends.General.PlayerIsOffline");
return false;
}
return true;
}
private boolean allowsWriteTo(OnlinePAFPlayer pPlayer, PAFPlayer pQueryPlayer) {
if (pQueryPlayer.getSettingsWorth(2) == 1) {
sendError(pPlayer, new TextComponent(PREFIX
+ Main.getInstance().getMessages().getString("Friends.Command.MSG.CanNotWriteToHim")));
return false;
}
return true;
}
}
|
[
"[email protected]"
] | |
84694667ecae8815ddd19155e836593326269c39
|
39d9bb7791787972a09da0a4e9c748d8fec3a86c
|
/gcoinsExample/app/src/main/java/gcode/baseproject/domain/model/permissions/Permission.java
|
71e49555f2e411e17791af5d67c3e1633d3c692f
|
[] |
no_license
|
DanielDPS/SGRApp
|
4ccfc629302233a31ac7563021beb155c3f77866
|
1c60acd3b798b6ed0ef779b2c149ca3c09af77d3
|
refs/heads/master
| 2020-04-29T05:23:44.514159 | 2019-05-27T15:27:00 | 2019-05-27T15:27:00 | 175,881,533 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,101 |
java
|
package gcode.baseproject.domain.model.permissions;
import java.io.Serializable;
public class Permission implements Serializable {
private boolean addable;
private boolean editable;
private boolean readable;
private boolean removeable;
private boolean hasSuperAccess;
public void setAddable(boolean addable) {
this.addable = addable;
}
public boolean isAddable() {
return addable;
}
public void setEditable(boolean editable) {
this.editable = editable;
}
public boolean isEditable() {
return editable;
}
public void setReadable(boolean readable) {
this.readable = readable;
}
public boolean isReadable() {
return readable;
}
public void setRemoveable(boolean removeable) {
this.removeable = removeable;
}
public boolean isRemoveable() {
return removeable;
}
public void setSuperAccess(boolean superAccess) {
this.hasSuperAccess = superAccess;
}
public boolean hasSuperAccess() {
return hasSuperAccess;
}
}
|
[
"[email protected]"
] | |
a4c0854af9ee22b59caeaec076b645c7c9979196
|
094e957f14bffed93ccc47404b1519e147028247
|
/cloudsimex-geolocation/src/test/java/org/cloudbus/cloudsim/ex/geolocation/IPUtilTest.java
|
251c02012563747c4c7bfe63bd7497e0dac445e7
|
[] |
no_license
|
dharmpal83/CloudSimEx
|
e083924fb1f5fea12ef276e750652d5942d90143
|
635ec0897012acd89795ec54b4f1b4f4ab31b807
|
refs/heads/master
| 2020-12-26T14:22:05.122657 | 2014-02-27T03:24:23 | 2014-02-27T03:24:23 | 18,139,530 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 913 |
java
|
package org.cloudbus.cloudsim.ex.geolocation;
import static org.junit.Assert.assertEquals;
import java.net.UnknownHostException;
import org.junit.Test;
public class IPUtilTest {
@Test
public void testIPv4StringConversion() throws UnknownHostException {
assertEquals("0.0.0.1", IPUtil.convertIPv4(1));
assertEquals("0.0.0.2", IPUtil.convertIPv4(2));
assertEquals("127.255.255.255", IPUtil.convertIPv4(Integer.MAX_VALUE));
assertEquals("128.0.0.0", IPUtil.convertIPv4(Integer.MIN_VALUE));
assertEquals("255.255.255.255", IPUtil.convertIPv4(-1));
assertEquals("223.255.255.0", IPUtil.convertIPv4((int)3758096128l));
assertEquals("182.48.63.255", IPUtil.convertIPv4((int)3056615423l));
}
// private static byte[] conv(int value) {
// return new byte[] {
// (byte) (value >>> 24),
// (byte) (value >>> 16),
// (byte) (value >>> 8),
// (byte) value };
//
// }
}
|
[
"[email protected]"
] | |
b245fc9c7b05e5b3a0df65a56e3fee4cf1556424
|
20bd7dfc1654fb22068a7c0003cd45519db371fa
|
/Part_2_1_Dispatcher_Pattern/ReactorServer/src/HandleMap.java
|
44660d333c5f6254f99c5cd7e5c27f14359e6102
|
[] |
no_license
|
FYLSunghwan/SWM-ArchitectureStudy
|
9060a566843bdcb3d49a738e198400b91cbe5b99
|
ed0e66541716f637a029b395c1ee102e0676d242
|
refs/heads/master
| 2022-10-04T15:15:27.794331 | 2020-06-04T11:02:44 | 2020-06-04T11:02:44 | 269,310,791 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 94 |
java
|
import java.util.HashMap;
public class HandleMap extends HashMap<String, EventHandler> {
}
|
[
"[email protected]"
] | |
cb38960d2f0792bb115282042e2c9dc47866132e
|
4d9bbc7d5c3590501430d0d8aa2518ec2366ec63
|
/src/main/java/com/github/kpavlov/restws/server/model/Link.java
|
68e9e8216c2be57a45761be6c414b67a62adba1f
|
[
"MIT"
] |
permissive
|
kpavlov/spring-hmac-rest
|
c7193b0830804ef651809280bc1dd1e3aa2ff7d9
|
49c90b43c5f812363dd93607e8375a215adf62a2
|
refs/heads/master
| 2022-12-14T13:04:50.682511 | 2022-12-06T20:02:41 | 2022-12-06T20:03:12 | 42,979,533 | 42 | 19 |
MIT
| 2022-12-06T20:03:13 | 2015-09-23T05:06:40 |
Java
|
UTF-8
|
Java
| false | false | 108 |
java
|
package com.github.kpavlov.restws.server.model;
import java.net.URL;
public class Link {
URL href;
}
|
[
"[email protected]"
] | |
28c1c87bd56a1cfe6ef56e186fc293cd4d45840b
|
edc15241edb72d670c793527bc5cd327f7c50544
|
/app/src/main/java/com/yuntongxun/as/common/utils/MimeTypes.java
|
10c1312a1e860887a3705b799bd128a3f28c34e9
|
[] |
no_license
|
qq5889/YTX
|
21a6f3ae6b1468aa16bfe494d1f1cd6915cb85e5
|
25c70bc5ec7807cdac7c350392613b57a063acc6
|
refs/heads/master
| 2020-09-23T04:24:57.840475 | 2016-09-09T09:01:13 | 2016-09-09T09:01:13 | 67,783,412 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,346 |
java
|
/*
* Copyright (C) 2008 OpenIntents.org
*
* 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.yuntongxun.as.common.utils;
import android.webkit.MimeTypeMap;
import java.util.HashMap;
import java.util.Map;
public class MimeTypes {
private Map<String, String> mMimeTypes;
private Map<String, Integer> mIcons;
public MimeTypes() {
mMimeTypes = new HashMap<String,String>();
mIcons = new HashMap<String,Integer>();
}
/* I think the type and extension names are switched (type contains .png, extension contains x/y),
* but maybe it's on purpouse, so I won't change it.
*/
public void put(String type, String extension, int icon){
put(type, extension);
mIcons.put(extension, icon);
}
public void put(String type, String extension) {
// Convert extensions to lower case letters for easier comparison
extension = extension.toLowerCase();
mMimeTypes.put(type, extension);
}
public String getMimeType(String filename) {
String extension = FileUtils.getExtension(filename);
// Let's check the official map first. Webkit has a nice extension-to-MIME map.
// Be sure to remove the first character from the extension, which is the "." character.
if (extension.length() > 0) {
String webkitMimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.substring(1));
if (webkitMimeType != null) {
// Found one. Let's take it!
return webkitMimeType;
}
}
// Convert extensions to lower case letters for easier comparison
extension = extension.toLowerCase();
String mimetype = mMimeTypes.get(extension);
if(mimetype==null) mimetype = "*/*";
return mimetype;
}
public int getIcon(String mimetype){
Integer iconResId = mIcons.get(mimetype);
if(iconResId == null)
return 0; // Invalid identifier
return iconResId;
}
}
|
[
"[email protected]"
] | |
47239f6c9351b523864101a60de1c45f7649cb2d
|
5a94d45079d4b9ba3b44c910f583072c90313b21
|
/modules/mkdev-employee/mkdev-employee-api/src/main/java/org/mkdev/employee/service/persistence/EmployeeDetailUtil.java
|
d2676858cb75b0937af942f74d0f7366b55a0b87
|
[] |
no_license
|
MKDevNotes/mkdevnotes-LR71
|
558c48f77bba4b4d9cff339a7e0addf816eaf1fc
|
b87986cccce6972e4b57bce9cd69e6118f9a9965
|
refs/heads/master
| 2020-05-21T16:54:21.685005 | 2019-06-04T17:37:50 | 2019-06-04T17:37:50 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 36,837 |
java
|
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package org.mkdev.employee.service.persistence;
import aQute.bnd.annotation.ProviderType;
import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.util.OrderByComparator;
import org.mkdev.employee.model.EmployeeDetail;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
import org.osgi.util.tracker.ServiceTracker;
import java.util.List;
/**
* The persistence utility for the employee detail service. This utility wraps {@link org.mkdev.employee.service.persistence.impl.EmployeeDetailPersistenceImpl} and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class.
*
* <p>
* Caching information and settings can be found in <code>portal.properties</code>
* </p>
*
* @author Brian Wing Shun Chan
* @see EmployeeDetailPersistence
* @see org.mkdev.employee.service.persistence.impl.EmployeeDetailPersistenceImpl
* @generated
*/
@ProviderType
public class EmployeeDetailUtil {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
*/
/**
* @see com.liferay.portal.kernel.service.persistence.BasePersistence#clearCache()
*/
public static void clearCache() {
getPersistence().clearCache();
}
/**
* @see com.liferay.portal.kernel.service.persistence.BasePersistence#clearCache(com.liferay.portal.kernel.model.BaseModel)
*/
public static void clearCache(EmployeeDetail employeeDetail) {
getPersistence().clearCache(employeeDetail);
}
/**
* @see com.liferay.portal.kernel.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
*/
public static long countWithDynamicQuery(DynamicQuery dynamicQuery) {
return getPersistence().countWithDynamicQuery(dynamicQuery);
}
/**
* @see com.liferay.portal.kernel.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
*/
public static List<EmployeeDetail> findWithDynamicQuery(
DynamicQuery dynamicQuery) {
return getPersistence().findWithDynamicQuery(dynamicQuery);
}
/**
* @see com.liferay.portal.kernel.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
*/
public static List<EmployeeDetail> findWithDynamicQuery(
DynamicQuery dynamicQuery, int start, int end) {
return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
}
/**
* @see com.liferay.portal.kernel.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
*/
public static List<EmployeeDetail> findWithDynamicQuery(
DynamicQuery dynamicQuery, int start, int end,
OrderByComparator<EmployeeDetail> orderByComparator) {
return getPersistence()
.findWithDynamicQuery(dynamicQuery, start, end,
orderByComparator);
}
/**
* @see com.liferay.portal.kernel.service.persistence.BasePersistence#update(com.liferay.portal.kernel.model.BaseModel)
*/
public static EmployeeDetail update(EmployeeDetail employeeDetail) {
return getPersistence().update(employeeDetail);
}
/**
* @see com.liferay.portal.kernel.service.persistence.BasePersistence#update(com.liferay.portal.kernel.model.BaseModel, ServiceContext)
*/
public static EmployeeDetail update(EmployeeDetail employeeDetail,
ServiceContext serviceContext) {
return getPersistence().update(employeeDetail, serviceContext);
}
/**
* Returns all the employee details where uuid = ?.
*
* @param uuid the uuid
* @return the matching employee details
*/
public static List<EmployeeDetail> findByUuid(String uuid) {
return getPersistence().findByUuid(uuid);
}
/**
* Returns a range of all the employee details where uuid = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link EmployeeDetailModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param uuid the uuid
* @param start the lower bound of the range of employee details
* @param end the upper bound of the range of employee details (not inclusive)
* @return the range of matching employee details
*/
public static List<EmployeeDetail> findByUuid(String uuid, int start,
int end) {
return getPersistence().findByUuid(uuid, start, end);
}
/**
* Returns an ordered range of all the employee details where uuid = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link EmployeeDetailModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param uuid the uuid
* @param start the lower bound of the range of employee details
* @param end the upper bound of the range of employee details (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @return the ordered range of matching employee details
*/
public static List<EmployeeDetail> findByUuid(String uuid, int start,
int end, OrderByComparator<EmployeeDetail> orderByComparator) {
return getPersistence().findByUuid(uuid, start, end, orderByComparator);
}
/**
* Returns an ordered range of all the employee details where uuid = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link EmployeeDetailModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param uuid the uuid
* @param start the lower bound of the range of employee details
* @param end the upper bound of the range of employee details (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @param retrieveFromCache whether to retrieve from the finder cache
* @return the ordered range of matching employee details
*/
public static List<EmployeeDetail> findByUuid(String uuid, int start,
int end, OrderByComparator<EmployeeDetail> orderByComparator,
boolean retrieveFromCache) {
return getPersistence()
.findByUuid(uuid, start, end, orderByComparator,
retrieveFromCache);
}
/**
* Returns the first employee detail in the ordered set where uuid = ?.
*
* @param uuid the uuid
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching employee detail
* @throws NoSuchEmployeeDetailException if a matching employee detail could not be found
*/
public static EmployeeDetail findByUuid_First(String uuid,
OrderByComparator<EmployeeDetail> orderByComparator)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence().findByUuid_First(uuid, orderByComparator);
}
/**
* Returns the first employee detail in the ordered set where uuid = ?.
*
* @param uuid the uuid
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching employee detail, or <code>null</code> if a matching employee detail could not be found
*/
public static EmployeeDetail fetchByUuid_First(String uuid,
OrderByComparator<EmployeeDetail> orderByComparator) {
return getPersistence().fetchByUuid_First(uuid, orderByComparator);
}
/**
* Returns the last employee detail in the ordered set where uuid = ?.
*
* @param uuid the uuid
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching employee detail
* @throws NoSuchEmployeeDetailException if a matching employee detail could not be found
*/
public static EmployeeDetail findByUuid_Last(String uuid,
OrderByComparator<EmployeeDetail> orderByComparator)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence().findByUuid_Last(uuid, orderByComparator);
}
/**
* Returns the last employee detail in the ordered set where uuid = ?.
*
* @param uuid the uuid
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching employee detail, or <code>null</code> if a matching employee detail could not be found
*/
public static EmployeeDetail fetchByUuid_Last(String uuid,
OrderByComparator<EmployeeDetail> orderByComparator) {
return getPersistence().fetchByUuid_Last(uuid, orderByComparator);
}
/**
* Returns the employee details before and after the current employee detail in the ordered set where uuid = ?.
*
* @param empId the primary key of the current employee detail
* @param uuid the uuid
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the previous, current, and next employee detail
* @throws NoSuchEmployeeDetailException if a employee detail with the primary key could not be found
*/
public static EmployeeDetail[] findByUuid_PrevAndNext(long empId,
String uuid, OrderByComparator<EmployeeDetail> orderByComparator)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence()
.findByUuid_PrevAndNext(empId, uuid, orderByComparator);
}
/**
* Removes all the employee details where uuid = ? from the database.
*
* @param uuid the uuid
*/
public static void removeByUuid(String uuid) {
getPersistence().removeByUuid(uuid);
}
/**
* Returns the number of employee details where uuid = ?.
*
* @param uuid the uuid
* @return the number of matching employee details
*/
public static int countByUuid(String uuid) {
return getPersistence().countByUuid(uuid);
}
/**
* Returns the employee detail where uuid = ? and groupId = ? or throws a {@link NoSuchEmployeeDetailException} if it could not be found.
*
* @param uuid the uuid
* @param groupId the group ID
* @return the matching employee detail
* @throws NoSuchEmployeeDetailException if a matching employee detail could not be found
*/
public static EmployeeDetail findByUUID_G(String uuid, long groupId)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence().findByUUID_G(uuid, groupId);
}
/**
* Returns the employee detail where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
*
* @param uuid the uuid
* @param groupId the group ID
* @return the matching employee detail, or <code>null</code> if a matching employee detail could not be found
*/
public static EmployeeDetail fetchByUUID_G(String uuid, long groupId) {
return getPersistence().fetchByUUID_G(uuid, groupId);
}
/**
* Returns the employee detail where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found, optionally using the finder cache.
*
* @param uuid the uuid
* @param groupId the group ID
* @param retrieveFromCache whether to retrieve from the finder cache
* @return the matching employee detail, or <code>null</code> if a matching employee detail could not be found
*/
public static EmployeeDetail fetchByUUID_G(String uuid, long groupId,
boolean retrieveFromCache) {
return getPersistence().fetchByUUID_G(uuid, groupId, retrieveFromCache);
}
/**
* Removes the employee detail where uuid = ? and groupId = ? from the database.
*
* @param uuid the uuid
* @param groupId the group ID
* @return the employee detail that was removed
*/
public static EmployeeDetail removeByUUID_G(String uuid, long groupId)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence().removeByUUID_G(uuid, groupId);
}
/**
* Returns the number of employee details where uuid = ? and groupId = ?.
*
* @param uuid the uuid
* @param groupId the group ID
* @return the number of matching employee details
*/
public static int countByUUID_G(String uuid, long groupId) {
return getPersistence().countByUUID_G(uuid, groupId);
}
/**
* Returns all the employee details where uuid = ? and companyId = ?.
*
* @param uuid the uuid
* @param companyId the company ID
* @return the matching employee details
*/
public static List<EmployeeDetail> findByUuid_C(String uuid, long companyId) {
return getPersistence().findByUuid_C(uuid, companyId);
}
/**
* Returns a range of all the employee details where uuid = ? and companyId = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link EmployeeDetailModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param uuid the uuid
* @param companyId the company ID
* @param start the lower bound of the range of employee details
* @param end the upper bound of the range of employee details (not inclusive)
* @return the range of matching employee details
*/
public static List<EmployeeDetail> findByUuid_C(String uuid,
long companyId, int start, int end) {
return getPersistence().findByUuid_C(uuid, companyId, start, end);
}
/**
* Returns an ordered range of all the employee details where uuid = ? and companyId = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link EmployeeDetailModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param uuid the uuid
* @param companyId the company ID
* @param start the lower bound of the range of employee details
* @param end the upper bound of the range of employee details (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @return the ordered range of matching employee details
*/
public static List<EmployeeDetail> findByUuid_C(String uuid,
long companyId, int start, int end,
OrderByComparator<EmployeeDetail> orderByComparator) {
return getPersistence()
.findByUuid_C(uuid, companyId, start, end, orderByComparator);
}
/**
* Returns an ordered range of all the employee details where uuid = ? and companyId = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link EmployeeDetailModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param uuid the uuid
* @param companyId the company ID
* @param start the lower bound of the range of employee details
* @param end the upper bound of the range of employee details (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @param retrieveFromCache whether to retrieve from the finder cache
* @return the ordered range of matching employee details
*/
public static List<EmployeeDetail> findByUuid_C(String uuid,
long companyId, int start, int end,
OrderByComparator<EmployeeDetail> orderByComparator,
boolean retrieveFromCache) {
return getPersistence()
.findByUuid_C(uuid, companyId, start, end,
orderByComparator, retrieveFromCache);
}
/**
* Returns the first employee detail in the ordered set where uuid = ? and companyId = ?.
*
* @param uuid the uuid
* @param companyId the company ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching employee detail
* @throws NoSuchEmployeeDetailException if a matching employee detail could not be found
*/
public static EmployeeDetail findByUuid_C_First(String uuid,
long companyId, OrderByComparator<EmployeeDetail> orderByComparator)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence()
.findByUuid_C_First(uuid, companyId, orderByComparator);
}
/**
* Returns the first employee detail in the ordered set where uuid = ? and companyId = ?.
*
* @param uuid the uuid
* @param companyId the company ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching employee detail, or <code>null</code> if a matching employee detail could not be found
*/
public static EmployeeDetail fetchByUuid_C_First(String uuid,
long companyId, OrderByComparator<EmployeeDetail> orderByComparator) {
return getPersistence()
.fetchByUuid_C_First(uuid, companyId, orderByComparator);
}
/**
* Returns the last employee detail in the ordered set where uuid = ? and companyId = ?.
*
* @param uuid the uuid
* @param companyId the company ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching employee detail
* @throws NoSuchEmployeeDetailException if a matching employee detail could not be found
*/
public static EmployeeDetail findByUuid_C_Last(String uuid, long companyId,
OrderByComparator<EmployeeDetail> orderByComparator)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence()
.findByUuid_C_Last(uuid, companyId, orderByComparator);
}
/**
* Returns the last employee detail in the ordered set where uuid = ? and companyId = ?.
*
* @param uuid the uuid
* @param companyId the company ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching employee detail, or <code>null</code> if a matching employee detail could not be found
*/
public static EmployeeDetail fetchByUuid_C_Last(String uuid,
long companyId, OrderByComparator<EmployeeDetail> orderByComparator) {
return getPersistence()
.fetchByUuid_C_Last(uuid, companyId, orderByComparator);
}
/**
* Returns the employee details before and after the current employee detail in the ordered set where uuid = ? and companyId = ?.
*
* @param empId the primary key of the current employee detail
* @param uuid the uuid
* @param companyId the company ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the previous, current, and next employee detail
* @throws NoSuchEmployeeDetailException if a employee detail with the primary key could not be found
*/
public static EmployeeDetail[] findByUuid_C_PrevAndNext(long empId,
String uuid, long companyId,
OrderByComparator<EmployeeDetail> orderByComparator)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence()
.findByUuid_C_PrevAndNext(empId, uuid, companyId,
orderByComparator);
}
/**
* Removes all the employee details where uuid = ? and companyId = ? from the database.
*
* @param uuid the uuid
* @param companyId the company ID
*/
public static void removeByUuid_C(String uuid, long companyId) {
getPersistence().removeByUuid_C(uuid, companyId);
}
/**
* Returns the number of employee details where uuid = ? and companyId = ?.
*
* @param uuid the uuid
* @param companyId the company ID
* @return the number of matching employee details
*/
public static int countByUuid_C(String uuid, long companyId) {
return getPersistence().countByUuid_C(uuid, companyId);
}
/**
* Returns the employee detail where empId = ? or throws a {@link NoSuchEmployeeDetailException} if it could not be found.
*
* @param empId the emp ID
* @return the matching employee detail
* @throws NoSuchEmployeeDetailException if a matching employee detail could not be found
*/
public static EmployeeDetail findByEmployeeId(long empId)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence().findByEmployeeId(empId);
}
/**
* Returns the employee detail where empId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
*
* @param empId the emp ID
* @return the matching employee detail, or <code>null</code> if a matching employee detail could not be found
*/
public static EmployeeDetail fetchByEmployeeId(long empId) {
return getPersistence().fetchByEmployeeId(empId);
}
/**
* Returns the employee detail where empId = ? or returns <code>null</code> if it could not be found, optionally using the finder cache.
*
* @param empId the emp ID
* @param retrieveFromCache whether to retrieve from the finder cache
* @return the matching employee detail, or <code>null</code> if a matching employee detail could not be found
*/
public static EmployeeDetail fetchByEmployeeId(long empId,
boolean retrieveFromCache) {
return getPersistence().fetchByEmployeeId(empId, retrieveFromCache);
}
/**
* Removes the employee detail where empId = ? from the database.
*
* @param empId the emp ID
* @return the employee detail that was removed
*/
public static EmployeeDetail removeByEmployeeId(long empId)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence().removeByEmployeeId(empId);
}
/**
* Returns the number of employee details where empId = ?.
*
* @param empId the emp ID
* @return the number of matching employee details
*/
public static int countByEmployeeId(long empId) {
return getPersistence().countByEmployeeId(empId);
}
/**
* Returns the employee detail where firstName = ? and email = ? or throws a {@link NoSuchEmployeeDetailException} if it could not be found.
*
* @param firstName the first name
* @param email the email
* @return the matching employee detail
* @throws NoSuchEmployeeDetailException if a matching employee detail could not be found
*/
public static EmployeeDetail findByUserEmail(String firstName, String email)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence().findByUserEmail(firstName, email);
}
/**
* Returns the employee detail where firstName = ? and email = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
*
* @param firstName the first name
* @param email the email
* @return the matching employee detail, or <code>null</code> if a matching employee detail could not be found
*/
public static EmployeeDetail fetchByUserEmail(String firstName, String email) {
return getPersistence().fetchByUserEmail(firstName, email);
}
/**
* Returns the employee detail where firstName = ? and email = ? or returns <code>null</code> if it could not be found, optionally using the finder cache.
*
* @param firstName the first name
* @param email the email
* @param retrieveFromCache whether to retrieve from the finder cache
* @return the matching employee detail, or <code>null</code> if a matching employee detail could not be found
*/
public static EmployeeDetail fetchByUserEmail(String firstName,
String email, boolean retrieveFromCache) {
return getPersistence()
.fetchByUserEmail(firstName, email, retrieveFromCache);
}
/**
* Removes the employee detail where firstName = ? and email = ? from the database.
*
* @param firstName the first name
* @param email the email
* @return the employee detail that was removed
*/
public static EmployeeDetail removeByUserEmail(String firstName,
String email)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence().removeByUserEmail(firstName, email);
}
/**
* Returns the number of employee details where firstName = ? and email = ?.
*
* @param firstName the first name
* @param email the email
* @return the number of matching employee details
*/
public static int countByUserEmail(String firstName, String email) {
return getPersistence().countByUserEmail(firstName, email);
}
/**
* Caches the employee detail in the entity cache if it is enabled.
*
* @param employeeDetail the employee detail
*/
public static void cacheResult(EmployeeDetail employeeDetail) {
getPersistence().cacheResult(employeeDetail);
}
/**
* Caches the employee details in the entity cache if it is enabled.
*
* @param employeeDetails the employee details
*/
public static void cacheResult(List<EmployeeDetail> employeeDetails) {
getPersistence().cacheResult(employeeDetails);
}
/**
* Creates a new employee detail with the primary key. Does not add the employee detail to the database.
*
* @param empId the primary key for the new employee detail
* @return the new employee detail
*/
public static EmployeeDetail create(long empId) {
return getPersistence().create(empId);
}
/**
* Removes the employee detail with the primary key from the database. Also notifies the appropriate model listeners.
*
* @param empId the primary key of the employee detail
* @return the employee detail that was removed
* @throws NoSuchEmployeeDetailException if a employee detail with the primary key could not be found
*/
public static EmployeeDetail remove(long empId)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence().remove(empId);
}
public static EmployeeDetail updateImpl(EmployeeDetail employeeDetail) {
return getPersistence().updateImpl(employeeDetail);
}
/**
* Returns the employee detail with the primary key or throws a {@link NoSuchEmployeeDetailException} if it could not be found.
*
* @param empId the primary key of the employee detail
* @return the employee detail
* @throws NoSuchEmployeeDetailException if a employee detail with the primary key could not be found
*/
public static EmployeeDetail findByPrimaryKey(long empId)
throws org.mkdev.employee.exception.NoSuchEmployeeDetailException {
return getPersistence().findByPrimaryKey(empId);
}
/**
* Returns the employee detail with the primary key or returns <code>null</code> if it could not be found.
*
* @param empId the primary key of the employee detail
* @return the employee detail, or <code>null</code> if a employee detail with the primary key could not be found
*/
public static EmployeeDetail fetchByPrimaryKey(long empId) {
return getPersistence().fetchByPrimaryKey(empId);
}
public static java.util.Map<java.io.Serializable, EmployeeDetail> fetchByPrimaryKeys(
java.util.Set<java.io.Serializable> primaryKeys) {
return getPersistence().fetchByPrimaryKeys(primaryKeys);
}
/**
* Returns all the employee details.
*
* @return the employee details
*/
public static List<EmployeeDetail> findAll() {
return getPersistence().findAll();
}
/**
* Returns a range of all the employee details.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link EmployeeDetailModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param start the lower bound of the range of employee details
* @param end the upper bound of the range of employee details (not inclusive)
* @return the range of employee details
*/
public static List<EmployeeDetail> findAll(int start, int end) {
return getPersistence().findAll(start, end);
}
/**
* Returns an ordered range of all the employee details.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link EmployeeDetailModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param start the lower bound of the range of employee details
* @param end the upper bound of the range of employee details (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @return the ordered range of employee details
*/
public static List<EmployeeDetail> findAll(int start, int end,
OrderByComparator<EmployeeDetail> orderByComparator) {
return getPersistence().findAll(start, end, orderByComparator);
}
/**
* Returns an ordered range of all the employee details.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link EmployeeDetailModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param start the lower bound of the range of employee details
* @param end the upper bound of the range of employee details (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @param retrieveFromCache whether to retrieve from the finder cache
* @return the ordered range of employee details
*/
public static List<EmployeeDetail> findAll(int start, int end,
OrderByComparator<EmployeeDetail> orderByComparator,
boolean retrieveFromCache) {
return getPersistence()
.findAll(start, end, orderByComparator, retrieveFromCache);
}
/**
* Removes all the employee details from the database.
*/
public static void removeAll() {
getPersistence().removeAll();
}
/**
* Returns the number of employee details.
*
* @return the number of employee details
*/
public static int countAll() {
return getPersistence().countAll();
}
public static java.util.Set<String> getBadColumnNames() {
return getPersistence().getBadColumnNames();
}
public static EmployeeDetailPersistence getPersistence() {
return _serviceTracker.getService();
}
private static ServiceTracker<EmployeeDetailPersistence, EmployeeDetailPersistence> _serviceTracker;
static {
Bundle bundle = FrameworkUtil.getBundle(EmployeeDetailPersistence.class);
ServiceTracker<EmployeeDetailPersistence, EmployeeDetailPersistence> serviceTracker =
new ServiceTracker<EmployeeDetailPersistence, EmployeeDetailPersistence>(bundle.getBundleContext(),
EmployeeDetailPersistence.class, null);
serviceTracker.open();
_serviceTracker = serviceTracker;
}
}
|
[
"[email protected]"
] | |
87a88a92a9352d837620fcb18f52fe5af1953a5d
|
59a6035e9e326939f9115fe705aed5959a5b3e1a
|
/校内通/客户端/NewApp/src/com/example/util/QiniuUtil.java
|
698b47366ef0171711cf9353398d2b6ab19c0fd4
|
[] |
no_license
|
aaAlicebb/SchoolApp
|
7b68fa9ee5fdd78d8097c6f49dacfdb2adbc088c
|
a5b7db128c51eabab402487c1287f952fad9f732
|
refs/heads/master
| 2021-01-13T15:12:34.416363 | 2016-12-12T14:20:41 | 2016-12-12T14:20:41 | 76,220,693 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,332 |
java
|
package com.example.util;
import org.json.JSONObject;
import com.lidroid.xutils.util.LogUtils;
import com.qiniu.android.http.ResponseInfo;
import com.qiniu.android.storage.UpCompletionHandler;
import com.qiniu.android.storage.UpProgressHandler;
import com.qiniu.android.storage.UploadManager;
import com.qiniu.android.storage.UploadOptions;
public class QiniuUtil {
static UploadManager uploadManager = new UploadManager();
/**
* 上传文件到七牛云存储上
* @param filePath
* @param key
* @param token
* @param callback
*/
public static void put(String filePath, String key, String token,final FileLoadCallBack callback){
uploadManager.put(filePath, key, token, new UpCompletionHandler() {
@Override
public void complete(String key, ResponseInfo info, JSONObject response) {
if(info.isOK()){
String fileKey = response.optString("key", "");
callback.onSuccess(fileKey);
}else{
callback.onFailure(info.toString());
LogUtils.e(info.toString());
TipUtil.show("上传失败...");
}
}
}, new UploadOptions(null, null, false, new UpProgressHandler() {
@Override
public void progress(String key, double percent) {
callback.onProcess(key, percent);
}
}, null));
}
}
//
// public static void getUpToken(){
//
// }
|
[
"[email protected]"
] | |
37fdf588351bdd5aec572373cb3597e94a98a28f
|
b5557ae8f04aaf081d854afb2452059e0cb19f09
|
/src/com/haxademic/app/haxmapper/textures/TextureColorAudioSlide.java
|
9412dff2a7214bbfe34ab49c660f7710fb6b545c
|
[
"MIT"
] |
permissive
|
wangyuewwl/haxademic
|
40760e9a31265a8e03eda003e53e86ac984991f0
|
17c4dc3ef18795fa98cb2bfdba1f80c3b9a14b41
|
refs/heads/master
| 2021-04-26T06:16:58.287570 | 2018-03-02T03:48:35 | 2018-03-02T03:48:35 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,332 |
java
|
package com.haxademic.app.haxmapper.textures;
import com.haxademic.core.app.P;
import com.haxademic.core.math.MathUtil;
public class TextureColorAudioSlide
extends BaseTexture {
protected int _eqIndex;
protected int _mode;
protected float _lastAmp = 0;
public TextureColorAudioSlide( int width, int height ) {
super();
buildGraphics( width, height );
randomize();
}
public BaseTexture setActive( boolean isActive ) {
boolean wasActive = _active;
super.setActive(isActive);
if( isActive != wasActive ) {
randomize();
}
return this;
}
public void randomize() {
_eqIndex = MathUtil.randRange(3, 31);
_mode = MathUtil.randRange(0, 3);
}
public void updateDraw() {
_texture.clear();
_texture.noStroke();
_texture.fill( _colorEase.colorInt() );
float amp = P.p.audioIn.getEqAvgBand( _eqIndex ) * 0.15f;
if( amp < _lastAmp ) amp = _lastAmp * 0.9f;
if( _mode == 0 ) {
_texture.rect(0, 0, _texture.width * amp, _texture.height );
} else if( _mode == 1 ) {
_texture.rect(_texture.width, 0, -_texture.width * amp, _texture.height );
} else if( _mode == 2 ) {
_texture.rect(0, 0, _texture.width, _texture.height * amp );
} else if( _mode == 3 ) {
_texture.rect(0, _texture.height, _texture.width, -_texture.height * amp );
}
_lastAmp = amp;
}
}
|
[
"[email protected]"
] | |
087aae49e69dd9f9caedd1b1766c0feb0627f44a
|
c68f791005359cfec81af712aae0276c70b512b0
|
/0-unclassified/great.java
|
ac759f1e5dad0ad888d0e6906b4bde1df45dd487
|
[] |
no_license
|
luqmanarifin/cp
|
83b3435ba2fdd7e4a9db33ab47c409adb088eb90
|
08c2d6b6dd8c4eb80278ec34dc64fd4db5878f9f
|
refs/heads/master
| 2022-10-16T14:30:09.683632 | 2022-10-08T20:35:42 | 2022-10-08T20:35:42 | 51,346,488 | 106 | 46 | null | 2017-04-16T11:06:18 | 2016-02-09T04:26:58 |
C++
|
UTF-8
|
Java
| false | false | 1,946 |
java
|
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskA solver = new TaskA();
solver.solve(1, in, out);
out.close();
}
}
class TaskA {
static final int MOD = (int) (1e9 + 7);
public void solve(int testNumber, InputReader in, PrintWriter out) {
// type the code here
int a = 0, b = 0;
String aa = in.next();
String bb = in.next();
for(int i = 0; i < aa.length(); i += 2) {
String aai = aa.substring(i, i+1);
String aai1 = aa.substring(i+1, i+2);
String bbi = bb.substring(i, i+1);
String bbi1 = bb.substring(i+1, i+2);
if(aai.equals("[") && bbi1.equals(")")) a++;
else if(aai.equals("(") && bbi1.equals("<")) a++;
else if(aai.equals("8") && bbi1.equals("]")) a++;
else if(bbi.equals("[") && aai1.equals(")")) b++;
else if(bbi.equals("(") && aai1.equals("<")) b++;
else if(bbi.equals("8") && aai1.equals("]")) b++;
}
if(a > b)
out.println("TEAM 1 WINS");
else if(a < b)
out.println("TEAM 2 WINS");
else
out.println("TIE");
}
}
class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
}
|
[
"[email protected]"
] | |
d84cee1f6bd9b91961da65905f47d593c1c43fc5
|
32c128ad2d6367c734881c8adbc90d01cbf2afc4
|
/app/src/main/java/com/jiao/luo/interf/MyOnItemClickListener.java
|
7a405498210f022feb22bcdb3ff14a2924fb0f2d
|
[
"MIT"
] |
permissive
|
Crazy2008/Corner
|
571b99d6caf985550cd3cc750f67c4dfc948682c
|
8f3013ecf54f75d3497ce19c5eb4c278a96de23f
|
refs/heads/master
| 2021-07-13T06:55:41.089344 | 2017-10-16T03:25:35 | 2017-10-16T03:25:35 | 107,071,054 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 388 |
java
|
package com.jiao.luo.interf;
public interface MyOnItemClickListener {
void onItem(int pos);
/**
* 收藏
*
* @param pos
*/
void onFavItem(int pos);
/**
* 评论
*
* @param pos
*/
void onCommentItem(int pos);
/**
* 转发
*
* @param pos
*/
void onRelayItem(int pos);
}
|
[
"[email protected]"
] | |
795b059078b76bc0d2791566222492dda5354bbf
|
68999c22fa8dba4e16e5cb56eaa9a9f5f9847e15
|
/src/com/yoanaydavid/recetas/NuevoPasoActivity.java
|
6235cc2f5bd93e689ccad8f36f4c80b01c116902
|
[] |
no_license
|
david-lorenzo88/Recetas
|
879ee66d25a719a26fc1ebf9c95aef89573e54b9
|
97a97e8c93c26f49ef7110f790aa5bf23c38700c
|
refs/heads/master
| 2021-01-01T17:21:12.826563 | 2012-02-24T18:16:32 | 2012-02-24T18:16:32 | 3,468,859 | 1 | 1 | null | null | null | null |
ISO-8859-1
|
Java
| false | false | 7,137 |
java
|
package com.yoanaydavid.recetas;
import java.io.File;
import java.io.FileNotFoundException;
import com.yoanaydavid.recetas.java.Paso;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.Toast;
public class NuevoPasoActivity extends FragmentActivity implements
OnClickListener {
final static int NUEVO_PASO_ACTIVITY_CODE = 5;
final static int SELECT_PHOTO = 6;
final CharSequence[] items = { "Desde archivo", "Desde cámara" };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
NuevoPasoFragment npf = new NuevoPasoFragment(this);
getSupportFragmentManager().beginTransaction()
.add(android.R.id.content, npf).commit();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
NuevoPasoFragment npf = (NuevoPasoFragment) getSupportFragmentManager()
.findFragmentById(android.R.id.content);
if (requestCode != SELECT_PHOTO && resultCode == RESULT_OK) {
try {
// La camara devuelve -1 si foto OK y 0 si pulsamos back
// mCurrentPhotoPath ya tiene el path de la foto
Uri selectedImage = Uri.fromFile(new File(npf
.getmCurrentPhotoPath()));
Bitmap bm = decodeUri(selectedImage);
npf.setPic(bm, selectedImage.getPath());
npf.getImagenButton().setText("Cambiar Imagen");
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
/*
* npf.setPic(npf.getmCurrentPhotoPath());
*
* npf.getImagenButton().setText("Cambiar Imagen");
*/
}
else if (requestCode == SELECT_PHOTO && resultCode == RESULT_OK) {
try {
Uri selectedImage = data.getData();
Bitmap bm = decodeUri(selectedImage);
npf.setPic(bm, selectedImage.getPath());
npf.setmCurrentPhotoPath(getRealPathFromURI(selectedImage));
Log.i("test", npf.getmCurrentPhotoPath());
npf.getImagenButton().setText("Cambiar Imagen");
/*
* InputStream imageStream =
* getContentResolver().openInputStream( selectedImage); Bitmap
* yourSelectedImage = BitmapFactory .decodeStream(imageStream);
*/
} catch (FileNotFoundException ex) {
ex.printStackTrace();
}
}
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Button b = (Button) v;
switch (b.getId()) {
case R.id.imagenButton:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Selecciona una fuente");
builder.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int item) {
NuevoPasoFragment npf = (NuevoPasoFragment) getSupportFragmentManager()
.findFragmentById(android.R.id.content);
switch (item) {
case 0:
Intent photoPickerIntent = new Intent(
Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, SELECT_PHOTO);
// Desde archivo (Fragment)
// requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
/*
* ImagesBgFragment bgF = new ImagesBgFragment(
* RecetasActivity.this); FragmentTransaction ft =
* getSupportFragmentManager() .beginTransaction();
* ft.replace(R.id.detailsRecetas, bgF);
* ft.setTransition
* (FragmentTransaction.TRANSIT_FRAGMENT_FADE);
* ft.addToBackStack(null); ft.commit();
*/
/*
* Intent intent = new Intent(getBaseContext(),
* ImagesBgActivity.class);
* startActivityForResult(intent,
* NUEVO_PASO_ACTIVITY_CODE);
*/
break;
case 1:
// Desde camara (Intent)
npf.dispatchTakePictureIntent(NUEVO_PASO_ACTIVITY_CODE);
break;
}
}
});
AlertDialog alert = builder.create();
alert.show();
break;
case R.id.guardarPasoButton:
// Comprobamos que tenemos una descripcion del paso
NuevoPasoFragment np = (NuevoPasoFragment) getSupportFragmentManager()
.findFragmentById(android.R.id.content);
String desc = np.getTxtDescripcion().getText().toString().trim();
if (!desc.equals("")) {
// Ocultamos el teclado
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(np.getTxtDescripcion()
.getWindowToken(), 0);
// Guardamos los resultados y finalizamos
Intent intent = new Intent();
intent.putExtra("descripcion", desc);
if (np.getmCurrentPhotoPath() != null) {
intent.putExtra("path", np.getmCurrentPhotoPath());
}
setResult(RESULT_OK, intent);
finish();
} else {
Toast.makeText(getBaseContext(),
"¡Falta la descripción del paso!", Toast.LENGTH_LONG)
.show();
}
break;
}
}
private Bitmap decodeUri(Uri selectedImage) throws FileNotFoundException {
Display display = ((WindowManager) getBaseContext().getSystemService(
Context.WINDOW_SERVICE)).getDefaultDisplay();
// Decode image size
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeStream(
getContentResolver().openInputStream(selectedImage), null, o);
// The new size we want to scale to
final int REQUIRED_SIZE = (int) (display.getWidth() * 0.25);
// Find the correct scale value. It should be the power of 2.
int width_tmp = o.outWidth, height_tmp = o.outHeight;
int scale = 1;
while (true) {
if (width_tmp / 2 < REQUIRED_SIZE || height_tmp / 2 < REQUIRED_SIZE) {
break;
}
width_tmp /= 2;
height_tmp /= 2;
scale *= 2;
}
// Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
return BitmapFactory.decodeStream(
getContentResolver().openInputStream(selectedImage), null, o2);
}
// And to convert the image URI to the direct file system path of the image
// file
public String getRealPathFromURI(Uri contentUri) {
// can post image
String[] proj = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(contentUri, proj, // Which columns to
// return
null, // WHERE clause; which rows to return (all rows)
null, // WHERE clause selection arguments (none)
null); // Order-by clause (ascending by name)
int column_index = cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
}
|
[
"[email protected]"
] | |
1ef5713c63edf6b30cb0390b8782efc6ceff8161
|
e1eae0d59d7ee0c3e1fb38b9090fa5d5063d5f36
|
/week-03/day-04/src/Excercise01Counter.java
|
2434ae8bd13fc1281d4e34df9ad3cd8192a0d74c
|
[] |
no_license
|
green-fox-academy/FerencziSamu
|
146be55ebeb7bb81ea180645cfef5df981cb53fb
|
38cc2a21e13e71d52f65498ffe412a82b642ab86
|
refs/heads/master
| 2021-09-12T15:46:23.967435 | 2018-04-18T08:19:58 | 2018-04-18T08:19:58 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 324 |
java
|
public class Excercise01Counter {
// Write a recursive function that takes one parameter: n and counts down from n.
public static void main(String[] args) {
int n = 10;
counter(n);
}
public static int counter(int n){
if (n == 1) {
return 1;
} else {
return counter(n - 1);
}
}
}
|
[
"[email protected]"
] | |
df7c43f6b237b3befb432dbd42ff153f47243f5d
|
447520f40e82a060368a0802a391697bc00be96f
|
/apks/playstore_apps/com_idamob_tinkoff_android/source/ru/tinkoff/mb/api/entities/accounts/WalletBankAccount.java
|
7c410873edd8397e621ee831b0d36cc3f36bdeb2
|
[
"Apache-2.0"
] |
permissive
|
iantal/AndroidPermissions
|
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
|
d623b732734243590b5f004d167e542e2e2ae249
|
refs/heads/master
| 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 |
Apache-2.0
| 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null |
UTF-8
|
Java
| false | false | 1,602 |
java
|
package ru.tinkoff.mb.api.entities.accounts;
import com.google.common.a.j;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import java.io.Serializable;
import java.util.Arrays;
@DatabaseTable
public class WalletBankAccount
implements Serializable, c
{
@DatabaseField(foreign=true, foreignAutoCreate=true, foreignAutoRefresh=true)
public BaseBankAccount account;
@com.google.gson.a.c(a="id")
@DatabaseField(id=true)
public String id;
@com.google.gson.a.c(a="identificationState")
@DatabaseField
public String identificationState;
public WalletBankAccount() {}
public final String a()
{
return this.id;
}
public final void a(BaseBankAccount paramBaseBankAccount)
{
this.account = paramBaseBankAccount;
}
public final BaseBankAccount b()
{
return this.account;
}
public final b c()
{
return this.account.accountType;
}
public final boolean d()
{
return this.account.hidden;
}
public final boolean equals(Object paramObject)
{
if (this == paramObject) {}
do
{
return true;
if ((paramObject == null) || (getClass() != paramObject.getClass())) {
return false;
}
paramObject = (WalletBankAccount)paramObject;
} while ((j.a(this.id, paramObject.id)) && (j.a(this.identificationState, paramObject.identificationState)) && (j.a(this.account, paramObject.account)));
return false;
}
public final int hashCode()
{
return Arrays.hashCode(new Object[] { this.id, this.identificationState, this.account });
}
}
|
[
"[email protected]"
] | |
01e01144f1c6e98c4b66f6b653d397752832b0e5
|
8efa2aacaf2ec548ea8da52f7fadc52b207b1072
|
/test/com/test/utils/OauthTest.java
|
411ad792333ba16362b88a3b32c6f5d2b158c8bb
|
[] |
no_license
|
amonter/backend_peoplehunt
|
f4a44e0b3d81eec749d75a1680810c6c1074232e
|
9e356388b3bab37dd3bce7839d8e1481697d381d
|
refs/heads/master
| 2021-01-10T22:44:42.376510 | 2016-10-08T23:07:52 | 2016-10-08T23:07:52 | 70,361,948 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,514 |
java
|
package com.test.utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import org.scribe.builder.ServiceBuilder;
import org.scribe.model.Token;
import org.scribe.oauth.OAuthService;
public class OauthTest {
public static void main(String[] args){
final String requestTokenUrl = "https://api.efactor.com/oauth/request_token";
final String authorizeUrl = "https://api.efactor.com/oauth/authorize";
final String accessTokenUrl = "https://api.efactor.com/oauth/access_token";
// All the pairs here match one another
final List<String> requests = new ArrayList<String>();
//these will just match
//requests.add("http://127.0.0.1:7000/rest/pairinghuntmatching/?myhuntid=54108&bundleId=162&selectedtags=10039");
requests.add("https://api.efactor.com/oauth/request_token");
//requests.add("http://127.0.0.1:7000/rest/pairinghuntmatching/?myhuntid=5995&bundleId=162&selectedtags=10041");//pair one match
for (final String theRequest : requests) {
new Thread(new Runnable(){
@Override
public void run() {
try {
OAuthService service = new ServiceBuilder()
.provider(EfactorApi.class)
.apiKey("a52bf1268fea0843b3859e221aed586a04fd600d2")
.apiSecret("6ab9789a2e17103812215a04070fa72d")
.callback("http://crowdscanner.com")
.debug() // here!
.build();
Token requestToken = service.getRequestToken();
String authUrl = service.getAuthorizationUrl(requestToken);
System.out.println(authUrl+"?oauth_token="+requestToken.getToken());
/*
URL address = new URL(theRequest);
URLConnection conn = address.openConnection();
// Get the response -this has to be here
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
System.out.println(line);
}
rd.close();
*/
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}).start();
}
}
}
|
[
"[email protected]"
] | |
5d8b07977d28dc06208d84239917c6a413aa0e46
|
88068fae0d66ffa63ad74e41a5b8c1bffa1a3fca
|
/src/com/example/tourism/Hotels_aqaba4.java
|
8e634f10c16d150294fdbc12fc13c5953f06d2a3
|
[] |
no_license
|
yalakhras/Tourism
|
b3c31402569d45ca8579d88cb5ea1df70085cb05
|
afc8ec61395395f8a4fd547a4845ba6d32d56c8f
|
refs/heads/main
| 2023-08-18T16:24:04.299912 | 2021-10-09T23:47:00 | 2021-10-09T23:47:00 | 415,442,533 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,423 |
java
|
package com.example.tourism;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckedTextView;
public class Hotels_aqaba4 extends Activity {
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.hotels_aqaba4);
// hotel 1
CheckedTextView t1=(CheckedTextView) findViewById(R.id.checkedTextView2_haq4);
t1.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent web1=new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.doubletree.com"));
startActivity(web1);
}
});
final CheckedTextView e1=(CheckedTextView) findViewById(R.id.checkedTextView3_haq4);
e1.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent email1=new Intent(Hotels_aqaba4.this,Contact_us.class);
email1.putExtra("double Tree", e1.getText().toString());
startActivity(email1);
}
});
// hotel 2
CheckedTextView t2=(CheckedTextView) findViewById(R.id.checkedTextView6_haq4);
t2.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent web2=new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.marinaplazahotel.com"));
startActivity(web2);
}
});
final CheckedTextView e2=(CheckedTextView) findViewById(R.id.checkedTextView7_haq4);
e2.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent email2=new Intent(Hotels_aqaba4.this,Contact_us.class);
email2.putExtra("marina", e2.getText().toString());
startActivity(email2);
}
});
CheckedTextView p2=(CheckedTextView) findViewById(R.id.checkedTextView8_haq4);
p2.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent phone2=new Intent(Intent.ACTION_DIAL,Uri.parse("tel: 0096232092900"));
startActivity(phone2);
}
});
}
}
|
[
"[email protected]"
] | |
0d9d7510c507eef0e93f66211b4edbcc3f3915ba
|
5bc36cfea194a51e16aab28bd3c7a40f04f87a92
|
/app/src/main/java/com/attendance/ui/fragments/LoginProcess.java
|
21aba27e771daf045cdf6d506e65422f79b05859
|
[
"MIT"
] |
permissive
|
MonsterTechnoGit/Attendance-App
|
4c923e10f83ae0b37170dc1e870047a172fc88e8
|
516088ee01e8537de5916002c5fc2dd3c47c16c8
|
refs/heads/master
| 2020-03-25T23:53:25.830020 | 2018-03-30T14:44:36 | 2018-03-30T14:44:36 | 144,297,617 | 2 | 2 | null | 2018-08-10T14:39:29 | 2018-08-10T14:39:28 | null |
UTF-8
|
Java
| false | false | 1,519 |
java
|
package com.attendance.ui.fragments;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.ImageView;
import com.attendance.R;
import com.attendance.base.BaseFragment;
import com.attendance.ui.activities.MainActivity;
/**
* Created by coolalien on 17,March,2017
*/
public class LoginProcess extends BaseFragment {
private ImageView teacher;
/**
* instance of this class
* @return
*/
public static LoginProcess getInstance(){
return new LoginProcess();
}
@Override
protected int layoutId() {
return R.layout.login_process;
}
@Override
protected void ui(View rootview) {
teacher = (ImageView) rootview.findViewById(R.id.teacher_login);
}
@Override
protected void function() {
teacher.setOnClickListener(onClick);
}
@Override
protected Fragment setfragment() {
return CommonFragment.getInstance();
}
@Override
protected int setContainerId() {
return ((MainActivity) getActivity()).setContainerId();
}
@Override
public void FrgamentLoader() {
super.FrgamentLoader();
}
/**
* OnClickListener
*/
private View.OnClickListener onClick = new View.OnClickListener() {
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.teacher_login:
FrgamentLoader();
break;
}
}
};
}
|
[
"[email protected]"
] | |
437e4430447a8979485de87351c5bb9dc545a398
|
e593d0a760d469ebcd7eec1c36470f2480262e22
|
/restful-web-services/src/main/java/com/vyom/rest/basic/auth/AuthenticationBean.java
|
b59b510b798f89abef3d729d24ed44613437a5df
|
[] |
no_license
|
vyom-shah/Angular-Sprint-boot-TODO-Application
|
921f28a2b5a1734dca5d4a9f68afdabd2e7bf1c9
|
72cdd81fc58d7b50d0b7048d66f9d73415bbea63
|
refs/heads/master
| 2022-11-10T06:34:08.482855 | 2020-06-27T04:55:14 | 2020-06-27T04:55:14 | 269,433,577 | 0 | 0 | null | 2020-06-04T19:28:11 | 2020-06-04T18:21:38 |
TypeScript
|
UTF-8
|
Java
| false | false | 404 |
java
|
package com.vyom.rest.basic.auth;
public class AuthenticationBean {
private String message;
public AuthenticationBean(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
return String.format("HelloWorldBean [message=%s]", message);
}
}
|
[
"[email protected]"
] | |
917afff1a7cfd3925b3f23516865659b0eda89bc
|
3ef55e152decb43bdd90e3de821ffea1a2ec8f75
|
/large/module0288_public/tests/unittests/src/java/module0288_public_tests_unittests/a/IFoo0.java
|
551b5c17ce7c0dda51cd26a08fe4e42749f8df5a
|
[
"BSD-3-Clause"
] |
permissive
|
salesforce/bazel-ls-demo-project
|
5cc6ef749d65d6626080f3a94239b6a509ef145a
|
948ed278f87338edd7e40af68b8690ae4f73ebf0
|
refs/heads/master
| 2023-06-24T08:06:06.084651 | 2023-03-14T11:54:29 | 2023-03-14T11:54:29 | 241,489,944 | 0 | 5 |
BSD-3-Clause
| 2023-03-27T11:28:14 | 2020-02-18T23:30:47 |
Java
|
UTF-8
|
Java
| false | false | 885 |
java
|
package module0288_public_tests_unittests.a;
import java.nio.file.*;
import java.sql.*;
import java.util.logging.*;
/**
* Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
* labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
* Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
*
* @see javax.annotation.processing.Completion
* @see javax.lang.model.AnnotatedConstruct
* @see javax.management.Attribute
*/
@SuppressWarnings("all")
public interface IFoo0<I> extends java.util.concurrent.Callable<I> {
javax.naming.directory.DirContext f0 = null;
javax.net.ssl.ExtendedSSLSession f1 = null;
javax.rmi.ssl.SslRMIClientSocketFactory f2 = null;
String getName();
void setName(String s);
I get();
void set(I e);
}
|
[
"[email protected]"
] | |
06d46dc8af47dbf51a7e3a3c675c47cdaf74775f
|
36f867480c74ead64e94e659a8ebce757b95ffa9
|
/src/main/java/ru/kruglov/task8/ClassCounter/Main.java
|
a9a84141c8a20ec5fe4a0e7fd1a787baba00ac84
|
[] |
no_license
|
kirmizi-melek/stc
|
0211b17eb61ff198f247f0acdcd220f151c1c922
|
2e12ca6e7e8e1c3f1c64f1dd909bbf0c4b4e526b
|
refs/heads/master
| 2022-05-20T14:18:41.770508 | 2019-12-06T16:21:41 | 2019-12-06T16:21:41 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 783 |
java
|
package ru.kruglov.task8.ClassCounter;
public class Main {
public static void main(String[] args) throws Throwable {
// Add five instances of a class
Class firstClass = new Class();
Class secondClass = new Class();
Class thirdClass = new Class();
Class fourthClass = new Class();
Class fifthClass = new Class();
// get count of instances
System.out.println(Class.getObjectsCount()); // 5
// delete one instance
fifthClass.finalize();
// get count of instances
System.out.println(Class.getObjectsCount()); // 4
// Add one more instance
Class sixthClass = new Class();
// get count of instances
System.out.println(Class.getObjectsCount()); //5
}
}
|
[
"[email protected]"
] | |
e7728f60fa23568ff3d3d6fe85a1a08eaed28a32
|
31402a971da22703082d23740996f2fcd5719505
|
/src/edu/nju/desserthouse/dao/impl/OrderDetailDaoImpl.java
|
4d15c2a68cce830b894f9629ca75973fa314b312
|
[] |
no_license
|
ly1996/DessertHouse
|
a12dd281c2c9c0934fd065d5a281a972937ca7f7
|
e6475740b5042035bceace2c26cc4fdcafd95095
|
refs/heads/master
| 2021-01-17T23:03:10.670175 | 2016-06-20T15:36:52 | 2016-06-20T15:36:52 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,862 |
java
|
package edu.nju.desserthouse.dao.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import edu.nju.desserthouse.dao.BaseDao;
import edu.nju.desserthouse.dao.OrderDetailDao;
import edu.nju.desserthouse.model.OrderDetail;
import edu.nju.desserthouse.model.hci.OrderDetailVO;
@Repository
public class OrderDetailDaoImpl implements OrderDetailDao{
@Autowired
private BaseDao baseDao;
public BaseDao getBaseDao() {
return baseDao;
}
public void setBaseDao(BaseDao baseDao) {
this.baseDao = baseDao;
}
@Override
public void save(OrderDetail orderDetail) {
try {
baseDao.save(orderDetail);
}catch (Exception e) {
e.printStackTrace();
}
}
@Override
public OrderDetail find(int id) {
OrderDetail orderDetail = (OrderDetail)baseDao.load(OrderDetail.class, id);
return orderDetail;
}
@Override
public List<OrderDetail> getAllOrderDetailList() {
@SuppressWarnings("unchecked")
List<OrderDetail> list = baseDao.getAllList(OrderDetail.class);
return list;
}
@Override
public List<OrderDetailVO> getAllOrderDetailList(int oid) {
String sql = "SELECT od.odid,od.oid,od.did,od.price,od.amount,d.name,d.image FROM desserthouse.orderdetail od join dessert d on od.did=d.did where od.oid="+oid;
List<Object[]> objects = baseDao.querySQL(sql);
List<OrderDetailVO> list = new ArrayList<OrderDetailVO>();
for (Object[] obj : objects) {
OrderDetailVO od = new OrderDetailVO();
od.setOdid((int) obj[0]);
od.setOid((int)obj[1]);
od.setDid((int) obj[2]);
od.setPrice((double) obj[3]);
od.setAmount((int) obj[4]);
od.setDname((String) obj[5]);
od.setImage((String) obj[6]);
list.add(od);
}
return list;
}
}
|
[
"[email protected]"
] | |
fac06caad3c709c5f1a69c3d6b1d56e131fc93d8
|
83e58da0c9f5d4df57f1231636b8cf0267bee5b9
|
/SpringExamples/src/main/java/com/bridgelabz/nonstringcollection/Question.java
|
042308e6162affe277d9ebadcbfccfe5f71548df
|
[] |
no_license
|
niksm96/SpringHibernate
|
c6a2ddcdeea37b6ac1050f85682123907e7e76f6
|
4bccaf4a84acce2bb5db4847c6c1bb5ff2174243
|
refs/heads/master
| 2020-04-19T23:43:28.518013 | 2019-01-31T13:31:17 | 2019-01-31T13:31:17 | 168,503,546 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 641 |
java
|
package com.bridgelabz.nonstringcollection;
import java.util.Iterator;
import java.util.List;
public class Question {
private int id;
private String name;
private List<Answers> answers;
public Question() {}
public Question(int id, String name, List<Answers> answers) {
super();
this.id = id;
this.name = name;
this.answers = answers;
}
public void displayInfo(){
System.out.println(id+" "+name);
System.out.println("answers are:");
Iterator<Answers> itr=answers.iterator();
while(itr.hasNext()){
System.out.println(itr.next());
}
}
}
|
[
"[email protected]"
] | |
698a9540306168946bf3e0b4251337e5f4bb55f9
|
30f89185ff34c8b6c838193eb7df9117aaab9482
|
/ssl_fido_client-master/ssl_fido_client-master/newfido/src/main/java/com/example/newfido/client/ErrorCode.java
|
c9356b806a91a3d5ca0f985967953c0107e10d2c
|
[
"MIT"
] |
permissive
|
giannismakro/FIDO_UAF_Intergration_with_OpenID
|
ce044fd284b3ab7e023516198b84cc33089c2d8a
|
8a3a84b80034d7477c2982ee3d02a475ec246a27
|
refs/heads/master
| 2023-04-09T08:59:14.629216 | 2022-01-23T22:20:01 | 2022-01-23T22:20:01 | 399,498,720 | 0 | 0 |
MIT
| 2022-01-23T22:17:14 | 2021-08-24T14:36:42 |
JavaScript
|
UTF-8
|
Java
| false | false | 600 |
java
|
package com.example.newfido.client;
/**
* Created by sorin.teican on 03-Mar-17.
*/
public class ErrorCode {
public static final short NO_ERROR = 0x0;
public static final short WAIT_USER_ACTION = 0x1;
public static final short INSECURE_TRANSPORT = 0x2;
public static final short USER_CANCELLED = 0x3;
public static final short UNSUPPORTED_VERSION = 0x4;
public static final short NO_SUITABLE_AUTHENTICATOR = 0x5;
public static final short PROTOCOL_ERROR = 0x6;
public static final short UNNTRUSTED_FACET_ID = 0x7;
public static final short UNKNOWN = 0xFF;
}
|
[
"[email protected]"
] | |
a4dc3db1df33869b0a9b29e1105f789c2920acd7
|
0652c5f6c99b15daef8a2e026fcd30747bf9a39a
|
/src/main/java/com/flipkartHybrid/Utility/DataUtil.java
|
5f5e4abdce9e3b28dfe2611ab10aa32c3334dd2c
|
[] |
no_license
|
SuryahGit/Filpkart-HybridFramework
|
f71d732692f68114645bf1d9c4154031ada52650
|
92471beaf71b660623b14064a20372996799d3b2
|
refs/heads/master
| 2023-07-24T03:01:32.213367 | 2019-08-16T13:11:46 | 2019-08-16T13:11:46 | 101,334,887 | 0 | 0 | null | 2023-07-16T04:19:18 | 2017-08-24T20:25:14 |
HTML
|
UTF-8
|
Java
| false | false | 1,983 |
java
|
package com.flipkartHybrid.Utility;
import java.util.Hashtable;
public class DataUtil {
public static Object[][] getData(Xls_Reader xls, String testcaseName) {
int row = xls.getRowCount(Constants.Data_Sheet);
System.out.println(row);
int rowStartsfrom = 0;
while (!xls.getCellData(Constants.Data_Sheet, 0, rowStartsfrom).equals(testcaseName)) {
rowStartsfrom++;
}
System.out.println(rowStartsfrom);
int DatastartsFrom = rowStartsfrom + 2;
int colStartsFrom = rowStartsfrom + 1;
int rows = 0;
while (!xls.getCellData(Constants.Data_Sheet, 0, DatastartsFrom + rows).equals("")) {
rows++;
}
System.out.println("Number of Datas " + rows);
int col = 0;
while (!xls.getCellData(Constants.Data_Sheet, col, colStartsFrom).equals("")) {
col++;
}
Object[][] obj = new Object[rows][1];
int rNums = 0;
System.out.println("Number of Cols " + col);
for (int rNum = DatastartsFrom; rNum < DatastartsFrom + rows; rNum++) {
Hashtable<String, String> table = new Hashtable<String, String>();
for (int cNum = 0; cNum < col; cNum++) {
String Keys = xls.getCellData(Constants.Data_Sheet, cNum, colStartsFrom);
String Value = xls.getCellData(Constants.Data_Sheet, cNum, rNum);
table.put(Keys, Value);
// obj[rNums][cNum] = xls.getCellData(sheetName, cNum, rNum);
// System.out.print(xls.getCellData(sheetName, cNum, rNum));
}
obj[rNums][0] = table;
rNums++;
}
return obj;
}
public static boolean isTestCaseRunnable(Xls_Reader xls, String testcaseName)
{
int row = xls.getRowCount(Constants.TestCases_Sheet);
for(int rNum=2; rNum<row;rNum++)
{
String TCName = xls.getCellData(Constants.TestCases_Sheet, Constants.TCID_Col, rNum);
if(TCName.equals(testcaseName))
{
String Runmode = xls.getCellData(Constants.TestCases_Sheet, Constants.Runmode_Col, rNum);
if(Runmode.equals("N"))
{
return true;
}
else
{
return false;
}
}
}
return true;
}
}
|
[
"[email protected]"
] | |
c497601b6d7f7c384398a35eab506aa68ffbda60
|
e502af8641080b1e9289aa3bc5647fea803db94f
|
/src/day0228/Plane.java
|
0eadb9f9f89b1d7eeb6ae42c04fcd434a4018809
|
[] |
no_license
|
crane1/Java_Study
|
a16e633e810ae92199c80f91f48c7fb22fdf5cdc
|
092e0c8cb69479582a320d0b0cb3a6ae61b90b0e
|
refs/heads/master
| 2021-01-20T11:44:20.869886 | 2017-04-06T12:13:46 | 2017-04-06T12:13:46 | 82,632,917 | 0 | 0 | null | null | null | null |
WINDOWS-1252
|
Java
| false | false | 138 |
java
|
package day0228;
public class Plane implements CanFly {
@Override
public void fly() {
System.out.println("·É»úÔÚ·É");
}
}
|
[
"[email protected]"
] | |
10ab71d9c42c284a0c23a5bfed48e85d6de68538
|
8a54e1c1ba300812528a42c4c588f7377ad303a2
|
/lottie/src/main/java/com/airbnb/lottie/model/content/Repeater.java
|
e5f89b1dfa6511661bbaa1c7b0352ac7299ded9f
|
[] |
no_license
|
niplus/obex
|
47493c87aa3b1bd0d411fdd060ad191181b909c8
|
b75de893543f60a0742cae64a9c139167f1fa677
|
refs/heads/master
| 2023-06-08T19:37:54.074589 | 2021-05-08T05:56:26 | 2021-05-08T05:56:26 | 364,802,048 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,277 |
java
|
package com.airbnb.lottie.model.content;
import androidx.annotation.Nullable;
import com.airbnb.lottie.LottieDrawable;
import com.airbnb.lottie.animation.content.Content;
import com.airbnb.lottie.animation.content.RepeaterContent;
import com.airbnb.lottie.model.animatable.AnimatableFloatValue;
import com.airbnb.lottie.model.animatable.AnimatableTransform;
import com.airbnb.lottie.model.layer.BaseLayer;
public class Repeater implements ContentModel {
private final String name;
private final AnimatableFloatValue copies;
private final AnimatableFloatValue offset;
private final AnimatableTransform transform;
public Repeater(String name, AnimatableFloatValue copies, AnimatableFloatValue offset,
AnimatableTransform transform) {
this.name = name;
this.copies = copies;
this.offset = offset;
this.transform = transform;
}
public String getName() {
return name;
}
public AnimatableFloatValue getCopies() {
return copies;
}
public AnimatableFloatValue getOffset() {
return offset;
}
public AnimatableTransform getTransform() {
return transform;
}
@Nullable
@Override public Content toContent(LottieDrawable drawable, BaseLayer layer) {
return new RepeaterContent(drawable, layer, this);
}
}
|
[
"[email protected]"
] | |
c0c7ad8fff6d4200c8d1d8c87b358dd18c240bcd
|
cf5b1b3c0b318e26a8b9ba0cc1d5b4a211769754
|
/Dodatne naloge/dodatneNaloge_izhodisca/sklop05_razrediInObjekti/naloga04_dopolnitveRazredaOseba/Test01.java
|
d3a758685dfc5a7a47baf42679985523f9fefc9d
|
[] |
no_license
|
gstefanic/OP
|
9e563e4ad6ffd70720bc2803d2571c4b4e3b657b
|
c8065646cf5a15ba3db2e18e13713981c39a7103
|
refs/heads/master
| 2021-01-01T04:00:45.629126 | 2017-01-06T07:38:09 | 2017-01-06T07:38:09 | 77,276,426 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,236 |
java
|
public class Test01 {
public static void main(String[] args) {
Oseba os11 = new Oseba("Jožef", "Pogačnik", 'M', 1921);
Oseba os12 = new Oseba("Marija", "Pogačnik", 'Z', 1928);
Oseba os13 = new Oseba("France", "Kotnik", 'M', 1932);
Oseba os14 = new Oseba("Ivana", "Kotnik", 'Z', 1931);
Oseba os15 = new Oseba("Anton", "Zajc", 'M', 1922);
Oseba os21 = new Oseba("Marjan", "Pogačnik", 'M', 1946, os11, os12);
Oseba os22 = new Oseba("Dana", "Pogačnik", 'Z', 1950);
Oseba os23 = new Oseba("Milan", "Smole", 'M', 1953);
Oseba os24 = new Oseba("Metka", "Smole", 'Z', 1953);
Oseba os25 = new Oseba("Zvone", "Kotnik", 'M', 1956, os13, os14);
Oseba os26 = new Oseba("Tanja", "Kotnik", 'Z', 1954);
Oseba os27 = new Oseba("Branka", "Zajc", 'Z', 1952, os15, os14);
Oseba os31 = new Oseba("Dejan", "Pogačnik", 'M', 1973, os21, os22);
Oseba os32 = new Oseba("Mojca", "Pogačnik", 'Z', 1977, os23, os24);
Oseba os33 = new Oseba("Miha", "Smole", 'M', 1978, os23, os24);
Oseba os34 = new Oseba("Neža", "Smole", 'Z', 1980, os25, os26);
Oseba os35 = new Oseba("Aleš", "Kotnik", 'M', 1982, os25, os26);
Oseba os36 = new Oseba("Jana", "Kotnik", 'Z', 1981);
Oseba os41 = new Oseba("Rok", "Pogačnik", 'M', 2003, os31, os32);
Oseba os42 = new Oseba("Eva", "Pogačnik", 'Z', 2006, os31, os32);
Oseba os43 = new Oseba("Gal", "Smole", 'M', 2009, os33, os34);
Oseba os44 = new Oseba("Maj", "Kotnik", 'M', 2010, os35, os36);
Oseba os45 = new Oseba("Nika", "Kotnik", 'Z', 2012, os35, os36);
System.out.println( os11.ocetovskaGeneracijskaRazlika(os31) );
System.out.println( os11.ocetovskaGeneracijskaRazlika(os41) );
System.out.println( os13.ocetovskaGeneracijskaRazlika(os44) );
System.out.println( os23.ocetovskaGeneracijskaRazlika(os43) );
System.out.println( os26.ocetovskaGeneracijskaRazlika(os26) );
System.out.println( os31.ocetovskaGeneracijskaRazlika(os21) );
System.out.println( os42.ocetovskaGeneracijskaRazlika(os21) );
System.out.println( os44.ocetovskaGeneracijskaRazlika(os13) );
}
}
|
[
"[email protected]"
] | |
adaf313503b5df67d97b5c4e2171e13afb1a1319
|
4d90a6ab9f3d9ed0fe78202b19c79696f8ff2f08
|
/app/src/main/java/com/rarosa/mpandey/kuberjobs/operations/AddUser.java
|
d3e77e6ebd94404e0f9d8a441d651e2e124a64fa
|
[] |
no_license
|
saurabgrt/kuberjobs
|
9fb26b7aedaf3a18e260a6c27cfe1b5907a7b48b
|
9445af6c025ab372d767cb5d7cb171b1d379eef3
|
refs/heads/master
| 2020-08-02T19:45:39.651502 | 2019-09-28T18:10:48 | 2019-09-28T18:10:48 | 211,485,031 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,225 |
java
|
package com.rarosa.mpandey.kuberjobs.operations;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;
import com.rarosa.mpandey.kuberjobs.activities.BackendActivity;
import com.rarosa.mpandey.kuberjobs.model.User;
public class AddUser extends AppCompatActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = this.getIntent();
Bundle extras = intent.getExtras();
String name = extras.getString("ADD-NAME-ID");
String email = extras.getString("ADD-EMAIL-ID");
String password = extras.getString("ADD-PASSWORD-ID");
String phone = extras.getString("ADD-PHONE-ID");
// Add only if user does not exist before
BackendActivity.getBackendActivity().add(name, email, phone, password);
/* On succesful addition in database */
User user = User.getUser();
user.setName(name);
user.setEmail(email);
user.setPhoneNumber(phone);
user.setPassword(password);
Toast.makeText(getApplicationContext(), "User added to simple DB", Toast.LENGTH_SHORT).show();
}
}
|
[
"[email protected]"
] | |
269b172c83dd264393a78b4338baa12e481e2ae2
|
8ef2d899e92ed9b101a2db0f3a5c9a9408526de2
|
/Meera has passed her exam or not/Main.java
|
0eb4e5304ff0f232472aeeed1fa1d8879b63a647
|
[] |
no_license
|
AS2468/Playground
|
a9cf298748e6cf6a9f46dfbaf5bba3b1fdd88d6d
|
aaa60a5448ed981adad28717b4ba27d6f56e1a7e
|
refs/heads/master
| 2022-06-11T19:03:58.921235 | 2020-05-06T07:21:39 | 2020-05-06T07:21:39 | 258,457,043 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 280 |
java
|
#include<iostream>
using namespace std;
int main()
{
int i,n,s;
cin>>n;
int a[n];
for(i=0;i<n;i++)
cin>>a[i];
cin>>s;
for(i=0;i<n;i++)
{
if(a[i]==s)
{
cout<<"She passed her exam";
break;
}
if(i==n-1)
cout<<"She failed";
}
}
|
[
"[email protected]"
] | |
07945e1f4f6dd0a54f444390d4f06f86e619f42c
|
6a4cc0d21ecf55eaec359611983e8818983ecb98
|
/TestPoc/src/booleanEg/BooleanEg1.java
|
6e88347af4e6998c199ed44e2d71040ba25eee3d
|
[] |
no_license
|
Venkatesh-Azhagiri/Java-Examples
|
90f60220534d79081102addaff97de8da9d2636b
|
e0b2eb18a6e094457ebcd4c3c3ead0ce969219c5
|
refs/heads/master
| 2022-12-29T23:00:46.475910 | 2020-10-14T16:47:58 | 2020-10-14T16:47:58 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 208 |
java
|
package booleanEg;
public class BooleanEg1 {
public static void main(String[] args) {
boolean var = false;
if(var=true){
System.out.println("if");
}else{
System.out.println("else");
}
}
}
|
[
"[email protected]"
] | |
f723f41c4e8907c065c642ebaaeecda9ad674930
|
372a87bb0057207ec58e7ec2a1200d2ae9167967
|
/leecode/src/main/java/com/baka/code/ClimbingStairs.java
|
d58ac8f1f9b4ed75457f84185605f8d255b934ae
|
[] |
no_license
|
threedbag/design
|
38e21853946d0f053acd6b498e05c6431efc7975
|
d62cb799f0b797d5f7d5699008b6b523b34eb315
|
refs/heads/master
| 2020-04-08T06:36:55.005941 | 2019-02-03T05:52:08 | 2019-02-03T05:52:08 | 159,102,669 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,410 |
java
|
package com.baka.code;
//く__,.ヘヽ. / ,ー、 〉
// \ ', !-─‐-i / /´
// /`ー' L//`ヽ、
// / /, /| , , ', ????????
// イ / /-‐/ i L_ ハ ヽ! i ?BUG哪来的呢?
// レ ヘ 7イ`ト レ'ァ-ト、!ハ| | ???????
// !,/7 '0' ´0iソ| |
// |.从" _ ,,,, / |./ |
// レ'| i>.、,,__ _,.イ / .i |
// レ'| | / k_7_/レ'ヽ, ハ. |
// | |/i 〈|/ i ,.ヘ | i |
// .|/ / i: ヘ! \ |
// kヽ>、ハ _,.ヘ、 /、!
// !'〈//`T´', \ `'7'ーr'
// レ'ヽL__|___i,___,ンレ|ノ
// ト-,/ |___./
// 'ー' !_,.:
/**
* @ProjectName: design
* @Package: com.baka.code
* @ClassName: ClimbingStairs
* @Description: 假设你正在爬楼梯。需要 n 阶你才能到达楼顶。
每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢?
* @Author: 唐朝
* @CreateDate: 2018/12/1 21:25
* @UpdateUser: 更新者
* @UpdateDate: 2018/12/1 21:25
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
public class ClimbingStairs {
//最后一步爬一个台阶的可能加上最后一步爬俩台阶的可能
/**
* 递归个数太多导致超时
* @param n
* @return
*/
public static int climbStairs(int n) {
if (n == 1) {
return 1;
}else if (n<=0){
return 1;
}
return climbStairs(n-1)+climbStairs(n-2);
}
public static int climbStairs2(int n) {
if (n ==1) {
return 1;
}else if (n==2){
return 2;
}
int[] ints = new int[n];
ints[0]=1;
ints[1]=2;
for (int i = 2; i < ints.length; i++) {
ints[i]=ints[i-1]+ints[i-2];
}
return ints[n-1];
}
public static void main(String[] args) {
System.out.println(climbStairs2(44));
}
}
|
[
"[email protected]"
] | |
5134ccc2ea1b714275dc4bf165a774322cccc3a8
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/24/24_14e47353330fcac0a337d8fd26029840ca8af4d7/FileMetaClass/24_14e47353330fcac0a337d8fd26029840ca8af4d7_FileMetaClass_s.java
|
47118480f646d76ef1b631ce53803cfb181b9d98
|
[] |
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 | 25,863 |
java
|
/***** BEGIN LICENSE BLOCK *****
* Version: CPL 1.0/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Common Public
* License Version 1.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.eclipse.org/legal/cpl-v10.html
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* Copyright (C) 2005 Thomas E Enebo <[email protected]>
* Copyright (C) 2005 Charles O Nutter <[email protected]>
* Copyright (C) 2006 Ola Bini <[email protected]>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the CPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the CPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****/
package org.jruby.runtime.builtin.meta;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.util.regex.Pattern;
import org.jruby.IRuby;
import org.jruby.RubyArray;
import org.jruby.RubyClass;
import org.jruby.RubyDir;
import org.jruby.RubyFile;
import org.jruby.RubyFileStat;
import org.jruby.RubyFileTest;
import org.jruby.RubyFixnum;
import org.jruby.RubyInteger;
import org.jruby.RubyModule;
import org.jruby.RubyNumeric;
import org.jruby.RubyString;
import org.jruby.RubyTime;
import org.jruby.runtime.Arity;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.IOModes;
import org.jruby.util.JRubyFile;
import org.jruby.util.PrintfFormat;
import org.jruby.util.collections.SinglyLinkedList;
public class FileMetaClass extends IOMetaClass {
private static final int FNM_NOESCAPE = 1;
private static final int FNM_PATHNAME = 2;
private static final int FNM_DOTMATCH = 4;
private static final int FNM_CASEFOLD = 8;
public static final PrintfFormat OCTAL_FORMATTER = new PrintfFormat("%o");
public FileMetaClass(IRuby runtime) {
super("File", RubyFile.class, runtime.getClass("IO"));
}
public FileMetaClass(String name, RubyClass superClass, SinglyLinkedList parentCRef) {
super(name, RubyFile.class, superClass, parentCRef);
}
protected class FileMeta extends Meta {
protected void initializeClass() {
IRuby runtime = getRuntime();
RubyString separator = runtime.newString("/");
separator.freeze();
defineConstant("SEPARATOR", separator);
defineConstant("Separator", separator);
RubyString altSeparator = runtime.newString(File.separatorChar == '/' ? "\\" : "/");
altSeparator.freeze();
defineConstant("ALT_SEPARATOR", altSeparator);
RubyString pathSeparator = runtime.newString(File.pathSeparator);
pathSeparator.freeze();
defineConstant("PATH_SEPARATOR", pathSeparator);
// TODO: These were missing, so we're not handling them elsewhere?
setConstant("BINARY", runtime.newFixnum(32768));
setConstant("FNM_NOESCAPE", runtime.newFixnum(FNM_NOESCAPE));
setConstant("FNM_CASEFOLD", runtime.newFixnum(FNM_CASEFOLD));
setConstant("FNM_DOTMATCH", runtime.newFixnum(FNM_DOTMATCH));
setConstant("FNM_PATHNAME", runtime.newFixnum(FNM_PATHNAME));
// Create constants for open flags
setConstant("RDONLY", runtime.newFixnum(IOModes.RDONLY));
setConstant("WRONLY", runtime.newFixnum(IOModes.WRONLY));
setConstant("RDWR", runtime.newFixnum(IOModes.RDWR));
setConstant("CREAT", runtime.newFixnum(IOModes.CREAT));
setConstant("EXCL", runtime.newFixnum(IOModes.EXCL));
setConstant("NOCTTY", runtime.newFixnum(IOModes.NOCTTY));
setConstant("TRUNC", runtime.newFixnum(IOModes.TRUNC));
setConstant("APPEND", runtime.newFixnum(IOModes.APPEND));
setConstant("NONBLOCK", runtime.newFixnum(IOModes.NONBLOCK));
// Create constants for flock
setConstant("LOCK_SH", runtime.newFixnum(RubyFile.LOCK_SH));
setConstant("LOCK_EX", runtime.newFixnum(RubyFile.LOCK_EX));
setConstant("LOCK_NB", runtime.newFixnum(RubyFile.LOCK_NB));
setConstant("LOCK_UN", runtime.newFixnum(RubyFile.LOCK_UN));
// Create Constants class
RubyModule constants = defineModuleUnder("Constants");
// TODO: These were missing, so we're not handling them elsewhere?
constants.setConstant("BINARY", runtime.newFixnum(32768));
constants.setConstant("FNM_NOESCAPE", runtime.newFixnum(1));
constants.setConstant("FNM_CASEFOLD", runtime.newFixnum(8));
constants.setConstant("FNM_DOTMATCH", runtime.newFixnum(4));
constants.setConstant("FNM_PATHNAME", runtime.newFixnum(2));
// Create constants for open flags
constants.setConstant("RDONLY", runtime.newFixnum(IOModes.RDONLY));
constants.setConstant("WRONLY", runtime.newFixnum(IOModes.WRONLY));
constants.setConstant("RDWR", runtime.newFixnum(IOModes.RDWR));
constants.setConstant("CREAT", runtime.newFixnum(IOModes.CREAT));
constants.setConstant("EXCL", runtime.newFixnum(IOModes.EXCL));
constants.setConstant("NOCTTY", runtime.newFixnum(IOModes.NOCTTY));
constants.setConstant("TRUNC", runtime.newFixnum(IOModes.TRUNC));
constants.setConstant("APPEND", runtime.newFixnum(IOModes.APPEND));
constants.setConstant("NONBLOCK", runtime.newFixnum(IOModes.NONBLOCK));
// Create constants for flock
constants.setConstant("LOCK_SH", runtime.newFixnum(RubyFile.LOCK_SH));
constants.setConstant("LOCK_EX", runtime.newFixnum(RubyFile.LOCK_EX));
constants.setConstant("LOCK_NB", runtime.newFixnum(RubyFile.LOCK_NB));
constants.setConstant("LOCK_UN", runtime.newFixnum(RubyFile.LOCK_UN));
// TODO Singleton methods: atime, blockdev?, chardev?, chown, ctime, directory?
// TODO Singleton methods: executable?, executable_real?,
// TODO Singleton methods: ftype, grpowned?, lchmod, lchown, link, mtime, owned?
// TODO Singleton methods: pipe?, readlink, setgid?, setuid?, socket?,
// TODO Singleton methods: stat, sticky?, symlink, symlink?, umask, utime
extendObject(runtime.getModule("FileTest"));
defineSingletonMethod("basename", Arity.optional());
defineSingletonMethod("chmod", Arity.required(2));
defineSingletonMethod("chown", Arity.required(2));
defineSingletonMethod("delete", Arity.optional(), "unlink");
defineSingletonMethod("dirname", Arity.singleArgument());
defineSingletonMethod("expand_path", Arity.optional());
defineSingletonMethod("extname", Arity.singleArgument());
defineSingletonMethod("fnmatch", Arity.optional());
defineSingletonMethod("fnmatch?", Arity.optional(), "fnmatch");
defineSingletonMethod("join", Arity.optional());
defineSingletonMethod("lstat", Arity.singleArgument());
defineSingletonMethod("mtime", Arity.singleArgument());
defineSingletonMethod("open", Arity.optional());
defineSingletonMethod("rename", Arity.twoArguments());
defineSingletonMethod("size?", Arity.singleArgument(), "size_p");
defineSingletonMethod("split", Arity.singleArgument());
defineSingletonMethod("stat", Arity.singleArgument(), "lstat");
defineSingletonMethod("symlink?", Arity.singleArgument(), "symlink_p");
defineSingletonMethod("truncate", Arity.twoArguments());
defineSingletonMethod("utime", Arity.optional());
defineSingletonMethod("unlink", Arity.optional());
// TODO: Define instance methods: atime, chmod, chown, ctime, lchmod, lchown, lstat, mtime
//defineMethod("flock", Arity.singleArgument());
defineMethod("chmod", Arity.required(1));
defineMethod("chown", Arity.required(1));
defineMethod("initialize", Arity.optional());
defineMethod("path", Arity.noArguments());
defineMethod("stat", Arity.noArguments());
defineMethod("truncate", Arity.singleArgument());
defineMethod("flock", Arity.singleArgument());
RubyFileStat.createFileStatClass(runtime);
}
};
protected Meta getMeta() {
return new FileMeta();
}
public RubyClass newSubClass(String name, SinglyLinkedList parentCRef) {
return new FileMetaClass(name, this, parentCRef);
}
public IRubyObject allocateObject() {
return new RubyFile(getRuntime(), this);
}
public IRubyObject basename(IRubyObject[] args) {
checkArgumentCount(args, 1, 2);
String name = RubyString.stringValue(args[0]).toString();
if (name.length() > 1 && name.charAt(name.length() - 1) == '/') {
name = name.substring(0, name.length() - 1);
}
// Paths which end in "/" or "\\" must be stripped off.
int slashCount = 0;
int length = name.length();
for (int i = length - 1; i >= 0; i--) {
char c = name.charAt(i);
if (c != '/' && c != '\\') {
break;
}
slashCount++;
}
if (slashCount > 0 && length > 1) {
name = name.substring(0, name.length() - slashCount);
}
int index = name.lastIndexOf('/');
if (index == -1) {
// XXX actually only on windows...
index = name.lastIndexOf('\\');
}
if (!name.equals("/") && index != -1) {
name = name.substring(index + 1);
}
if (args.length == 2) {
String ext = RubyString.stringValue(args[1]).toString();
if (".*".equals(ext)) {
index = name.lastIndexOf('.');
if (index > 0) { // -1 no match; 0 it is dot file not extension
name = name.substring(0, index);
}
} else if (name.endsWith(ext)) {
name = name.substring(0, name.length() - ext.length());
}
}
return getRuntime().newString(name).infectBy(args[0]);
}
public IRubyObject chmod(IRubyObject[] args) {
checkArgumentCount(args, 2, -1);
int count = 0;
RubyInteger mode = args[0].convertToInteger();
for (int i = 1; i < args.length; i++) {
IRubyObject filename = args[i];
if (!RubyFileTest.exist_p(filename, filename.convertToString()).isTrue()) {
throw getRuntime().newErrnoENOENTError("No such file or directory - " + filename);
}
try {
Process chmod = Runtime.getRuntime().exec("chmod " + OCTAL_FORMATTER.sprintf(mode.getLongValue()) + " " + filename);
chmod.waitFor();
int result = chmod.exitValue();
if (result == 0) {
count++;
}
} catch (IOException ioe) {
// FIXME: ignore?
} catch (InterruptedException ie) {
// FIXME: ignore?
}
}
return getRuntime().newFixnum(count);
}
public IRubyObject chown(IRubyObject[] args) {
checkArgumentCount(args, 2, -1);
int count = 0;
RubyInteger owner = args[0].convertToInteger();
for (int i = 1; i < args.length; i++) {
IRubyObject filename = args[i];
if (!RubyFileTest.exist_p(filename, filename.convertToString()).isTrue()) {
throw getRuntime().newErrnoENOENTError("No such file or directory - " + filename);
}
try {
Process chown = Runtime.getRuntime().exec("chown " + owner + " " + filename);
chown.waitFor();
int result = chown.exitValue();
if (result == 0) {
count++;
}
} catch (IOException ioe) {
// FIXME: ignore?
} catch (InterruptedException ie) {
// FIXME: ignore?
}
}
return getRuntime().newFixnum(count);
}
public IRubyObject dirname(IRubyObject arg) {
RubyString filename = RubyString.stringValue(arg);
String name = filename.toString();
if (name.length() > 1 && name.charAt(name.length() - 1) == '/') {
name = name.substring(0, name.length() - 1);
}
//TODO deal with drive letters A: and UNC names
int index = name.lastIndexOf('/');
if (index == -1) {
// XXX actually, only on windows...
index = name.lastIndexOf('\\');
}
if (index == -1) {
return getRuntime().newString(".");
}
if (index == 0) {
return getRuntime().newString("/");
}
return getRuntime().newString(name.substring(0, index)).infectBy(filename);
}
public IRubyObject extname(IRubyObject arg) {
RubyString filename = RubyString.stringValue(arg);
String name = filename.toString();
int ix = name.lastIndexOf(".");
if(ix == -1) {
return getRuntime().newString("");
} else {
return getRuntime().newString(name.substring(ix));
}
}
public IRubyObject expand_path(IRubyObject[] args) {
checkArgumentCount(args, 1, 2);
String relativePath = RubyString.stringValue(args[0]).toString();
int pathLength = relativePath.length();
if (pathLength >= 1 && relativePath.charAt(0) == '~') {
// Enebo : Should ~frogger\\foo work (it doesnt in linux ruby)?
int userEnd = relativePath.indexOf('/');
if (userEnd == -1) {
if (pathLength == 1) {
// Single '~' as whole path to expand
relativePath = RubyDir.getHomeDirectoryPath(this).toString();
} else {
// No directory delimeter. Rest of string is username
userEnd = pathLength;
}
}
if (userEnd == 1) {
// '~/...' as path to expand
relativePath = RubyDir.getHomeDirectoryPath(this).toString() +
relativePath.substring(1);
} else if (userEnd > 1){
// '~user/...' as path to expand
String user = relativePath.substring(1, userEnd);
IRubyObject dir = RubyDir.getHomeDirectoryPath(this, user);
if (dir.isNil()) {
throw getRuntime().newArgumentError("user " + user + " does not exist");
}
relativePath = "" + dir +
(pathLength == userEnd ? "" : relativePath.substring(userEnd));
}
}
if (new File(relativePath).isAbsolute()) {
return getRuntime().newString(relativePath);
}
String cwd = getRuntime().getCurrentDirectory();
if (args.length == 2 && !args[1].isNil()) {
cwd = RubyString.stringValue(args[1]).toString();
}
// Something wrong we don't know the cwd...
if (cwd == null) {
return getRuntime().getNil();
}
JRubyFile path = JRubyFile.create(cwd, relativePath);
String extractedPath;
try {
extractedPath = path.getCanonicalPath();
} catch (IOException e) {
extractedPath = path.getAbsolutePath();
}
return getRuntime().newString(extractedPath);
}
/**
* Returns true if path matches against pattern The pattern is not a regular expression;
* instead it follows rules similar to shell filename globbing. It may contain the following
* metacharacters:
* *: Glob - match any sequence chars (re: .*). If like begins with '.' then it doesn't.
* ?: Matches a single char (re: .).
* [set]: Matches a single char in a set (re: [...]).
*
*/
// Fixme: implement FNM_PATHNAME, FNM_DOTMATCH, and FNM_CASEFOLD
public IRubyObject fnmatch(IRubyObject[] args) {
checkArgumentCount(args, 2, -1);
String pattern = args[0].convertToString().toString();
RubyString path = args[1].convertToString();
int opts = (int) (args.length > 2 ? args[2].convertToInteger().getLongValue() : 0);
boolean dot = pattern.startsWith(".");
pattern = pattern.replaceAll("(\\.)", "\\\\$1");
pattern = pattern.replaceAll("(?<=[^\\\\])\\*", ".*");
pattern = pattern.replaceAll("^\\*", ".*");
pattern = pattern.replaceAll("(?<=[^\\\\])\\?", ".");
pattern = pattern.replaceAll("^\\?", ".");
if ((opts & FNM_NOESCAPE) != FNM_NOESCAPE) {
pattern = pattern.replaceAll("\\\\([^\\\\*\\\\?])", "$1");
}
pattern = pattern.replaceAll("\\{", "\\\\{");
pattern = pattern.replaceAll("\\}", "\\\\}");
pattern = "^" + pattern + "$";
if (path.toString().startsWith(".") && !dot) {
return getRuntime().newBoolean(false);
}
return getRuntime().newBoolean(Pattern.matches(pattern, path.toString()));
}
/*
* Fixme: This does not have exact same semantics as RubyArray.join, but they
* probably could be consolidated (perhaps as join(args[], sep, doChomp)).
*/
public RubyString join(IRubyObject[] args) {
boolean isTainted = false;
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < args.length; i++) {
if (args[i].isTaint()) {
isTainted = true;
}
String element;
if (args[i] instanceof RubyString) {
element = args[i].toString();
} else if (args[i] instanceof RubyArray) {
// Fixme: Need infinite recursion check to put [...] and not go into a loop
element = join(((RubyArray) args[i]).toJavaArray()).toString();
} else {
element = args[i].convertToString().toString();
}
chomp(buffer);
if (i > 0 && !element.startsWith("/") && !element.startsWith("\\")) {
buffer.append("/");
}
buffer.append(element);
}
RubyString fixedStr = RubyString.newString(getRuntime(), buffer.toString());
fixedStr.setTaint(isTainted);
return fixedStr;
}
private void chomp(StringBuffer buffer) {
int lastIndex = buffer.length() - 1;
while (lastIndex >= 0 && (buffer.lastIndexOf("/") == lastIndex || buffer.lastIndexOf("\\") == lastIndex)) {
buffer.setLength(lastIndex);
lastIndex--;
}
}
public IRubyObject lstat(IRubyObject filename) {
RubyString name = RubyString.stringValue(filename);
return getRuntime().newRubyFileStat(JRubyFile.create(getRuntime().getCurrentDirectory(),name.toString()));
}
public IRubyObject mtime(IRubyObject filename) {
RubyString name = RubyString.stringValue(filename);
return getRuntime().newTime(JRubyFile.create(getRuntime().getCurrentDirectory(),name.toString()).lastModified());
}
public IRubyObject open(IRubyObject[] args) {
return open(args, true);
}
public IRubyObject open(IRubyObject[] args, boolean tryToYield) {
checkArgumentCount(args, 1, -1);
IRuby runtime = getRuntime();
ThreadContext tc = runtime.getCurrentContext();
RubyString pathString = RubyString.stringValue(args[0]);
pathString.checkSafeString();
String path = pathString.toString();
IOModes modes =
args.length >= 2 ? getModes(args[1]) : new IOModes(runtime, IOModes.RDONLY);
RubyFile file = new RubyFile(runtime, this);
RubyInteger fileMode =
args.length >= 3 ? args[2].convertToInteger() : null;
file.openInternal(path, modes);
if (fileMode != null) {
chmod(new IRubyObject[] {fileMode, pathString});
}
if (tryToYield && tc.isBlockGiven()) {
IRubyObject value = getRuntime().getNil();
try {
value = tc.yield(file);
} finally {
file.close();
}
return value;
}
return file;
}
public IRubyObject rename(IRubyObject oldName, IRubyObject newName) {
RubyString oldNameString = RubyString.stringValue(oldName);
RubyString newNameString = RubyString.stringValue(newName);
oldNameString.checkSafeString();
newNameString.checkSafeString();
JRubyFile oldFile = JRubyFile.create(getRuntime().getCurrentDirectory(),oldNameString.toString());
JRubyFile newFile = JRubyFile.create(getRuntime().getCurrentDirectory(),newNameString.toString());
if (!oldFile.exists() || !newFile.getParentFile().exists()) {
throw getRuntime().newErrnoENOENTError("No such file or directory - " + oldNameString + " or " + newNameString);
}
oldFile.renameTo(JRubyFile.create(getRuntime().getCurrentDirectory(),newNameString.toString()));
return RubyFixnum.zero(getRuntime());
}
public IRubyObject size_p(IRubyObject filename) {
long size = 0;
try {
FileInputStream fis = new FileInputStream(new File(filename.toString()));
FileChannel chan = fis.getChannel();
size = chan.size();
chan.close();
fis.close();
} catch (IOException ioe) {
// missing files or inability to open should just return nil
}
if (size == 0) {
return getRuntime().getNil();
}
return getRuntime().newFixnum(size);
}
public RubyArray split(IRubyObject arg) {
RubyString filename = RubyString.stringValue(arg);
return filename.getRuntime().newArray(dirname(filename),
basename(new IRubyObject[] { filename }));
}
public IRubyObject symlink_p(IRubyObject arg1) {
// FIXME if possible, make this return something real (Java's lack of support for symlinks notwithstanding)
return getRuntime().getFalse();
}
// Can we produce IOError which bypasses a close?
public IRubyObject truncate(IRubyObject arg1, IRubyObject arg2) {
RubyString filename = RubyString.stringValue(arg1);
RubyFixnum newLength = (RubyFixnum) arg2.convertToType("Fixnum", "to_int", true);
IRubyObject[] args = new IRubyObject[] { filename, getRuntime().newString("w+") };
RubyFile file = (RubyFile) open(args, false);
file.truncate(newLength);
file.close();
return RubyFixnum.zero(getRuntime());
}
/**
* This method does NOT set atime, only mtime, since Java doesn't support anything else.
*/
public IRubyObject utime(IRubyObject[] args) {
checkArgumentCount(args, 2, -1);
// Ignore access_time argument since Java does not support it.
long mtime;
if (args[1] instanceof RubyTime) {
mtime = ((RubyTime) args[1]).getJavaDate().getTime();
} else if (args[1] instanceof RubyNumeric) {
mtime = RubyNumeric.num2long(args[1]);
} else {
mtime = 0;
}
for (int i = 2, j = args.length; i < j; i++) {
RubyString filename = RubyString.stringValue(args[i]);
filename.checkSafeString();
JRubyFile fileToTouch = JRubyFile.create(getRuntime().getCurrentDirectory(),filename.toString());
if (!fileToTouch.exists()) {
throw getRuntime().newErrnoENOENTError(" No such file or directory - \"" +
filename + "\"");
}
fileToTouch.setLastModified(mtime);
}
return getRuntime().newFixnum(args.length - 2);
}
public IRubyObject unlink(IRubyObject[] args) {
for (int i = 0; i < args.length; i++) {
RubyString filename = RubyString.stringValue(args[i]);
filename.checkSafeString();
JRubyFile lToDelete = JRubyFile.create(getRuntime().getCurrentDirectory(),filename.toString());
if (!lToDelete.exists()) {
throw getRuntime().newErrnoENOENTError(" No such file or directory - \"" + filename + "\"");
}
if (!lToDelete.delete()) {
return getRuntime().getFalse();
}
}
return getRuntime().newFixnum(args.length);
}
// TODO: Figure out to_str and to_int conversion + precedence here...
private IOModes getModes(IRubyObject object) {
if (object instanceof RubyString) {
return new IOModes(getRuntime(), ((RubyString)object).toString());
} else if (object instanceof RubyFixnum) {
return new IOModes(getRuntime(), ((RubyFixnum)object).getLongValue());
}
throw getRuntime().newTypeError("Invalid type for modes");
}
}
|
[
"[email protected]"
] | |
471946034b8020a1a4047e90159797caffeb0aa2
|
48ee7578712d3f5c27cc1fe340802dec47176560
|
/src/test/java/org/lsst/ccs/command/InputConversionEngineTest.java
|
fcca53b17a3306c724f13a847241099ce42b8d6d
|
[] |
no_license
|
tonyj321/Command
|
d5719f58edda068ff6c1b9c90e6ca9995776976f
|
f01a421c6d00213937137854314ec943178ce7af
|
refs/heads/master
| 2016-09-10T17:56:54.781551 | 2013-06-26T21:07:36 | 2013-06-26T21:07:36 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,833 |
java
|
package org.lsst.ccs.command;
import java.util.Random;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.fail;
import junit.framework.TestCase;
/**
*
* @author tonyj
*/
public class InputConversionEngineTest extends TestCase {
private InputConversionEngine inputConversionEngine;
public InputConversionEngineTest(String testName) {
super(testName);
}
@Override
protected void setUp() throws Exception {
super.setUp();
inputConversionEngine = new InputConversionEngine();
}
public void testConvertArgToType() throws Exception {
Object result = inputConversionEngine.convertArgToType("1234", Integer.TYPE);
assertEquals(1234, result);
}
public void testConvertArgToType2() throws Exception {
Object result = inputConversionEngine.convertArgToType("1234", Integer.class);
assertEquals(1234, result);
}
public void testConvertArgToType3() throws Exception {
Object result = inputConversionEngine.convertArgToType("1234", Float.TYPE);
assertEquals(1234.0f, result);
}
public void testConvertArgToType4() throws Exception {
Object result = inputConversionEngine.convertArgToType("1234", Double.TYPE);
assertEquals(1234.0, result);
}
public void testConvertArgToType11() throws Exception {
Object result = inputConversionEngine.convertArgToType("TrUe", Boolean.TYPE);
assertEquals(true, result);
}
public void testConvertArgToType5() throws Exception {
Object result = inputConversionEngine.convertArgToType("1234", String.class);
assertEquals("1234", result);
}
public void testConvertArgToType6() throws Exception {
Object result = inputConversionEngine.convertArgToType("1234", RandomObject.class);
assertEquals("1234", ((RandomObject) result).getArg());
}
public void testConvertArgToType7() throws Exception {
try {
inputConversionEngine.convertArgToType("1234", Random.class);
fail("Should have thrown an exception");
} catch (CommandInvocationException x) {
assertEquals("Can't convert string 1234 to class java.util.Random", x.getMessage());
}
}
public void testConvertArgToType8() throws Exception {
try {
inputConversionEngine.convertArgToType("4567", RandomObject.class);
fail("Should have thrown an exception");
} catch (CommandInvocationException x) {
assertEquals("Error instantiating class org.lsst.ccs.command.InputConversionEngineTest$RandomObject using string 4567", x.getMessage());
}
}
public void testConvertArgToType9() throws Exception {
try {
inputConversionEngine.convertArgToType("1234", Boolean.TYPE);
fail("Should have thrown an exception");
} catch (CommandInvocationException x) {
assertEquals("Can't convert 1234 to Boolean", x.getMessage());
}
}
public void testConvertArgToType10() throws Exception {
try {
inputConversionEngine.convertArgToType("1234.5", Integer.TYPE);
fail("Should have thrown an exception");
} catch (CommandInvocationException x) {
assertEquals("Can't convert string 1234.5 to class int",x.getMessage());
}
}
private static class RandomObject {
private final String arg;
// Note, the constructor must be public for this to work.
public RandomObject(String arg) {
if (!"1234".equals(arg)) {
throw new IllegalArgumentException("Illegal value " + arg);
}
this.arg = arg;
}
public String getArg() {
return arg;
}
}
}
|
[
"[email protected]"
] | |
5ade5baaa26136d7a5e3b3bd91288e2b928c4a54
|
99eca6fccc20c1bad300cdaca4ad6d4cda74b3da
|
/lineage-parser-druid/src/main/java/cn/site/jupitermouse/lineage/parser/druid/tracer/DefaultColumnLineageTracer.java
|
dd22f06d01cd30dad8e55ebea40ed0e398cff23d
|
[] |
no_license
|
CrissMagic/xuanwu-lineage
|
9440ae6974fdd5958975329e08729b5e4980f94f
|
be94421df185f02d5943b94137a393d06aa0d4c2
|
refs/heads/master
| 2023-07-23T16:25:11.426396 | 2023-07-12T01:31:20 | 2023-07-12T01:31:20 | 513,368,969 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,633 |
java
|
package cn.site.jupitermouse.lineage.parser.druid.tracer;
import java.util.*;
import cn.site.jupitermouse.lineage.parser.druid.exception.ParserException;
import cn.site.jupitermouse.lineage.parser.druid.model.ColumnNode;
import cn.site.jupitermouse.lineage.parser.druid.model.TableNode;
import cn.site.jupitermouse.lineage.parser.druid.model.TreeNode;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.postgresql.visitor.PGSchemaStatVisitor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
/**
* <p>
* 默认字段血缘生成逻辑
* </p>
*
* @author JupiterMouse 2020/09/09
* @since 1.0
*/
@Slf4j
public class DefaultColumnLineageTracer implements ColumnLineageTracer {
/**
* Long tableId 节点ID
* List<TreeNode<TableNode>>> 某一节点最近的节点
*/
private final Map<Long, List<TreeNode<TableNode>>> recentTreeNodeMap = new HashMap<>();
/**
* 构建字段来源的字段血缘
*
* @param currentColumnNode 当前的字段节点
* @param tableNode 表节点
*/
@Override
public void traceColumnLineageTree(String dbType, TreeNode<ColumnNode> currentColumnNode,
TreeNode<TableNode> tableNode) {
// 当前字段向下检索列的来源, 后面需定位当前列所在的节点
ColumnNode currentColumn = currentColumnNode.getValue();
// 根据AST构造关系,这里来源表最多一层,所以判断来源是否有值,如果有值,那么以来源字段构建检索
if (CollectionUtils.isNotEmpty(currentColumn.getSourceColumns())) {
// 来源字段
List<ColumnNode> sourceColumnList = currentColumn.getSourceColumns();
// 遍历存入能够直接取到的字段
sourceColumnList.forEach(column -> {
TreeNode<ColumnNode> middleColumnNode = new TreeNode<>();
currentColumnNode.addChild(middleColumnNode);
middleColumnNode.setValue(column);
// 依旧以当前的表节点去向下检索来源字段
this.traceColumnLineageTree(dbType, middleColumnNode, tableNode);
});
// 来源字段不为空,提前结束
return;
}
// 字段肯定来源于下一级的节点去寻找, 构建离当前节点最近的别名节点
List<TreeNode<TableNode>> nearestTableNodeList = this.nearestTableNodes(tableNode);
// 当前字段的定位表名
String scanTableName = currentColumnNode.getValue().getTableName();
// 字段名称为空修复
if (StringUtils.isEmpty(scanTableName)) {
scanTableName = this.repairMissingTableName(currentColumnNode.getValue(), dbType);
}
// 先遍历来源的表节点列表
for (TreeNode<TableNode> currentRecentlyTableNode : nearestTableNodeList) {
TableNode lineageTable = currentRecentlyTableNode.getValue();
// 如果是叶子节点,直接返回表名作为别名
String alias = Optional.ofNullable(lineageTable.getAlias()).orElse(lineageTable.getName());
if (!scanTableName.equals(alias)) {
// 下一次循环
continue;
}
if (currentRecentlyTableNode.isLeaf()) {
TreeNode<ColumnNode> endColumnNode = new TreeNode<>();
endColumnNode.setValue(ColumnNode.builder()
.name(currentColumnNode.getValue().getName())
.tableName(scanTableName)
.owner(lineageTable)
// 记录节点ID
.tableTreeNodeId(currentRecentlyTableNode.getId().get())
.build());
currentColumnNode.addChild(endColumnNode);
return;
// 1. 终止
}
// 定位的列名 先取列名,列名去不了取别名
String scanColumnName = Optional.ofNullable(currentColumnNode.getValue().getName())
.orElse(currentColumnNode.getValue().getAlias());
// 获取当前中间节点的字段名
List<ColumnNode> columns = currentRecentlyTableNode.getValue().getColumns();
// 设置节点所有表为当前
for (ColumnNode column : columns) {
String name = Optional.ofNullable(column.getAlias()).orElse(column.getName());
// 如果相等 构建关系
if (scanColumnName.equals(name)) {
TreeNode<ColumnNode> midColumnTree = new TreeNode<>();
currentColumnNode.addChild(midColumnTree);
midColumnTree.setValue(column);
// 继续向下遍历
this.traceColumnLineageTree(dbType, midColumnTree, currentRecentlyTableNode);
return;
}
}
}
// for 循环完之后还是找不到,判断长度是否为1并且为leaf节点
this.possibleColumnSource(currentColumnNode, nearestTableNodeList);
}
private void possibleColumnSource(TreeNode<ColumnNode> currentColumnNode,
List<TreeNode<TableNode>> nearestTableNodeList) {
if (!CollectionUtils.isEmpty(nearestTableNodeList) && nearestTableNodeList.size() == 1
&& nearestTableNodeList.get(0).isLeaf()) {
// 2. 终止
TreeNode<ColumnNode> endColumnNode = new TreeNode<>();
currentColumnNode.addChild(endColumnNode);
endColumnNode
.setValue(ColumnNode.builder()
// 最后是取真实字段名
.name(currentColumnNode.getValue().getName())
.tableName(nearestTableNodeList.get(0).getValue().getName())
.owner(nearestTableNodeList.get(0).getValue())
.build());
} else {
// 兜底:记录找不到的信息
log.warn("columnNodeTree:{} not ended", currentColumnNode.getId());
}
}
/**
* 有效节点判断
*
* @param node 当前节点
* @return nearestTableNodeList List<TreeNode<TableNode>>
*/
@SuppressWarnings("unsed")
private boolean validNode(TreeNode<TableNode> node) {
return node.getValue().getAlias() != null || node.getValue().getIsVirtualTemp() == null;
}
/**
* 查找表血缘树最近的节点
*
* @param currentNode 当前的🌲 节点
* @return List<TreeNode < TableNode>>
*/
private List<TreeNode<TableNode>> nearestTableNodes(TreeNode<TableNode> currentNode) {
List<TreeNode<TableNode>> hitTreeNodeList = recentTreeNodeMap.get(currentNode.getId().get());
if (CollectionUtils.isNotEmpty(hitTreeNodeList)) {
return hitTreeNodeList;
}
List<TreeNode<TableNode>> nearestTableNodeList = new ArrayList<>();
this.nearestTableNodes(currentNode, nearestTableNodeList);
// 放入缓存
recentTreeNodeMap.put(currentNode.getId().get(), nearestTableNodeList);
return nearestTableNodeList;
}
/**
* 查询离当前节点最近的节点
*
* @param currentNode 当前节点
* @param nearestTableNodeList 存储当前的最近节点
*/
private void nearestTableNodes(TreeNode<TableNode> currentNode, List<TreeNode<TableNode>> nearestTableNodeList) {
// 找完所有的节点都没有找到,那么从查询的中断节点里面去寻找,如果别名为空 找下一个节点,如果匹配到别名就停止并返回
if (currentNode.isLeaf()) {
nearestTableNodeList.add(currentNode);
return;
}
// 如果找不到就找子节点
currentNode.getChildList().forEach(node -> {
// 子节点,找到就结束
if (node.getValue().getAlias() != null || node.getValue().getIsVirtualTemp() == null) {
nearestTableNodeList.add(node);
// 当本身是别名节点时不往下走
return;
}
// 找不到继续向下
this.nearestTableNodes(node, nearestTableNodeList);
});
}
/**
* 修复缺失的表名
* for example:
* 1. select distinct a1,b1 from table1 V
* 2. select distinct a1,b1 from table1,table2 X
* 第一种情况识别可以,第二种会取第一个表的字段,建议在SQL书写时,指定出对应别名
*
* @param columnNode columnNode
* @param dbType dbType
* @return 表名
*/
private String repairMissingTableName(ColumnNode columnNode, String dbType) {
if (StringUtils.isEmpty(columnNode.getTableExpression())) {
throw new ParserException("repair missing table, table expression can't null.");
}
SQLStatement stmt = SQLUtils.parseSingleStatement(columnNode.getTableExpression(), dbType);
PGSchemaStatVisitor pgSchemaStatVisitor = new PGSchemaStatVisitor();
stmt.accept(pgSchemaStatVisitor);
return pgSchemaStatVisitor.getTables().keySet().stream().findFirst()
.orElseThrow(() -> new ParserException("repair missing table failed,column expression[%s].",
columnNode.getExpression()))
.getName();
}
}
|
[
"[email protected]"
] | |
7797f9163b625c9056b051c4d16e1f3d90cf47ce
|
dc34ef4634755345bdf9e983616fc34503e6d3de
|
/app/src/main/java/id/sch/smktelkom_mlg/project/xiirpl304142434/belajariqro/menu_awal.java
|
a3e2d72b7a7af8f7fad6b721f6cc05e76a7cb79d
|
[] |
no_license
|
ridhoafnidev/BelajarIqro
|
0541efeebbbf88369f35855df9c8f28c3ebaf4cd
|
8a24450638e1cecbb9e0c96698f7ca2cb25a3ccb
|
refs/heads/master
| 2021-06-09T04:32:17.610375 | 2016-12-07T07:26:56 | 2016-12-07T07:26:56 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,172 |
java
|
package id.sch.smktelkom_mlg.project.xiirpl304142434.belajariqro;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageButton;
public class menu_awal extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu_awal);
ImageButton belajariqro = (ImageButton) findViewById(R.id.belajar_iqro);
belajariqro.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(), bljr_iqro.class);
startActivity(i);
}
});
ImageButton jusamma = (ImageButton) findViewById(R.id.j_amma);
jusamma.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(), jussamamain_Activity.class);
startActivity(i);
}
});
}
}
|
[
"[email protected]"
] | |
b3eaf0f24f0fd43d3c51f73193d18cfbe4528c8e
|
e996ed5aed52561417616b1251a36bebbcc84d40
|
/src/main/java/com/nelioalves/cursomc/services/ClienteService.java
|
3d610f24c11ad5b0dc2d810c3952be1204d537cb
|
[] |
no_license
|
stranieri74/spring-boot-ionic-backend
|
60edc1e61acfc097d74c1370727947e77b8994f3
|
24874a72185224e1a4691559a791f73dca43f983
|
refs/heads/master
| 2022-12-01T01:47:45.817228 | 2020-08-15T22:46:02 | 2020-08-15T22:46:02 | 287,836,780 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 727 |
java
|
package com.nelioalves.cursomc.services;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nelioalves.cursomc.domain.Cliente;
import com.nelioalves.cursomc.repositories.ClienteRepository;
import com.nelioalves.cursomc.services.exception.ObjectNotFoundException;
@Service
public class ClienteService {
@Autowired //automaticamente é instanciada
private ClienteRepository repo;
public Cliente buscar(Integer id) {
Optional<Cliente> obj = repo.findById(id);
return obj.orElseThrow(() -> new ObjectNotFoundException(
"Objeto não encontrado! Id: " + id + ", Tipo: " + Cliente.class.getName()));
}
}
|
[
"[email protected]"
] | |
ed5ae3c61db48897021e7a0717728b4f7b0a67af
|
1a77ec036f4a992feb113fcf5df92c3fad7666ff
|
/src/com/nuskin/dao/SlideMapper.java
|
b60bd0ff25cf6435510c39d4ec0409d95922323c
|
[] |
no_license
|
davelet/springWithBatis
|
f6b143d0aa9f46d5438acb67b469d2a2c1288c75
|
76c9c65eab7f4a6b904e9a7881d9d87978a7d979
|
refs/heads/master
| 2020-12-24T15:31:39.983178 | 2014-11-12T06:40:57 | 2014-11-12T06:40:57 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 318 |
java
|
package com.nuskin.dao;
import java.util.List;
import com.nuskin.model.Slide;
public interface SlideMapper
{
int deleteByPrimaryKey(Integer id);
int insert(Slide record);
List<Slide> getAvailableSlides();
Slide selectById(Integer id);
int updateByPrimaryKeySelective(Slide record);
}
|
[
"[email protected]"
] | |
c87c23bc7f3161b3c3107923b764339a9ea77a41
|
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
|
/project173/src/main/java/org/gradle/test/performance/largejavamultiproject/project173/p869/Production17387.java
|
0b23fc6b546ecb3bf5261f908d5701b993983d7d
|
[] |
no_license
|
big-guy/largeJavaMultiProject
|
405cc7f55301e1fd87cee5878a165ec5d4a071aa
|
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
|
refs/heads/main
| 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,970 |
java
|
package org.gradle.test.performance.largejavamultiproject.project173.p869;
public class Production17387 {
private Production17384 property0;
public Production17384 getProperty0() {
return property0;
}
public void setProperty0(Production17384 value) {
property0 = value;
}
private Production17385 property1;
public Production17385 getProperty1() {
return property1;
}
public void setProperty1(Production17385 value) {
property1 = value;
}
private Production17386 property2;
public Production17386 getProperty2() {
return property2;
}
public void setProperty2(Production17386 value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
}
|
[
"[email protected]"
] | |
aa45d08d82d852aca6a25158ab78d12eb8c99e6a
|
74b47b895b2f739612371f871c7f940502e7165b
|
/aws-java-sdk-mgn/src/main/java/com/amazonaws/services/mgn/model/transform/SourcePropertiesJsonUnmarshaller.java
|
bc6ba1031bd043e8041ea8ebd3b69c314a790131
|
[
"Apache-2.0"
] |
permissive
|
baganda07/aws-sdk-java
|
fe1958ed679cd95b4c48f971393bf03eb5512799
|
f19bdb30177106b5d6394223a40a382b87adf742
|
refs/heads/master
| 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 |
Apache-2.0
| 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null |
UTF-8
|
Java
| false | false | 4,647 |
java
|
/*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.mgn.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.mgn.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* SourceProperties JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SourcePropertiesJsonUnmarshaller implements Unmarshaller<SourceProperties, JsonUnmarshallerContext> {
public SourceProperties unmarshall(JsonUnmarshallerContext context) throws Exception {
SourceProperties sourceProperties = new SourceProperties();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("cpus", targetDepth)) {
context.nextToken();
sourceProperties.setCpus(new ListUnmarshaller<CPU>(CPUJsonUnmarshaller.getInstance())
.unmarshall(context));
}
if (context.testExpression("disks", targetDepth)) {
context.nextToken();
sourceProperties.setDisks(new ListUnmarshaller<Disk>(DiskJsonUnmarshaller.getInstance())
.unmarshall(context));
}
if (context.testExpression("identificationHints", targetDepth)) {
context.nextToken();
sourceProperties.setIdentificationHints(IdentificationHintsJsonUnmarshaller.getInstance().unmarshall(context));
}
if (context.testExpression("lastUpdatedDateTime", targetDepth)) {
context.nextToken();
sourceProperties.setLastUpdatedDateTime(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("networkInterfaces", targetDepth)) {
context.nextToken();
sourceProperties.setNetworkInterfaces(new ListUnmarshaller<NetworkInterface>(NetworkInterfaceJsonUnmarshaller.getInstance())
.unmarshall(context));
}
if (context.testExpression("os", targetDepth)) {
context.nextToken();
sourceProperties.setOs(OSJsonUnmarshaller.getInstance().unmarshall(context));
}
if (context.testExpression("ramBytes", targetDepth)) {
context.nextToken();
sourceProperties.setRamBytes(context.getUnmarshaller(Long.class).unmarshall(context));
}
if (context.testExpression("recommendedInstanceType", targetDepth)) {
context.nextToken();
sourceProperties.setRecommendedInstanceType(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return sourceProperties;
}
private static SourcePropertiesJsonUnmarshaller instance;
public static SourcePropertiesJsonUnmarshaller getInstance() {
if (instance == null)
instance = new SourcePropertiesJsonUnmarshaller();
return instance;
}
}
|
[
""
] | |
b2b66e4b356312f9c79c558219950aa22e5cac17
|
e20d4479f445960dd420421701bf5b3b5654c535
|
/app/src/main/java/de/dennis/mobilesensing/storage/Wrapper/wNetwork.java
|
a610245d3cec54dc5ac0a469d4b275f84ec8e65f
|
[] |
no_license
|
DennisLa/MobileSensing
|
8be4fa5474a06560aa2d0def66be225887067168
|
dbafb136481ed99222b07f372d910c65b95737fd
|
refs/heads/master
| 2021-01-19T09:02:18.790533 | 2017-06-20T08:04:17 | 2017-06-20T08:04:17 | 87,711,575 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 454 |
java
|
package de.dennis.mobilesensing.storage.Wrapper;
/**
* Created by Dennis on 22.03.2017.
*/
public class wNetwork {
private String networkType;
private long timestamp;
public wNetwork(String networkType, long timestamp){
this.networkType=networkType;
this.timestamp=timestamp;
}
public String getNetworkType() {
return networkType;
}
public long getTimestamp() {
return timestamp;
}
}
|
[
"[email protected]"
] | |
4e7a16f6f3fac5df069f594334826e1a1cf84706
|
31bb1edb09d9ccc6dce760d644e26635ce76b54f
|
/5th-semester/Concurrency Theory/lab2-homework/src/Philosopher2.java
|
3b1bcaceb5a178dfdaad7abcef72f888a7a99d46
|
[] |
no_license
|
mdarul/AGH
|
f9f7368077f518e4858646997a3bd81783d8bd83
|
ca7ea58cf05bde1a8a1c2bcd71455fa6280caae2
|
refs/heads/master
| 2021-05-15T23:18:19.558117 | 2018-03-25T13:25:50 | 2018-03-25T13:25:50 | 106,801,328 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,001 |
java
|
import java.util.Random;
/**
* Created by michal on 21/10/17.
*/
public class Philosopher2 extends Thread {
BinarySemaphore[] forks;
private int n;
public Philosopher2(BinarySemaphore[] forks, int n) {
this.forks = forks;
this.n = n;
}
@Override
public void run() {
for(int i=0; i < 5; i++) {
Random rand = new Random();
if(this.n == 4){
try {forks[(this.n+1)%5].binarySemaPhoreWait();}
catch (InterruptedException e) {e.printStackTrace();}
try {forks[this.n].binarySemaPhoreWait();}
catch (InterruptedException e) {e.printStackTrace();}
System.out.println("Philosopher " + n + " is dining");
try {Thread.sleep(rand.nextInt(1000) + 1000);}
catch (InterruptedException e) {e.printStackTrace();}
forks[this.n].binarySemaPhoreSignal();
forks[(this.n+1)%5].binarySemaPhoreSignal();
System.out.println("Philosopher " + n + " finished eating");
}
else {
try {forks[this.n].binarySemaPhoreWait();}
catch (InterruptedException e) {e.printStackTrace();}
try {forks[(this.n+1)%5].binarySemaPhoreWait();}
catch (InterruptedException e) {e.printStackTrace();}
System.out.println("Philosopher " + n + " is dining");
try {Thread.sleep(rand.nextInt(1000) + 1000);}
catch (InterruptedException e) {e.printStackTrace();}
forks[(this.n+1)%5].binarySemaPhoreSignal();
forks[this.n].binarySemaPhoreSignal();
System.out.println("Philosopher " + n + " finished eating");
}
System.out.println("Philosopher " + n + " is thinking...");
try {Thread.sleep(rand.nextInt(1000) + 1000);}
catch (InterruptedException e) {e.printStackTrace();}
}
}
}
|
[
"[email protected]"
] | |
69c759e292cb91608c4743c770250fdd606a1c31
|
bbb1f95fc3e0d59e3441271bc19cc9909e6703bf
|
/SIG_expedientes/src/Clases/TipoDeUsuario.java
|
3cf4ea3efa9343d8f2b5748f821092e3a0af5b1a
|
[] |
no_license
|
vincek17/SIG_expedientes
|
71c49b1312d6cc778249e71d6bde3033cc984088
|
a2428733260af392159df6485e5d122e85c1ae59
|
refs/heads/master
| 2020-06-02T14:09:51.116594 | 2015-06-14T14:36:58 | 2015-06-14T14:36:58 | 37,395,603 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,078 |
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 Clases;
import Controlador.ControladorBD;
import java.sql.Connection;
import java.sql.PreparedStatement;
import javax.swing.JOptionPane;
/**
*
* @author jbeltran2
*/
public class TipoDeUsuario {
int idtipousuario;
String descripciontipousuario;
Connection cn;
public TipoDeUsuario() {
ControladorBD con = new ControladorBD();
cn = con.AbrirConexion();
}
/*
public void TipoDeUsuario(int idtipousuario, String descripciontipousuario){
//this.idtipousuario = idtipousuario;
this.descripciontipousuario = descripciontipousuario;
}*/
/**
* @return the idtipousuario
*/
public int getIdtipousuario() {
return idtipousuario;
}
/**
* @param idtipousuario the idtipousuario to set
*/
public void setIdtipousuario(int idtipousuario) {
this.idtipousuario = idtipousuario;
}
/**
* @return the descripciontipousuario
*/
public String getDescripciontipousuario() {
return descripciontipousuario;
}
/**
* @param descripciontipousuario the descripciontipousuario to set
*/
public void setDescripciontipousuario(String descripciontipousuario) {
this.descripciontipousuario = descripciontipousuario;
}
public boolean NuevoTipoDeUsuario(){
boolean resp = false;
try{
String sql = "INSERT INTO TIPODEUSUARIO(DESCRIPCIONTIPOUSUARIO) VALUES(?)";
PreparedStatement cmd = cn.prepareStatement(sql);
cmd.setString(1,descripciontipousuario);
if(!cmd.execute()){
resp = true;
}
cmd.close();
cn.close();
}catch(Exception ex){
JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());
}
return resp;
}
}
|
[
"Kevin@KevinPC"
] |
Kevin@KevinPC
|
61d5e4e5c25f78f04e9273696cecd752beeecd5c
|
7b355f8aae52a965a1b01f404c8f09d74110e7ed
|
/src/main/java/com/example/modules/activity/mapper/ActivityMapper.java
|
0dbcfc110b47e6994949e553131d83b700e7eb89
|
[] |
no_license
|
Shiro-1/GraduationProject-API
|
1254ba4e2c0ec8d19f47fde7bfded16bf27c1360
|
a538a5ef0b6ca4b62b2b72bea0fb538a599827c3
|
refs/heads/master
| 2023-05-12T12:43:39.574255 | 2021-04-24T08:52:46 | 2021-04-24T08:52:46 | 257,850,670 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,602 |
java
|
package com.example.modules.activity.mapper;
import com.example.modules.activity.entity.Activity;
import com.example.modules.activity.entity.Attend;
import com.example.modules.activity.entity.Attention;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ActivityMapper {
@Select("select * from activity")
List<Activity> getActivity();
@Update("update activity set activityName = #{activityName},managerName = #{managerName}" +
",managerId = #{managerId},address = #{address},startTime = #{startTime}" +
",endTime = #{endTime},num = #{num},maxNum = #{maxNum},visit = #{visit}" +
",status = #{status} where id = #{id}")
int modifyActivity(Activity activity);
@Insert("insert into activity (activityName," +
"managerName,managerId,address,startTime,endTime,num,maxNum" +
",visit,status) values(#{activityName},#{managerName},#{managerId},#{address},#{startTime}" +
",#{endTime},#{num},#{maxNum},#{visit},#{status})")
int addActivity(Activity activity);
@Select("select * from activity where id =#{id}")
Activity get(String id);
@Insert("insert into participate (user_id," +
"activity_id,status) values(#{userId},#{activityId},1)")
int addJoin(String userId,String activityId);
@Select("select * from participate where user_id = #{userId}")
List<Attend> getAttention(String userId);
}
|
[
"[email protected]"
] | |
05db091056805d8e3a922c541f81cd61ccd69600
|
eab4e0ab1a5f45dd0b8b9619ec2ac113f0d65f85
|
/src/com/anand/jpacollection/PersonalDetails.java
|
afd68087def3054c84e411442b196fd1507db2ba
|
[] |
no_license
|
anandrockdeveloper/JAVA_JPA
|
819fd8b76f0d61094505ce358102c80e0d9ab340
|
6de220e9632ea586d4731cedfcc35facddc329fa
|
refs/heads/master
| 2020-04-22T10:07:00.127700 | 2019-02-12T10:02:53 | 2019-02-12T10:02:53 | 170,294,139 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,011 |
java
|
package com.anand.jpacollection;
import java.util.List;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table
public class PersonalDetails {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int PersonID;
private String LastName;
private String FirstName;
@ElementCollection
private List<PAddress> Address;
public int getPersonID() {
return PersonID;
}
public void setPersonID(int personID) {
PersonID = personID;
}
public String getLastName() {
return LastName;
}
public void setLastName(String lastName) {
LastName = lastName;
}
public String getFirstName() {
return FirstName;
}
public void setFirstName(String firstName) {
FirstName = firstName;
}
public List<PAddress> getAddress() {
return Address;
}
public void setAddress(List address) {
Address = address;
}
}
|
[
"[email protected]"
] | |
b61b64e52b9a603c8a728a08e8cde0c4d351beff
|
c29c028379c06118582b7addb1445700546a603a
|
/app/src/main/java/com/example/jsrgjhl/hlapp/Utils/jsonstr2map.java
|
9f96a0121b215141a9db50e89fa2041957a9df2c
|
[] |
no_license
|
HicoderDR/HLAPP
|
b7c55cb29485b937c9d7e30acd92eaa37a3dfc26
|
109743a3dacee652a3613784914c5b6f792ce5d5
|
refs/heads/master
| 2020-04-10T00:45:54.334371 | 2019-07-15T03:48:45 | 2019-07-15T03:48:45 | 160,695,612 | 0 | 3 | null | 2019-03-31T09:48:12 | 2018-12-06T15:39:42 |
Java
|
UTF-8
|
Java
| false | false | 1,229 |
java
|
package com.example.jsrgjhl.hlapp.Utils;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class jsonstr2map {
public static Map<String, Object> jsonstr2map(String jsonStr) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
if (!jsonStr.isEmpty()) {
JSONObject json = new JSONObject(jsonStr);
Iterator i = json.keys();
while (i.hasNext()) {
String key = (String) i.next();
String value = json.getString(key);
if (value.indexOf("{") == 0) {
map.put(key.trim(), jsonstr2map(value));
} else if (value.indexOf("[") == 0) {
map.put(key.trim(), jsonstr2list(value));
} else {
map.put(key.trim(), value.trim());
}
}
}
return map;
}
/**
* 以"["开头的String转list,list里装有map
*/
public static List<Map<String, Object>> jsonstr2list(String jsonStr) throws Exception {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
JSONArray ja = new JSONArray(jsonStr);
for (int j = 0; j < ja.length(); j++) {
String jm = ja.getString(j);
if (jm.indexOf("{") == 0) {
Map<String, Object> m = jsonstr2map(jm);
list.add(m);
}
}
return list;
}
}
|
[
"[email protected]"
] | |
b7f11be05d0c5f024edf3a4e7e29f88c88c754eb
|
d33828c2b585278c6833d6cfcfd535aaadb0c09c
|
/src/main/java/com/jishaokang/dao/HomeworkDAO.java
|
4c1304b207abe13a64f057fe4da4282dbbf1d9d3
|
[] |
no_license
|
NANA-Final/bishe
|
8d2c64070c925b41c637d479129d6919b37ddaf1
|
cd37001afd4045e7a506387e4408a87c2f194956
|
refs/heads/master
| 2023-01-27T12:01:25.321705 | 2020-12-16T10:01:05 | 2020-12-16T10:01:05 | 321,939,532 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 550 |
java
|
package com.jishaokang.dao;
import com.jishaokang.model.dto.Competition;
import com.jishaokang.model.dto.Homework;
import com.jishaokang.model.dto.Score;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created by NANA_Final on 2019/6/21.
*/
@Repository
public interface HomeworkDAO {
void addHomework(Homework homework);
void deleteHomework(Homework homework);
List<Competition> selectHomeworkByClassId(Homework homework);
List<Score> selectHomeworkScoreByCompetitionId(Homework homework);
}
|
[
"[email protected]"
] | |
f9d988ca43c33375573b83ea00001867d0b114e1
|
04560471089022ce5a759a812fc1827250992dd4
|
/scanner/src/main/java/uk/co/dolphin_com/rscore/RScore.java
|
0c7796fa3edfb1299647fe6046c04b8fecc038f3
|
[
"MIT"
] |
permissive
|
MrKhantee/MusicXML-Android
|
48c1943093ba2e364ad55c31307e53be00b7dab6
|
50da6dbd98a7065a5b3d5e21d35637904cae14f2
|
refs/heads/master
| 2023-03-11T09:08:20.051218 | 2021-03-04T00:40:44 | 2021-03-04T00:40:44 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,029 |
java
|
package uk.co.dolphin_com.rscore;
import java.io.File;
import uk.co.dolphin_com.rscore.ex.RScoreException;
public class RScore {
private final long nativePointer;
public enum Orientation {
ROT0, ROT90, ROT180, ROT270
}
public static native RScore Convert(int[] pixel,
int bitmapWidth,
int bitmapHeight,
int width,
Orientation orientation,
ConvertCallback convertCallback,
File midiFile,
File xmlFile,
ConvertOptions convertOptions) throws RScoreException;
public static native Version getVersion();
public native BarInfo getBarInfo(int i);
public native int getNumBars();
private RScore(long nativePointer) {
this.nativePointer = nativePointer;
}
}
|
[
"[email protected]"
] | |
875700aa763e2120c1fb251ad92b967b5d1c0252
|
54e7994528eef56bdf082d9bb940e4ce2d64dc35
|
/Herencia/src/entidad/Trucha.java
|
12d1f8fccd994e0c4d30a161c292750c9280e632
|
[] |
no_license
|
Eryel/kimira
|
a57332f92f2dab620582dd706711d8fa791fedd8
|
6a064f20b258f176fdf2d19dd3e6de25307e019b
|
refs/heads/master
| 2020-09-14T14:16:57.833582 | 2019-12-05T12:57:11 | 2019-12-05T12:57:11 | 223,153,105 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 59 |
java
|
package entidad;
public class Trucha extends Pez {
}
|
[
"[email protected]"
] | |
5c26a56b1b10608be80c3747cc9dfcfc0377ac22
|
3e8191286f7f373e3c66e90a869ea7276236cdf5
|
/mvn-core/src/main/java/com/service/PaperService.java
|
5efb427de460a85102665bd3e8dced0f593ce123
|
[] |
no_license
|
hefangqiang/mvnProjects
|
e308c82c0c6517d8cc54558030795ecb1ffe77cd
|
eec27e8599cb682238748d4dfdee1ea08d450d4e
|
refs/heads/master
| 2020-04-07T22:58:35.268828 | 2019-03-07T07:26:41 | 2019-03-07T07:26:41 | 158,792,403 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 390 |
java
|
package com.service;
import com.pojo.Paper;
import java.util.List;
/**
* @description: TODO
* @author: Mr.He
* @date: 2018-11-08 14:05
**/
public interface PaperService {
Paper addPaper(Paper paper);
long deletePaperById(long id);
Paper updatePaper(Paper paper);
Paper queryById(long id);
List<Paper> queryAllPaper();
void addSms(Paper paper);
}
|
[
"[email protected]"
] | |
547490d877d1ff92f49c14b0c64631d2b3c9002c
|
2a1d533a9f34c480a882581a4126b5f91c49af25
|
/runCloud/src/main/java/com/example/runcloud/activity/ChangePassword.java
|
ca05d126d6500e43693ec49c5c7336c7f1c22b94
|
[] |
no_license
|
wind1129/RunCloud-master
|
335d47fefb6869956898aea367bf7f0cfb0d8144
|
69cf06058e12eca26468f25f60ef2dadcc65e037
|
refs/heads/master
| 2021-01-12T03:17:55.258197 | 2017-01-06T06:06:30 | 2017-01-06T06:06:30 | 78,179,014 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,355 |
java
|
package com.example.runcloud.activity;
import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.ParseException;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
import com.example.runcloud.BaseActivity;
import com.example.runcloud.R;
import com.example.runcloud.application.MyApplication;
import com.example.runcloud.entity.HttpMessage;
import com.example.runcloud.fragment.FragmentMainActivity;
import com.example.runcloud.util.EncryptUtils;
import com.example.runcloud.util.FunctionUtils;
import com.example.runcloud.util.HttpClientTool;
import com.example.runcloud.util.HttpUtils;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
public class ChangePassword extends BaseActivity implements OnClickListener{
/**全局变量*/
private MyApplication myApplication;
/**本地存储*/
private SharedPreferences sp;
private String userId;
private String orgId;
/**url部分*/
private String uri;
private String baseUrl ="/ares/restful/user/user";
private String finalBaseUrl;
private ImageView backView;
private TextView titleView;
private EditText orgial_password;
private EditText new_password;
private EditText new_password_again;
private RelativeLayout sure_change_password;
private HttpResponse httpResponse;
JSONObject param = new JSONObject();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setTranslucentStatus();
setContentView(R.layout.change_password);
/**url*/
myApplication =(MyApplication)getApplication();
userId = myApplication.getInformation().getUserId();
orgId =myApplication.getInformation().getOrgId();
sp = getSharedPreferences("userInfo", Context.MODE_PRIVATE);
uri = sp.getString("URI", "");
finalBaseUrl =uri+baseUrl;
titleView =(TextView) findViewById(R.id.content_title_text);
titleView.setText("修改密码");
orgial_password = (EditText) findViewById(R.id.orgial_password);
new_password = (EditText) findViewById(R.id.new_password);
new_password_again = (EditText) findViewById(R.id.new_password_again);
sure_change_password = (RelativeLayout) findViewById(R.id.sure_change_password);
sure_change_password.setOnClickListener(this);
backView = (ImageView)findViewById(R.id.content_back);
backView.setOnClickListener(this);
}
/** 判断网民是否为空的Task */
private class ChangePwdJudgementTask extends AsyncTask<Void, Void, String> {
@Override
protected String doInBackground(Void... arg0) {
return baseUrl;
}
@Override
protected void onPostExecute(String baseUrl) {
if (TextUtils.isEmpty(orgial_password.getText())) {
FunctionUtils.showCustomDialog("原密码不能为空", ChangePassword.this);
return;
}
if (TextUtils.isEmpty(new_password.getText())) {
FunctionUtils.showCustomDialog("新密码不能为空", ChangePassword.this);
return;
}
if (TextUtils.isEmpty(new_password_again.getText())) {
FunctionUtils.showCustomDialog("新密码确认不能为空", ChangePassword.this);
return;
}
if(!new_password_again.getText().toString().equals(new_password.getText().toString())){
FunctionUtils.showCustomDialog("两次密码不一致", ChangePassword.this);
return;
}
try {
param.put("exPassword", EncryptUtils.encodeMD5String(orgial_password.getText().toString()));
param.put("password", EncryptUtils.encodeMD5String(new_password_again.getText().toString()));
param.put("userId", userId);
param.put("orgId", orgId);
new ChangePwdPutTask().execute();
} catch (JSONException e) {
Log.d("JSONException", e.getMessage());
e.printStackTrace();
}
}
}
/** 判断规则是否为空的Task */
private class ChangePwdPutTask extends AsyncTask<Void, Void, Integer> {
@Override
protected Integer doInBackground(Void... arg0) {
int code;
HttpPut httpPut = new HttpPut(finalBaseUrl);
StringEntity se;
try {
se = new StringEntity(param.toString(), "utf-8");
httpPut.setEntity(se);
// 发送请求
httpResponse = HttpClientTool.getHttpClient()
.execute(httpPut);
code = httpResponse.getStatusLine().getStatusCode();
return code;
} catch (Exception e) {
return 0;
}
}
@Override
protected void onPostExecute(Integer code) {
if (code == 200) {
String rev;
try {
rev = EntityUtils.toString(httpResponse.getEntity());
Log.d("++++++++++++++++++++++++rev", rev);
HttpMessage httpMessage = HttpUtils.HttpMessageFromJson(rev);
if(httpMessage.getResultCode().equals("000000")){
FunctionUtils.showCustomDialog("密码修改成功",
ChangePassword.this);
}else{
FunctionUtils.showCustomDialog(httpMessage.getMessage(),
ChangePassword.this);
return;
}
Intent intent = new Intent();
intent.putExtra("FramgmentId", "Tab5");
intent.setClass(ChangePassword.this, FragmentMainActivity.class);
startActivity(intent);
} catch (ParseException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} else {
FunctionUtils.showCustomDialog("与服务器失去连接,\n请稍后再试",
ChangePassword.this);
}
}
}
private void doput(){
new Thread(new Runnable() {
@Override
public void run() {
try {
JSONObject param = new JSONObject();
param.put("exPassword", EncryptUtils.encodeMD5String(orgial_password.getText().toString()));
param.put("password", EncryptUtils.encodeMD5String(new_password_again.getText().toString()));
param.put("userId", userId);
param.put("orgId", orgId);
HttpPut httpPut = new HttpPut(finalBaseUrl);
StringEntity se = new StringEntity(param.toString(), "utf-8");
httpPut.setEntity(se);
// 发送请求
HttpResponse httpResponse = HttpClientTool.getHttpClient().execute(httpPut);
int code=httpResponse.getStatusLine().getStatusCode();
Log.d("++++++++++++++++++++", String.valueOf(code));
if(code==200){
String rev = EntityUtils.toString(httpResponse.getEntity());
Log.d("++++++++++++++++++++++++rev", rev);
Intent intent = new Intent(ChangePassword.this, FragmentMainActivity.class);
startActivity(intent);
}
}catch (Exception e) {
}
}
}).start();
}
@Override
public void onClick(View arg0) {
switch (arg0.getId()) {
case R.id.content_back:
finish();
overridePendingTransition(0, R.anim.base_slide_right_out);
return;
case R.id.sure_change_password:
new ChangePwdJudgementTask().execute();
break;
default:
break;
}
}
@Override
public void onBackPressed() {
super.onBackPressed();
overridePendingTransition(0, R.anim.base_slide_right_out);
}
}
|
[
"[email protected]"
] | |
6513fd3c76b53ffc39e71d6de8dafbf4cb94f074
|
abd1cf9d4db4af9941c7378647820726f92a1737
|
/SkipListDriver.java
|
f958d6bb41fbe726d3a4df187e302e2b0e3faaf0
|
[] |
no_license
|
poojasrinivasan/SkipLists
|
56366e72c01123bb09f36a13b1949a29de597877
|
cc55eb0c41df5ed2008162ae6198a35dd5287d6f
|
refs/heads/master
| 2020-03-31T06:19:53.221766 | 2018-10-18T16:55:17 | 2018-10-18T16:55:17 | 151,977,520 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,358 |
java
|
package pxs176230;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Iterator;
import java.util.Scanner;
//Driver program for skip list implementation.
public class SkipListDriver {
public static void main(String[] args) throws FileNotFoundException {
Scanner sc;
if (args.length > 0) {
File file = new File(args[0]);
sc = new Scanner(file);
} else {
sc = new Scanner(System.in);
}
String operation = "";
long operand = 0;
int modValue = 999983;
long result = 0;
Long returnValue = null;
SkipList<Long> skipList = new SkipList<>();
// Initialize the timer
Timer timer = new Timer();
while (!((operation = sc.next()).equals("End"))) {
switch (operation) {
case "Add": {
operand = sc.nextLong();
if (skipList.add(operand)) {
result = (result + 1) % modValue;
}
break;
}
case "Ceiling": {
operand = sc.nextLong();
returnValue = skipList.ceiling(operand);
if (returnValue != null) {
result = (result + returnValue) % modValue;
}
break;
}
case "First": {
returnValue = skipList.first();
if (returnValue != null) {
result = (result + returnValue) % modValue;
}
break;
}
case "Get": {
int intOperand = sc.nextInt();
returnValue = skipList.get(intOperand);
if (returnValue != null) {
result = (result + returnValue) % modValue;
}
break;
}
case "Last": {
returnValue = skipList.last();
if (returnValue != null) {
result = (result + returnValue) % modValue;
}
break;
}
case "Floor": {
operand = sc.nextLong();
returnValue = skipList.floor(operand);
if (returnValue != null) {
result = (result + returnValue) % modValue;
}
break;
}
case "Remove": {
operand = sc.nextLong();
if (skipList.remove(operand) != null) {
result = (result + 1) % modValue;
}
break;
}
case "Contains": {
operand = sc.nextLong();
if (skipList.contains(operand)) {
result = (result + 1) % modValue;
}
break;
}
}
}
// End Time
timer.end();
System.out.println(result);
System.out.println(timer);
/*
skipList.rebuild();
Iterator it = skipList.iterator();
while (it.hasNext()) {
System.out.println(it.next());
}*/
}
}
|
[
"[email protected]"
] | |
054c85c9436bdebb414fca59de1acab003e031d6
|
8713f8fdb374a8b396aa5ae1a10bf91dd1500edd
|
/src/main/java/OOP/MoodleThree/LessonEight/TaskTwo/YandexDemo.java
|
1aa06cea07d7969fa38c7d436e16f2a7c7220d1e
|
[] |
no_license
|
shoxrux-javaDev/javaTaskBook
|
ccc9671b6c650d60894377b7ff8fd71c043253f0
|
ff2d68fecdf084a4e9ea9159fb999a1d12e4414b
|
refs/heads/master
| 2023-06-13T07:50:19.370792 | 2021-07-12T18:50:05 | 2021-07-12T18:50:05 | 385,351,402 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 430 |
java
|
package OOP.MoodleThree.LessonEight.TaskTwo;
import java.io.IOException;
import java.net.URL;
import java.util.Scanner;
public class YandexDemo {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
System.out.print("enter what you search on yandex: ");
String search= scanner.nextLine();
// URL url=new URL("https://","yandex.ru");
}
}
|
[
"[email protected]"
] | |
7776c8d8973abf6d25c290e7e5a5357c6b023599
|
436d220c5adcc8fc618693551c9cb4e2da0d3aed
|
/src/com/company/Section2_14.java
|
df88ba67da076dc34d1fcefb052897ca2e9645f8
|
[] |
no_license
|
Palmlight/Section2
|
f74df65fc476f6804a4fa0d650fcde28040530b1
|
72d62a7e00a612c204ac64bc547ad0067a861141
|
refs/heads/master
| 2023-02-13T02:50:13.432619 | 2021-01-15T07:13:22 | 2021-01-15T07:13:22 | 329,710,226 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 605 |
java
|
package com.company;
import java.util.Scanner;
public class Section2_14 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter weight in pounds: ");
double pounds = input.nextDouble();
System.out.println("Enter weight in inches: ");
double inches = input.nextDouble();
double poundsToKilograms = pounds * 0.45359237;
double inchesToMeters = inches * 0.0254;
double BMI = poundsToKilograms / Math.pow(inchesToMeters, 2);
System.out.println("BMI is " + BMI);
}
}
|
[
"[email protected]"
] | |
cffa2ad97e98568e75619e03b043740bbdd860f7
|
563e8db7dba0131fb362d8fb77a852cae8ff4485
|
/Blagosfera/core/src/main/java/ru/radom/kabinet/module/blagosfera/bp/dto/converter/BPTreeItemConverter.java
|
bcb679651b2cc8cd5dc52a4bda79f513e3843dc5
|
[] |
no_license
|
askor2005/blagosfera
|
13bd28dcaab70f6c7d6623f8408384bdf337fd21
|
c6cf8f1f7094ac7ccae3220ad6518343515231d0
|
refs/heads/master
| 2021-01-17T18:05:08.934188 | 2016-10-14T16:53:38 | 2016-10-14T16:53:48 | 70,894,701 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,193 |
java
|
package ru.radom.kabinet.module.blagosfera.bp.dto.converter;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import ru.radom.kabinet.module.blagosfera.bp.dto.BPTreeFolder;
import ru.radom.kabinet.module.blagosfera.bp.dto.BPTreeItem;
import ru.radom.kabinet.module.blagosfera.bp.dto.BPTreeModel;
import ru.radom.kabinet.module.blagosfera.bp.model.ProcessTreeItem;
/**
* Created by Otts Alexey on 29.10.2015.<br/>
* Конверетер {@link ProcessTreeItem} -> {@link BPTreeItem}
*/
@Component
public class BPTreeItemConverter implements Converter<ProcessTreeItem, BPTreeItem> {
@Override
public BPTreeItem convert(ProcessTreeItem source) {
BPTreeItem item;
if(source.getModel() == null) {
BPTreeFolder folder = new BPTreeFolder();
folder.setChildren(source.getChildrenCount() != 0);
item = folder;
} else {
BPTreeModel model = new BPTreeModel();
model.setModelId(source.getModel().getId());
item = model;
}
item.setText(source.getName());
item.setId(source.getId());
return item;
}
}
|
[
"[email protected]"
] | |
9dcee20070368caa718f8b78f8ce84dedd33d31c
|
47ec3f2c18566916a4bee28678b7e579cb237eb2
|
/src/main/java/com/pivotal/bootup/web/rest/AccountResource.java
|
87e61380012307e7b2668c0235739e22aa13342e
|
[] |
no_license
|
svennela/bootup
|
49fd1fd152d226cdbb2138ee5ae280c45f33153a
|
5e4e670b83e788ddd7f9e9b3b3a8bc62864b9466
|
refs/heads/master
| 2021-01-18T20:21:33.235527 | 2014-07-31T21:34:55 | 2014-07-31T21:34:55 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,975 |
java
|
package com.pivotal.bootup.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.pivotal.bootup.domain.Authority;
import com.pivotal.bootup.domain.PersistentToken;
import com.pivotal.bootup.domain.User;
import com.pivotal.bootup.repository.PersistentTokenRepository;
import com.pivotal.bootup.repository.UserRepository;
import com.pivotal.bootup.security.SecurityUtils;
import com.pivotal.bootup.service.MailService;
import com.pivotal.bootup.service.UserService;
import com.pivotal.bootup.web.rest.dto.UserDTO;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.thymeleaf.context.IWebContext;
import org.thymeleaf.spring4.SpringTemplateEngine;
import org.thymeleaf.spring4.context.SpringWebContext;
import javax.inject.Inject;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.*;
/**
* REST controller for managing the current user's account.
*/
@RestController
@RequestMapping("/app")
public class AccountResource {
private final Logger log = LoggerFactory.getLogger(AccountResource.class);
@Autowired
private ServletContext servletContext;
@Autowired
private ApplicationContext applicationContext;
@Inject
private SpringTemplateEngine templateEngine;
@Inject
private UserRepository userRepository;
@Inject
private UserService userService;
@Inject
private PersistentTokenRepository persistentTokenRepository;
@Inject
private MailService mailService;
/**
* POST /rest/register -> register the user.
*/
@RequestMapping(value = "/rest/register",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<?> registerAccount(@RequestBody UserDTO userDTO, HttpServletRequest request,
HttpServletResponse response) {
User user = userRepository.findOne(userDTO.getLogin());
if (user != null) {
return new ResponseEntity<>(HttpStatus.NOT_MODIFIED);
} else {
user = userService.createUserInformation(userDTO.getLogin(), userDTO.getPassword(), userDTO.getFirstName(),
userDTO.getLastName(), userDTO.getEmail().toLowerCase(), userDTO.getLangKey());
final Locale locale = Locale.forLanguageTag(user.getLangKey());
String content = createHtmlContentFromTemplate(user, locale, request, response);
mailService.sendActivationEmail(user.getEmail(), content, locale);
return new ResponseEntity<>(HttpStatus.CREATED);
}
}
/**
* GET /rest/activate -> activate the registered user.
*/
@RequestMapping(value = "/rest/activate",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<String> activateAccount(@RequestParam(value = "key") String key) {
User user = userService.activateRegistration(key);
if (user == null) {
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
return new ResponseEntity<String>(user.getLogin(), HttpStatus.OK);
}
/**
* GET /rest/authenticate -> check if the user is authenticated, and return its login.
*/
@RequestMapping(value = "/rest/authenticate",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public String isAuthenticated(HttpServletRequest request) {
log.debug("REST request to check if the current user is authenticated");
return request.getRemoteUser();
}
/**
* GET /rest/account -> get the current user.
*/
@RequestMapping(value = "/rest/account",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<UserDTO> getAccount() {
User user = userService.getUserWithAuthorities();
if (user == null) {
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
List<String> roles = new ArrayList<>();
for (Authority authority : user.getAuthorities()) {
roles.add(authority.getName());
}
return new ResponseEntity<>(
new UserDTO(
user.getLogin(),
null,
user.getFirstName(),
user.getLastName(),
user.getEmail(),
user.getLangKey(),
roles),
HttpStatus.OK);
}
/**
* POST /rest/account -> update the current user information.
*/
@RequestMapping(value = "/rest/account",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public void saveAccount(@RequestBody UserDTO userDTO) {
userService.updateUserInformation(userDTO.getFirstName(), userDTO.getLastName(), userDTO.getEmail());
}
/**
* POST /rest/change_password -> changes the current user's password
*/
@RequestMapping(value = "/rest/account/change_password",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<?> changePassword(@RequestBody String password) {
if (StringUtils.isEmpty(password)) {
return new ResponseEntity<>(HttpStatus.FORBIDDEN);
}
userService.changePassword(password);
return new ResponseEntity<>(HttpStatus.OK);
}
/**
* GET /rest/account/sessions -> get the current open sessions.
*/
@RequestMapping(value = "/rest/account/sessions",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<List<PersistentToken>> getCurrentSessions() {
User user = userRepository.findOne(SecurityUtils.getCurrentLogin());
if (user == null) {
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
return new ResponseEntity<>(
persistentTokenRepository.findByUser(user),
HttpStatus.OK);
}
/**
* DELETE /rest/account/sessions?series={series} -> invalidate an existing session.
*
* - You can only delete your own sessions, not any other user's session
* - If you delete one of your existing sessions, and that you are currently logged in on that session, you will
* still be able to use that session, until you quit your browser: it does not work in real time (there is
* no API for that), it only removes the "remember me" cookie
* - This is also true if you invalidate your current session: you will still be able to use it until you close
* your browser or that the session times out. But automatic login (the "remember me" cookie) will not work
* anymore.
* There is an API to invalidate the current session, but there is no API to check which session uses which
* cookie.
*/
@RequestMapping(value = "/rest/account/sessions/{series}",
method = RequestMethod.DELETE)
@Timed
public void invalidateSession(@PathVariable String series) throws UnsupportedEncodingException {
String decodedSeries = URLDecoder.decode(series, "UTF-8");
User user = userRepository.findOne(SecurityUtils.getCurrentLogin());
List<PersistentToken> persistentTokens = persistentTokenRepository.findByUser(user);
for (PersistentToken persistentToken : persistentTokens) {
if (StringUtils.equals(persistentToken.getSeries(), decodedSeries)) {
persistentTokenRepository.delete(decodedSeries);
}
}
}
private String createHtmlContentFromTemplate(final User user, final Locale locale, final HttpServletRequest request,
final HttpServletResponse response) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("user", user);
variables.put("baseUrl", request.getScheme() + "://" + // "http" + "://
request.getServerName() + // "myhost"
":" + request.getServerPort());
IWebContext context = new SpringWebContext(request, response, servletContext,
locale, variables, applicationContext);
return templateEngine.process("activationEmail", context);
}
}
|
[
"[email protected]"
] | |
be030687e3807d8fa06423add3d2aadd6724e755
|
fcd7757e1a0176b0978279f3d499e9cd0fef4849
|
/src/main/java/edu/escuelaing/arep/sockets/EchoServer.java
|
97c0568a610181223856ecda98f82855c01aad7b
|
[] |
no_license
|
DavidRiveraRvD/AREP-AavanceClase
|
b4517b4b32ac648ae5312c65a2567f0074b4d189
|
7476caa7cb1a980a88c5783b41adc48699bc80da
|
refs/heads/main
| 2023-07-16T04:26:53.320171 | 2021-09-02T16:24:38 | 2021-09-02T16:24:38 | 402,439,928 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,163 |
java
|
package edu.escuelaing.arem.sockets;
import java.net.*;
import java.io.*;
public class EchoServer {
public static void main(String[] args) throws IOException {
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(35000);
} catch (IOException e) {
System.err.println(e);
System.err.println("Could not listen on port: 35000.");
System.exit(1);
}
boolean running = true;
while (running) {
Socket clientSocket = null;
try {
clientSocket = serverSocket.accept();
} catch (IOException e) {
System.err.println("Accept failed.");
System.exit(1);
}
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
String inputLine, outputLine;
while ((inputLine = in.readLine()) != null) {
System.out.println("Mensaje: " + inputLine);
outputLine = "Respuesta del servidor: " + inputLine;
out.println(outputLine);
if (outputLine.equals("Respuesta del servidor:"))
break;
}
out.close();
in.close();
clientSocket.close();
}
serverSocket.close();
}
}
|
[
"[email protected]"
] | |
a5af3c4f15e4ff70ddae02f412732a4f8ab9ce6e
|
139d0c11b2d7a7ee8edc989a1daf7f670d41c320
|
/app/src/main/java/com/example/letsdonate/CreateEvent.java
|
34d9a3c4c035cfaa8c3903c5af984319bc80cc16
|
[] |
no_license
|
ShresthaPriyal/LetsDonate-1
|
c2106fbfbc2e1d48e9a37f02e5c10740a918601b
|
dcd48a491ca3af80eb7d188604de0303aeff0e10
|
refs/heads/master
| 2020-08-18T14:14:01.999669 | 2019-10-08T06:19:54 | 2019-10-08T06:19:54 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,537 |
java
|
package com.example.letsdonate;
import androidx.appcompat.app.AppCompatActivity;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.os.Bundle;
import android.text.format.DateFormat;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.TimePicker;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
public class CreateEvent extends AppCompatActivity implements DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener {
int i,j,k,l,m; // for the use of Calender object
int year,day,hour,min; // to store the input
String month;
static final String[] months = {"January","February","March","April","May","June","July","August","September","October","November","December"};
TextView showDate;
TextView showTime;
EditText location;
Button setDate;
Button setTime;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_event);
showDate = (TextView) findViewById(R.id.show_date);
showTime = (TextView) findViewById(R.id.showtime);
location = (EditText) findViewById(R.id.location);
}
// Calender Listener Method
@Override
public void onDateSet(DatePicker datePicker, int i, int i1, int i2) {
year = i;
day = i2;
switch (i1)
{
case 0: month = "January"; break;
case 1: month = "February"; break;
case 2: month = "March"; break;
case 3: month = "April"; break;
case 4: month = "May"; break;
case 5: month = "June"; break;
case 6: month = "july"; break;
case 7: month = "August"; break;
case 8: month = "September"; break;
case 9: month = "October"; break;
case 10: month = "November"; break;
case 11: month = "December"; break;
}
showDate.setText(day+" "+month+" "+" "+year);
}
// Time set listener Method
@Override
public void onTimeSet(TimePicker timePicker, int i, int i1) {
hour = i;
min = i1;
showTime.setText(" "+hour+":"+min);
}
// To listen Set Date Button
public void method_Setdate(View view)
{
Calendar c = Calendar.getInstance(); // to get the current date
i = c.get(Calendar.YEAR);
j = c.get(Calendar.MONTH);
k = c.get(Calendar.DAY_OF_MONTH);
// prompt Calender to the user
DatePickerDialog datePickerDialog = new DatePickerDialog(CreateEvent.this,CreateEvent.this,i,j,k);
datePickerDialog.show();
}
// To listen Set Time Button
public void Method_setTime(View view)
{
Calendar c = Calendar.getInstance(); // to get current time
l = c.get(Calendar.HOUR_OF_DAY);
m = c.get(Calendar.MINUTE);
// prompt the Clock to the user
TimePickerDialog timePickerDialog = new TimePickerDialog(CreateEvent.this,
CreateEvent.this,l,m, DateFormat.is24HourFormat(this));
timePickerDialog.show();
}
// Create Button listener
public void create(View view)
{
// Write your code here , To store input in the database
//Closing this activity after everything is done
onBackPressed();
}
}
|
[
"[email protected]"
] | |
e4c0076d648ffb40dbb0025e47ee40fddc9b23a2
|
f8f714738fb3c791798d94e03b4391ee20004ded
|
/kitchensink/src/main/java/com/easterlyn/kitchensink/listener/PvpKeepInventory.java
|
5622daa0819573c7454918c724f6bef7f0a772a1
|
[] |
no_license
|
Easterlyn/Easterlyn
|
fd4178b763fab740d04e35f9b98a2599795cae39
|
dae9ba7e80f39879d15013c14e78ee9c6c2dd07b
|
refs/heads/master
| 2023-08-17T11:59:18.193389 | 2023-08-10T10:47:05 | 2023-08-10T10:47:05 | 10,777,313 | 1 | 3 | null | 2023-08-10T10:47:07 | 2013-06-19T01:39:56 |
Java
|
UTF-8
|
Java
| false | false | 2,516 |
java
|
package com.easterlyn.kitchensink.listener;
import com.easterlyn.EasterlynCore;
import com.easterlyn.plugin.EasterlynPlugin;
import com.easterlyn.user.User;
import com.github.jikoo.planarwrappers.util.Experience;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.jetbrains.annotations.NotNull;
public class PvpKeepInventory implements Listener {
private final String key = "kitchensink:lastPvpDamage";
private final EasterlynPlugin plugin;
public PvpKeepInventory(@NotNull EasterlynPlugin plugin) {
this.plugin = plugin;
}
@EventHandler(ignoreCancelled = true)
public void onEntityDamageByEntity(@NotNull EntityDamageByEntityEvent event) {
if (!(event.getEntity() instanceof Player player)) {
return;
}
boolean playerDamage = false;
if (event.getDamager() instanceof Player) {
playerDamage = true;
} else if (event.getDamager() instanceof Projectile projectile) {
playerDamage = projectile.getShooter() instanceof Player;
}
if (!playerDamage) {
return;
}
// TODO bad
User user = plugin.getCore().getUserManager().getOrLoadNow(player.getUniqueId());
user.getTemporaryStorage().put(key, System.currentTimeMillis());
}
@EventHandler(ignoreCancelled = true)
public void onPlayerDeath(@NotNull PlayerDeathEvent event) {
RegisteredServiceProvider<EasterlynCore> easterlynProvider =
Bukkit.getServer().getServicesManager().getRegistration(EasterlynCore.class);
if (easterlynProvider == null) {
return;
}
// TODO bad
User user = plugin.getCore().getUserManager().getOrLoadNow(event.getEntity().getUniqueId());
Object object = user.getTemporaryStorage().get(key);
if (!(object instanceof Long)) {
return;
}
long timestamp = (long) object;
if (timestamp < System.currentTimeMillis() - 6000L) {
return;
}
event.setDroppedExp(Experience.getExp(event.getEntity()));
int dropped = Experience.getExp(event.getEntity()) / 10;
if (dropped > 30) {
dropped = 30;
}
event.setDroppedExp(dropped);
Experience.changeExp(event.getEntity(), -dropped);
event.setKeepLevel(true);
event.setKeepInventory(true);
event.getDrops().clear();
}
}
|
[
"[email protected]"
] | |
652d0ba77fcad8ecd7d30c375dc3e6e39c40c2c2
|
854713e6a0550fe5f2fe09576b656013cf56af4d
|
/src/com/nompor/gtk/animation/AbstractMessageDrawablePagingAnimation.java
|
cba8d93d0501cff445bf0c28029c4b1b8c50d60f
|
[
"MIT"
] |
permissive
|
midwinter1111/java-nompor-lib
|
178c6ef58d2cdf8316c5fcee0bebb8f9a28cc8e6
|
66bce811c6a21acd8756368dfaf8f3ca527eb870
|
refs/heads/master
| 2020-12-18T09:28:04.579439 | 2019-01-20T12:10:16 | 2019-01-20T12:10:16 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,546 |
java
|
package com.nompor.gtk.animation;
import java.util.ArrayList;
import com.nompor.gtk.GTKException;
public class AbstractMessageDrawablePagingAnimation<G> implements MessageDrawableAnimation<G> {
public static final int AUTO_NEXT_PAGE_OFF=-1;
private ArrayList<MessageDrawableAnimation<G>> list = new ArrayList<>();
private int pageNo;
private int maxAlreadyShowPageNo;
private boolean isStart;
private int endOfFrameCount;
private int autoNextPageCount=AUTO_NEXT_PAGE_OFF;
public void add(MessageDrawableAnimation<G> page) {
if ( isStart ) throw new GTKException("already animation started.");
list.add(page);
}
@Override
public void update() {
isStart = true;
if ( isEnd() ) return;
MessageDrawableAnimation<G> mda = list.get(pageNo);
mda.update();
if ( autoNextPageCount != AUTO_NEXT_PAGE_OFF && mda.isEnd() ) {
endOfFrameCount++;
if ( endOfFrameCount > autoNextPageCount ) {
nextPage();
}
}
}
@Override
public boolean isEnd() {
return list.stream().allMatch(e -> e.isEnd());
}
public void nextPage() {
isStart = true;
endOfFrameCount = 0;
if ( pageNo < getMaxPageNo() ) pageNo++;
maxAlreadyShowPageNo = Math.max(pageNo, maxAlreadyShowPageNo);
}
public void prevPage() {
isStart = true;
endOfFrameCount = 0;
if ( pageNo > 0 ) pageNo--;
}
public boolean isNowPageEnd() {
return list.get(pageNo).isEnd();
}
public void doFinalNowPage() {
list.get(pageNo).doFinal();
}
public void doInitNowPage() {
list.get(pageNo).doInit();
}
public int getMaxAlreadyShowPageNo() {
return maxAlreadyShowPageNo;
}
public int getPageNo() {
return pageNo;
}
public int getMaxPageNo() {
return list.size() - 1;
}
public int length() {
return list.size();
}
public int getMinPageNo() {
return 0;
}
public void doInitPageNo(int pageNo) {
list.get(pageNo).doInit();
}
public void doFinalPageNo(int pageNo) {
list.get(pageNo).doFinal();
}
@Override
public void doFinal() {
list.stream().forEach(e -> e.doFinal());
pageNo = getMaxPageNo();
maxAlreadyShowPageNo = pageNo;
isStart = true;
}
@Override
public void doInit() {
list.stream().forEach(e -> e.doInit());
pageNo = 0;
maxAlreadyShowPageNo = 0;
isStart = false;
}
@Override
public void draw(G g) {
list.get(pageNo).draw(g);
}
public boolean isStart() {
return isStart;
}
public void setAutoNextPageDelayCount(int autoNextPageCount) {
this.autoNextPageCount = autoNextPageCount;
}
public int getAutoNextPageDelayCount() {
return autoNextPageCount;
}
}
|
[
"[email protected]"
] | |
e3ca1e3720dd332b107ecfb1fcce136a5eb7fdb7
|
189293031138569a0a77e9197c1aaf4563318651
|
/src/main/java/tikape/domain/Vastaus.java
|
3cf651a697b3a3cd6f659f6d70197a2bc9299f9c
|
[] |
no_license
|
tykkipeli/OmaWebProjekti
|
cc3b1e6ed250b161501558e4d19fe5aced812d10
|
1770c79b46c5d5cb1c7cf23fe91d6ae8e03bf7a7
|
refs/heads/master
| 2020-04-01T01:35:18.488472 | 2018-10-19T10:15:14 | 2018-10-19T10:15:14 | 152,744,737 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 998 |
java
|
package tikape.domain;
public class Vastaus {
private String vastausteksti;
private Boolean oikein;
private int id;
private int kysymysId;
public Vastaus(int id, int kysymysId, String vastausteksti, Boolean oikein) {
this.vastausteksti = vastausteksti;
this.oikein = oikein;
this.id = id;
this.kysymysId = kysymysId;
}
public int getKysymysId() {
return kysymysId;
}
public void setKysymysId(int kysymysId) {
this.kysymysId = kysymysId;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getVastausteksti() {
return vastausteksti;
}
public void setVastausteksti(String vastausteksti) {
this.vastausteksti = vastausteksti;
}
public Boolean getOikein() {
return oikein;
}
public void setOikein(Boolean oikein) {
this.oikein = oikein;
}
}
|
[
"[email protected]"
] | |
abc75afa4ba160e972fd3db0f04f6900fc316c4a
|
bd6adbd2a987f95e8d0c2dcad4b485141f8ce954
|
/src/module-info.java
|
5edf047285f71604d639bca9237e88a10ef614db
|
[] |
no_license
|
iuthub/java_2020_lecture9_tipcalculator
|
c2f40ac3ca48e5082ecf90306ad34a1351a8ba7e
|
788a78045010a816c3b0c26e884bfa7300b2d5c2
|
refs/heads/main
| 2023-01-29T07:35:06.617328 | 2020-12-09T21:09:39 | 2020-12-09T21:09:39 | 320,079,879 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 120 |
java
|
module HelloWorldFx1 {
requires javafx.fxml;
requires javafx.controls;
opens com.desmonduz.helloWorldFx1;
}
|
[
"[email protected]"
] | |
ac2e48076057eceb844781f8b28be57e914b3708
|
e29365f2bb9ad7bc8f844d0532c0cc31e9fb8c47
|
/src/QuotientAndRemainder.java
|
d68332995f8ebde4021009c1b5e0519f660d9509
|
[] |
no_license
|
mohamedirfan0312/HIT-lab-1
|
5ba86f119d7e5c090476638b2e19f3461cdd8c7b
|
ee32d31ec3c0bfa2fc9c6094671a2c45a3afc24e
|
refs/heads/main
| 2023-05-14T21:03:43.012023 | 2021-06-06T16:48:31 | 2021-06-06T16:48:31 | 374,363,551 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 300 |
java
|
public class QuotientAndRemainder
{
public static void main(String[] args)
{
int number1 = 140, number2 = 45;
int quotient = number1 / number2;
int remainder = number1 % number2;
System.out.println("Quotient is: " + quotient);
System.out.println("Remainder is: " + remainder);
}
}
|
[
"[email protected]"
] | |
746b007c9efbf22d43806072a55c822803f33d4a
|
2adf29c5a3f81eeb0bb627680cb6dbe56db235d4
|
/wcn-security-app/src/main/java/com/github/wangchenning/security/app/authentication/WcnAuthenticationSuccessHandler.java
|
19cd162eeabda552035225660e0b3b684ebed648
|
[] |
no_license
|
G-ChenNing/wcn-security
|
5dfa5d94ee077bbe3a45d9c60b43824af4bab1bf
|
bb3f323f98b72ee3517ec7d8f8feca3ed6d9ccad
|
refs/heads/master
| 2021-06-17T03:52:17.242135 | 2019-08-30T07:33:38 | 2019-08-30T07:33:38 | 197,173,749 | 1 | 0 | null | 2021-04-26T19:20:08 | 2019-07-16T10:34:46 |
Java
|
UTF-8
|
Java
| false | false | 1,739 |
java
|
package com.github.wangchenning.security.app.authentication;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.wangchenning.security.core.properties.LoginType;
import com.github.wangchenning.security.core.properties.SecurityProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
import org.springframework.stereotype.Component;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author Musk
*/
@Component
public class WcnAuthenticationSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler {
private Logger logger = LoggerFactory.getLogger(WcnAuthenticationSuccessHandler.class);
@Autowired
private ObjectMapper objectMapper;
@Autowired
private SecurityProperties securityProperties;
@Override
public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException {
logger.info("登陆成功");
if (LoginType.JSON.equals(securityProperties.getBrowser().getLoginType())) {
httpServletResponse.setContentType("application/json;charset=UTF-8");
httpServletResponse.getWriter().write(objectMapper.writeValueAsString(authentication));
} else {
super.onAuthenticationSuccess(httpServletRequest, httpServletResponse, authentication);
}
}
}
|
[
"[email protected]"
] | |
ff7eb48868a0827f1b9443ac23e6a21cd7f45dc5
|
ef318d0e14ce75ba89edc5b92e551218c569fd96
|
/app/src/main/java/com/example/pablovilas/reversi/bbdd/PartidasBD.java
|
7cf1d79a1911733b46450e3f29ee1a42233f1479
|
[] |
no_license
|
josemanuel97/Reversi
|
fb1336c27e2f9c0174de754963f94c534c751925
|
5f7d5d1172261cc5ed5ba26d9f0f7d3e2b7478d1
|
refs/heads/master
| 2020-05-16T19:32:03.101074 | 2018-06-12T17:46:30 | 2018-06-12T17:46:30 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,253 |
java
|
package com.example.pablovilas.reversi.bbdd;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
public class PartidasBD extends SQLiteOpenHelper {
private static final String TABLE_NAME = "Partidas";
private static final int DATABASE_VERSION = 2;
private String sqlCreate = "CREATE TABLE Partidas " +
"(_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
"alias TEXT, " +
"date TEXT, " +
"medida TEXT, " +
"control TEXT, " +
"num_blacks TEXT, " +
"num_whites TEXT, " +
"total_time TEXT, " +
"state TEXT )";
public PartidasBD(Context context) {
super(context, TABLE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(sqlCreate);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS Partidas");
db.execSQL(sqlCreate);
}
// Insertar una partida en la base de datos.
public void insertPartida(PartidasClass partida){
SQLiteDatabase db = this.getWritableDatabase();
if(db != null){
db.execSQL("INSERT INTO Partidas (alias, date, medida, control, num_blacks, num_whites, total_time, state) VALUES (" +
"'" + partida.getAlias() +"', " +
"'" + partida.getDate() + "', " +
"'" + partida.getMedida() + "', " +
"'" + partida.getControl() + "', " +
"'" + partida.getNum_blacks() + "', " +
"'" + partida.getNum_whites() + "', " +
"'" + partida.getTotal_time() + "', " +
"'" + partida.getState() + "')");
}
}
// Obtener todas las partidas guardadas.
public List<PartidasClass> allPartidas() {
List<PartidasClass> partidas = new ArrayList<>();
String query = "SELECT * FROM " + TABLE_NAME;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
PartidasClass partida;
if (cursor.moveToFirst()) {
do {
partida = new PartidasClass();
partida.setAlias(cursor.getString(1));
partida.setDate(cursor.getString(2));
partida.setMedida(cursor.getString(3));
partida.setControl(cursor.getString(4));
partida.setNum_blacks(cursor.getString(5));
partida.setNum_whites(cursor.getString(6));
partida.setTotal_time(cursor.getString(7));
partida.setState(cursor.getString(8));
partidas.add(partida);
} while (cursor.moveToNext());
}
cursor.close();
return partidas;
}
// Conseguir la partida seleccionada.
public PartidasClass getSelectedPartida(int position) {
String query = "SELECT * FROM " + TABLE_NAME;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
PartidasClass partida = new PartidasClass();
if (cursor.moveToPosition(position)) {
partida.setAlias(cursor.getString(1));
partida.setDate(cursor.getString(2));
partida.setMedida(cursor.getString(3));
partida.setControl(cursor.getString(4));
partida.setNum_blacks(cursor.getString(5));
partida.setNum_whites(cursor.getString(6));
partida.setTotal_time(cursor.getString(7));
partida.setState(cursor.getString(8));
}
cursor.close();
return partida;
}
// Elimina una partida en la base de datos.
public void deletePartida(List<Integer> positions){
Collections.sort(positions, Collections.reverseOrder());
String query = "SELECT * FROM " + TABLE_NAME;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
for(int position: positions){
if (cursor.moveToPosition(position)) {
db.delete(TABLE_NAME, "date=?", new String[]{cursor.getString(2)});
}
}
cursor.close();
}
public void cambiar_alias_partidas(List<Integer> positions, String newAlias){
Collections.sort(positions, Collections.reverseOrder());
String query = "SELECT * FROM " + TABLE_NAME;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
ContentValues cv = new ContentValues();
cv.put("alias", newAlias);
for(int position: positions){
if (cursor.moveToPosition(position)) {
db.update(TABLE_NAME, cv, "_id="+cursor.getString(0), null);
}
}
cursor.close();
}
}
|
[
"[email protected]"
] | |
9fdc2b18e7d567a1fb78b4d8a8dcd43918fe8784
|
359c7e46d5d143ab2f849b488d7d92ee15aeaf3d
|
/ProyectoInt/src/main/java/pe/edu/upeu/dao/IngresosDAO.java
|
ebaaba2271c94fd6878b917694fb6966b4953800
|
[
"Apache-2.0"
] |
permissive
|
JOSELIN-CONDORI/JOSELIN-TINTAYA-UPEU
|
38a1940a37fd2d90b85eaa6154ffd09a8c6e6af6
|
f3a2b2b683546620c05f63f5e8697634aac5dd99
|
refs/heads/main
| 2023-06-24T17:40:32.249666 | 2021-07-23T17:25:51 | 2021-07-23T17:25:51 | 358,319,955 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,403 |
java
|
package pe.edu.upeu.dao;
import java.text.SimpleDateFormat;
import java.util.Date;
import pe.edu.upeu.data.AppCrud;
import pe.edu.upeu.modelo.ConceptosTO;
import pe.edu.upeu.modelo.IngresosTO;
import pe.edu.upeu.modelo.ItinerarioViajesTO;
import pe.edu.upeu.util.LeerArchivo;
import pe.edu.upeu.util.TecladoRead;
import pe.edu.upeu.util.UtilsX;
import org.fusesource.jansi.Ansi;
import org.fusesource.jansi.AnsiConsole;
import static org.fusesource.jansi.Ansi.Color.*;
public class IngresosDAO extends AppCrud {
Ansi color=new Ansi();
LeerArchivo lar;
ConceptosTO consTO;
IngresosTO ingresoTO;
ItinerarioViajesTO itiviTO;
TecladoRead tre=new TecladoRead();
UtilsX ut=new UtilsX();
SimpleDateFormat formato=new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
SimpleDateFormat formatoFecha=new SimpleDateFormat("dd-MM-yyyy");
public void ingresos() {
AnsiConsole.systemInstall();
System.out.println(color.render("| @|green **REGISTRAR INGRESOS**|@"));
mostrarConceptos();
ingresoTO=new IngresosTO();
ingresoTO.setIdConceptos(tre.read("", "Indique el concepto:"));
mostrarItinerario();
ingresoTO.setIdItineraio(tre.read("", "Indique el itinerario:"));
lar=new LeerArchivo("Ingresos.txt");
ingresoTO.setIdOperacion(generarId(lar, 0, "IN", 2));
ingresoTO.setFecha(formatoFecha.format(new Date()));
lar=new LeerArchivo("Itinerario.txt");
Object[][] datait=buscarContenido(lar, 0, ingresoTO.getIdItineraio());
lar=new LeerArchivo("Zona.txt");
Object[][] dataZ=buscarContenido(lar, 0, datait[0][4].toString());
ingresoTO.setMonto(Double.parseDouble(datait[0][5].toString())*Double.parseDouble(dataZ[0][3].toString()));
lar=new LeerArchivo("Ingresos.txt");
agregarContenido(lar,ingresoTO);
}
public void mostrarItinerario() {
lar=new LeerArchivo("Itinerario.txt");
Object[][] data=listarContenido(lar);
String fechaInit=tre.read("", "Ingrese la fecha del itinerario que desea en formato (dd-MM-yyyy):");
int cantidadFi=0;
for (int i = 0; i < data.length; i++) {
String[] dataFechaV=String.valueOf(data[i][1]).split(" ");
if (fechaInit.equals(dataFechaV[0]) ) {
cantidadFi++;
}
}
Object[][] dataRealRF=new Object[cantidadFi][data[0].length];
cantidadFi=0;
for (int i = 0; i < data.length; i++) {//
String[] dataFechaV=String.valueOf(data[i][1]).split(" ");
if (fechaInit.equals(dataFechaV[0]) ) {
System.out.print(data[i][0]+"="+data[i][2]+",");
}
}
System.out.println("");
}
public void mostrarConceptos() {
lar=new LeerArchivo("Concepto.txt");
Object[][] data=listarContenido(lar);
for (int i = 0; i < data.length; i++) {//
if (data[i][0].equals("C1")) {
System.out.print(data[i][0]+"="+data[i][2]+",");
}
}
System.out.println("");
}
}
|
[
"JOSELIN-CONDORI"
] |
JOSELIN-CONDORI
|
06b92045aa7441659fc27c118076085b5ace5345
|
3afffe392113b7faf46a7703aec0ca098d8f99e5
|
/wx-app-boss/src/main/java/com/phone/erp/boss/mapper/sales/WholesaleReportMapper.java
|
8cfee6fee0e3ae86366be775b1e23802833767d3
|
[] |
no_license
|
disvenk/wx-app
|
9d49ea040098f101890723db0d59a081ea128f59
|
728982c8e76cb9d4fada92084905834f7a38770c
|
refs/heads/master
| 2023-08-10T07:39:17.816203 | 2019-10-22T06:57:27 | 2019-10-22T06:57:27 | 216,744,215 | 0 | 0 | null | 2023-07-22T19:27:15 | 2019-10-22T06:56:39 |
Java
|
UTF-8
|
Java
| false | false | 243 |
java
|
package com.phone.erp.boss.mapper.sales;
import com.phone.erp.boss.mapper.ReportBaseMapper;
/**
* [批发战报mapper接口]
* @author hmj
* @create 2018-08-27 15:33
*/
public interface WholesaleReportMapper extends ReportBaseMapper {
}
|
[
"[email protected]"
] | |
c6496029a15c00804e878dfa2c57a3ab738e984d
|
c9d0798fca052d5fb0e6c9ecd3bfccddd842cdb5
|
/src/test/java/proslab/unicam/usefultests/LoginTest.java
|
de43e1b05d73c764f92dfad5a6980f2bd1b37f75
|
[] |
no_license
|
FabrizioFornari/PracticeWithSelenium
|
4399d99c67335c4522589660094bca0dae9fc83a
|
fa0cf3ef979802a8e067f02c61308e7a2fa0e293
|
refs/heads/master
| 2022-06-23T07:18:12.899693 | 2020-11-11T09:46:53 | 2020-11-11T09:46:53 | 166,678,224 | 0 | 0 | null | 2022-06-21T00:55:19 | 2019-01-20T15:42:15 |
Java
|
UTF-8
|
Java
| false | false | 2,167 |
java
|
package proslab.unicam.usefultests;
import static org.junit.jupiter.api.Assertions.*;
import org.apache.log4j.Logger;
//import org.apache.log4j.Logger;
//import org.apache.log4j.PropertyConfigurator;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import proslab.unicam.config.PropertiesFile;
class LoginTest {
static WebDriver driver;
final static Logger log = Logger.getLogger(HttpResponseCode.class.getName());
static PropertiesFile prop = new PropertiesFile();
@BeforeAll
static void setUpBeforeClass() throws Exception {
prop.readPropertiesFile();
}
@AfterAll
static void tearDownAfterClass() throws Exception {
driver.close();
}
@BeforeEach
void setUp() throws Exception {
}
@AfterEach
void tearDown() throws Exception {
}
@Test
public void login() {
loginBrowser();
}
public void loginBrowser() {
String projectPath = System.getProperty("user.dir");
System.setProperty("webdriver.chrome.driver", projectPath+"/drivers/chromedriver");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(15,TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
driver.get("http://www.facebook.com");
driver.findElement(By.name("email")).sendKeys("your email id");
driver.findElement(By.name("pass")).sendKeys("your password");
driver.findElement(By.id("loginbutton")).click();
//driver.findElement(By.className("_4rbf _53ij")).toString();
System.out.println(driver.findElement(By.cssSelector("._4rbf._53ij")).getText());
assertNotEquals("The email or phone number you’ve entered doesn’t match any account. Sign up for an account.", driver.findElement(By.cssSelector("._4rbf._53ij")).getText());
}
}
|
[
"[email protected]"
] | |
12d14a88d12fa0746bcd018da611622cbc0f81f7
|
34eca4466b0e9b7a597be43aa193bde15c98c537
|
/src/main/java/com/github/msafonov/corporate/bot/Migration.java
|
de5a1aeb16b124caf2b045156fabea47a026cedc
|
[
"MIT"
] |
permissive
|
RedheadedGirl/corporate-bot
|
ce04de851ab6ed14c57ee0663c64fa9a17dda142
|
940a244408f69379a30c8a0739afc1e6b78ee183
|
refs/heads/main
| 2023-06-20T05:36:26.994388 | 2021-07-09T12:17:49 | 2021-07-09T12:17:49 | 381,624,496 | 0 | 0 |
MIT
| 2021-06-30T08:10:31 | 2021-06-30T08:10:30 | null |
UTF-8
|
Java
| false | false | 1,093 |
java
|
package com.github.msafonov.corporate.bot;
import org.flywaydb.core.Flyway;
import java.sql.SQLException;
public class Migration {
private String url;
private String user;
private String password;
private String schema;
public Migration(String url, String user, String password, String schema) {
this.url = url;
this.user = user;
this.password = password;
this.schema = schema;
}
public void migrateToNewVersion() throws SQLException {
String data_url = url + "?currentSchema=" + schema;
Flyway flyway = Flyway.configure().dataSource(data_url, user, password).load();
flyway.migrate();
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
|
[
"[email protected]"
] | |
d7046cdda5723e33f83769847af4a9a3bba51d98
|
5185f52fb8be5f45c00833343609e0900cfeff67
|
/src/main/java/edu/eci/arsw/threads/CountThread.java
|
911283375b933108cd6c852ba68701e1b1d39ee2
|
[] |
no_license
|
JuanMunozD/ARSW-LAB1
|
27307d8941ad46be25dadf1dc115bc52488ebaa0
|
f8e102e55167476bdd146ccdcd0be28a8a8b22ac
|
refs/heads/master
| 2023-02-18T06:51:19.523660 | 2021-01-21T14:58:27 | 2021-01-21T14:58:27 | 331,656,741 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 548 |
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 edu.eci.arsw.threads;
/**
*
* @author hcadavid
*/
public class CountThread implements Runnable{
private int minimo;
private int maximo;
public CountThread(int ini, int fin) {
minimo = Math.min(ini, fin);
maximo = Math.max(ini, fin);
}
@Override
public void run() {
for (int i=minimo; i<=maximo; i++) System.out.println(i);
}
}
|
[
"[email protected]"
] | |
40820a68e405d7fcfde333028cd31a18101ff3a5
|
47f086f14c3392dd4f181fced9ff7d2c54bea057
|
/src/main/java/com/technologygarden/service/impl/GardenManagePowerLoadServiceImpl.java
|
1cc562d308b518037fc0a3f9e898f2b686b1d0bb
|
[] |
no_license
|
HotBoy001/technology
|
8234adb912671ca00b40ab600a23400046d63da2
|
f43c50b30179364cc16b196930935afbf03c4f01
|
refs/heads/master
| 2023-01-29T06:41:33.053585 | 2020-12-15T02:14:30 | 2020-12-15T02:14:30 | 321,526,597 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,455 |
java
|
package com.technologygarden.service.impl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.technologygarden.dao.PowerLoadMapper;
import com.technologygarden.entity.PowerLoad;
import com.technologygarden.entity.ResultBean.ResultBean;
import com.technologygarden.entity.ResultBean.ResultStatus;
import com.technologygarden.service.GardenManagePowerLoadService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Slf4j
@Service("gardenManagePowerLoadService")
public class GardenManagePowerLoadServiceImpl implements GardenManagePowerLoadService {
private final PowerLoadMapper powerLoadMapper;
@Autowired
public GardenManagePowerLoadServiceImpl(PowerLoadMapper powerLoadMapper) {
this.powerLoadMapper = powerLoadMapper;
}
@Override
public ResultBean<PageInfo<?>> getPowerLoadListByPage(Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
Page<PowerLoad> powerLoadList = powerLoadMapper.selectAllWithRoomInfoByPage();
PageInfo<?> pageInfo = new PageInfo<>(powerLoadList);
return new ResultBean<>(pageInfo);
}
@Override
public ResultBean<?> insertPowerLoad(PowerLoad powerLoad) {
powerLoadMapper.insert(powerLoad);
return new ResultBean<>();
}
@Override
public ResultBean<?> deletePowerLoadById(Integer powerLoadId) {
powerLoadMapper.deleteByPrimaryKey(powerLoadId);
return new ResultBean<>();
}
@Override
public ResultBean<?> updatePowerLoadById(PowerLoad powerLoad) {
if (powerLoad.getPlId() == null) {
log.warn("修改用电负荷 主键缺失 ---> " + powerLoad);
return new ResultBean<>(ResultStatus.PARAMETER_MISSING_ERROR);
}
powerLoadMapper.updateDynamicById(powerLoad);
return new ResultBean<>();
}
@Override
public ResultBean<PageInfo<?>> searchPowerLoad(Integer pageNum, Integer pageSize, Integer roomId, Integer buildingId, String companyName) {
PageHelper.startPage(pageNum, pageSize);
Page<PowerLoad> powerLoadList = powerLoadMapper.searchPowerLoadWithRoomInfoByPage(roomId, buildingId, companyName);
PageInfo<?> pageInfo = new PageInfo<>(powerLoadList);
return new ResultBean<>(pageInfo);
}
}
|
[
"[email protected]"
] | |
0b4224e3e3a8442345940433c860af9c53b265c4
|
98120a431bf9e03aeec5cb5cca0bbf7fbf4b2c3d
|
/CamaraCannon.java
|
97f1ea1cc938ec00024058b4a49b0506acaeeec3
|
[] |
no_license
|
RafaelMendezUCAB/photo-editor
|
158ab005027357e49d87401641e05f32b2dc909f
|
f95a31d424400695bfc4d0d4a0cc288d34e3c63a
|
refs/heads/master
| 2022-09-23T02:41:24.456847 | 2020-06-01T01:52:29 | 2020-06-01T01:52:29 | 268,377,774 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 551 |
java
|
public class CamaraCannon extends Camara {
public void capturarImagen() {
System.out.println("A photo is taken from a modern cannon camera");
}
public void saturacionImagen() {
System.out.println("saturation is applied to the image before taking the photo from a cannon camera");
}
public void contrasteImagen() {
System.out.println("Contrast to the image before taking the photo from a cannon camera");
}
public void brilloImagen() {
System.out.println("the image is brightened before taking the photo from a cannon camera");
}
}
|
[
"[email protected]"
] | |
9935fc8a61ba1593ddbba92e7278227aa11ef78f
|
d4723e4531e2152274ab2cb8784465f468dae670
|
/Generator Armii Afterglow/src/skills/Skill.java
|
3e0b60c84386179bd4ed0982f72b4e047236f725
|
[] |
no_license
|
Naitoreivun/AfterglowArmyGenerator
|
a0c308f7a69900f69c87def2aeb0d12afd288dff
|
00245b44f89b0c510d0ae837dd7e4d042b27a77a
|
refs/heads/master
| 2016-09-06T10:49:47.040691 | 2015-05-13T00:30:38 | 2015-05-13T00:30:38 | 34,218,692 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 739 |
java
|
package skills;
public class Skill extends BasicSkill
{
public static final int TACTICS = 0;
public static final int MIND = 1;
public static final int LOOT = 2;
public static final int COMBAT = 3;
private final int value;
public Skill()
{
super();
value = 0;
}
public Skill(String name)
{
super(name);
value = 0;
}
public Skill(String name, String description)
{
super(name, description);
value = 0;
}
public Skill(String name, String description, int value)
{
super(name, description);
this.value = value;
}
@Override
public String toString()
{
return super.toString() + " (" + value + ")";
}
public int getValue()
{
return value;
}
}
|
[
"[email protected]"
] | |
4aba261634ce95aacedce1f943391c3ff438c01b
|
3633db033670c7334f3c985ac203057485b9ff74
|
/src/main/java/br/com/autotrac/jatlauncher/apirest/repository/ParamDeviceRepository.java
|
53be70e4b30fa56e78c10dd15681c0d2696f43a8
|
[] |
no_license
|
fernandocostagomes/api-backendautotraclauncher
|
4dbe7d0c160094c2a456516ab9af0460463b9d37
|
a8d555fd602fd2a303a4933b26169ac7a48c0f60
|
refs/heads/master
| 2023-03-20T06:57:59.460568 | 2023-02-03T01:30:36 | 2023-02-03T01:30:36 | 246,133,799 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 444 |
java
|
package br.com.autotrac.jatlauncher.apirest.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import br.com.autotrac.jatlauncher.apirest.models.PARAM_DEVICE;
public interface ParamDeviceRepository extends JpaRepository<PARAM_DEVICE, Long>
{
PARAM_DEVICE findById( long id );
PARAM_DEVICE findByParamNumId( long id );
List<PARAM_DEVICE> findAllByDeviceNumId( long device_num_id );
}
|
[
"[email protected]"
] | |
e9b6c8417fed13677d9f968574329e64e81fcff1
|
a298809628d4a7bc6f0f3947cc5096e2b0ccd026
|
/mybatisProject/src/com/kh/mybatis/board/model/vo/Reply.java
|
b995f239330b8cc0a0b6af320d3cf3bd468063fd
|
[] |
no_license
|
BrianH29/BH_mybatis_workspace
|
6062f6620ae2976f2b7a309621722ff66cb2662d
|
461ee016dd1bfc6605b691ff92845d02ab41f028
|
refs/heads/main
| 2023-01-06T18:04:55.488798 | 2020-11-05T00:17:00 | 2020-11-05T00:17:00 | 304,542,839 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,644 |
java
|
package com.kh.mybatis.board.model.vo;
import java.sql.Date;
public class Reply {
private int replyNo;
private String replyContent;
private int refBoardNo;
private String replyWriter;
private Date createDate;
private String status;
public Reply() {}
public Reply(int replyNo, String replyContent, int refBoardNo, String replyWriter, Date createDate, String status) {
super();
this.replyNo = replyNo;
this.replyContent = replyContent;
this.refBoardNo = refBoardNo;
this.replyWriter = replyWriter;
this.createDate = createDate;
this.status = status;
}
public int getReplyNo() {
return replyNo;
}
public void setReplyNo(int replyNo) {
this.replyNo = replyNo;
}
public String getReplyContent() {
return replyContent;
}
public void setReplyContent(String replyContent) {
this.replyContent = replyContent;
}
public int getRefBoardNo() {
return refBoardNo;
}
public void setRefBoardNo(int refBoardNo) {
this.refBoardNo = refBoardNo;
}
public String getReplyWriter() {
return replyWriter;
}
public void setReplyWriter(String replyWriter) {
this.replyWriter = replyWriter;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
@Override
public String toString() {
return "Reply [replyNo=" + replyNo + ", replyContent=" + replyContent + ", refBoardNo=" + refBoardNo
+ ", replyWriter=" + replyWriter + ", createDate=" + createDate + ", status=" + status + "]";
}
}
|
[
"[email protected]"
] | |
c96b46db7f10385b7a99ad5db5964ec026282181
|
0c40da843f1376894b14ac84cab9efbd1a1739dd
|
/src/main/java/algorithm/ValidSudoku.java
|
45ac006d3430d198e9f80d08db0fcd86087afec5
|
[] |
no_license
|
Nachtflug/leetcode
|
8a8ac146bbc975bf3b0571da4fc2b71987e5cbad
|
7408de2ba20f45c3370485d0691d8d9cca258342
|
refs/heads/master
| 2021-03-28T11:35:25.655051 | 2020-08-03T08:38:52 | 2020-08-03T08:38:52 | 247,859,893 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,040 |
java
|
package algorithm;
/**
* 36. 有效的数独难度中等373判断一个 9x9 的数独是否有效。只需要根据以下规则,验证已经填入的数字是否有效即可。
*
*
* 数字 1-9 在每一行只能出现一次。
* 数字 1-9 在每一列只能出现一次。
* 数字 1-9 在每一个以粗实线分隔的 3x3 宫内只能出现一次。
*
*
*
*
* 上图是一个部分填充的有效的数独。
*
* 数独部分空格内已填入了数字,空白格用 '.' 表示。
*
* 示例 1:
*
* 输入:
* [
* ["5","3",".",".","7",".",".",".","."],
* ["6",".",".","1","9","5",".",".","."],
* [".","9","8",".",".",".",".","6","."],
* ["8",".",".",".","6",".",".",".","3"],
* ["4",".",".","8",".","3",".",".","1"],
* ["7",".",".",".","2",".",".",".","6"],
* [".","6",".",".",".",".","2","8","."],
* [".",".",".","4","1","9",".",".","5"],
* [".",".",".",".","8",".",".","7","9"]
* ]
* 输出: true
*
*
* 示例 2:
*
* 输入:
* [
* ["8","3",".",".","7",".",".",".","."],
* ["6",".",".","1","9","5",".",".","."],
* [".","9","8",".",".",".",".","6","."],
* ["8",".",".",".","6",".",".",".","3"],
* ["4",".",".","8",".","3",".",".","1"],
* ["7",".",".",".","2",".",".",".","6"],
* [".","6",".",".",".",".","2","8","."],
* [".",".",".","4","1","9",".",".","5"],
* [".",".",".",".","8",".",".","7","9"]
* ]
* 输出: false
* 解释: 除了第一行的第一个数字从 5 改为 8 以外,空格内其他数字均与 示例1 相同。
* 但由于位于左上角的 3x3 宫内有两个 8 存在, 因此这个数独是无效的。
*
* 说明:
*
*
* 一个有效的数独(部分已被填充)不一定是可解的。
* 只需要根据以上规则,验证已经填入的数字是否有效即可。
* 给定数独序列只包含数字 1-9 和字符 '.' 。
* 给定数独永远是 9x9 形式的。
*
* 来源:力扣(LeetCode)
* 链接:https://leetcode-cn.com/problems/valid-sudoku
* 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
public class ValidSudoku {
public static int[] TWO_POW = new int[10];
static {
for (int i = 1; i < 10; i++) {
TWO_POW[i] = 1 << i;
}
}
public boolean isValidSudoku(char[][] board) {
int[] slots = new int[27];
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
if (board[i][j] == '.') continue;
int x = board[i][j] - '0';
int area = 18 + (i / 3) * 3 + j / 3;
if ((slots[i] & TWO_POW[x]) != 0)
return false;
if ((slots[j + 9] & TWO_POW[x]) != 0)
return false;
if ((slots[area] & TWO_POW[x]) != 0)
return false;
slots[i] |= TWO_POW[x];
slots[j + 9] |= TWO_POW[x];
slots[area] |= TWO_POW[x];
}
}
return true;
}
}
|
[
"[email protected]"
] | |
00135eb08bdc1d9f1a98c0469bf8b695cc6deb3a
|
68dc340f72aeed52e6b69faecac1742122d74a11
|
/src/weibo4android/Tag.java
|
912e60034a8a850e03a6d310bcb91d6631196d2a
|
[] |
no_license
|
junwei-ren/weibo1122
|
59e13ce2319d839a60964b22c72e6fe5d3554687
|
63dee47ca85966350015299af6a7160f4ff351da
|
refs/heads/master
| 2016-09-05T10:07:58.418593 | 2011-09-16T00:00:03 | 2011-09-16T00:00:04 | 2,393,402 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,826 |
java
|
package weibo4android;
import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import weibo4android.http.Response;
import weibo4android.org.json.JSONArray;
import weibo4android.org.json.JSONException;
import weibo4android.org.json.JSONObject;
/**
* @author haidong
*
*/
public class Tag extends WeiboResponse implements java.io.Serializable{
private static final long serialVersionUID = 2177657076940291492L;
private String id;
private String value;
public Tag(Response res,Element elem) throws WeiboException{
ensureRootNodeNameIs("tag", elem);
id = getChildText("id",elem);
value = getChildText("value",elem);
}
public Tag(Response res ,Element elem,Weibo weibo,String str) throws WeiboException{
ensureRootNodeNameIs("tagid", elem);
id=elem.getNodeName();
value=elem.getNodeValue();
}
public Tag(Response res,Element elem,Weibo weibo) throws WeiboException{
ensureRootNodeNameIs("tagid", elem);
id=elem.getNodeName();
value=elem.getNodeValue();
}
public Tag(JSONObject json) throws WeiboException, JSONException {
if (!(json.getString("id")==null||json.getString("id").length()==0)) {
id = json.getString("id");
} else if (!(json.getString("tagid")==null||json.getString("tagid").length()==0)) {
id = json.getString("tagid");
}
if (!(json.getString("value")==null||json.getString("value").length()==0))
value = json.getString("value");
}
public static List<Tag> constructTags(Response res,Weibo weibo) throws WeiboException {
Document doc = res.asDocument();
if (isRootNodeNilClasses(doc)) {
return new ArrayList<Tag>(0);
} else {
try {
ensureRootNodeNameIs("tags", doc);
NodeList list = doc.getDocumentElement().getElementsByTagName(
"tag");
int size = list.getLength();
List<Tag> tags = new ArrayList<Tag>(size);
for (int i = 0; i < size; i++) {
tags.add(new Tag(res, (Element) list.item(i)));
}
return tags;
} catch (WeiboException te) {
ensureRootNodeNameIs("nil-classes", doc);
return new ArrayList<Tag>(0);
}
}
}
public static List<Tag> createTags(Response res,Weibo weibo) throws WeiboException{
Document doc=res.asDocument();
if(isRootNodeNilClasses(doc)){
return new ArrayList<Tag>(0);
}else{
try{
ensureRootNodeNameIs("tagids",doc);
NodeList list = doc.getDocumentElement().getElementsByTagName(
"tagid");
int size = list.getLength();
List<Tag> tags = new ArrayList<Tag>(size);
for (int i = 0; i < size; i++) {
tags.add(new Tag(res, (Element) list.item(i),null));
}
return tags;
} catch (WeiboException te) {
ensureRootNodeNameIs("nil-classes", doc);
return new ArrayList<Tag>(0);
}
}
}
public static List<Tag> destroyTags(Response res,Weibo weibo) throws WeiboException{
Document doc=res.asDocument();
if(isRootNodeNilClasses(doc)){
return new ArrayList<Tag>(0);
}else{
try{
ensureRootNodeNameIs("tags",doc);
NodeList list = doc.getDocumentElement().getElementsByTagName(
"tagid");
int size = list.getLength();
List<Tag> tags = new ArrayList<Tag>(size);
for (int i = 0; i < size; i++) {
tags.add(new Tag(res, (Element)list.item(i),null,null));
}
return tags;
} catch (WeiboException te) {
ensureRootNodeNameIs("nil-classes", doc);
return new ArrayList<Tag>(0);
}
}
}
static List<Tag> constructTags(Response res) throws WeiboException {
try {
JSONArray list = res.asJSONArray();
int size = list.length();
List<Tag>tags = new ArrayList<Tag>(size);
for (int i = 0; i < size; i++) {
tags.add(new Tag(list.getJSONObject(i)));
}
return tags;
} catch (JSONException jsone) {
throw new WeiboException(jsone);
} catch (WeiboException te) {
throw te;
}
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Tag other = (Tag) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @return the value
*/
public String getValue() {
return value;
}
public String toString() {
return "tags{ " +id +
"," +value+
'}';
}
}
|
[
"[email protected]"
] | |
1813433b06745bd224ad50ddef613f553f9cf3dc
|
e5a765bf1b5a5efade5c66aca7989147cb9c29f7
|
/word/src/com/lanou3g/servlet/RegisterServlet.java
|
334db995ea7835379518ee47f92d5c58db8e1861
|
[] |
no_license
|
xuhan961228/xuhan2
|
7fc8fe3c219dc4bedd8a95ba666e9bce34a39829
|
07cc8930c39b3f829a1492e0f3cfb42774d9a98a
|
refs/heads/master
| 2021-09-09T12:19:51.332399 | 2018-01-15T14:52:58 | 2018-01-15T14:52:58 | 114,257,141 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,049 |
java
|
package com.lanou3g.servlet;
import com.lanou3g.dao.UserDao;
import com.lanou3g.domain.User;
import org.apache.commons.beanutils.BeanUtils;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Map;
@WebServlet(name = "RegisterServlet",urlPatterns = "/register")
public class RegisterServlet extends HttpServlet {
private UserDao userDao=new UserDao();
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String username = request.getParameter("username");
String password = request.getParameter("password");
if (username==null||password==null){
RequestDispatcher dispatcher = request.getRequestDispatcher("/register");
dispatcher.include(request,response);
// System.out.println("sss");
}else {
// System.out.println("xxxx");
Map<String, String[]> parameterMap = request.getParameterMap();
User user=new User();
try {
BeanUtils.populate(user,parameterMap);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
userDao.insertUser(user);
// System.out.println("2222");
// userDao.findByName(username);
// System.out.println("dddd");
response.setStatus(302);
response.sendRedirect("http://localhost:8080/login.jap");
// response.getWriter().write("SUCCESS");
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
}
|
[
"[email protected]"
] | |
76103121109f161d8b0f3d38580fbebf0c5dd4fe
|
70a2e24dee9035df560a1ce5534b59e39f5ea6c4
|
/src/ru/list/ruraomsk/editDT/DataTableCellRender.java
|
8b9b4e0d5b4c806de7370a8b711a051401e635c0
|
[] |
no_license
|
ruraomsk/dte
|
fea34bd8ccad15de22bacaf33f35b19e59fea5d2
|
5000cadff672960dd5f6aaa1264b5a547da4d383
|
refs/heads/master
| 2021-01-11T09:22:30.377701 | 2017-03-16T04:25:48 | 2017-03-16T04:25:48 | 77,143,747 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,902 |
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 ru.list.ruraomsk.editDT;
import com.tibbo.aggregate.common.datatable.DataTable;
import com.tibbo.aggregate.common.datatable.FieldFormat;
import java.awt.Component;
import javax.swing.table.TableCellRenderer;
import ru.list.ruraomsk.editDT.defrenders.*;
/**
*
* @author Русинов Юрий <[email protected]>
*/
class DataTableCellRender
{
FieldFormat ff;
DataTable dt;
private TableCellRenderer render;
public DataTableCellRender(DataTable dt,FieldFormat ff)
{
this.ff = ff;
this.dt = dt;
makerenders();
}
public TableCellRenderer getRender(){
return render;
}
private void makerenders()
{
if (ff.hasSelectionValues()) {
render = new ChoiceRender(dt);
return;
}
if (ff.getType() == 'I') {
render = new NumberRender();
return;
}
if (ff.getType() == 'L') {
render = new NumberRender();
return;
}
if (ff.getType() == 'B') {
render = new BooleanRender();
return;
}
if (ff.getType() == 'F') {
render = new NumberRender();
return;
}
if (ff.getType() == 'D') {
render = new DateRender();
return;
}
if (ff.getType() == 'T') {
render = new DataTableRender();
return;
}
if (ff.getType() == 'C') {
render = new ColorRender();
return;
}
// if(ff.getType()=='A'){
// render=new BlockRender();
// return;
}
}
|
[
"rura@ruramint"
] |
rura@ruramint
|
a783fc1926973f87092d6e7bca48c15ddb83d664
|
4d6313a7fd314270abf3264f28a4c62afb2305b1
|
/mergeSort/StringWrapper.java
|
f4a08c2df70a5026c0ef6a8b31a4458aa1874eaf
|
[] |
no_license
|
CodyTRandall/JavaProjects
|
13ece070670a699c8fe6e7f0a95bbeee8c87bcfc
|
f7e9415e731e325c97bafb051071c778bcabe428
|
refs/heads/master
| 2016-09-06T15:52:10.211304 | 2012-12-04T04:19:03 | 2012-12-04T04:19:03 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,892 |
java
|
package a4;
/**
This class is a wrapper class for strings that also contains
a comparator object that counts the number of comparisons
performed by the string.
@author Jeff Smith
@version for Assignment 1, CS 146, Section 3, SJSU, Spring 2012
*/
public class StringWrapper implements Comparable<StringWrapper>
{
private String string; // the string to be wrapped
private CountingComparator cc;
// the comparator to be used for string comparisons
/**
Constructs a wrapper for a given string that uses a given
counting comparator for string comparisons. Null arguments
are accepted
@param s the string to be wrapped
@param cc the comparator to be used for string comparisons
*/
public StringWrapper(String s, CountingComparator cc)
{
this.string = s;
this.cc = cc;
}
/**
Compares this StringWrapper object with another for order.
Null arguments and CountingComparators are not checked for.
@return a negative integer, zero, or a positive integer
as this object is less than, equal to, or greater than the specified object.
*/
public int compareTo(StringWrapper y)
{
return cc.compare(string, y.string);
}
/**
Indicates whether some other object is "equal to" this one.
@param y the object to be compared to
@return <code>true</code> if and only if y is a StringWrapper
wrapping a string that is equal (case-sensitively)
to the string wrapped by this object
*/
public boolean equals(Object otherObject) {
if (otherObject == null) return false;
if (getClass() != otherObject.getClass())
return false;
StringWrapper other = (StringWrapper) otherObject;
return compareTo(other)==0; }
/**
Returns a hash code value for the object.
No null check is made for the string being represented
@return the hash code of the string being represented
*/
public int hashCode()
{
return string.hashCode();
}
/**
Sets the comparison counter of the counting comparator to 0.
No check is made whether this counting comparator is null
*/
public void resetCounter() {
cc.resetCounter(); }
/**
Gets the current comparison count of the counting comparator
No check is made whether this counting comparator is null
@return the current comparison count
*/
public int getCounter() {
return cc.getCounter(); }
/**
*
* @return the current string
*/
public String toString(){
return string;
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.