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
3394b4aa1c16d0adff28e423c8893410e05f1278
9cfa4900641ab26f03ada690d80d40788c9b5ceb
/java_solution/BinarySearchTreeIterator_173.java
0f26ec4b1c1642d60cad77d71aa766cd7b3b3bd2
[]
no_license
PizzaL/LeetCode
5cae679125575dc1cfd9c54cd8f1b6590923e6ad
2966679200abf11a06cd40ca3ab13005b803ff0f
refs/heads/master
2022-03-01T23:49:36.735057
2019-09-02T08:46:52
2019-09-02T08:46:52
58,784,912
0
0
null
null
null
null
UTF-8
Java
false
false
511
java
class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } public class BSTIterator { public BSTIterator(TreeNode root) { } /** @return whether we have a next smallest number */ public boolean hasNext() { } /** @return the next smallest number */ public int next() { } } /** * Your BSTIterator will be called like this: * BSTIterator i = new BSTIterator(root); * while (i.hasNext()) v[f()] = i.next(); */
[ "syluo1990@hotmail.com" ]
syluo1990@hotmail.com
8b14e7c69e295ca59a2f8bda2244aef163705fb1
a842e97c0cd30c2a0a162ae5e8630be6e7584863
/app/src/main/java/com/example/cinemaapp/view/owner/manageMovies/remove/ManageMoviesRemovePresenter.java
d34f5b1e8d55ce0caa33d64eab48f6765a9ca2f6
[]
no_license
ThanasisKl/CinemApp
5ecbb6b0c8daa4af05a57b75cfa4c84c51bd5582
74d496771c597fab4512553dd020ce60b078f470
refs/heads/main
2023-06-24T08:45:44.684418
2021-07-24T13:42:53
2021-07-24T13:42:53
389,107,308
1
0
null
null
null
null
UTF-8
Java
false
false
677
java
package com.example.cinemaapp.view.owner.manageMovies.remove; import com.example.cinemaapp.dao.memorydao.MovieDAOMemory; import com.example.cinemaapp.model.Movie; public class ManageMoviesRemovePresenter { private ManageMoviesRemoveView view; private MovieDAOMemory movies; private Movie movieToRemove; public ManageMoviesRemovePresenter(ManageMoviesRemoveView view, MovieDAOMemory movies) { this.view = view; this.movies = movies; } public void removeMovie() { movieToRemove = movies.find(view.getMovieTitle()); movies.delete(movieToRemove.getId()); view.showMessage("Movie removed Successfully"); } }
[ "tklettas@gmail.com" ]
tklettas@gmail.com
fae09d8466f17b4fdc679c0cc29ce7e457b89093
a14e0a89e84efb26c11f6da99e2f84846650cb71
/src/test/java/com/monical/MockTest.java
d0d35751618ead0325e3dfbcd5f7f147fbab69a9
[]
no_license
ketue/misc
cdd4145d0d992e8bb86f2cb0187c79a2acdda708
c87cb58ddea9182b2ebdd9838ab8e0bbf0fd8806
refs/heads/master
2021-06-30T08:34:18.574489
2019-05-16T06:30:27
2019-05-16T06:30:27
94,887,663
0
0
null
null
null
null
UTF-8
Java
false
false
1,310
java
package com.monical; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.junit.Test; import java.util.LinkedList; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; /** * @author zijie.cao * @date 2018-08-12 14:44:22 */ public class MockTest { @Test public void stubbing() { //You can mock concrete classes, not only interfaces LinkedList mockedList = mock(LinkedList.class); //stubbing when(mockedList.get(0)).thenReturn("first"); when(mockedList.get(2)).thenThrow(new RuntimeException()); //following prints "first" // System.out.println(mockedList.get(0)); //following throws runtime exception System.out.println(mockedList.get(1)); //following prints "null" because get(999) was not stubbed System.out.println(mockedList.get(999)); //Although it is possible to verify a stubbed invocation, usually it's just redundant //If your code cares what get(0) returns then something else breaks (often before even verify() gets executed). //If your code doesn't care what get(0) returns then it should not be stubbed. verify(mockedList).get(999); } }
[ "caozijie@maoyan.com" ]
caozijie@maoyan.com
6e950a6fb14ba1115c4bf1a39934be54678c50ac
0a4bd46a1c92af00339a2c507ff03f136553bd0d
/src/main/java/com/teamtreehouse/meetup/domain/Comment.java
009f92788c71c04610d782fe4843a663bd4bb6b1
[]
no_license
RichardDuffy/improv-meetup
553aa9d14ef1b856745f873735c603f84b9653eb
5ecdf0761baaa71022bca5bd25cea11127aca7c9
refs/heads/master
2020-06-19T10:31:34.846587
2016-06-30T22:34:01
2016-06-30T22:34:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,001
java
package com.teamtreehouse.meetup.domain; import java.util.Date; import com.teamtreehouse.meetup.integration.Gravatar; public class Comment { private String mMessage; private String mPoster; private String mPosterEmail; private Date mPostedDate; public String getMessage() { return mMessage; } public void setMessage(String mMessage) { this.mMessage = mMessage; } public String getPoster() { return mPoster; } public void setPoster(String mPoster) { this.mPoster = mPoster; } public String getPosterAvatar() { return Gravatar.urlFor(getPosterEmail()); } public Date getPostedDate() { return mPostedDate; } public void setPostedDate(Date mPostedDate) { this.mPostedDate = mPostedDate; } public String getPosterEmail() { return mPosterEmail; } public void setPosterEmail(String mPosterEmail) { this.mPosterEmail = mPosterEmail; } }
[ "craig@teamtreehouse.com" ]
craig@teamtreehouse.com
87b7c397f06a249cbb15f4f105ae300c9d2b93a9
7ecabba5af47f9e388f734a43365d877c33caba8
/mobile/app/src/main/java/com/am/a3dpernikguide/contract/callback/preferences/OnLoginPreferencesCallback.java
db2ed2a1a06d5a7f587bb2f211d99ca941893bb9
[]
no_license
DavidIvanov02/3DPernikGuide
8771af42ea43a6f7651bfe046bb1ca2bf0b99b73
d1264ea71e77b91ab91f016deafcf8af82569d5d
refs/heads/main
2023-05-26T09:05:58.824056
2021-06-08T13:44:49
2021-06-08T13:44:49
326,943,241
0
0
null
null
null
null
UTF-8
Java
false
false
184
java
package com.am.a3dpernikguide.contract.callback.preferences; /** * @author Created by Aleks Vasilev Milchov */ public interface OnLoginPreferencesCallback { void onSuccess(); }
[ "david4obgg1@gmail.com" ]
david4obgg1@gmail.com
27dd578f2a7e1ea47ef8e1e1e32c2ad4accc3902
4c364f90858a768640176228a8244327138b96d7
/app/src/main/java/com/a11/weather/MyApplication.java
738ebc4c9780fc6a0730f8784b880f5e42ea1779
[]
no_license
SpringRT/NewWeather
2208c17bf8aa10ed13ff8638399d7304f42c8754
b63e785e36a76fc50b553234b78aee489358cdde
refs/heads/master
2020-07-04T21:00:54.923969
2016-11-18T15:46:09
2016-11-18T15:46:09
74,142,808
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
package com.a11.weather; import android.app.Application; import com.a11.weather.data.models.Weather; public class MyApplication extends Application{ public MyApplication(){ super(); } public static Weather currentWeather = null; public static boolean screenIsSet = false; }
[ "arinalucky97@gmail.com" ]
arinalucky97@gmail.com
ed59c94685b9b312052a852dad309d090a74cfd3
73b6eb52798ddce8b798b1bb056d805031cde1d6
/xiaoshixun/gekk/src/main/java/com/example/gekk/base/BasePresenter.java
54fb6f203447a33f9122f13715ae32b36c1aa932
[]
no_license
qizhiyangguang/geek
12c1f62a6975cd6b238ba5ec174494b2d24ec756
bca518c1016040b752408f84a1c355795645e7d9
refs/heads/master
2020-05-15T21:56:42.934100
2019-04-21T09:20:08
2019-04-21T09:20:08
182,512,806
0
0
null
null
null
null
UTF-8
Java
false
false
554
java
package com.example.gekk.base; import java.util.ArrayList; public abstract class BasePresenter<V extends BaseMvpView> { protected V mView; protected ArrayList<BaseModel> models=new ArrayList<>(); public BasePresenter() { initModel(); } protected abstract void initModel(); public void bind(V view){ this.mView = mView; } public void onDestory(){ mView=null; if (models.size()>0){ for (BaseModel model:models) { model.onDestroy(); } } } }
[ "2206411563@qq.com" ]
2206411563@qq.com
c43d58fc27b1877669577e21a1a3ffd0f9ca0453
d7d65f84ac32d0b097b52585fb01a8189915595a
/Solution/BackEnd-Spring/src/main/java/com/br/almoxarifado/entity/TokenGenerate.java
acdf0ab4deb861d9aef53a29e52fb134e679c709
[]
no_license
36239741/AlmoxarifadoMagaiver
22bc9968f56a796074e62b515aa6403d34dd95cc
3e8d8fe8add3ba5bb446b78ca28c12b1ead313a1
refs/heads/master
2023-01-11T12:31:06.783330
2019-12-13T01:20:20
2019-12-13T01:20:20
204,361,925
1
0
null
2023-01-07T12:46:26
2019-08-25T23:35:11
Java
UTF-8
Java
false
false
829
java
package com.br.almoxarifado.entity; import java.time.LocalDateTime; import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Entity @Data @AllArgsConstructor @NoArgsConstructor public class TokenGenerate { @Id @GeneratedValue private Long id; private UUID token = UUID.randomUUID(); @Column(name = "tempo_expiracao") private LocalDateTime tempoExpiracao; @Column(name = "token_status") private Boolean tokenStatus = true; @ManyToOne(targetEntity = Usuario.class, fetch = FetchType.LAZY) private Usuario usuario; }
[ "henrique_nitatori@hotmail.com" ]
henrique_nitatori@hotmail.com
6195732b331c3875ad5fcc9e5599ac1c393afb8d
54cf47338064105ea184255dfe7013e56046810a
/src/main/java/vehicule/AutoVehicul.java
938477d238a433ee64ae0f115b47ee8eff978381
[]
no_license
staiu/oop
3c9f9360aec8ae1cce5e65f8bbe7424a847f496d
d882ce96565cdba674cf663788aaa834af3fcae5
refs/heads/master
2020-05-22T07:04:29.459985
2019-05-12T13:16:47
2019-05-12T13:16:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,050
java
package vehicule; /** * Orice clasa in java mosteneste o clasa numita Object */ public class AutoVehicul { public int nrRoti; protected String tip; private String numeClasa = AutoVehicul.class.toString(); int cevaDefault; public AutoVehicul(int numarRoti, String marcaAuto) { nrRoti = numarRoti; tip = marcaAuto; } /** * Principiul de overloading * Atunci cand scrii aceeasi metoda cu acelasi nume, * dar ai parametri diferiti fie ca numar fie ca tip. * Nu conteaza niciodata ce nume dai la variabile. */ public void afiseazaVehicule() { afiseazaVehicule(", "); } public void afiseazaVehicule(String separator) { String text = "AutoVehicul{" + "nrRoti=" + nrRoti + separator + " tip='" + tip + '\'' + '}'; System.out.println(text); } public void afiseazaVehicule(int nrDeori) { for (int i = 0; i < nrDeori; i++) { afiseazaVehicule(); } } }
[ "catalincimpoeru24@gmail.com" ]
catalincimpoeru24@gmail.com
b04f923c41ca0c97c8543fc937b09abe3c3a2ed3
38344764fb43e67513ac30f45ce69cff6b4f8472
/src/main/java/com/test/MongoMaven/strom/count/TestCountSpout.java
939d538ff69706ee97f89e650d89090769ded3bc
[]
no_license
txw905149425/MavenTest
148c09d175fa3249ccdd516b0807338f968deb9e
d77477ca521e0b81baa08d345fe302ca14c83fa0
refs/heads/master
2021-01-22T23:33:27.043338
2018-01-30T06:55:59
2018-01-30T06:55:59
85,650,583
6
0
null
null
null
null
UTF-8
Java
false
false
2,205
java
package com.test.MongoMaven.strom.count; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.util.Map; import org.apache.storm.spout.SpoutOutputCollector; import org.apache.storm.task.TopologyContext; import org.apache.storm.topology.OutputFieldsDeclarer; import org.apache.storm.topology.base.BaseRichSpout; import org.apache.storm.tuple.Fields; import org.apache.storm.tuple.Values; public class TestCountSpout extends BaseRichSpout{ private static final long serialVersionUID = 1L; private SpoutOutputCollector collector; private FileReader fileReader; private boolean completed = false; public void nextTuple() { // TODO Auto-generated method stub if(completed){ try { Thread.sleep(1000); } catch (InterruptedException e) { // Do nothing } return; } String str; // Open the reader BufferedReader reader = new BufferedReader(fileReader); try { // Read all lines while ((str = reader.readLine()) != null) { /** * 发射每一行,Values是一个ArrayList的实现 */ this.collector.emit(new Values(str), str); } } catch (Exception e) { throw new RuntimeException("Error reading tuple", e); } finally { completed = true; } } public void open(Map config, TopologyContext context, SpoutOutputCollector collector) { // TODO Auto-generated method stub try { //获取创建Topology时指定的要读取的文件路径 this.fileReader = new FileReader(config.get("wordsFile").toString()); } catch (FileNotFoundException e) { throw new RuntimeException("Error reading file [" + config.get("wordFile") + "]"); } this.collector=collector; } public void declareOutputFields(OutputFieldsDeclarer declarer) { // TODO Auto-generated method stub declarer.declare(new Fields("line")); } }
[ "txw@gaodig.com" ]
txw@gaodig.com
763695de6fae55ca30ec51f47dcfd7424138f02e
ff8dac34d3473c0bcc8590d01dbf4030392146ac
/sip-proxy/src/gov/nist/sip/proxy/StopProxy.java
8572664608f11026b7199eb7bbe145cb84000599
[]
no_license
kostasrandy/SipNew
3127dbedd445b673e0ec9f009ba6b61e00945841
e0274ba743d8f79c26c30f3e9b9be089609ae552
refs/heads/master
2021-01-11T20:33:51.030164
2017-01-16T18:14:49
2017-01-16T18:14:49
79,144,375
1
2
null
null
null
null
UTF-8
Java
false
false
1,077
java
/******************************************************************************* * Product of NIST/ITL Advanced Networking Technologies Division (ANTD) * * Creator: O. Deruelle (deruelle@nist.gov) * * Questions/Comments: nist-sip-dev@antd.nist.gov * *******************************************************************************/ package gov.nist.sip.proxy; import java.util.*; import java.io.*; /** Class for stopping the proxy. */ public class StopProxy extends TimerTask { private Proxy proxy; /** Constructor : * @param proxy */ public StopProxy(Proxy proxy) { this.proxy=proxy; } /** */ public void run() { ProxyDebug.println("Proxy trying to exit............. "); try { proxy.exit(); } catch(Exception e) { ProxyDebug.println("Proxy failed to exit........................."); e.printStackTrace(); } ProxyDebug.println(); } }
[ "gechatz@softlab.ece.ntua.gr" ]
gechatz@softlab.ece.ntua.gr
ca8020981927cac175ff9ed9a9acc18592babe4e
05d5b452fb116504906a4e5749ca5d6c64cc4a86
/test/scrumcourse/env/CourseTest.java
3f65b1b14562cc3c30c2a9e86c2dd414226ff9a5
[]
no_license
luisrovirosa/CSD-Course
f2ab9ddde86fa4706d73e52fec2e04377860a702
ba51fc7b1ad0ee1f46053cd50a234ffc6f59e132
refs/heads/master
2020-05-17T15:54:03.197551
2013-05-21T12:13:50
2013-05-21T12:13:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,714
java
package scrumcourse.env; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; public class CourseTest { @Test public void createSimpleClass() throws Exception { Course course = new Course("maths"); assertEquals("maths", course.getName()); } // Needs env.college environment property with college name string // This test needs to be run with -Denv.college=Standford @Test public void collegeName() throws Exception { Course course = new Course("maths"); assertEquals("Standford", course.getCollege()); Course courseBerkeley = new Course("Berkeley", "maths"); assertEquals("Berkeley", courseBerkeley.getCollege()); } // A Short course has length less than 2 hours @Test public void shortCourse() throws Exception { Course course = new Course("maths"); course.start(); course.setTimeProvider(new Proveedor() { @Override public long getTime() { // TODO Auto-generated method stub return super.getTime() + 1_000_000_000L * 15; } }); course.end(); assertTrue(course.isShort()); assertTrue(course.getDurationSeconds() > 10); assertTrue(course.getDurationSeconds() < 20); } // A long course has length greater than 2 hours @Test public void longCourse() throws Exception { Course course = new Course("maths"); course.start(); course.setTimeProvider(new Proveedor() { @Override public long getTime() { // TODO Auto-generated method stub return super.getTime() + 1_000_000_000L * 3600 * 2 + 1; } }); course.end(); assertTrue(course.isLong()); } void sleepSeconds(long seconds) { try { Thread.sleep(seconds * 1000); } catch (InterruptedException e) { } } }
[ "luisrovirosa@gmail.com" ]
luisrovirosa@gmail.com
305260f09ffd1206d781da301e6589addeee7ae6
20ae816fdc19bf6fab932e6d13c2a188c92f5595
/005-springboot/spring-boot-010-cach/src/main/java/org/clmmm/springboot010cach/controller/DepartController.java
94725ee6885a905101f8e364b6cb4e91ac2bcda8
[]
no_license
clxmm/newjava
5ee4d76e1e6fe81eac3b42790897facf81f1ce62
07a6d369632a3a899bb721fbc773fac0987bca65
refs/heads/master
2023-04-07T18:10:15.102148
2021-04-11T09:20:51
2021-04-11T09:20:51
291,996,933
0
0
null
null
null
null
UTF-8
Java
false
false
747
java
package org.clmmm.springboot010cach.controller; import org.clmmm.springboot010cach.bean.Department; import org.clmmm.springboot010cach.service.DepartMentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; /** * @author clxmm * @version 1.0 * @date 2020/10/22 9:11 下午 */ @RestController public class DepartController { @Autowired DepartMentService departMentService; @GetMapping("/dept/{id}") public Department getDeptById(@PathVariable("id") Integer id) { return departMentService.getDeptById(id); } }
[ "meng_yme@163.com" ]
meng_yme@163.com
0a4d495a5a2d638bca2ae1866605485c4347f85c
07999918fc1df955c8b76ebce00ffac9fad2b606
/app/src/main/java/com/example/user/internproject/MoreFragment.java
de0f87c6334ab70c2fee59e4e90554ac958ed1fc
[]
no_license
sumonmd/Show-Employee-information-data-using-Firebase-and-Room-database.
3ea67510fc7dee7383e8ff455cc81d377084f943
cdc2db782eefbac3a90b7c6c415c5bbc2d418203
refs/heads/master
2022-01-18T18:40:45.692301
2019-07-21T08:49:02
2019-07-21T08:49:02
198,033,874
0
0
null
null
null
null
UTF-8
Java
false
false
562
java
package com.example.user.internproject; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; public class MoreFragment extends Fragment { @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_more,container,false); } }
[ "sumonjust50@gmail.com" ]
sumonjust50@gmail.com
ac7c3c37b81958a49c32a6d4112d9b9d032ffa9f
9c67007d899dbf8cff9711d9ae832866991145e8
/src/main/day08/ArrayTool.java
abe7c5f22f6e673b62cc3521b9a0b282404e60ab
[]
no_license
zhangyufeng12/Basis
ca82b0c7ec15888aa347597ad5e2307c402227fd
9165b6e751f434194fc28b77f0b88c30ba492bdc
refs/heads/master
2020-04-01T02:33:38.626591
2019-04-18T03:43:59
2019-04-18T03:43:59
152,784,425
0
0
null
null
null
null
UTF-8
Java
false
false
2,548
java
package main.day08; /** 建立一个用于操作数组的工具类,其中包含着常见的对数组操作的函数如:最值,排序等 。 @author 张三 @version V1.0 */ public class ArrayTool { ArrayTool(){}//该类中的方法都是静态的,所以该类是不需要的创建对象的。为了保证不让其他成创建该类对象 //可以将构造函数私有化。 /** 获取整型数组的最大值。 @param arr 接收一个元素为int类型的数组。 @return 该数组的最大的元素值 */ public static int getMax(int[] arr) { int maxIndex = 0; for(int x=1; x<arr.length; x++) { if(arr[x]>arr[maxIndex]) maxIndex = x;// } return arr[maxIndex]; } /** 对数组进行选择排序。 @param arr 接收一个元素为int类型的数组。 */ public static void selectSort(int[] arr) { for(int x=0; x<arr.length-1; x++) { for(int y=x+1; y<arr.length; y++) { if(arr[x]>arr[y]) swap(arr,x,y); } } System.out.print("数组排列顺序为:"); for (int m = 0; m < arr.length; m++) { System.out.print(arr[m] + "\t"); } } /* 用于给数组进行元素的位置置换。 @param arr 接收一个元素为int类型的数组。 @param a @param b */ private static void swap(int[] arr,int a,int b) { int temp = arr[a]; arr[a] = arr[b]; arr[b] = temp; } /** 获取指定的元素在指定数组中的索引. @param arr 接收一个元素为int类型的数组。 @param key 要找的元素。 @return 返回该元素第一次出现的位置,如果不存在返回-1. */ public static int getIndex(int[] arr,int key) { for(int x=0; x<arr.length; x++) { if(arr[x]==key) return x; } return -1; } /** 将int数组转换成字符串。格式是:[e1,e2,...] @param arr 接收一个元素为int类型的数组。 @return 返回该数组的字符串表现形式。 */ public static String arrayToString(int[] arr) { String str = "["; for(int x=0; x<arr.length; x++) { if(x!=arr.length-1) str = str + arr[x]+", "; else str = str + arr[x]+"]"; } return str; } }
[ "zhangyufeng_v@didichuxing.com" ]
zhangyufeng_v@didichuxing.com
a0ca4741900ecedf9687c13dfe8bf42cb8709c73
ed2c74cfc8f54d0065ce4b2e1b5e1961d80ceae6
/appratedialog/src/main/java/com/swastik/appratedialog/RateManager.java
e5336f0098f446b4f010061b90c16e897db5f340
[ "Apache-2.0" ]
permissive
KetanChauhan/AppRateDialog
4b4989625e11fdef7ba3783ed9c813fed537b3d8
283af756c8e09a02221541bdba7dac65c04a7dfb
refs/heads/master
2020-03-23T21:40:26.019610
2018-07-27T06:19:25
2018-07-27T06:19:25
142,124,221
2
0
null
2018-07-27T06:00:39
2018-07-24T07:52:40
Java
UTF-8
Java
false
false
3,359
java
package com.swastik.appratedialog; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.net.Uri; import android.util.Log; import java.util.List; public class RateManager { private PreferenceHelper preferenceHelper; public int usedCountThreshold = 3; public int usedDaysInterval = 3; private static final String GOOGLE_PLAY_LINK = "https://play.google.com/store/apps/details?id="; private static final String GOOGLE_PLAY_APP_PACKAGE = "com.android.vending"; public RateManager(Context context) { this.preferenceHelper = PreferenceHelper.getInstance(context); } public int getUsedCountThreshold() { return usedCountThreshold; } public void setUsedCountThreshold(int usedCountThreshold) { this.usedCountThreshold = usedCountThreshold; } public int getUsedDaysInterval() { return usedDaysInterval; } public void setUsedDaysInterval(int usedDaysInterval) { this.usedDaysInterval = usedDaysInterval; } public boolean isTimeToShowRateDialog(){ Log.d("AppRateDialog","noOfUsageCount:"+String.valueOf(preferenceHelper.getAppUsedCount())); if(preferenceHelper.isRated() || preferenceHelper.isNeverShowDialog()){ return false; } boolean isToShow = preferenceHelper.getAppUsedCount()>=(usedCountThreshold); if(isToShow){ return true; } long current = java.util.Calendar.getInstance().getTime().getTime(); long threshold = preferenceHelper.getLastUsedDatetime()+usedDaysInterval*24*60*60*1000; isToShow = current>=threshold; return isToShow; } public void monitor(){ if(preferenceHelper.isFirstTime()){ resetUsedTimesCounter(); preferenceHelper.setIsFirstTime(false); } preferenceHelper.addAppUsedCount(); } public void setRated(){ preferenceHelper.setIsRated(true); } public void resetUsedTimesCounter(){ preferenceHelper.setAppUsedCount(0); preferenceHelper.setLastUsedDatetime(java.util.Calendar.getInstance().getTime().getTime()); } public void setNeverShow() { preferenceHelper.setIsNeverShowDialog(true); } public void rateOnStore(Activity activity){ String packageName = activity.getPackageName(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(GOOGLE_PLAY_LINK + packageName)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if(isPackageExists(activity,GOOGLE_PLAY_APP_PACKAGE)){ intent.setPackage(GOOGLE_PLAY_APP_PACKAGE); } Log.d("AppRateDialog","Redirected to link "+GOOGLE_PLAY_LINK + packageName); activity.startActivity(intent); } private boolean isPackageExists(Context context, String targetPackage) { PackageManager packageManager = context.getPackageManager(); List<ApplicationInfo> packages = packageManager.getInstalledApplications(0); for (ApplicationInfo packageInfo : packages) { if (packageInfo.packageName.equals(targetPackage)){ return true; } } return false; } }
[ "chauhanketan73@gmail.com" ]
chauhanketan73@gmail.com
99044feeb0162d51d1c1224cd288d088b9a32e31
aaa018d13517b05c9001af66054585e0da839e70
/app/src/main/java/com/taocoder/pricemonitor/models/ApprovalsResult.java
fdfd1c5388c74bb82b49493c115bb5380b067cf2
[]
no_license
wahabtaofeeqo/price-monitor
419d444a06296157f4bf187b9e1978c63dead465
b88e6c1ae6636c52afaf211e637bb3c68ec48626
refs/heads/master
2023-01-01T08:58:21.582726
2020-10-19T09:28:43
2020-10-19T09:28:43
298,757,786
0
0
null
null
null
null
UTF-8
Java
false
false
1,008
java
package com.taocoder.pricemonitor.models; import java.util.List; public class ApprovalsResult { private boolean error; private String message; private List<Approval> approvals; public ApprovalsResult(boolean status) { this.error = status; } public ApprovalsResult(boolean status, String message) { this.error = status; this.message = message; } public ApprovalsResult(boolean status, List<Approval> approvals) { this.error = status; this.approvals = approvals; } public boolean isError() { return error; } public void setError(boolean error) { this.error = error; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public List<Approval> getApprovals() { return approvals; } public void setApprovals(List<Approval> approvals) { this.approvals = approvals; } }
[ "taofeekolamilekan218@gmail.com" ]
taofeekolamilekan218@gmail.com
115716680119ffec926b069058c99cb39391e957
ae74e2235d7df5c7bb19f90f75815f133e6b4066
/src/main/java/com/justice/repository/UserRepository.java
d6cbe12b7cc6b1ec55fb520447aa470df8cf0d33
[]
no_license
barthclem/Justine
78a2f272f7f644e722a23eba3e1aad757d07b5c9
9bfa8b600dea203d048243118ce82ff53bf13b1d
refs/heads/master
2021-01-19T10:18:26.913934
2017-02-16T13:33:08
2017-02-16T13:33:08
82,183,844
0
0
null
null
null
null
UTF-8
Java
false
false
271
java
package com.justice.repository; import com.justice.model.User; import org.springframework.data.repository.CrudRepository; /** * Created by aanu.oyeyemi on 1/4/17. * Project name -> demojustice */ public interface UserRepository extends CrudRepository<User,Long> { }
[ "aanu.oyeyemi@konga.com" ]
aanu.oyeyemi@konga.com
950d4d6f3244bf57f6eda21c936fd82952d6de6c
e5c481e6120c056f4e3e3ac8fb04cf076faf3043
/JavaModel/web/com/parks/promptmasterpage_impl.java
83ac810bc02bde5f823e3b1ec23358039d10b1fb
[]
no_license
gmelconian/Parks
f774c369359f5405c17a95d22ae63cbc45e43ce1
2321f5a0dcc6c59090da1669d756dbb0171f30ae
refs/heads/main
2023-08-25T00:27:44.482545
2021-10-20T17:47:33
2021-10-20T17:47:33
419,411,227
0
0
null
null
null
null
UTF-8
Java
false
false
27,428
java
package com.parks ; import com.parks.*; import com.genexus.*; import com.genexus.db.*; import com.genexus.webpanels.*; import java.sql.*; import com.genexus.search.*; public final class promptmasterpage_impl extends GXMasterPage { public promptmasterpage_impl( com.genexus.internet.HttpContext context ) { super(context); } public promptmasterpage_impl( int remoteHandle ) { super( remoteHandle , new ModelContext( promptmasterpage_impl.class )); } public promptmasterpage_impl( int remoteHandle , ModelContext context ) { super( remoteHandle , context); } protected void createObjects( ) { } public void initweb( ) { initialize_properties( ) ; } public void webExecute( ) { initweb( ) ; if ( ! isAjaxCallMode( ) ) { pa032( ) ; if ( ! isAjaxCallMode( ) ) { } if ( ( GxWebError == 0 ) && ! isAjaxCallMode( ) ) { ws032( ) ; if ( ! isAjaxCallMode( ) ) { we032( ) ; } } } cleanup(); } public void renderHtmlHeaders( ) { if ( ! isFullAjaxMode( ) ) { getDataAreaObject().renderHtmlHeaders(); } } public void renderHtmlOpenForm( ) { if ( ! isFullAjaxMode( ) ) { getDataAreaObject().renderHtmlOpenForm(); } } public void send_integrity_footer_hashes( ) { GXKey = httpContext.decrypt64( httpContext.getCookie( "GX_SESSION_ID"), context.getServerKey( )) ; } public void sendCloseFormHiddens( ) { /* Send hidden variables. */ /* Send saved values. */ send_integrity_footer_hashes( ) ; } public void renderHtmlCloseForm032( ) { sendCloseFormHiddens( ) ; sendSecurityToken(sPrefix); if ( ! isFullAjaxMode( ) ) { getDataAreaObject().renderHtmlCloseForm(); } if ( httpContext.isSpaRequest( ) ) { httpContext.disableOutput(); } httpContext.AddJavascriptSource("promptmasterpage.js", "?2021102014431985", false, true); httpContext.writeTextNL( "</body>") ; httpContext.writeTextNL( "</html>") ; if ( httpContext.isSpaRequest( ) ) { httpContext.enableOutput(); } } public String getPgmname( ) { return "PromptMasterPage" ; } public String getPgmdesc( ) { return "Prompt Master Page " ; } public void wb030( ) { if ( httpContext.isAjaxRequest( ) ) { httpContext.disableOutput(); } if ( ! wbLoad ) { renderHtmlHeaders( ) ; renderHtmlOpenForm( ) ; if ( ! ShowMPWhenPopUp( ) && httpContext.isPopUpObject( ) ) { if ( httpContext.isSpaRequest( ) ) { httpContext.enableOutput(); } if ( httpContext.isSpaRequest( ) ) { httpContext.disableJsOutput(); } /* Content placeholder */ httpContext.writeText( "<div") ; com.parks.GxWebStd.classAttribute( httpContext, "gx-content-placeholder"); httpContext.writeText( ">") ; if ( ! isFullAjaxMode( ) ) { getDataAreaObject().renderHtmlContent(); } httpContext.writeText( "</div>") ; if ( httpContext.isSpaRequest( ) ) { httpContext.disableOutput(); } if ( httpContext.isSpaRequest( ) ) { httpContext.enableJsOutput(); } wbLoad = true ; return ; } wb_table1_2_032( true) ; } else { wb_table1_2_032( false) ; } return ; } public void wb_table1_2_032e( boolean wbgen ) { if ( wbgen ) { } wbLoad = true ; } public void start032( ) { wbLoad = false ; wbEnd = 0 ; wbStart = 0 ; httpContext.wjLoc = "" ; httpContext.nUserReturn = (byte)(0) ; httpContext.wbHandled = (byte)(0) ; if ( GXutil.strcmp(httpContext.getRequestMethod( ), "POST") == 0 ) { } wbErr = false ; strup030( ) ; if ( ! httpContext.willRedirect( ) && ( httpContext.nUserReturn != 1 ) ) { if ( httpContext.isSpaRequest( ) ) { httpContext.disableJsOutput(); } if ( getDataAreaObject().executeStartEvent() != 0 ) { httpContext.setAjaxCallMode(); } if ( httpContext.isSpaRequest( ) ) { httpContext.enableJsOutput(); } } } public void ws032( ) { start032( ) ; evt032( ) ; } public void evt032( ) { if ( GXutil.strcmp(httpContext.getRequestMethod( ), "POST") == 0 ) { if ( ! httpContext.willRedirect( ) && ( httpContext.nUserReturn != 1 ) && ! wbErr ) { /* Read Web Panel buttons. */ sEvt = httpContext.cgiGet( "_EventName") ; EvtGridId = httpContext.cgiGet( "_EventGridId") ; EvtRowId = httpContext.cgiGet( "_EventRowId") ; if ( GXutil.len( sEvt) > 0 ) { sEvtType = GXutil.left( sEvt, 1) ; sEvt = GXutil.right( sEvt, GXutil.len( sEvt)-1) ; if ( GXutil.strcmp(sEvtType, "E") == 0 ) { sEvtType = GXutil.right( sEvt, 1) ; if ( GXutil.strcmp(sEvtType, ".") == 0 ) { sEvt = GXutil.left( sEvt, GXutil.len( sEvt)-1) ; if ( GXutil.strcmp(sEvt, "RFR_MPAGE") == 0 ) { httpContext.wbHandled = (byte)(1) ; dynload_actions( ) ; } else if ( GXutil.strcmp(sEvt, "START_MPAGE") == 0 ) { httpContext.wbHandled = (byte)(1) ; dynload_actions( ) ; /* Execute user event: Start */ e11032 (); } else if ( GXutil.strcmp(sEvt, "REFRESH_MPAGE") == 0 ) { httpContext.wbHandled = (byte)(1) ; dynload_actions( ) ; /* Execute user event: Refresh */ e12032 (); } else if ( GXutil.strcmp(sEvt, "LOAD_MPAGE") == 0 ) { httpContext.wbHandled = (byte)(1) ; dynload_actions( ) ; /* Execute user event: Load */ e13032 (); } else if ( GXutil.strcmp(sEvt, "ENTER_MPAGE") == 0 ) { httpContext.wbHandled = (byte)(1) ; if ( ! wbErr ) { Rfr0gs = false ; if ( ! Rfr0gs ) { } dynload_actions( ) ; } /* No code required for Cancel button. It is implemented as the Reset button. */ } else if ( GXutil.strcmp(sEvt, "LSCR") == 0 ) { httpContext.wbHandled = (byte)(1) ; dynload_actions( ) ; dynload_actions( ) ; } } else { } } if ( httpContext.wbHandled == 0 ) { getDataAreaObject().dispatchEvents(); } httpContext.wbHandled = (byte)(1) ; } } } } public void we032( ) { if ( ! com.parks.GxWebStd.gx_redirect( httpContext) ) { Rfr0gs = true ; refresh( ) ; if ( ! com.parks.GxWebStd.gx_redirect( httpContext) ) { renderHtmlCloseForm032( ) ; } } } public void pa032( ) { if ( nDonePA == 0 ) { if ( (GXutil.strcmp("", httpContext.getCookie( "GX_SESSION_ID"))==0) ) { gxcookieaux = httpContext.setCookie( "GX_SESSION_ID", httpContext.encrypt64( com.genexus.util.Encryption.getNewKey( ), context.getServerKey( )), "", GXutil.nullDate(), "", (short)(httpContext.getHttpSecure( ))) ; } GXKey = httpContext.decrypt64( httpContext.getCookie( "GX_SESSION_ID"), context.getServerKey( )) ; toggleJsOutput = httpContext.isJsOutputEnabled( ) ; if ( httpContext.isSpaRequest( ) ) { httpContext.disableJsOutput(); } init_web_controls( ) ; if ( toggleJsOutput ) { if ( httpContext.isSpaRequest( ) ) { httpContext.enableJsOutput(); } } if ( ! httpContext.isAjaxRequest( ) ) { } nDonePA = (byte)(1) ; } } public void dynload_actions( ) { /* End function dynload_actions */ } public void send_integrity_hashes( ) { } public void clear_multi_value_controls( ) { if ( httpContext.isAjaxRequest( ) ) { dynload_actions( ) ; before_start_formulas( ) ; } } public void fix_multi_value_controls( ) { } public void refresh( ) { send_integrity_hashes( ) ; rf032( ) ; if ( isFullAjaxMode( ) ) { send_integrity_footer_hashes( ) ; } /* End function Refresh */ } public void initialize_formulas( ) { /* GeneXus formulas. */ Gx_err = (short)(0) ; } public void rf032( ) { initialize_formulas( ) ; clear_multi_value_controls( ) ; if ( ShowMPWhenPopUp( ) || ! httpContext.isPopUpObject( ) ) { /* Execute user event: Refresh */ e12032 (); gxdyncontrolsrefreshing = true ; fix_multi_value_controls( ) ; gxdyncontrolsrefreshing = false ; } if ( ! httpContext.willRedirect( ) && ( httpContext.nUserReturn != 1 ) ) { /* Execute user event: Load */ e13032 (); wb030( ) ; if ( httpContext.isSpaRequest( ) ) { httpContext.enableOutput(); } } } public void send_integrity_lvl_hashes032( ) { } public void before_start_formulas( ) { Gx_err = (short)(0) ; fix_multi_value_controls( ) ; } public void strup030( ) { /* Before Start, stand alone formulas. */ before_start_formulas( ) ; /* Execute Start event if defined. */ httpContext.wbGlbDoneStart = (byte)(0) ; /* Execute user event: Start */ e11032 (); httpContext.wbGlbDoneStart = (byte)(1) ; /* After Start, stand alone formulas. */ if ( GXutil.strcmp(httpContext.getRequestMethod( ), "POST") == 0 ) { /* Read saved SDTs. */ /* Read saved values. */ /* Read variables values. */ /* Read subfile selected row values. */ /* Read hidden variables. */ GXKey = httpContext.decrypt64( httpContext.getCookie( "GX_SESSION_ID"), context.getServerKey( )) ; } else { dynload_actions( ) ; } } protected void GXStart( ) { /* Execute user event: Start */ e11032 (); if (returnInSub) return; } public void e11032( ) { /* Start Routine */ returnInSub = false ; } public void e12032( ) { /* Refresh Routine */ returnInSub = false ; } protected void nextLoad( ) { } protected void e13032( ) { /* Load Routine */ returnInSub = false ; } public void wb_table1_2_032( boolean wbgen ) { if ( wbgen ) { /* Table start */ sStyleString = "" ; sStyleString += " width: " + GXutil.ltrimstr( DecimalUtil.doubleToDec(95), 10, 0) + "%" + ";" ; com.parks.GxWebStd.gx_table_start( httpContext, tblTable2_Internalname, tblTable2_Internalname, "", "Table95", 0, "", "", 0, 0, sStyleString, "", "", 0); httpContext.writeText( "<tbody>") ; httpContext.writeText( "<tr>") ; httpContext.writeText( "<td colspan=\"3\" >") ; httpContext.writeText( "</td>") ; httpContext.writeText( "</tr>") ; httpContext.writeText( "<tr>") ; httpContext.writeText( "<td style=\""+GXutil.CssPrettify( "width:0px")+"\">") ; httpContext.writeText( "</td>") ; httpContext.writeText( "<td style=\""+GXutil.CssPrettify( "width:100%")+"\">") ; wb_table2_8_032( true) ; } else { wb_table2_8_032( false) ; } return ; } public void wb_table2_8_032e( boolean wbgen ) { if ( wbgen ) { httpContext.writeText( "</td>") ; httpContext.writeText( "<td style=\""+GXutil.CssPrettify( "width:0px")+"\">") ; httpContext.writeText( "</td>") ; httpContext.writeText( "</tr>") ; httpContext.writeText( "<tr>") ; httpContext.writeText( "<td colspan=\"3\" >") ; wb_table3_15_032( true) ; } else { wb_table3_15_032( false) ; } return ; } public void wb_table3_15_032e( boolean wbgen ) { if ( wbgen ) { wb_table4_18_032( true) ; } else { wb_table4_18_032( false) ; } return ; } public void wb_table4_18_032e( boolean wbgen ) { if ( wbgen ) { wb_table5_21_032( true) ; } else { wb_table5_21_032( false) ; } return ; } public void wb_table5_21_032e( boolean wbgen ) { if ( wbgen ) { wb_table6_24_032( true) ; } else { wb_table6_24_032( false) ; } return ; } public void wb_table6_24_032e( boolean wbgen ) { if ( wbgen ) { wb_table7_28_032( true) ; } else { wb_table7_28_032( false) ; } return ; } public void wb_table7_28_032e( boolean wbgen ) { if ( wbgen ) { wb_table8_31_032( true) ; } else { wb_table8_31_032( false) ; } return ; } public void wb_table8_31_032e( boolean wbgen ) { if ( wbgen ) { httpContext.writeText( "</td>") ; httpContext.writeText( "</tr>") ; httpContext.writeText( "</tbody>") ; /* End of table */ httpContext.writeText( "</table>") ; wb_table1_2_032e( true) ; } else { wb_table1_2_032e( false) ; } } public void wb_table8_31_032( boolean wbgen ) { if ( wbgen ) { /* Table start */ sStyleString = "" ; com.parks.GxWebStd.gx_table_start( httpContext, tblTable8_Internalname, tblTable8_Internalname, "", "TableHorizontalLine", 0, "", "", 0, 0, sStyleString, "", "", 0); httpContext.writeText( "<tbody>") ; httpContext.writeText( "<tr>") ; httpContext.writeText( "<td>") ; httpContext.writeText( "</td>") ; httpContext.writeText( "</tr>") ; httpContext.writeText( "</tbody>") ; /* End of table */ httpContext.writeText( "</table>") ; wb_table8_31_032e( true) ; } else { wb_table8_31_032e( false) ; } } public void wb_table7_28_032( boolean wbgen ) { if ( wbgen ) { /* Table start */ sStyleString = "" ; com.parks.GxWebStd.gx_table_start( httpContext, tblTable7_Internalname, tblTable7_Internalname, "", "HorizontalSpace", 0, "", "", 0, 0, sStyleString, "", "", 0); httpContext.writeText( "<tbody>") ; httpContext.writeText( "<tr>") ; httpContext.writeText( "<td>") ; httpContext.writeText( "</td>") ; httpContext.writeText( "</tr>") ; httpContext.writeText( "</tbody>") ; /* End of table */ httpContext.writeText( "</table>") ; wb_table7_28_032e( true) ; } else { wb_table7_28_032e( false) ; } } public void wb_table6_24_032( boolean wbgen ) { if ( wbgen ) { /* Table start */ sStyleString = "" ; com.parks.GxWebStd.gx_table_start( httpContext, tblTable1_Internalname, tblTable1_Internalname, "", "TableBottom", 0, "", "", 1, 2, sStyleString, "", "", 0); httpContext.writeText( "<tbody>") ; httpContext.writeText( "<tr style=\""+GXutil.CssPrettify( "text-align:-khtml-left;text-align:-moz-left;text-align:-webkit-left")+"\">") ; httpContext.writeText( "<td data-align=\"center\" style=\""+GXutil.CssPrettify( "text-align:-khtml-center;text-align:-moz-center;text-align:-webkit-center")+"\">") ; /* Text block */ com.parks.GxWebStd.gx_label_ctrl( httpContext, lblTextblock1_Internalname, "Footer Info", "", "", lblTextblock1_Jsonclick, "'"+""+"'"+",true,"+"'"+"E_MPAGE."+"'", "", "SmallText", 0, "", 1, 1, 0, (short)(0), "HLP_PromptMasterPage.htm"); httpContext.writeText( "</td>") ; httpContext.writeText( "</tr>") ; httpContext.writeText( "</tbody>") ; /* End of table */ httpContext.writeText( "</table>") ; wb_table6_24_032e( true) ; } else { wb_table6_24_032e( false) ; } } public void wb_table5_21_032( boolean wbgen ) { if ( wbgen ) { /* Table start */ sStyleString = "" ; com.parks.GxWebStd.gx_table_start( httpContext, tblTable6_Internalname, tblTable6_Internalname, "", "HorizontalSpace", 0, "", "", 0, 0, sStyleString, "", "", 0); httpContext.writeText( "<tbody>") ; httpContext.writeText( "<tr>") ; httpContext.writeText( "<td>") ; httpContext.writeText( "</td>") ; httpContext.writeText( "</tr>") ; httpContext.writeText( "</tbody>") ; /* End of table */ httpContext.writeText( "</table>") ; wb_table5_21_032e( true) ; } else { wb_table5_21_032e( false) ; } } public void wb_table4_18_032( boolean wbgen ) { if ( wbgen ) { /* Table start */ sStyleString = "" ; com.parks.GxWebStd.gx_table_start( httpContext, tblTable5_Internalname, tblTable5_Internalname, "", "TableHorizontalLine", 0, "", "", 0, 0, sStyleString, "", "", 0); httpContext.writeText( "<tbody>") ; httpContext.writeText( "<tr>") ; httpContext.writeText( "<td>") ; httpContext.writeText( "</td>") ; httpContext.writeText( "</tr>") ; httpContext.writeText( "</tbody>") ; /* End of table */ httpContext.writeText( "</table>") ; wb_table4_18_032e( true) ; } else { wb_table4_18_032e( false) ; } } public void wb_table3_15_032( boolean wbgen ) { if ( wbgen ) { /* Table start */ sStyleString = "" ; com.parks.GxWebStd.gx_table_start( httpContext, tblTable4_Internalname, tblTable4_Internalname, "", "HorizontalSpace", 0, "", "", 1, 2, sStyleString, "", "", 0); httpContext.writeText( "<tbody>") ; httpContext.writeText( "<tr>") ; httpContext.writeText( "<td>") ; httpContext.writeText( "</td>") ; httpContext.writeText( "</tr>") ; httpContext.writeText( "</tbody>") ; /* End of table */ httpContext.writeText( "</table>") ; wb_table3_15_032e( true) ; } else { wb_table3_15_032e( false) ; } } public void wb_table2_8_032( boolean wbgen ) { if ( wbgen ) { /* Table start */ sStyleString = "" ; com.parks.GxWebStd.gx_table_start( httpContext, tblTable3_Internalname, tblTable3_Internalname, "", "ViewTable", 0, "", "", 1, 2, sStyleString, "", "", 0); httpContext.writeText( "<tbody>") ; httpContext.writeText( "<tr>") ; httpContext.writeText( "<td>") ; if ( httpContext.isSpaRequest( ) ) { httpContext.enableOutput(); } if ( httpContext.isSpaRequest( ) ) { httpContext.disableJsOutput(); } /* Content placeholder */ httpContext.writeText( "<div") ; com.parks.GxWebStd.classAttribute( httpContext, "gx-content-placeholder"); httpContext.writeText( ">") ; if ( ! isFullAjaxMode( ) ) { getDataAreaObject().renderHtmlContent(); } httpContext.writeText( "</div>") ; if ( httpContext.isSpaRequest( ) ) { httpContext.disableOutput(); } if ( httpContext.isSpaRequest( ) ) { httpContext.enableJsOutput(); } httpContext.writeText( "</td>") ; httpContext.writeText( "</tr>") ; httpContext.writeText( "</tbody>") ; /* End of table */ httpContext.writeText( "</table>") ; wb_table2_8_032e( true) ; } else { wb_table2_8_032e( false) ; } } @SuppressWarnings("unchecked") public void setparameters( Object[] obj ) { } public String getresponse( String sGXDynURL ) { initialize_properties( ) ; BackMsgLst = httpContext.GX_msglist ; httpContext.GX_msglist = LclMsgLst ; sDynURL = sGXDynURL ; nGotPars = 1 ; nGXWrapped = 1 ; httpContext.setWrapped(true); pa032( ) ; ws032( ) ; we032( ) ; httpContext.setWrapped(false); httpContext.GX_msglist = BackMsgLst ; String response = ""; try { response = ((java.io.ByteArrayOutputStream) httpContext.getOutputStream()).toString("UTF8"); } catch (java.io.UnsupportedEncodingException e) { Application.printWarning(e.getMessage(), e); } finally { httpContext.closeOutputStream(); } return response; } public void responsestatic( String sGXDynURL ) { } public void master_styles( ) { define_styles( ) ; } public void define_styles( ) { httpContext.AddThemeStyleSheetFile("", context.getHttpContext().getTheme( )+".css", "?"+httpContext.getCacheInvalidationToken( )); boolean outputEnabled = httpContext.isOutputEnabled( ); if ( httpContext.isSpaRequest( ) ) { httpContext.enableOutput(); } idxLst = 1 ; while ( idxLst <= (getDataAreaObject() == null ? Form : getDataAreaObject().getForm()).getJscriptsrc().getCount() ) { httpContext.AddJavascriptSource(GXutil.rtrim( (getDataAreaObject() == null ? Form : getDataAreaObject().getForm()).getJscriptsrc().item(idxLst)), "?2021102014431993", true, true); idxLst = (int)(idxLst+1) ; } if ( ! outputEnabled ) { if ( httpContext.isSpaRequest( ) ) { httpContext.disableOutput(); } } /* End function define_styles */ } public void include_jscripts( ) { if ( nGXWrapped != 1 ) { httpContext.AddJavascriptSource("promptmasterpage.js", "?2021102014431994", false, true); } /* End function include_jscripts */ } public void init_default_properties( ) { tblTable3_Internalname = "TABLE3_MPAGE" ; tblTable4_Internalname = "TABLE4_MPAGE" ; tblTable5_Internalname = "TABLE5_MPAGE" ; tblTable6_Internalname = "TABLE6_MPAGE" ; lblTextblock1_Internalname = "TEXTBLOCK1_MPAGE" ; tblTable1_Internalname = "TABLE1_MPAGE" ; tblTable7_Internalname = "TABLE7_MPAGE" ; tblTable8_Internalname = "TABLE8_MPAGE" ; tblTable2_Internalname = "TABLE2_MPAGE" ; (getDataAreaObject() == null ? Form : getDataAreaObject().getForm()).setInternalname( "FORM_MPAGE" ); } public void initialize_properties( ) { httpContext.setAjaxOnSessionTimeout(ajaxOnSessionTimeout()); if ( httpContext.isSpaRequest( ) ) { httpContext.disableJsOutput(); } init_default_properties( ) ; Contentholder.setDataArea(getDataAreaObject()); if ( httpContext.isSpaRequest( ) ) { httpContext.enableJsOutput(); } } public void init_web_controls( ) { /* End function init_web_controls */ } public boolean supportAjaxEvent( ) { return true ; } public void initializeDynEvents( ) { setEventMetadata("REFRESH_MPAGE","{handler:'refresh',iparms:[]"); setEventMetadata("REFRESH_MPAGE",",oparms:[]}"); } protected boolean IntegratedSecurityEnabled( ) { return false; } protected int IntegratedSecurityLevel( ) { return 0; } protected String IntegratedSecurityPermissionPrefix( ) { return ""; } protected void cleanup( ) { super.cleanup(); CloseOpenCursors(); } protected void CloseOpenCursors( ) { } /* Aggregate/select formulas */ public void initialize( ) { Contentholder = new com.genexus.webpanels.GXDataAreaControl(); GXKey = "" ; sPrefix = "" ; sEvt = "" ; EvtGridId = "" ; EvtRowId = "" ; sEvtType = "" ; sStyleString = "" ; lblTextblock1_Jsonclick = "" ; BackMsgLst = new com.genexus.internet.MsgList(); LclMsgLst = new com.genexus.internet.MsgList(); sDynURL = "" ; Form = new com.genexus.webpanels.GXWebForm(); /* GeneXus formulas. */ Gx_err = (short)(0) ; } private byte GxWebError ; private byte nDonePA ; private byte nGotPars ; private byte nGXWrapped ; private short wbEnd ; private short wbStart ; private short gxcookieaux ; private short Gx_err ; private int idxLst ; private String GXKey ; private String sPrefix ; private String sEvt ; private String EvtGridId ; private String EvtRowId ; private String sEvtType ; private String sStyleString ; private String tblTable2_Internalname ; private String tblTable8_Internalname ; private String tblTable7_Internalname ; private String tblTable1_Internalname ; private String lblTextblock1_Internalname ; private String lblTextblock1_Jsonclick ; private String tblTable6_Internalname ; private String tblTable5_Internalname ; private String tblTable4_Internalname ; private String tblTable3_Internalname ; private String sDynURL ; private boolean wbLoad ; private boolean Rfr0gs ; private boolean wbErr ; private boolean toggleJsOutput ; private boolean gxdyncontrolsrefreshing ; private boolean returnInSub ; private com.genexus.internet.MsgList BackMsgLst ; private com.genexus.internet.MsgList LclMsgLst ; private com.genexus.webpanels.GXDataAreaControl Contentholder ; private com.genexus.webpanels.GXWebForm Form ; }
[ "gabrielmelconian@gmail.com" ]
gabrielmelconian@gmail.com
548435fa1430c385d1f9325403e9523835d0b391
058c52b2bed9779e0dcc315c608f2dd6fdd06533
/leetcode/src/easy/BestTimetoBuyandSellStock.java
7dcafa48ebc3316d325fd10025db6404fce67d9a
[]
no_license
xiaohudui/leetcode
feb17d4562e9edd72949330f094de2162bc702de
7d0302475c62661394050773684b3cb963c81974
refs/heads/master
2021-01-10T01:19:10.604221
2015-10-12T06:32:42
2015-10-12T06:32:42
36,716,734
0
0
null
null
null
null
GB18030
Java
false
false
1,772
java
package easy; import java.util.HashMap; public class BestTimetoBuyandSellStock { /** * 思路一:找到所有极大值和极小值,加上开头结尾,放入map中在极大值极小值找到最优解(超时) */ public int maxProfit(int[] prices) { if (prices == null || prices.length < 2) { return 0; } int maxProfit = 0; HashMap<Integer, Integer> peeks = new HashMap<Integer, Integer>(); peeks.put(0, prices[0]); peeks.put(prices.length-1, prices[prices.length-1]); HashMap<Integer, Integer> bottoms = new HashMap<Integer, Integer>(); bottoms.put(0, prices[0]); bottoms.put(prices.length-1, prices[prices.length-1]); for(int i=1; i+1 < prices.length;i++ ) { if ( prices[i] >= prices[i + 1] && prices[i]>=prices[i-1]) { peeks.put(i, prices[i]); } } for (int i=1 ; i+1 < prices.length;i++) { if (prices[i] <= prices[i + 1] && prices[i] <= prices[i - 1]) { bottoms.put(i, prices[i]); } } for (int bottom : bottoms.keySet()) { int bottomValue = bottoms.get(bottom); for (int peek : peeks.keySet()) { int peekValue = peeks.get(peek); if (bottom < peek) { maxProfit = maxProfit > peekValue - bottomValue ? maxProfit : peekValue - bottomValue; } } } return maxProfit; } /** * 动态规划,存储今天之前的最小值,和今天卖出的最大利润,维护这两个值 * 利用之前的比较结果 */ public int maxProfit1(int[] prices) { if(prices==null || prices.length<2){ return 0; } int min=prices[0]; int maxProfit=0; for (int i = 1; i < prices.length; i++) { maxProfit=maxProfit>prices[i]-min?maxProfit:prices[i]-min; min=min<prices[i]?min:prices[i]; } return maxProfit; } }
[ "15501253762@163.com" ]
15501253762@163.com
a1163f9aa98a34ebf8ed817f925be51f81108fd6
7eae24bfa24294b20e8d46c5c5c849ea3a74b51d
/app/src/main/java/com/binzi/aop/proxy/ProxyActivity.java
3a1fbc265b0a80e3b1059919fed527775e0ca7b9
[]
no_license
huangyoubin/Android-AOP
bf8333669bf46a6b84f539fbacb0d162c927d468
2849273422c1aa683baed44542c7a31a48a84635
refs/heads/master
2022-11-19T17:09:57.530717
2020-07-22T03:39:32
2020-07-22T03:39:32
259,379,516
1
0
null
null
null
null
UTF-8
Java
false
false
712
java
package com.binzi.aop.proxy; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.binzi.aop.R; import java.lang.reflect.Proxy; public class ProxyActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_proxy); proxy(); } private void proxy() { Business business = new Business(); Business businessProxy = (Business) Proxy.newProxyInstance(getClassLoader(), new Class[]{IBusiness1.class, IBusiness2.class}, new LogInvocationHandler(business)); businessProxy.doSomeThing1(); } }
[ "huangyoubin@gotokeep.com" ]
huangyoubin@gotokeep.com
05b757637977b563684fb21896264a6eb04c2bb4
6d858ed98415a4b83067c124bf6b0aad3e4f3fc0
/src/main/java/JobPortal/Application.java
7e280fd993c5789f497a97bccc0d9ff94142097c
[]
no_license
tjmorrissey/LinkdIn2.0_Sprint
662dd1c69594a8ae1a7a80d7a479d5d5192f650d
09c4d08b4a4cb64b378086fd42d53f81debddf69
refs/heads/master
2022-06-19T22:13:12.928039
2020-04-30T22:40:59
2020-04-30T22:40:59
257,409,643
0
5
null
2020-04-29T22:11:21
2020-04-20T21:37:14
JavaScript
UTF-8
Java
false
false
290
java
package JobPortal; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
[ "60196631+tjmorrissey@users.noreply.github.com" ]
60196631+tjmorrissey@users.noreply.github.com
b7d70e270d00446b38e27fda215d4f25c46be5a7
687e916c1ed76025722ab791048cecd3fc570b45
/src/main/java/com/avaloq/api/service/impl/CombinationServiceImpl.java
f440cc2ab1d4a56cd81b2cdd137a251906cf2430
[]
no_license
mosesbc/dice-roll-service
297a38f9c1359c00880e584aa37891d30d86aaae
be36a4754516c1d0ba1119ab0cd13f3df40ed079
refs/heads/master
2021-03-20T12:14:30.798990
2020-03-16T03:30:11
2020-03-16T03:30:11
247,205,128
0
0
null
2020-10-13T20:21:00
2020-03-14T03:34:05
Java
UTF-8
Java
false
false
571
java
package com.avaloq.api.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.avaloq.api.dao.CombinationDAO; import com.avaloq.api.model.Combination; import com.avaloq.api.service.CombinationService; @Service("combinationService") public class CombinationServiceImpl implements CombinationService{ @Autowired private CombinationDAO combinationDAO; @Override public List<Combination> getCombinations() { return combinationDAO.getCombinations(); } }
[ "mosescalma@gmail.com" ]
mosescalma@gmail.com
29748fb99d3492be8c0f4f820ec708cb03186c38
5188335c018b2751a9acb97dcb511d8866ad439b
/reverse2.java
691c84c5f665e7529cfd35a7585af35b7058badc
[]
no_license
Pavanjatla/java-programs
28cada401f0876afe68dbe3df987e249bf78bbbe
99103c930c8855ee03ae7e3099684f47f8cf89ea
refs/heads/master
2020-06-29T18:14:58.282924
2019-08-16T03:24:08
2019-08-16T03:24:08
200,589,336
0
0
null
2019-08-05T05:50:23
2019-08-05T05:40:16
null
UTF-8
Java
false
false
349
java
import java.util.*; public class reverse2 { public static void main(String[] args) { int i; System.out.println("enter a string"); Scanner obj=new Scanner(System.in); String a=obj.nextLine(); String reverse=" "; for (i=a.length()-1;i>=0 ;i-- ) { reverse=reverse + a.charAt(i); } System.out.print(reverse); } }
[ "noreply@github.com" ]
noreply@github.com
2a5690c79d1aec7bfc7b482eb1f79d922ab254ea
01b098e4495d49cd7be48609e70b5d87c78b7023
/docker/LIME Testbench/LimeTB/source/limec/src/main/java/fi/hut/ics/lime/isl_c/backend/BackEnd.java
2f17b2fb73a275b62b094ea6b4e26fe5b92dc7ed
[]
no_license
megamart2/integration
0d4f184f5aed44a3d78678a9813479d62709e9bb
7b6ee547f60493ab99f0e569f20c2024e6583041
refs/heads/master
2020-04-16T19:43:28.037748
2020-03-20T10:33:07
2020-03-20T10:33:07
165,871,359
3
0
null
null
null
null
UTF-8
Java
false
false
1,072
java
/** * Runs at the end of execution; the aspect(s) have been created and placed * into the same directory with the original C source files. The backend * * - Cleans up after the fi.hut.ics.lime.isl_c tool; i.e. it removes the * temporary directory created by the * fi.hut.ics.lime.isl_c.frontend.FrontEnd class * * @author lharpf */ package fi.hut.ics.lime.isl_c.backend; import java.io.File; import java.io.IOException; import fi.hut.ics.lime.common.utils.FileUtils; import fi.hut.ics.lime.isl_c.frontend.FrontEnd; public class BackEnd { private final FrontEnd frontEnd; public BackEnd(FrontEnd frontEnd) { this.frontEnd = frontEnd; } /** * Deletes the temporary directory created by the FrontEnd frontEnd. */ public void cleanUp() { File tmpDirectory = this.frontEnd.getTemporaryDirectory(); try { FileUtils.deleteDirectory(tmpDirectory); } catch (IOException ioe) { System.out.print("ERROR: While deleting temporary directory " + tmpDirectory.getAbsolutePath() + ":\n" + ioe.getMessage()); } } }
[ "jesus.gorronogoitia@atos.net" ]
jesus.gorronogoitia@atos.net
0644dfd3123dd9ab50f92af5391ae24e0cd60bc8
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/1/1_0cc6d84254a8ebd0955af26902771b2bb842cfa1/XmlNamespace/1_0cc6d84254a8ebd0955af26902771b2bb842cfa1_XmlNamespace_s.java
e0d572e5351f2a61d2e96e4be9da9988e999e695
[]
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
8,674
java
/** * (The MIT License) * * Copyright (c) 2008 - 2012: * * * {Aaron Patterson}[http://tenderlovemaking.com] * * {Mike Dalessio}[http://mike.daless.io] * * {Charles Nutter}[http://blog.headius.com] * * {Sergio Arbeo}[http://www.serabe.com] * * {Patrick Mahoney}[http://polycrystal.org] * * {Yoko Harada}[http://yokolet.blogspot.com] * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * 'Software'), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package nokogiri; import static nokogiri.internals.NokogiriHelpers.CACHED_NODE; import static nokogiri.internals.NokogiriHelpers.getCachedNodeOrCreate; import static nokogiri.internals.NokogiriHelpers.getLocalNameForNamespace; import static nokogiri.internals.NokogiriHelpers.getNokogiriClass; import static nokogiri.internals.NokogiriHelpers.stringOrNil; import nokogiri.internals.NokogiriHelpers; import nokogiri.internals.SaveContextVisitor; import org.jruby.Ruby; import org.jruby.RubyClass; import org.jruby.RubyObject; import org.jruby.RubyString; import org.jruby.anno.JRubyClass; import org.jruby.anno.JRubyMethod; import org.jruby.runtime.ThreadContext; import org.jruby.runtime.builtin.IRubyObject; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Node; /** * Class for Nokogiri::XML::Namespace * * @author serabe * @author Yoko Harada <yokolet@gmail.com> */ @JRubyClass(name="Nokogiri::XML::Namespace") public class XmlNamespace extends RubyObject { private Attr attr; private IRubyObject prefix; private IRubyObject href; private String prefixString; private String hrefString; public XmlNamespace(Ruby ruby, RubyClass klazz) { super(ruby, klazz); } public Node getNode() { return attr; } public String getPrefix() { return prefixString; } public String getHref() { return hrefString; } void deleteHref() { hrefString = "http://www.w3.org/XML/1998/namespace"; href = NokogiriHelpers.stringOrNil(getRuntime(), hrefString); attr.getOwnerElement().removeAttributeNode(attr); } public void init(Attr attr, IRubyObject prefix, IRubyObject href, IRubyObject xmlDocument) { init(attr, prefix, href, (String) prefix.toJava(String.class), (String) href.toJava(String.class), xmlDocument); } public void init(Attr attr, IRubyObject prefix, IRubyObject href, String prefixString, String hrefString, IRubyObject xmlDocument) { this.attr = attr; this.prefix = prefix; this.href = href; this.prefixString = prefixString; this.hrefString = hrefString; this.attr.setUserData(CACHED_NODE, this, null); setInstanceVariable("@document", xmlDocument); } public static XmlNamespace createFromAttr(Ruby runtime, Attr attr) { String prefixValue = getLocalNameForNamespace(attr.getName()); IRubyObject prefix_value; if (prefixValue == null) { prefix_value = runtime.getNil(); prefixValue = ""; } else { prefix_value = RubyString.newString(runtime, prefixValue); } String hrefValue = attr.getValue(); IRubyObject href_value = RubyString.newString(runtime, hrefValue); // check namespace cache XmlDocument xmlDocument = (XmlDocument)getCachedNodeOrCreate(runtime, attr.getOwnerDocument()); xmlDocument.initializeNamespaceCacheIfNecessary(); XmlNamespace xmlNamespace = xmlDocument.getNamespaceCache().get(prefixValue, hrefValue); if (xmlNamespace != null) return xmlNamespace; // creating XmlNamespace instance XmlNamespace namespace = (XmlNamespace) NokogiriService.XML_NAMESPACE_ALLOCATOR.allocate(runtime, getNokogiriClass(runtime, "Nokogiri::XML::Namespace")); namespace.init(attr, prefix_value, href_value, prefixValue, hrefValue, xmlDocument); // updateing namespace cache xmlDocument.getNamespaceCache().put(namespace, attr.getOwnerElement()); return namespace; } public static XmlNamespace createFromPrefixAndHref(Node owner, IRubyObject prefix, IRubyObject href) { String prefixValue = prefix.isNil() ? "" : (String) prefix.toJava(String.class); String hrefValue = (String) href.toJava(String.class); Ruby runtime = prefix.getRuntime(); Document document = owner.getOwnerDocument(); // check namespace cache XmlDocument xmlDocument = (XmlDocument)getCachedNodeOrCreate(runtime, document); xmlDocument.initializeNamespaceCacheIfNecessary(); XmlNamespace xmlNamespace = xmlDocument.getNamespaceCache().get(prefixValue, hrefValue); if (xmlNamespace != null) return xmlNamespace; // creating XmlNamespace instance XmlNamespace namespace = (XmlNamespace) NokogiriService.XML_NAMESPACE_ALLOCATOR.allocate(runtime, getNokogiriClass(runtime, "Nokogiri::XML::Namespace")); String attrName = "xmlns"; if (!"".equals(prefixValue)) { attrName = attrName + ":" + prefixValue; } Attr attrNode = document.createAttribute(attrName); attrNode.setNodeValue(hrefValue); // initialize XmlNamespace object namespace.init(attrNode, prefix, href, prefixValue, hrefValue, xmlDocument); // updating namespace cache xmlDocument.getNamespaceCache().put(namespace, owner); return namespace; } // owner should be an Attr node public static XmlNamespace createDefaultNamespace(Ruby runtime, Node owner) { String prefixValue = owner.getPrefix(); String hrefValue = owner.getNamespaceURI(); Document document = owner.getOwnerDocument(); // check namespace cache XmlDocument xmlDocument = (XmlDocument)getCachedNodeOrCreate(runtime, document); XmlNamespace xmlNamespace = xmlDocument.getNamespaceCache().get(prefixValue, hrefValue); if (xmlNamespace != null) return xmlNamespace; // creating XmlNamespace instance XmlNamespace namespace = (XmlNamespace) NokogiriService.XML_NAMESPACE_ALLOCATOR.allocate(runtime, getNokogiriClass(runtime, "Nokogiri::XML::Namespace")); IRubyObject prefix = stringOrNil(runtime, prefixValue); IRubyObject href = stringOrNil(runtime, hrefValue); // initialize XmlNamespace object namespace.init((Attr)owner, prefix, href, prefixValue, hrefValue, xmlDocument); // updating namespace cache xmlDocument.getNamespaceCache().put(namespace, owner); return namespace; } /** * Create and return a copy of this object. * * @return a clone of this object */ @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } public boolean isEmpty() { return prefix.isNil() && href.isNil(); } @JRubyMethod public IRubyObject href(ThreadContext context) { return href; } @JRubyMethod public IRubyObject prefix(ThreadContext context) { return prefix; } public void accept(ThreadContext context, SaveContextVisitor visitor) { String string = " " + prefix + "=\"" + href + "\""; visitor.enter(string); visitor.leave(string); // is below better? //visitor.enter(attr); //visitor.leave(attr); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
8b790c8a6699ad763de7ad0fc737c19d236e8eaa
1c00c3eae8ad0c8d96d43e47155527edc7e3ef8f
/core/src/com/mygdx/game/entities/ScoreArea.java
f3fe61e873320498f199ba5bb5a02a6a66478106
[]
no_license
Morchul/FlappyBird
9174b03e38cce58a28ae851ad4e3f9f8ac516199
96a0ee456edbd4370783b02c47efe8a8655dfceb
refs/heads/master
2021-08-23T15:42:33.554291
2017-12-05T13:32:55
2017-12-05T13:32:55
113,182,372
0
0
null
null
null
null
UTF-8
Java
false
false
1,077
java
package com.mygdx.game.entities; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.physics.box2d.Body; import com.mygdx.game.physiks.Box2DWorld; public class ScoreArea extends Entities{ private Body body; public ScoreArea(Box2DWorld box2DWorld, float width, float height, float x, float y, Texture texture) { super(box2DWorld, width, height, x, y,texture); type = EntitiType.SCORE; } @Override public void createBody(Box2DWorld box2DWorld, Entities ent) { body = box2DWorld.createScoreArea(width, height, pos.x, pos.y); body.setUserData(ent); } @Override public void destroyBody(Box2DWorld box2DWorld) { box2DWorld.world.destroyBody(body); body.setUserData(null); body = null; } @Override public Body getBody() { return body; } @Override public void act(float delta){ super.act(delta); if(body == null) { this.remove(); return; } body.setLinearVelocity(Pipes.SPEED,0); } }
[ "silvan.ott@sitasys.com" ]
silvan.ott@sitasys.com
551c56dd092b85edac40d245ca7563a2f42a5ac8
5a02e784a1660c8bbe2dfa435bb2babf59d61257
/src/Model/InforLabel.java
4d662bbe44faa14895876df591dbac557488679b
[]
no_license
huynguyen411/Space_Shooter
b7e0439cbe3134857af5fc545392ea3e1499affd
f94c1ee59bd212e3449f32c023adc2552c082920
refs/heads/master
2022-12-07T00:33:48.076702
2020-08-29T03:42:47
2020-08-29T16:53:27
291,186,391
0
0
null
null
null
null
UTF-8
Java
false
false
1,483
java
package Model; import javafx.geometry.Pos; import javafx.scene.control.Label; import javafx.scene.image.Image; import javafx.scene.layout.Background; import javafx.scene.layout.BackgroundImage; import javafx.scene.layout.BackgroundPosition; import javafx.scene.layout.BackgroundRepeat; import javafx.scene.text.Font; import java.io.FileInputStream; import java.io.FileNotFoundException; public class InforLabel extends Label { private final static String FONT_PATH = "src/Model/resource/kenvector_future.ttf"; private final static String BUTTON_STYLE = "-fx-background-color: transparent; -fx-background-image: url('/Model/resource/ShipChooser/green_button_13.png');"; private final static String BACKGROUND_IMAGE = "Model/resource/green_label.png"; public InforLabel(String text){ setPrefHeight(49); setPrefWidth(380); setText(text); setWrapText(true); setLabelFont(); setAlignment(Pos.CENTER); BackgroundImage backgroundImage = new BackgroundImage(new Image(BACKGROUND_IMAGE, 380, 49, false, true), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, null); setBackground(new Background(backgroundImage)); } private void setLabelFont(){ try { setFont(Font.loadFont(new FileInputStream(FONT_PATH), 23)); } catch (FileNotFoundException e) { setFont(Font.font("Verdana", 23)); } } }
[ "huynguyen411@users.noreply.github.com" ]
huynguyen411@users.noreply.github.com
d29c277d1d8be1b9b3db3da747032e4622132078
a8dec264863725fae640088622e146af2b600c09
/game01/core/src/main/java/sut/game01/core/MyGame.java
5738fb4908d2ab83a821272f22a96c1530dd0b6f
[]
no_license
jaylollipop/game01
c7e117d4be197defd30db0dbbc2a18d5439b068d
519b92dc4d229db6b1ef8a352318b0c7da835f1c
refs/heads/master
2021-01-10T08:54:15.628668
2016-03-23T08:37:54
2016-03-23T08:37:54
54,542,055
0
0
null
null
null
null
UTF-8
Java
false
false
811
java
package sut.game01.core; import static playn.core.PlayN.*; import playn.core.Game; import playn.core.Image; import playn.core.ImageLayer; import playn.core.Game; import playn.core.util.Clock; import tripleplay.game.ScreenStack; public class MyGame extends Game.Default { public static final int UPDATE_RATE = 25; private ScreenStack ss = new ScreenStack(); protected final Clock.Source clock = new Clock.Source(UPDATE_RATE); public MyGame() { super(UPDATE_RATE); // call update every 33ms (30 times per second) } @Override public void init() { ss.push(new HomeScreen(ss)); } @Override public void update(int delta) { ss.update(delta); } @Override public void paint(float alpha) { clock.paint(alpha); ss.paint(clock); } }
[ "jaylollipop@yahoo.com" ]
jaylollipop@yahoo.com
1f5c149f79ea76e926cd7f6c1257cb0dc99057cb
89e73dccd01d2eee2c2d823078d6685d730a94d4
/Exam/Exam/src/main/java/app/domain/dto/xmlImport/accessories/AccessoriesImportXmlDto.java
561e56b653ff8a586f5aa014ac9d8d6cd745f03f
[]
no_license
ViktorGorchev/Hibernate-Databases-Advanced
7f170b21fb009eab558f26b3cd4ce165c293126c
1597f0181bf8060034e51511759ff2def293da48
refs/heads/master
2021-04-29T02:17:36.598343
2017-01-04T15:31:15
2017-01-04T15:31:15
78,027,441
0
0
null
null
null
null
UTF-8
Java
false
false
952
java
package app.domain.dto.xmlImport.accessories; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import java.io.Serializable; import java.util.ArrayList; import java.util.List; @XmlRootElement(name = "accessories") @XmlAccessorType(value = XmlAccessType.FIELD) public class AccessoriesImportXmlDto implements Serializable { @XmlElement(name = "accessory") List<AccessoryImportXmlDto> accessoryImportXmlDtos; public AccessoriesImportXmlDto() { this.setAccessoryImportXmlDtos(new ArrayList<>()); } public List<AccessoryImportXmlDto> getAccessoryImportXmlDtos() { return this.accessoryImportXmlDtos; } public void setAccessoryImportXmlDtos(List<AccessoryImportXmlDto> accessoryImportXmlDtos) { this.accessoryImportXmlDtos = accessoryImportXmlDtos; } }
[ "viktor_g_g@yahoo.com" ]
viktor_g_g@yahoo.com
8b234e456d1a0a992c5f292f4175c7f92c9210c0
bbfe43bf5179fc4c114371e7191ee3d81ab67173
/src/main/java/com/ontarget/api/repository/ContactRepository.java
0a31fc3db8ab4dfe2cb39e7231163b9d80339097
[]
no_license
ontargetrepo/onTargetAPI
605804ae37e0667f46949c4814f9ae51f9e11066
209435ca16b470df479cea7bef2f08d268fbc04c
refs/heads/master
2021-01-10T06:03:49.885120
2016-02-01T18:25:22
2016-02-01T18:25:22
50,623,850
0
1
null
null
null
null
UTF-8
Java
false
false
404
java
package com.ontarget.api.repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import com.ontarget.entities.Contact; public interface ContactRepository extends JpaRepository<Contact, Integer> { @Query("select c from Contact c where c.user.id = ?1") List<Contact> findByUserId(Integer userId); }
[ "santosh8pun@gmail.com" ]
santosh8pun@gmail.com
70029bd349824ea808a4905204634043591f429d
cda283e85d3cb5e9bd16b01745229b72d610f243
/src/main/java/gradleplug/GradleTaskRuntimeConfigurationProducer.java
c9c5651e91dfb9da6660190243cbb04af1dbfa89
[]
no_license
shyiko/gradleplug
0f94984ef2df03ba53c0bd18bb1ab0e1d30d3638
8c96e625d7d5a610a669ee1e2d090b9db6a5208c
refs/heads/master
2020-04-06T06:26:47.764275
2011-02-22T21:48:36
2011-02-22T21:48:36
1,387,225
0
0
null
null
null
null
UTF-8
Java
false
false
7,306
java
/* * Copyright 2011 Stanley Shyiko * * 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 gradleplug; import com.intellij.execution.JavaExecutionUtil; import com.intellij.execution.Location; import com.intellij.execution.RunManagerEx; import com.intellij.execution.RunnerAndConfigurationSettings; import com.intellij.execution.actions.ConfigurationContext; import com.intellij.execution.junit.RuntimeConfigurationProducer; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; import org.jetbrains.plugins.groovy.runner.GroovyScriptRunConfiguration; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * @author <a href="mailto:stanley.shyiko@gmail.com">shyiko</a> * @since 13.02.2011 */ public class GradleTaskRuntimeConfigurationProducer extends RuntimeConfigurationProducer implements Cloneable { protected PsiElement sourceElement; public GradleTaskRuntimeConfigurationProducer() { super(GradleTaskConfigurationType.getInstance()); } public PsiElement getSourceElement() { return sourceElement; } public int compareTo(final Object o) { return RuntimeConfigurationProducer.PREFERED; } @Override protected RunnerAndConfigurationSettings findExistingByElement(Location location, @NotNull RunnerAndConfigurationSettings[] existingConfigurations, ConfigurationContext context) { if (!(location instanceof GradleTaskLocation)) { return null; } GradleTaskLocation taskLocation = (GradleTaskLocation) location; String programParameters = getProgramParameters(taskLocation); VirtualFile virtualFile = taskLocation.getBuildFile().getVirtualFile(); if (virtualFile == null) { return null; } String scriptPath = virtualFile.getPath(); for (RunnerAndConfigurationSettings existingConfiguration : existingConfigurations) { GroovyScriptRunConfiguration configuration = (GroovyScriptRunConfiguration) existingConfiguration.getConfiguration(); if (programParameters.equals(configuration.getProgramParameters()) && scriptPath.equals(configuration.getScriptPath())) { return existingConfiguration; } } return null; } protected RunnerAndConfigurationSettings createConfigurationByElement(final Location location, final ConfigurationContext context) { if (!(location instanceof GradleTaskLocation)) { return null; } GradleTaskLocation taskLocation = (GradleTaskLocation) location; RunnerAndConfigurationSettings settings = createConfiguration(taskLocation); sourceElement = taskLocation.getBuildFile(); return settings; } private RunnerAndConfigurationSettings createConfiguration(GradleTaskLocation taskLocation) { GroovyFile buildFile = taskLocation.getBuildFile(); PsiClass scriptClass = buildFile.getScriptClass(); if (scriptClass == null) { return null; } Project project = scriptClass.getProject(); RunManagerEx runManagerEx = RunManagerEx.getInstanceEx(project); RunnerAndConfigurationSettings settings = runManagerEx.createConfiguration(getConfigurationName(taskLocation), getConfigurationFactory()); final GroovyScriptRunConfiguration configuration = (GroovyScriptRunConfiguration) settings.getConfiguration(); PsiDirectory containingDirectory = buildFile.getContainingDirectory(); if (containingDirectory == null) { return null; } configuration.setWorkDir(containingDirectory.getVirtualFile().getPath()); VirtualFile virtualFile = buildFile.getVirtualFile(); if (virtualFile == null) { return null; } configuration.setModule(JavaExecutionUtil.findModule(scriptClass)); /* Forced to use the ugly ones below because of GroovyScriptRunConfiguration class signature changes (IDEA 10 builds) */ setScriptPath(configuration, virtualFile.getPath()); setScriptParams(configuration, (getProgramParameters(taskLocation))); return settings; } private void setScriptPath(GroovyScriptRunConfiguration configuration, String scriptPath) { setValueRethrowingExceptions(configuration, "setScriptPath", String.class, "scriptPath", scriptPath); } private void setScriptParams(GroovyScriptRunConfiguration configuration, String scriptParams) { setValueRethrowingExceptions(configuration, "setProgramParameters", String.class, "scriptParams", scriptParams); } private void setValueRethrowingExceptions(Object object, String method, Class methodParamType, String field, Object value) { try { setValue(object, method, methodParamType, field, value); } catch (InvocationTargetException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (NoSuchFieldException e) { throw new RuntimeException(e); } } private void setValue(Object object, String method, Class methodParamType, String field, Object value) throws InvocationTargetException, IllegalAccessException, NoSuchFieldException { Class cls = object.getClass(); try { Method setProgramParameters = cls.getMethod(method, methodParamType); setProgramParameters.invoke(object, value); } catch (NoSuchMethodException ex) { Field scriptParamsField = cls.getField(field); scriptParamsField.set(object, value); } } private String getConfigurationName(GradleTaskLocation taskLocation) { GroovyFile buildFile = taskLocation.getBuildFile(); PsiDirectory containingDirectory = buildFile.getContainingDirectory(); assert containingDirectory != null; return containingDirectory.getName() + " " + getProgramParameters(taskLocation); } private String getProgramParameters(GradleTaskLocation taskLocation) { StringBuilder sb = new StringBuilder(); for (String task : taskLocation.getTasks()) { sb.append(task).append(" "); } return sb.substring(0, sb.length() - 1); } }
[ "stanley.shyiko@gmail.com" ]
stanley.shyiko@gmail.com
191f10519a12b7bf61623265e058c21ae3e91e4a
2ad3c30b2c36a3a4d7b7eb2d8e371f83049a6a8a
/javabt/javabt/Basic1/src/basic1/HAYTinhtong4.java
4adc0846d462b975260a2559bd38026276648d42
[]
no_license
khoale22/LearnFullJava
85774d94df57afd2a4ee957410bf6222d1112f78
f6010e451a95f8c5e4f8c5cbc9ffd4a5a2c901a3
refs/heads/master
2022-12-21T20:27:02.215968
2020-07-07T14:09:04
2020-07-07T14:09:04
248,209,077
0
0
null
2022-12-16T03:16:17
2020-03-18T11:08:39
Rich Text Format
UTF-8
Java
false
false
868
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 basic1; import java.util.Scanner; /** * * @author Khoale123 */ public class HAYTinhtong4 { // Hãy viết chương trình tính tổng các chữ số của một số nguyên bất kỳ. Ví dụ: Số 8545604 có tổng các chữ số là: 8+5+4+5+6+0+4= 32. public static void main(String[] args) { // TODO code application logic here int n, tong = 0; System.out.println("nhap vao so nguyen n "); Scanner input = new Scanner(System.in); n = input.nextInt(); while (n > 0) { tong += n % 10; n = n / 10; } System.out.println("tong cac chu so cua n la: " + tong); } }
[ "tran.than@heb.com" ]
tran.than@heb.com
930b7e4514ae058cc0d24126a4281640e3af9c6f
56d0c0f34b3b08dead32a23c35c6e9adf8cb34c2
/src/Strategy/XMLUtil.java
27167dae0ecfb1227f4ca61eed70ff1df0ba73c7
[]
no_license
Cassielzh/DesignPattren
77f99c20631f9df64f26b8498e70db8a180fdfae
54fbac4ebd8284902d68d3ba92144a1de181689f
refs/heads/main
2023-06-04T21:00:03.743760
2021-06-20T11:46:29
2021-06-20T11:46:29
361,356,584
0
0
null
null
null
null
UTF-8
Java
false
false
1,114
java
package Strategy; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.SAXException; import java.io.*; public class XMLUtil { //该方法用于从xml配置文件中提取具体类类名,并返回一个实体对象 public static Object getBean() { try { //创建DOM文件对象 DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = dFactory.newDocumentBuilder(); Document doc; doc = builder.parse(new File("config.xml")); //获取包含类名的文本节点 NodeList nl = doc.getElementsByTagName("classname"); Node classNode =nl.item(0).getFirstChild(); String cName=classNode.getNodeValue(); //通过类名生成实例对象并将其返回 Class c= Class.forName(cName); Object obj =c.newInstance(); return obj; } catch(Exception e) { e.printStackTrace(); System.out.println("xmlutil错了"); return null; } } }
[ "1563350461@qq.com" ]
1563350461@qq.com
354b252225a0df171079e599a3ae1e21f40b8f97
7b41595a5dcaa63d16bb9985e5c7cd887f48c17f
/src/main/java/com/s2m/card/services/AppeletVersionService.java
30fa560632a3b55d1752ebab5d54d22c37b767e7
[]
no_license
MeriemGoudim/CardProjectBackend
46541efb7a5a9b94a63ecebda4e12abb3c38a6ae
341b97e1ff4d396bdb6650b7810cbff4561e0f63
refs/heads/master
2022-12-10T16:18:29.447411
2020-09-01T23:49:48
2020-09-01T23:49:48
291,167,178
0
0
null
null
null
null
UTF-8
Java
false
false
1,535
java
package com.s2m.card.services; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.s2m.card.exception.ResourceNotFoundException; import com.s2m.card.models.AppeletVersion; import com.s2m.card.repositories.AppeletVersionRepository; @Component public class AppeletVersionService { @Autowired private AppeletVersionRepository repository; public List<AppeletVersion> getAllAppeletsVersions(){ return (List<AppeletVersion>) repository.findAll(); } public AppeletVersion create(AppeletVersion appeletVersion) { return repository.save(appeletVersion); } public Optional<AppeletVersion> getAppeletVersionById(Long id) { return repository.findById(id); } public void delete(Long id) throws ResourceNotFoundException { AppeletVersion appeletVersion=repository.findById(id) .orElseThrow(() -> new ResourceNotFoundException("AppeletVersion not found for this id :: " + id)); repository.delete(appeletVersion); } public AppeletVersion update(Long id,AppeletVersion appV) throws ResourceNotFoundException { AppeletVersion appeletVersion=repository.findById(id) .orElseThrow(() -> new ResourceNotFoundException("AppeletVersion not found for this id :: " + id)); appeletVersion.setNom(appV.getNom()); appeletVersion.setAppelets(appV.getAppelets()); AppeletVersion updatedAppeletVersion = repository.save(appeletVersion); return updatedAppeletVersion; } }
[ "53157220+MeriemGoudim@users.noreply.github.com" ]
53157220+MeriemGoudim@users.noreply.github.com
d4f33428204db983bbb8cf9f49e5d9e834ada9d4
64ce100fb5eb4a47f2ceb5c4af202a2a09f0c470
/auth/src/main/java/com/spring/microservice/auth/repository/CityRepository.java
c533412f2b454547367f22c2e159b3888f61680f
[]
no_license
TrungLuong1194/bmstu-microservice
fe30e852514b7275e992b118ff12e77b78b4d36c
4359a388ea9caf5c3a82b331966a4f2322ebfdf8
refs/heads/master
2023-08-03T14:07:10.307330
2020-05-24T22:02:42
2020-05-24T22:02:42
223,385,361
3
0
null
2023-07-22T22:21:21
2019-11-22T11:00:23
Java
UTF-8
Java
false
false
365
java
package com.spring.microservice.auth.repository; import com.spring.microservice.auth.model.City; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface CityRepository extends JpaRepository<City, Long> { City findCityById(long id); City findCityByName(String name); }
[ "trungluong1194@gmail.com" ]
trungluong1194@gmail.com
0491c4c7deed95b8b78690c437f4c00f2b0baeab
70faefb9a44f90455226dda795d25cac9dd25b7b
/app/src/main/java/com/idevelopstudio/poshopping/ProductList/ProductAdapter.java
5577b525cb81edd09a96bca53cc418b8c161822a
[]
no_license
ahmermughal/POShoppingJava
20e2cade4b2cd64b77cf4052a86118897d131e34
8816e06cf98450a01522f496f04c709772dc177e
refs/heads/master
2020-12-21T05:22:23.083187
2019-12-26T14:33:46
2019-12-26T14:33:46
236,320,902
0
0
null
null
null
null
UTF-8
Java
false
false
3,441
java
package com.idevelopstudio.poshopping.ProductList; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.idevelopstudio.poshopping.CategoryList.CategoryAdapter; import com.idevelopstudio.poshopping.CategoryList.CategoryModel; import com.idevelopstudio.poshopping.Database.Product; import com.idevelopstudio.poshopping.R; import java.util.List; public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.AdapterViewHolder> { private Context context; private List<Product> products; private AdapterClickListner adapterClickListner; private AdapterDeleteListener adapterDeleteListener; public interface AdapterClickListner{ void onAdapterClick(Product product); } public interface AdapterDeleteListener{ void onAdapterDelete(Product product); } public Context getContext() { return context; } public ProductAdapter(Context context, AdapterClickListner adapterClickListner, AdapterDeleteListener adapterDeleteListener) { this.context = context; this.adapterClickListner = adapterClickListner; this.adapterDeleteListener = adapterDeleteListener; } public void setProducts(List<Product> products){ this.products = products; notifyDataSetChanged(); } @NonNull @Override public AdapterViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(context); View view = inflater.inflate(R.layout.list_item_product, parent, false); return new ProductAdapter.AdapterViewHolder(view); } @Override public void onBindViewHolder(@NonNull AdapterViewHolder holder, int position) { if(position == 0){ holder.divider.setVisibility(View.INVISIBLE); }else{ Product product = products.get(position-1); holder.nameTextView.setText(product.getName()); holder.stockTextView.setText(product.getStock() + " Left"); holder.priceTextView.setText(product.getPrice() + " PKR"); } } public void deleteItem(int position) { Product product = products.get(position-1); products.remove(position-1); notifyItemRemoved(position); adapterDeleteListener.onAdapterDelete(product); } @Override public int getItemCount() { return products!= null ? products.size()+1 : 0; } public class AdapterViewHolder extends RecyclerView.ViewHolder { TextView nameTextView; TextView stockTextView; TextView priceTextView; View divider; public AdapterViewHolder(@NonNull View itemView) { super(itemView); nameTextView = itemView.findViewById(R.id.tv_name); stockTextView = itemView.findViewById(R.id.tv_stock); priceTextView = itemView.findViewById(R.id.tv_price); divider = itemView.findViewById(R.id.divider); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { adapterClickListner.onAdapterClick(products.get(getAdapterPosition()-1)); } }); } } }
[ "a2mughal143@gmail.com" ]
a2mughal143@gmail.com
2e7662d62610c7f965a505fa47e8cd89dfa2e5b6
d1bd1246f161b77efb418a9c24ee544d59fd1d20
/java/Raptor/src/org/javenstudio/raptor/dfs/server/common/InconsistentFSStateException.java
152d0153bbe385c05f154ba8c6b0728609756d1e
[]
no_license
navychen2003/javen
f9a94b2e69443291d4b5c3db5a0fc0d1206d2d4a
a3c2312bc24356b1c58b1664543364bfc80e816d
refs/heads/master
2021-01-20T12:12:46.040953
2015-03-03T06:14:46
2015-03-03T06:14:46
30,912,222
0
1
null
2023-03-20T11:55:50
2015-02-17T10:24:28
Java
UTF-8
Java
false
false
848
java
package org.javenstudio.raptor.dfs.server.common; import java.io.File; import java.io.IOException; import org.javenstudio.raptor.util.StringUtils; /** * The exception is thrown when file system state is inconsistent * and is not recoverable. * */ public class InconsistentFSStateException extends IOException { private static final long serialVersionUID = 1L; public InconsistentFSStateException(File dir, String descr) { super("Directory " + getFilePath(dir) + " is in an inconsistent state: " + descr); } public InconsistentFSStateException(File dir, String descr, Throwable ex) { this(dir, descr + "\n" + StringUtils.stringifyException(ex)); } private static String getFilePath(File dir) { try { return dir.getCanonicalPath(); } catch(IOException e) {} return dir.getPath(); } }
[ "navychen2003@hotmail.com" ]
navychen2003@hotmail.com
92a9ac7b414c7f906d0869691166da28d9c03880
5f0c178e4f82145da035e5b8df4a922b0a9a9695
/src/mz/com/caelum/mvc/logica/AdicionaContatoLogic.java
dc89f60479d9ae41d31aa3a38ea8560c6a011a24
[]
no_license
crisostomomagaia/Romano
8cfb5a68558a27f75585b56dfbe1855d5639938f
4e9c232e0816d0e1b63ecfd06c6509ec7b28c5cc
refs/heads/master
2020-12-25T14:23:27.611440
2016-08-25T14:10:09
2016-08-25T14:10:09
66,562,180
0
0
null
null
null
null
UTF-8
Java
false
false
1,573
java
/** * */ package br.com.caelum.mvc.logica; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import br.com.caelum.agenda.dao.ContatoDao; import br.com.caelum.agenda.modelo.Contato; /** * @author user Aug 11, 2016 9:52:17 AM fj21-agenda br.com.caelum.mvc.logica * 2016 * */ public class AdicionaContatoLogic implements Logica { /* * (non-Javadoc) * * @see br.com.caelum.mvc.logica.Logica#executa(javax.servlet.http. * HttpServletRequest, javax.servlet.http.HttpServletResponse) */ @Override public String executa(HttpServletRequest req, HttpServletResponse res) throws Exception { Contato contato = new Contato(); // contato.setId(id); contato.setNome(req.getParameter("nome")); contato.setEmail(req.getParameter("email")); contato.setEndereco(req.getParameter("endereco")); String dataEmTexto = req.getParameter("dataNascimento"); Calendar dataNascimento = null; // return "mvc?logica=ListaContatoLogic"; try { Date date = new SimpleDateFormat("dd/MM/yyyy").parse(dataEmTexto); dataNascimento = Calendar.getInstance(); dataNascimento.setTime(date); } catch (ParseException e) { System.out.println("Erro de conversao de data"); } contato.setDataNascimento(dataNascimento); ContatoDao dao = new ContatoDao(); dao.adiciona(contato); System.out.println("Inserindo contato"); return "mvc?logica=ListaContatoLogic"; } }
[ "crismagaia@yahoo.com.br" ]
crismagaia@yahoo.com.br
7d78f186be75ee83f277d2bb142b7e5eee9b1098
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_6b286543d40b890a1ccb333c54a967a3a711f446/FMLBukkitHandler/2_6b286543d40b890a1ccb333c54a967a3a711f446_FMLBukkitHandler_s.java
afeafa011ef70d0facbbb13c3d502c1719ed6982
[]
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
16,786
java
/* * The FML Forge Mod Loader suite. Copyright (C) 2012 cpw * * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package cpw.mods.fml.server; import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Random; import java.util.logging.Logger; import net.minecraft.server.MinecraftServer; import net.minecraft.server.BaseMod; import net.minecraft.server.BiomeBase; import net.minecraft.server.CommonRegistry; import net.minecraft.server.EntityItem; import net.minecraft.server.EntityHuman; import net.minecraft.server.IChunkProvider; import net.minecraft.server.ICommandListener; import net.minecraft.server.IInventory; import net.minecraft.server.ItemStack; import net.minecraft.server.NetworkManager; import net.minecraft.server.Packet1Login; import net.minecraft.server.Packet250CustomPayload; import net.minecraft.server.Packet3Chat; import net.minecraft.server.BukkitRegistry; import net.minecraft.server.World; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.IFMLSidedHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModContainer; /** * Handles primary communication from hooked code into the system * * The FML entry point is {@link #onPreLoad(MinecraftServer)} called from {@link MinecraftServer} * * Obfuscated code should focus on this class and other members of the "server" (or "client") code * * The actual mod loading is handled at arms length by {@link Loader} * * It is expected that a similar class will exist for each target environment: Bukkit and Client side. * * It should not be directly modified. * * @author cpw * */ public class FMLBukkitHandler implements IFMLSidedHandler { /** * The singleton */ private static final FMLBukkitHandler INSTANCE = new FMLBukkitHandler(); /** * A reference to the server itself */ private MinecraftServer server; /** * A handy list of the default overworld biomes */ private BiomeBase[] defaultOverworldBiomes; /** * Called to start the whole game off from {@link MinecraftServer#startServer} * @param minecraftServer */ public void onPreLoad(MinecraftServer minecraftServer) { try { Class.forName("BaseModMp", false, getClass().getClassLoader()); MinecraftServer.field_6038_a.severe("" + "Forge Mod Loader has detected that this server has an ModLoaderMP installed alongside Forge Mod Loader.\n" + "This will cause a serious problem with compatibility. To protect your worlds, this minecraft server will now shutdown.\n" + "You should follow the installation instructions of either Minecraft Forge of Forge Mod Loader and NOT install ModLoaderMP \n" + "into the minecraft_server.jar file " + "before this server will be allowed to start up.\n\nFailure to do so will simply result in more startup failures.\n\n" + "The authors of Minecraft Forge and Forge Mod Loader strongly suggest you talk to your mod's authors and get them to\nupdate their " + "requirements. ModLoaderMP is not compatible with Minecraft Forge on the server and they will need to update their mod\n" + "for Minecraft Forge and other server compatibility, unless they are Minecraft Forge mods, in which case they already\n" + "don't need ModLoaderMP and the mod author simply has failed to update his requirements and should be informed appropriately.\n\n" + "The authors of Forge Mod Loader would like to be compatible with ModLoaderMP but it is closed source and owned by SDK.\n" + "SDK, the author of ModLoaderMP, has a standing invitation to submit compatibility patches \n" + "to the open source community project that is Forge Mod Loader so that this incompatibility doesn't last. \n" + "Users who wish to enjoy mods of both types are " + "encouraged to request of SDK that he submit a\ncompatibility patch to the Forge Mod Loader project at \n" + "http://github.com/cpw/FML.\nPosting on the minecraft forums at\nhttp://www.minecraftforum.net/topic/86765- (the MLMP thread)\n" + "may encourage him in this effort. However, I ask that your requests be polite.\n" + "Now, the server has to shutdown so you can reinstall your minecraft_server.jar\nproperly, until such time as we can work together."); throw new RuntimeException( "This FML based server has detected an installation of ModLoaderMP alongside. This will cause serious compatibility issues, so the server will now shut down."); } catch (ClassNotFoundException e) { // We're safe. continue } server = minecraftServer; FMLCommonHandler.instance().registerSidedDelegate(this); CommonRegistry.registerRegistry(new BukkitRegistry()); Loader.instance().loadMods(); } /** * Called a bit later on during server initialization to finish loading mods */ public void onLoadComplete() { Loader.instance().initializeMods(); } /** * Every tick just before world and other ticks occur */ public void onPreTick() { FMLCommonHandler.instance().gameTickStart(); } /** * Every tick just after world and other ticks occur */ public void onPostTick() { FMLCommonHandler.instance().gameTickEnd(); } /** * Get the server instance * @return */ public MinecraftServer getServer() { return server; } /** * Get a handle to the server's logger instance */ public Logger getMinecraftLogger() { return MinecraftServer.log; } /** * Called from ChunkProviderServer when a chunk needs to be populated * * To avoid polluting the worldgen seed, we generate a new random from the world seed and * generate a seed from that * * @param chunkProvider * @param chunkX * @param chunkZ * @param world * @param generator */ public void onChunkPopulate(IChunkProvider chunkProvider, int chunkX, int chunkZ, World world, IChunkProvider generator) { Random fmlRandom = new Random(world.getSeed()); long xSeed = fmlRandom.nextLong() >> 2 + 1L; long zSeed = fmlRandom.nextLong() >> 2 + 1L; fmlRandom.setSeed((xSeed * chunkX + zSeed * chunkZ) ^ world.getSeed()); for (ModContainer mod : Loader.getModList()) { if (mod.generatesWorld()) { mod.getWorldGenerator().generate(fmlRandom, chunkX, chunkZ, world, generator, chunkProvider); } } } /** * Called from the furnace to lookup fuel values * * @param itemId * @param itemDamage * @return */ public int fuelLookup(int itemId, int itemDamage) { int fv = 0; for (ModContainer mod : Loader.getModList()) { fv = Math.max(fv, mod.lookupFuelValue(itemId, itemDamage)); } return fv; } /** * Is the offered class and instance of BaseMod and therefore a ModLoader mod? */ public boolean isModLoaderMod(Class<?> clazz) { return BaseMod.class.isAssignableFrom(clazz); } /** * Load the supplied mod class into a mod container */ public ModContainer loadBaseModMod(Class<?> clazz, File canonicalFile) { @SuppressWarnings("unchecked") Class <? extends BaseMod > bmClazz = (Class <? extends BaseMod >) clazz; return new ModLoaderModContainer(bmClazz, canonicalFile); } /** * Called to notify that an item was picked up from the world * @param entityItem * @param entityPlayer */ public void notifyItemPickup(EntityItem entityItem, EntityHuman entityPlayer) { for (ModContainer mod : Loader.getModList()) { if (mod.wantsPickupNotification()) { mod.getPickupNotifier().notifyPickup(entityItem, entityPlayer); } } } /** * Raise an exception * @param exception * @param message * @param stopGame */ public void raiseException(Throwable exception, String message, boolean stopGame) { FMLCommonHandler.instance().getFMLLogger().throwing("FMLHandler", "raiseException", exception); throw new RuntimeException(exception); } /** * Attempt to dispense the item as an entity other than just as a the item itself * * @param world * @param x * @param y * @param z * @param xVelocity * @param zVelocity * @param item * @return */ public boolean tryDispensingEntity(World world, double x, double y, double z, byte xVelocity, byte zVelocity, ItemStack item) { for (ModContainer mod : Loader.getModList()) { if (mod.wantsToDispense() && mod.getDispenseHandler().dispense(x, y, z, xVelocity, zVelocity, world, item)) { return true; } } return false; } /** * @return the instance */ public static FMLBukkitHandler instance() { return INSTANCE; } /** * Build a list of default overworld biomes * @return */ public BiomeBase[] getDefaultOverworldBiomes() { if (defaultOverworldBiomes == null) { ArrayList<BiomeBase> biomes = new ArrayList<BiomeBase>(20); for (int i = 0; i < 23; i++) { if ("Sky".equals(BiomeBase.biomes[i].y) || "Hell".equals(BiomeBase.biomes[i].y)) { continue; } biomes.add(BiomeBase.biomes[i]); } defaultOverworldBiomes = new BiomeBase[biomes.size()]; biomes.toArray(defaultOverworldBiomes); } return defaultOverworldBiomes; } /** * Called when an item is crafted * @param player * @param craftedItem * @param craftingGrid */ public void onItemCrafted(EntityHuman player, ItemStack craftedItem, IInventory craftingGrid) { for (ModContainer mod : Loader.getModList()) { if (mod.wantsCraftingNotification()) { mod.getCraftingHandler().onCrafting(player, craftedItem, craftingGrid); } } } /** * Called when an item is smelted * * @param player * @param smeltedItem */ public void onItemSmelted(EntityHuman player, ItemStack smeltedItem) { for (ModContainer mod : Loader.getModList()) { if (mod.wantsCraftingNotification()) { mod.getCraftingHandler().onSmelting(player, smeltedItem); } } } /** * Called when a chat packet is received * * @param chat * @param player * @return true if you want the packet to stop processing and not echo to the rest of the world */ public boolean handleChatPacket(Packet3Chat chat, EntityHuman player) { for (ModContainer mod : Loader.getModList()) { if (mod.wantsNetworkPackets() && mod.getNetworkHandler().onChat(chat, player)) { return true; } } return false; } /** * Called when a packet 250 packet is received from the player * @param packet * @param player */ public void handlePacket250(Packet250CustomPayload packet, EntityHuman player) { if ("REGISTER".equals(packet.tag) || "UNREGISTER".equals(packet.tag)) { handleClientRegistration(packet, player); return; } ModContainer mod = FMLCommonHandler.instance().getModForChannel(packet.tag); if (mod != null) { mod.getNetworkHandler().onPacket250Packet(packet, player); } } /** * Handle register requests for packet 250 channels * @param packet */ private void handleClientRegistration(Packet250CustomPayload packet, EntityHuman player) { if (packet.data==null) { return; } try { for (String channel : new String(packet.data, "UTF8").split("\0")) { // Skip it if we don't know it if (FMLCommonHandler.instance().getModForChannel(channel) == null) { continue; } if ("REGISTER".equals(packet.tag)) { FMLCommonHandler.instance().activateChannel(player, channel); } else { FMLCommonHandler.instance().deactivateChannel(player, channel); } } } catch (UnsupportedEncodingException e) { getMinecraftLogger().warning("Received invalid registration packet"); } } /** * Handle a login * @param loginPacket * @param networkManager */ public void handleLogin(Packet1Login loginPacket, NetworkManager networkManager) { Packet250CustomPayload packet = new Packet250CustomPayload(); packet.tag = "REGISTER"; packet.data = FMLCommonHandler.instance().getPacketRegistry(); packet.length = packet.data.length; if (packet.length>0) { networkManager.queue(packet); } } public void announceLogin(EntityHuman player) { for (ModContainer mod : Loader.getModList()) { if (mod.wantsPlayerTracking()) { mod.getPlayerTracker().onPlayerLogin(player); } } } /** * Are we a server? */ @Override public boolean isServer() { return true; } /** * Are we a client? */ @Override public boolean isClient() { return false; } @Override public File getMinecraftRootDirectory() { try { return server.a(".").getCanonicalFile(); } catch (IOException ioe) { return new File("."); } } /** * @param var2 * @return */ public boolean handleServerCommand(String command, String player, ICommandListener listener) { for (ModContainer mod : Loader.getModList()) { if (mod.wantsConsoleCommands() && mod.getConsoleHandler().handleCommand(command, player, listener)) { return true; } } return false; } /** * @param player */ public void announceLogout(EntityHuman player) { for (ModContainer mod : Loader.getModList()) { if (mod.wantsPlayerTracking()) { mod.getPlayerTracker().onPlayerLogout(player); } } } /** * @param p_28168_1_ */ public void announceDimensionChange(EntityHuman player) { for (ModContainer mod : Loader.getModList()) { if (mod.wantsPlayerTracking()) { mod.getPlayerTracker().onPlayerChangedDimension(player); } } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
77e9c489d6fd5e93cee87a48289a1ce4d371b19f
da62f2ca68ea688d45611bb745a86ae76b409348
/deprecated/event/impl/src/java/org/apache/excalibur/mpool/PoolUtil.java
17797c6d7a82d42d7585c01be7d90c521f1c5918
[ "Apache-2.0" ]
permissive
eva-xuyen/excalibur
34dbf26dbd6e615dd9f04ced77580e5751a45401
4b5bcb6c21d998ddea41b0e3ebdbb2c1f8662c54
refs/heads/master
2021-01-23T03:04:14.441013
2015-03-26T02:45:49
2015-03-26T02:45:49
32,907,024
1
2
null
null
null
null
UTF-8
Java
false
false
2,618
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. * * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.excalibur.mpool; import java.lang.reflect.Method; /** * The PoolUtil class performs the reflection magic that is necessary to work * with the legacy Recyclable interface in the * <a href="http://jakarta.apache.org/avalon/excalibur/pool">Pool</a> package. * It also works with the new Resettable interface in MPool. * * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a> * @version CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:34 $ */ public final class PoolUtil { private final static Object[] EMPTY = new Object[]{}; private final static Class[] EMPTY_ARGS = new Class[]{}; private PoolUtil() { } /** * This method will either call "reset" on Resettable objects, * or it will call "recycle" on Recyclable objects. * * @param obj The object you want recycled. * @return the same object */ public static Object recycle( final Object obj ) { if( obj instanceof Resettable ) { ( (Resettable)obj ).reset(); } else { try { Class klass = obj.getClass(); Class recyclable = klass.getClassLoader().loadClass( "org.apache.avalon.excalibur.pool.Recyclable" ); if( recyclable.isAssignableFrom( klass ) ) { recycleLegacy( obj ); } } catch( Exception e ) { // No recyclable interface } } return obj; } private static void recycleLegacy( final Object obj ) throws Exception { Class klass = obj.getClass(); Method recycle = klass.getMethod( "recycle", EMPTY_ARGS ); recycle.invoke( obj, EMPTY ); } }
[ "root@mycompany.com" ]
root@mycompany.com
22fa5beff077fa247e6affdd8c7d63160b7807a0
e92dcbca75c18165b627c5075493b62f9968cf4d
/HealthcareClientAS 6 6 21/HealthcareClientAS/src/com/healthcare/client/HomeActivity.java
8a1c250269f003e4d9f24af89b80eebf232d276b
[]
no_license
amalmathewcodes/Android-Based-Health-Monitoring-System
02e4a3e31fa0b2d1395c86df5680aa5fe5ed0989
ba527b5567090043a2fec252181b0a5aa1fa3237
refs/heads/master
2023-06-28T16:32:43.269032
2021-07-20T17:03:10
2021-07-20T17:03:10
385,914,084
0
0
null
null
null
null
UTF-8
Java
false
false
11,412
java
package com.healthcare.client; import java.io.IOException; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Random; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.ParseException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.HttpHostConnectException; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.location.Criteria; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.net.Uri; import android.os.Bundle; import android.os.Looper; import android.text.format.DateFormat; import android.view.LayoutInflater; import android.view.View; import android.widget.EditText; import com.google.gson.Gson; public class HomeActivity extends Activity implements Runnable, LocationListener { Intent navi; Dialog sd; private LocationManager locationManager; private String provider; PatientObj obj; Thread t1; Gson gs = new Gson(); HttpClient cli; HttpPost post; HttpResponse res; HttpEntity resent; String result; boolean genearateRandomPHI=false; int temp,press,pulse=0,sugar; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); try{ t1=new Thread(this); t1.start(); int id = this.getIntent().getExtras().getInt("uid"); // getting user information from web service cli = new DefaultHttpClient(); post = new HttpPost("http://"+Config.ipaddr+"/Mobile_Healthcare/getmu.php?uid=" + id); res = cli.execute(post); resent = res.getEntity(); // conversion to string. result = EntityUtils.toString(resent); System.out.println("rrres"+result); // convertng JSON to Object.. obj = gs.fromJson(result, PatientObj.class); obj.setId(id); } catch (HttpHostConnectException e) { // TODO Auto-generated catch block e.printStackTrace(); Commons.showToast("Can't reach server, check the Hostname", true); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch(Exception e){ e.printStackTrace(); Commons.showToast("Something wrong."+e.getMessage(), true); } } // emergency call public void onEmergency(View v) { String url = "tel:" + obj.getEmergencyNo(); // intent indicates activity changes. Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(url)); // making the call startActivity(intent); } // sending report public void onSendReport(View v) { // show dialog for getting PHI data sd = new Dialog(this); LayoutInflater li = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View dv = li.inflate(R.layout.dialog_report, null); sd.setContentView(dv); sd.setCancelable(true); sd.setTitle("Send Report"); genearateRandomPHI=true; Random random=new Random(); if(this.pulse==0){//If Send Report clicked for the first time if(obj.getEmergencyNo().endsWith("1")){ pulse=101+random.nextInt(10);//emergency user temp=95+random.nextInt(8); press=50+random.nextInt(100); sugar=60+random.nextInt(90); }else{ pulse=60+random.nextInt(30);//normal user temp=96+random.nextInt(5); press=80+random.nextInt(39); sugar=90+random.nextInt(20); } } sd.show(); } public void onViewReport(View v) { Intent repMU = new Intent(this, ReportActivity.class); repMU.putExtra("pid", obj.getId()); startActivity(repMU); } public void onLogout(View v) { finish(); } public void onCancel(View v) { genearateRandomPHI=false; sd.dismiss(); } // send random variables. public void sendReport(){ Random random=new Random(); int increaseOrDecreaseInt=random.nextInt(3); boolean increase=increaseOrDecreaseInt>=1;//increase all phi values if random number is 1/2 if(increase){ this.pulse =this.pulse+random.nextInt(5) ;//60-100 this.sugar = this.sugar+random.nextInt(5) ;//70-140 this.press = this.press+random.nextInt(3) ;//60-140 this.temp = this.temp+random.nextInt(2) ;//97-100 }else{ this.pulse =this.pulse-random.nextInt(5) ;//60-100 this.sugar = this.sugar-random.nextInt(5) ;//70-140 this.press = this.press-random.nextInt(3) ;//60-140 this.temp = this.temp-random.nextInt(2) ;//97-100 } System.out.println("pulse"+pulse); runOnUiThread(new Runnable() { @Override public void run() { ( (EditText)sd.findViewById(R.id.txtPulse)).setText(""+pulse); ( (EditText)sd.findViewById(R.id.txtSugar)).setText(""+sugar); ( (EditText)sd.findViewById(R.id.txtPressure)).setText(""+press); ( (EditText)sd.findViewById(R.id.txtTemperature)).setText(""+temp); if(!Commons.isPressureOK(press)) ( (EditText)sd.findViewById(R.id.txtPressure)).setBackgroundColor(Color.RED); if(!Commons.isPulseOK(pulse)) ( (EditText)sd.findViewById(R.id.txtPulse)).setBackgroundColor(Color.RED); if(!Commons.isSugarOK(sugar)) ( (EditText)sd.findViewById(R.id.txtSugar)).setBackgroundColor(Color.RED); if(!Commons.isTemperatureOK(temp)) ( (EditText)sd.findViewById(R.id.txtTemperature)).setBackgroundColor(Color.RED); } }); // sending report to the service... PhiObj phiobj = new PhiObj(); // Location l=getLocation(); // phiobj.setPName(obj.getPName()); phiobj.setPid(obj.getId()); phiobj.setRepTime(DateFormat.format("dd/MMM/yyyy - hh.mm a", new Date()).toString()); phiobj.setPulse(pulse); phiobj.setSugar(sugar); phiobj.setPressure(press); phiobj.setTemperature(temp); //AndroidKeyStore keystore=new AndroidKeyStore(this); // keystore.addPref("u", "339da84d44aa94398577612dcbf2d8215965bb956248d96fb8840bfd56ff3d3cbab43fb9ac2f19b2ff7fbd21bcd816ae7943a0e6846fcdcf2ac9ead58238893c695a90ca35be932b037d37a6b0a6f9af776a9167870d4a11b4c011c24d001b342b109c5e0184e35133931d8ebbc4851887cda0662a0dce22904084013ea8208b"); //System.out.println("Preference->"+keystore.getPref("u")); GPSTracker gps=new GPSTracker(this); System.out.println("Loccc"+gps.getLocation()); if(gps.getLatitude()!=0.0){ phiobj.setLat(""+gps.getLatitude()); phiobj.setLng(""+gps.getLongitude()); }else{ // phiobj.setLat(Config.defaultLatitude);9.66836101723838 // phiobj.setLng(Config.defaultLongitude);, 76.62123625071573 } if(Commons.isNormal(pulse, sugar, press, temp)) phiobj.setStatus("Normal"); else phiobj.setStatus("Emergency"); String json = gs.toJson(phiobj); // System.out.println("JSon"+json); // sending report to the web service try{ post = new HttpPost("http://"+Config.ipaddr+"/Mobile_Healthcare/recPHI.php"); List<NameValuePair> rep = new ArrayList<NameValuePair>(3); rep.add(new BasicNameValuePair("phirep", json)); // post.setEntity(new UrlEncodedFormEntity(rep)); res = cli.execute(post); resent = res.getEntity(); result = EntityUtils.toString(resent); System.out.println("Result======="+result); if(result.equals("true")) Commons.showToast("Report sent to TA", true); else Commons.showToast("Can't sent report to TA\n" + result, true); } catch(Exception e){ Commons.showToast("Something wrong..Please check your connection..", true); e.printStackTrace(); } } public Location getLocation(){ locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // Define the criteria how to select the locatioin provider -> use // default Criteria criteria = new Criteria(); provider = locationManager.getBestProvider(criteria, false); // System.out.println("Provider is"+provider); Location location = locationManager.getLastKnownLocation(provider); // Initialize the location fields if (location != null) { System.out.println("Provider " + provider + " has been selected."); System.out.println("Location is "+location); onLocationChanged(location); int lat = (int) (location.getLatitude()); int lng = (int) (location.getLongitude()); System.out.println("long"+lng+"lat"+lat); } else { System.out.println("location not available"); } return location; } public void onReportSend(View v) { sendReport(); } @Override public void onActivityResult(int reqCode, int resCode, Intent data) { if(resCode == Activity.RESULT_OK) { Bundle bundle = data.getExtras(); obj = (PatientObj) bundle.getSerializable("Extra_Obj"); } } @Override public void onBackPressed() { } // to continously run the threads. public void run(){ Looper.prepare(); while(true){ if(genearateRandomPHI){ // System.out.println("Get Location"); // GPSTracker gps=new GPSTracker(this); // System.out.println(gps.getLocation()); // System.out.println(gps.getLocation()); sendReport(); //System.out.println("Sending report"); try { Thread.sleep(10000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } try { Thread.sleep(50); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } @Override public void onLocationChanged(Location arg0) { // TODO Auto-generated method stub System.out.println("Location changed------"+arg0); } @Override public void onProviderDisabled(String arg0) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String arg0) { // TODO Auto-generated method stub } @Override public void onStatusChanged(String arg0, int arg1, Bundle arg2) { // TODO Auto-generated method stub } }
[ "amalmathewoffid@gmail.com" ]
amalmathewoffid@gmail.com
121fbd80f1fb5e10951b237d4d10333db4a7d225
287b7e811b99f999bcb50ad75672ac1b3b11b6c3
/section1_4/TwoSum.java
953a6584f1cb447cb33530482b72317d87bbed95
[]
no_license
tvdn/algorithmsCourse
c92aa511e51e029fd5792cda12db7ff68a6bd2a5
aa1d27fd257a1725abdfe4a8afe6318f4bb6c1f3
refs/heads/master
2020-04-03T02:49:07.956547
2018-12-14T17:08:04
2018-12-14T17:08:04
154,968,017
0
0
null
null
null
null
UTF-8
Java
false
false
1,047
java
package section1_4; //code straight from Algorithms by Sedgewick and Wayne import edu.princeton.cs.algs4.StdOut; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; public class TwoSum { public static int count(int[] a) { // Count triples that sum to 0. int N = a.length; int cnt = 0; for (int i = 0; i < N; i++) for (int j = i+1; j < N; j++) if (a[i] + a[j] == 0) cnt++; return cnt; } public static void main(String[] args) throws Exception { File file = new File("/Users/Tomvdb/Java/algorithms_sedgewick/section1_4/1Mints.txt"); BufferedReader b = new BufferedReader(new FileReader(file)); String readLine = ""; int[] a = new int[10000]; for (int i = 0; i < 10000; i++) { a[i] = Integer.parseInt(b.readLine().trim()); } Stopwatch timer = new Stopwatch(); StdOut.println(count(a) + " " + timer.elapsedTime()); ; } }
[ "tomvdberg@hotmail.com" ]
tomvdberg@hotmail.com
31da0bf9ddf70d998b59c17c413dbe1b94158400
38b7acddfd4b52b86176e82b9696424db2dcee32
/src/com/miykeal/showCaseStandalone/Listeners/ShowCaseStandaloneNEWDropChestListener.java
480327d3ca4b2f3cd34da41f9e325fdc794ca602
[]
no_license
thefr34k/Showcase-FR34K
6c34274b00e2205c43414c552e341b02a1360cac
8fba6b21598f1cacc3dc28fdd9e2476480ce0449
refs/heads/master
2020-03-26T15:41:53.154587
2012-08-21T05:37:28
2012-08-21T05:37:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,556
java
package com.miykeal.showCaseStandalone.Listeners; //This is for a fork of the DC plugin (that hadn't been updated. import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import com.miykeal.showCaseStandalone.ShowCaseStandalone; import com.noheroes.dropchest.api.DropChestSuckEvent; /** * Copyright (C) 2011 Kellerkindt <kellerkindt@miykeal.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @author Sorklin <sorklin at gmail.com> */ public class ShowCaseStandaloneNEWDropChestListener implements Listener { private ShowCaseStandalone scs; public ShowCaseStandaloneNEWDropChestListener(ShowCaseStandalone instance){ this.scs = instance; scs.getServer().getPluginManager().registerEvents(this, scs); } @EventHandler(ignoreCancelled=true) public void onDropChestSuck(DropChestSuckEvent event) { if(scs.isShowCaseItem(event.getItem())){ event.setCancelled(true); } } }
[ "fr34k@djfr34k.com" ]
fr34k@djfr34k.com
a4880c85e95ffda484997b7b9fb880d619930a62
02a3e54503491ec0d7602e3313d2861c860167aa
/TravelNow/src/main/java/com/travelnow/controllers/AuthApiController.java
833d01c10543f9fef508552bd514d47fdd2ff97f
[]
no_license
jciarka/TravelNow-backend
9346eaddcb4b56885c858e218fbd277bad203001
f23135f708b8f18bc04b8af66847314fbb372bf9
refs/heads/master
2023-05-11T15:28:02.091233
2021-05-28T09:14:11
2021-05-28T09:14:11
371,644,021
0
0
null
null
null
null
UTF-8
Java
false
false
3,598
java
package com.travelnow.controllers; import javax.annotation.security.RolesAllowed; import com.travelnow.core.security.JwtTokenUtil; import com.travelnow.core.security.models.MyUserDetails; import com.travelnow.models.auth.AuthRequest; import com.travelnow.models.auth.CreateUserInfo; import com.travelnow.models.auth.UserView; import com.travelnow.services.UserService; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import com.travelnow.core.dbacces.models.security.User; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping(path = "api/auth/") public class AuthApiController { private final AuthenticationManager authenticationManager; private final JwtTokenUtil jwtTokenUtil; private final UserService userService; public AuthApiController(AuthenticationManager authenticationManager, JwtTokenUtil jwtTokenUtil, UserService userService){ this.authenticationManager = authenticationManager; this.jwtTokenUtil = jwtTokenUtil; this.userService = userService; } @PostMapping("token") public ResponseEntity<UserView> login(@RequestBody AuthRequest request) { try { Authentication authenticate = authenticationManager .authenticate( new UsernamePasswordAuthenticationToken( request.getUsername(), request.getPassword() ) ); MyUserDetails userDetails = (MyUserDetails) authenticate.getPrincipal(); UserView userView = new UserView( userService.findUserByUsername(userDetails.getUsername()) ); String token = jwtTokenUtil.generateAccessToken(userDetails); return ResponseEntity.ok() .header( HttpHeaders.AUTHORIZATION, token ) .body(userView); } catch (BadCredentialsException ex) { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build(); } } @PutMapping("add") public UserView createAccount(@RequestBody CreateUserInfo request) throws Exception { User user = userService.createAccount(request); return new UserView(user); } @GetMapping("/test") @RolesAllowed("ROLE_USER") public String test(){ Authentication auth = SecurityContextHolder.getContext().getAuthentication(); MyUserDetails userDetails = (MyUserDetails) auth.getPrincipal(); return "Test passed: " + userDetails.getUsername(); } } // Based on // https://github.com/Yoh0xFF/java-spring-security-example/blob/master/src/main/java/io/example/service/UserService.java // https://www.toptal.com/spring/spring-security-tutorial
[ "01104656@pw.edu.pl" ]
01104656@pw.edu.pl
0338f4d6568174279e85764fb94b3b13d867dab7
ff1094091d6ae9297b8c2cd5455af7ec221872ff
/cap_3/src/jframe/Practice_RadioButtoon.java
612b7840b9c5faf570f479f5a8cfcd4a442a9418
[]
no_license
KanerasIllya720/afterJavaClass
0e44ecd36060b2ddacb970cccf6da8e3f7543137
2cf5d27eefdc8bd24ae7a299b202a657ec9be87f
refs/heads/master
2022-10-29T16:44:16.309253
2020-06-15T07:53:37
2020-06-15T07:53:37
271,222,803
0
0
null
null
null
null
UHC
Java
false
false
818
java
package jframe; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JRadioButton; public class Practice_RadioButtoon { public static void main(String[] args) { new Practice_RadioButtoon().run(); } public void run() { JFrame fr = new JFrame(); fr.setSize(230, 200); fr.setLocationRelativeTo(null); fr.setLayout(null); fr.setTitle("버튼"); String[] nick = "얀데레,키,요,히,메".split(","); JRadioButton[] rad = new JRadioButton[5]; for (int i = 0; i < rad.length; i++) { rad[i] = new JRadioButton(nick[i]); rad[i].setBounds(20,20 + i * 25, 80, 30); fr.add(rad[i]); } JButton b1 = new JButton("실행?"); b1.setBounds(120, 20, 70, 120); fr.add(b1); fr.setVisible(true); } }
[ "user@30210-OYW" ]
user@30210-OYW
f4d9133b3d6f1beb385dcb7814d4dc31381166ed
5b0e2e7947446fab29795404a86ca5957bb19447
/back-end/springboot-watchfashion/springboot-watchfashion/src/main/java/com/chuvnahuy/springbootwatchfashion/security/jwt/AuthEntryPointJwt.java
b1d021873e3bdfbad3478c2b57be9612d4606630
[]
no_license
vanhuy122322/Spring-Boot
f8f1ffed687a1c6aae2bc0839a9ad027838bf5e4
6de7aa941cb1e70a453a82dec09cc0f38fe51b26
refs/heads/main
2023-07-24T10:45:33.856995
2021-09-07T03:53:49
2021-09-07T03:53:49
403,829,355
0
0
null
null
null
null
UTF-8
Java
false
false
961
java
package com.chuvnahuy.springbootwatchfashion.security.jwt; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.stereotype.Component; @Component public class AuthEntryPointJwt implements AuthenticationEntryPoint { private static final Logger logger = LoggerFactory.getLogger(AuthEntryPointJwt.class); @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { logger.error("Unauthorized error: {}", authException.getMessage()); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Error: Unauthorized"); } }
[ "vanhuy122322@gmail.com" ]
vanhuy122322@gmail.com
9317e2f88cb56e3f865021ee558aa1a14930402f
815028d04da36c1a35da46c31336104443044d26
/src/main/java/com/ubatis/circleserver/handler/AuthExceptionHandler.java
a27823f520f3b87b8e767de36b1ceeed57376f2a
[]
no_license
freemocker/circle-server
e9106f8c102dc20ac2be775224117f0a18b2d00c
e0cddc82829b1733f602c61832b2887c1598eff8
refs/heads/master
2020-06-07T05:48:23.080454
2019-06-15T08:07:36
2019-06-15T08:07:36
192,940,653
1
0
null
2019-06-20T15:03:29
2019-06-20T15:03:29
null
UTF-8
Java
false
false
1,245
java
package com.ubatis.circleserver.handler; import com.ubatis.circleserver.bean.basic.JsonBase; import com.ubatis.circleserver.exception.ValidException; import com.ubatis.circleserver.util.JsonUtil; import com.ubatis.circleserver.util.constant.CS; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; /** 统一异常处理 * Created by lance on 2017/4/25. */ @RestControllerAdvice public class AuthExceptionHandler { private final static Logger logger = LoggerFactory.getLogger(AuthExceptionHandler.class); @ExceptionHandler(value = ValidException.class) public JsonBase handle(ValidException ex){ JsonBase jsonBase = new JsonBase(ex.getCode(),ex.getMessage()); return jsonBase; } @ExceptionHandler(value = Exception.class) public JsonBase handleUnCatchException(Exception ex){ ex.printStackTrace(); JsonBase jsonBase = new JsonBase(); jsonBase.setCode(CS.RETURN_CODE_UNKNOWN_ERROR); jsonBase.setInfo(ex.getMessage()); logger.error("统一错误处理:{}", JsonUtil.toJson(jsonBase)); return jsonBase; } }
[ "809556311@qq.com" ]
809556311@qq.com
8ab80b9877f4f5aaaa0ef9897f4012caddfbdc96
cfef702b9623ab43f5df6358d41f61a734e3bfb2
/persistence/src/main/java/com/liguo/hgl/proxydao/dao/impl/TbNoticeInfoMapperImpl.java
c5f81838d23ef2a2411cd91dc148eca3158f2664
[]
no_license
JLLeitschuh/hgl
17adcc90560ad57d971a550df6621b62de9a4567
3648456ef796da360ebcd075b4a82052b54d3f0d
refs/heads/master
2021-01-02T15:21:03.738106
2017-07-19T09:05:42
2017-07-19T09:05:42
239,679,138
0
1
null
2020-11-17T19:13:19
2020-02-11T04:53:01
null
UTF-8
Java
false
false
2,840
java
package com.liguo.hgl.proxydao.dao.impl; import com.github.pagehelper.Page; import com.liguo.hgl.proxydao.base.BaseMapperImpl; import com.liguo.hgl.proxydao.dao.TbNoticeInfoMapper; import com.liguo.hgl.proxydao.model.Criteria; import com.liguo.hgl.proxydao.model.TbBrand; import com.liguo.hgl.proxydao.model.TbNoticeInfo; import com.liguo.hgl.proxydao.page.PageDto; import java.util.List; import org.apache.ibatis.session.RowBounds; import org.springframework.stereotype.Repository; @Repository public class TbNoticeInfoMapperImpl extends BaseMapperImpl<TbNoticeInfo> implements TbNoticeInfoMapper { public TbNoticeInfoMapperImpl() { super(); } public int deleteByPrimaryKey(Integer id) { return this.sqlSessionTemplate.delete("com.liguo.hgl.proxydao.dao.TbNoticeInfoMapper.deleteByPrimaryKey", id); } public int updateByPrimaryKeySelective(TbNoticeInfo record) { return this.sqlSessionTemplate.update("com.liguo.hgl.proxydao.dao.TbNoticeInfoMapper.updateByPrimaryKeySelective", record); } public int updateByPrimaryKey(TbNoticeInfo record) { return this.sqlSessionTemplate.update("com.liguo.hgl.proxydao.dao.TbNoticeInfoMapper.updateByPrimaryKey", record); } public int deleteByObject(Criteria parameter) { return this.sqlSessionTemplate.delete("com.liguo.hgl.proxydao.dao.TbNoticeInfoMapper.deleteByObject", parameter); } public int insert(TbNoticeInfo record) { return this.sqlSessionTemplate.insert("com.liguo.hgl.proxydao.dao.TbNoticeInfoMapper.insert", record); } public int insertSelective(TbNoticeInfo record) { return this.sqlSessionTemplate.insert("com.liguo.hgl.proxydao.dao.TbNoticeInfoMapper.insertSelective", record); } public int countByObject(Criteria parameter) { Object obj = this.sqlSessionTemplate.selectOne("com.liguo.hgl.proxydao.dao.TbNoticeInfoMapper.countByObject", parameter); return obj != null ? Integer.parseInt(String.valueOf(obj)) : 0; } @Override public List<TbNoticeInfo> selectByObject(Criteria parameter) { return this.sqlSessionTemplate.selectList("com.liguo.hgl.proxydao.dao.TbNoticeInfoMapper.selectByObject", parameter); } public TbNoticeInfo selectByPrimaryKey(Integer id) { Object obj = this.sqlSessionTemplate.selectOne("com.liguo.hgl.proxydao.dao.TbNoticeInfoMapper.selectByPrimaryKey", id); return obj != null ? (TbNoticeInfo)obj : null; } @Override public List<TbNoticeInfo> selectByObjectPage(Criteria example, PageDto pgo) { Page<TbNoticeInfo> selectList = (Page)this.sqlSessionTemplate.selectList("com.liguo.hgl.proxydao.dao.TbNoticeInfoMapper.selectByObjectPage",example,new RowBounds(pgo.pageIndex,pgo.pageSize)); pgo.reset((int)selectList.getTotal()); return selectList; } }
[ "xiongpeng@GOLD.CN" ]
xiongpeng@GOLD.CN
43b204050bead40f8e4e2dc75c14463a693bd06c
1e88b201a638cdb65978b4f454fe4fcdb7edec75
/Source Code/com/bitmovers/utilities/servlet/FormInputPage.java
568f93360405db0c2a4b2f40a72733f9d4ccaa0c
[]
no_license
iwoj/Maui
2c28346943a344646cc0c3f0252d5ae30a04b197
f6c32c5dc8cd281f3faa2694861a68a487d35a82
refs/heads/master
2021-01-21T23:14:24.789026
2012-01-19T05:58:28
2012-01-19T05:58:28
2,943,806
0
0
null
null
null
null
UTF-8
Java
false
false
6,558
java
// ============================================================================= // com.bitmovers.utilities.servlet.FormInputPage // ============================================================================= package com.bitmovers.utilities.servlet; import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import com.bitmovers.utilities.*; // ============================================================================= // CLASS: FormInputPage // ============================================================================= /** The FormInputPage class is a tool for developing HTTP Servlets that consist * of one or more form input pages. FormInputPage implements the generic code * that handles form input and field verification from a HttpServlet. * <p> * * FormInputPage is an abstract class. The developer implementing a Servlet * that requires form input is intended to extend this class. Particularily, * the developer is intended to implement the 'verifyField()' method which * defines the verification rules for required form fields. The implementing * developer must also (likely in the constructor) make calls to the * 'setFieldRequirements()' method in order to tell FormInputPage class which * fields are required fields. * <p> * * The class automatically handles HTML output through the 'outputHTML()' * method. When a 'formIsComplete()', the developer may also * 'getFormFieldData()' to do something with the data that has been collected. * <p> * * See the method descriptions for particular details. * <p> * * @version 2000.02.27-A * @author Chris Knight (chris.knight@bitmovers.com) */ public abstract class FormInputPage extends HTMLPage { // --------------------------------------------------------------------------- private final Hashtable requiredFields = new Hashtable(); // --------------------------------------------------------------------------- // METHOD: handleAdditionalVariables // --------------------------------------------------------------------------- /** This 'handleAdditonalVariables()' method is responsible for handling * any additional variables which need to be processed. This method can * be extended to handle variables in any way seen fit. The default * behaviour of this method is to not do anything special to the passed * variables. * */ public Hashtable handleAdditionalVariables(Hashtable additionalVariables) { // (1) Verify the contents of all required fields and then construct and // add the error variables to the parsedVariables hashtable. { Enumeration requiredKeys = this.requiredFields.keys(); while (requiredKeys.hasMoreElements()) { String fieldName = requiredKeys.nextElement().toString(); String fieldValue; try { fieldValue = super.getRequestData().get(fieldName).toString(); } catch (NullPointerException exception) { fieldValue = ""; } if (this.verifyField(fieldName, fieldValue)) { // remove the errorColour field if it's there if (additionalVariables.containsKey(fieldName + ".errorColour")) { additionalVariables.remove(fieldName + ".errorColour"); } } else { additionalVariables.put(fieldName + ".errorColour", "red"); } } } return additionalVariables; } // --------------------------------------------------------------------------- // METHOD: isComplete // --------------------------------------------------------------------------- /** If all required fields (specified through the 'setRequiredField()' * method) all pass the tests implemented in the 'verifyField()' method, * then this method returns 'true'. Otherwise this method returns false. */ public final boolean isComplete() { Enumeration requiredKeys = requiredFields.keys(); int errorCounter = 0; while (requiredKeys.hasMoreElements()) { String fieldName = requiredKeys.nextElement().toString(); String fieldValue; try { fieldValue = super.getRequestData().get(fieldName).toString(); } catch (NullPointerException exception) { fieldValue = ""; } if (!verifyField(fieldName, fieldValue)) { errorCounter++; } } if (errorCounter > 0) { return false; } else { return true; } } // --------------------------------------------------------------------------- // METHOD: verifyField // --------------------------------------------------------------------------- /** The FormInputPage subclass developer must implement this method in order * to handle field verification. For every 'required field' (specified * through the 'setRequiredField()' method), this method must accept the * field's name and return 'true' if the method is sucessfully populated * or return 'false' if not. An example implementation might look like * the following: * <p><pre> * public boolean verifyField(String fieldName, String fieldValue) * { * if (fieldName.equals("FIRST_NAME")) * { * if (fieldValue.equals("")) * { * return false; * } * else * { * return true; * } * } * else * { * return false; * } * } * </pre> * <p> */ public abstract boolean verifyField(String fieldName, String fieldValue); // --------------------------------------------------------------------------- // METHOD: setRequiredField // --------------------------------------------------------------------------- /** The 'setRequiredField()' method indicates which form fields are * required. To specify a required form field, pass the field's name * to this method. Only required fields are verified through the * 'verifyField()' method during runtime. */ public final void setRequiredField(String fieldName) { this.requiredFields.put(fieldName, "required"); } // --------------------------------------------------------------------------- } // ============================================================================= // Copyright 2000 Bitmovers Communications, Inc. eof
[ "i@woj.com" ]
i@woj.com
f4c35adc1b52c10b32af86f89adaea1e3a59fe9a
61ce211c77613aee9303ce054875ed0d43cd5873
/sandbox/src/test/java/ru/stqa/pft/sandbox/EquetionTests.java
354de32d9ad80562d0c4c399e80941cc379e3e86
[]
no_license
ViktorSmuk/java_prog_test
bf25d712aa1da4c86a6d6c5acb5e072a97896dbb
08313e63f4440836197d8742f626118377fe49a0
refs/heads/main
2023-08-07T06:52:45.393016
2021-09-13T12:40:11
2021-09-13T12:40:11
383,370,195
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
package ru.stqa.pft.sandbox; import org.testng.Assert; import org.testng.annotations.Test; public class EquetionTests { @Test public void test0(){ Equetion e = new Equetion(1,1,1); Assert.assertEquals(e.rootNumber(),0); } @Test public void test1(){ Equetion e = new Equetion(1,2,1); Assert.assertEquals(e.rootNumber(),1); } @Test public void test2(){ Equetion e = new Equetion(1,5,6); Assert.assertEquals(e.rootNumber(),2); } @Test public void testLinear(){ Equetion e = new Equetion(0,1,1); Assert.assertEquals(e.rootNumber(),1); } @Test public void testConstant(){ Equetion e = new Equetion(0,0,1); Assert.assertEquals(e.rootNumber(),0); } @Test public void testZero(){ Equetion e = new Equetion(0,0,0); Assert.assertEquals(e.rootNumber(),-1); } }
[ "smuk_92@mail.ru" ]
smuk_92@mail.ru
febe46b0bdbea2d2bd8b11244b95159296dcabe0
ecba8e1071dbb277fe6cc19c49b4e22fbf261610
/src/main/CMain.java
10b1bfc0f649232d19e46a3f737ad96e65584a8f
[]
no_license
schdomin/zep
b0ce1f18b45ba2990f61c41c2e2c3049f0b53c27
02ae0509e771d823d50a55bf3e1b88fab080daac
refs/heads/master
2021-01-17T19:58:27.429311
2014-06-26T20:59:10
2014-06-26T20:59:10
18,445,479
0
0
null
null
null
null
UTF-8
Java
false
false
10,672
java
package main; import java.sql.SQLException; //ds custom imports import exceptions.CZEPConfigurationException; import exceptions.CZEPEoIException; import exceptions.CZEPGUIException; import exceptions.CZEPMySQLManagerException; import utility.CImporter; import utility.CLogger; import utility.CMySQLManager; import learning.CLearnerBayes; //import learning.CLearnerRandom; public abstract class CMain { //ds hardcoded values private static final String m_strConfigFileName = "config.txt"; //ds default configuration parameters: gui private static int m_iWindowWidth = -1; private static int m_iWindowHeight = -1; //ds default configuration parameters: mysql private static String m_strMySQLServerURL = ""; private static String m_strMySQLUsername = ""; private static String m_strMySQLPassword = ""; //ds MAIN public static void main( String[] args ) { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) ZEP launched" ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) importing configuration from [" + m_strConfigFileName + "]" ); try { //ds GUI m_iWindowWidth = Integer.valueOf( CImporter.getAttribute( m_strConfigFileName, "m_iWindowWidth" ) ); m_iWindowHeight = Integer.valueOf( CImporter.getAttribute( m_strConfigFileName, "m_iWindowHeight" ) ); //ds MySQL m_strMySQLServerURL = CImporter.getAttribute( m_strConfigFileName, "m_strMySQLServerURL" ); m_strMySQLUsername = CImporter.getAttribute( m_strConfigFileName, "m_strMySQLUsername" ); m_strMySQLPassword = CImporter.getAttribute( m_strConfigFileName, "m_strMySQLPassword" ); } catch( CZEPConfigurationException e ) { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) CZEPConfigurationException: " + e.getMessage( ) + " - error during config file parsing" ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) aborted" ); return; } catch( NumberFormatException e ) { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) NumberFormatException: " + e.getMessage( ) + " - could not convert attribute values to numerical" ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) aborted" ); return; } System.out.println( "-------------------------------------------------------------------------------------------------" ); System.out.println( "| CONFIGURATION |" ); System.out.println( "-------------------------------------------------------------------------------------------------" ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) m_iWindowWidth=" + m_iWindowWidth ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) m_iWindowHeight=" + m_iWindowHeight ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) m_strMySQLUsername=" + m_strMySQLUsername ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) m_strMySQLServerURL=" + m_strMySQLServerURL ); System.out.println( "-------------------------------------------------------------------------------------------------" ); System.out.println( "| LAUNCH PHASE |" ); System.out.println( "-------------------------------------------------------------------------------------------------" ); //ds allocate the MySQL manager final CMySQLManager cMySQLManager = new CMySQLManager( m_strMySQLServerURL, m_strMySQLUsername, m_strMySQLPassword ); try { //ds launch the manager cMySQLManager.launch( ); } catch( ClassNotFoundException e ) { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) ClassNotFoundException: " + e.getMessage( ) + " - could not establish MySQL connection" ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) aborted" ); return; } catch( SQLException e ) { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) SQLException: " + e.getMessage( ) + " - could not establish a valid MySQL connection" ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) aborted" ); return; } catch( CZEPMySQLManagerException e ) { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) CZEPMySQLManagerException: " + e.getMessage( ) + " - failed to connect" ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) aborted" ); return; } //ds allocate the learner final CLearnerBayes cLearner = new CLearnerBayes( cMySQLManager ); try { //ds launch the learner cLearner.launch( ); } catch( SQLException e ) { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) SQLException: " + e.getMessage( ) + " - could not connect to MySQL database" ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) aborted" ); System.exit( 0 ); return; } catch( CZEPMySQLManagerException e ) { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) CZEPMySQLManagerException: " + e.getMessage( ) + " - could not launch learner" ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) aborted" ); System.exit( 0 ); return; } catch( CZEPEoIException e ) { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) CZEPEoIException: " + e.getMessage( ) + " - no images in database" ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) aborted" ); System.exit( 0 ); return; } //ds allocate a gui instance on the learner final CGUI cGUI = new CGUI( cLearner, cMySQLManager, m_iWindowWidth, m_iWindowHeight ); try { //ds launch GUI (this will automatically fetch the first datapool since needed for display) cGUI.launch( ); } catch( CZEPGUIException e ) { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) CZEPGUIException: " + e.getMessage( ) + " - could not initialize GUI" ); cGUI.close( ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) aborted" ); System.exit( 0 ); return; } catch( SQLException e ) { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) SQLException: " + e.getMessage( ) + " - could not initialize GUI" ); cGUI.close( ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) aborted" ); System.exit( 0 ); return; } catch( CZEPMySQLManagerException e ) { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) CZEPMySQLManagerException: " + e.getMessage( ) + " - could not connect to MySQL" ); cGUI.close( ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) aborted" ); System.exit( 0 ); return; } System.out.println( "-------------------------------------------------------------------------------------------------" ); System.out.println( "| CLASSIFICATION PHASE |" ); System.out.println( "-------------------------------------------------------------------------------------------------" ); //ds as long as the GUI is running while( cGUI.isActive( ) ) { try { //ds avoid 100% cpu Thread.sleep( 100 ); //ds check if we have to classify for the learner if( cLearner.isReadyToClassify( ) ) { //ds do classification cLearner.classify( ); } } catch( InterruptedException e ) { _logMaster( cLearner, cMySQLManager, "<CMain>(main) InterruptedException: " + e.getMessage( ) ); //ds not fatal System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) InterruptedException: " + e.getMessage( ) ); } catch( CZEPEoIException e ) { _logMaster( cLearner, cMySQLManager, "<CMain>(main) CZEPEoIException: " + e.getMessage( ) ); //ds fatal System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) CZEPEoIException: " + e.getMessage( ) ); cGUI.close( ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) aborted" ); System.exit( 0 ); return; } } cGUI.close( ); System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(main) ZEP terminated" ); System.exit( 0 ); return; } //ds MySQL logger private final static void _logMaster( final CLearnerBayes p_cLearner, final CMySQLManager p_cMySQLManager, final String p_strInfo ) { //ds get username and session id final String strUsername = p_cLearner.getUsername( ); final int iSessionID = p_cLearner.getSessionID( ); //ds if set if( null != strUsername ) { try { //ds log p_cMySQLManager.logMaster( strUsername, iSessionID, p_strInfo ); } catch( SQLException e ) { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(_logMaster) SQLException: " + e.getMessage( ) + " could not log to MySQL master" ); } } else { System.out.println( "[" + CLogger.getStamp( ) + "]<CMain>(_logMaster) could not log to master because of empty username" ); } } }
[ "schdomin@gmail.com" ]
schdomin@gmail.com
fa498a3c2ab73df094de05dcc6a6c07d45485ade
7eadb318f378e32fe15b5e357cbd1e63e5f56ecc
/flashlight2.java
7ef01936aaca0808100c8e91b3e985a63cc5eed5
[]
no_license
SimonBroborg/flashlight
680239ba1641a5dde034a91ee4737feb126b0bbf
84d8d92ad2427946a16c623c1118b62874bf884d
refs/heads/master
2020-03-22T13:05:30.749766
2018-07-07T12:30:34
2018-07-07T12:30:34
140,082,631
0
0
null
null
null
null
UTF-8
Java
false
false
5,354
java
import javafx.scene.shape.Line; import java.awt.*; import java.util.ArrayList; public class flashlight2 { private int targetX; private int targetY; private int x; private int y; private ArrayList<Rectangle> rects; public flashlight2(ArrayList<Rectangle> rects) { this.rects = rects; x = 100; y = 100; } public void update() { } public void draw(Graphics2D g2d) { ArrayList intersections = new ArrayList(); Line l1 = new Line(x, y, targetX, targetY); Line l2 = new Line(200, 100, 200, 500); g2d.drawLine((int) l2.getStartX(), (int) l2.getStartY(), (int) l2.getEndX(), (int) l2.getEndY()); Point l1Start = new Point((int) l1.getStartX(), (int) l1.getStartY()); Point l2Start = new Point((int) l2.getStartX(), (int) l2.getStartY()); Point l1End = new Point((int) l1.getEndX(), (int) l1.getEndY()); Point l2End = new Point((int) l2.getEndX(), (int) l2.getEndY()); if (doIntersect(l1Start, l1End, l2Start, l2End) != null) g2d.drawLine(x, y, doIntersect(l1Start, l1End, l2Start, l2End).x, doIntersect(l1Start, l1End, l2Start, l2End).y); else g2d.drawLine(x, y, x+ (int)(200 * Math.cos(Math.toRadians(getAngle(new Point(targetX, targetY))))), y +(int)(200 *Math.sin(Math.toRadians(getAngle(new Point(targetX, targetY)))))); } public double getAngle(Point p) { double angle = Math.toDegrees(Math.atan2(p.getY() - y, p.getX() - x)); return angle; } public boolean onSegment(Point p, Point q, Point r) { if (q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y)) return true; return false; } public float orientation(Point p, Point q, Point r) { // https://www.geeksforgeeks.org/check-if-two-given-line-segments-intersect/ float val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); if (val == 0) return 0; // colinear return (val > 0) ? 1 : 2; // clock or counterclock wise } public Point doIntersect(Point p1, Point q1, Point p2, Point q2) { // Find the four orientations needed for general and // special cases float o1 = orientation(p1, q1, p2); float o2 = orientation(p1, q1, q2); float o3 = orientation(p2, q2, p1); float o4 = orientation(p2, q2, q1); double a1 = q1.y - p1.y; double b1 = p1.x - q1.x; double c1 = a1 * (p1.x) + b1 * (p1.y); // Line CD represented as a2x + b2y = c2 double a2 = q2.y - p2.y; double b2 = p2.x - q2.x; double c2 = a2 * (p2.x) + b2 * (p2.y); double determinant = a1 * b2 - a2 * b1; double x = (b2 * c1 - b1 * c2) / determinant; double y = (a1 * c2 - a2 * c1) / determinant; Point point = new Point((int) x, (int) y); // General case if (o1 != o2 && o3 != o4) return point; // Special Cases // p1, q1 and p2 are colinear and p2 lies on segment p1q1 if (o1 == 0 && onSegment(p1, p2, q1)) return point; // p1, q1 and q2 are colinear and q2 lies on segment p1q1 if (o2 == 0 && onSegment(p1, q2, q1)) return point; // p2, q2 and p1 are colinear and p1 lies on segment p2q2 if (o3 == 0 && onSegment(p2, p1, q2)) return point; // p2, q2 and q1 are colinear and q1 lies on segment p2q2 if (o4 == 0 && onSegment(p2, q1, q2)) return point; return null; // Doesn't fall in any of the above cases } public Point lineLineIntersection(Point A, Point B, Point C, Point D) { // Line AB represented as a1x + b1y = c1 double a1 = B.y - A.y; double b1 = A.x - B.x; double c1 = a1 * (A.x) + b1 * (A.y); // Line CD represented as a2x + b2y = c2 double a2 = D.y - C.y; double b2 = C.x - D.x; double c2 = a2 * (C.x) + b2 * (C.y); double determinant = a1 * b2 - a2 * b1; int la1 = (B.y - A.y) / (B.x - A.x); int lb1 = A.y - la1 * A.x; int la2 = (D.y - C.y) / (D.x - C.x); int lb2 = C.y - la2 * C.x; int x0 = -(lb1 - lb2) / (la1 - la2); if (x0 > Math.min(A.x, B.x) && x0 < Math.max(A.x, B.x) && x0 > Math.min(C.x, D.x) && x0 < Math.max(C.x, D.x)) { System.out.println("="); } if (determinant == 0) { // The lines are parallel. This is simplified // by returning a pair of FLT_MAX return null; } else { double x = (b2 * c1 - b1 * c2) / determinant; double y = (a1 * c2 - a2 * c1) / determinant; return new Point((int) x, (int) y); } } public int getTargetX() { return targetX; } public int getTargetY() { return targetY; } public int getX() { return x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public void setX(int x) { this.x = x; } public void setTargetX(int targetX) { this.targetX = targetX; } public void setTargetY(int targetY) { this.targetY = targetY; } }
[ "kolasasen@gmail.com" ]
kolasasen@gmail.com
9349da195ad39fd44eaaf8baac3cb7ca3eaf2978
f55036fb075bde5bdfa4deb781f1b7a872870a2e
/src/main/java/cs/brown/edu/aelp/commands/KickCommand.java
ab6d2ff361aa7173b0337ddef8fad131ebb38212
[]
no_license
pzhang333/Pokemon-Brown
5e31fd5b2ded81de723618210a4b182a76b7ea40
d29f22a2a8c9c4c471d51566bc596de72ad1e227
refs/heads/master
2020-03-18T00:38:43.919605
2018-05-19T23:58:34
2018-05-19T23:58:34
134,105,308
2
0
null
null
null
null
UTF-8
Java
false
false
1,074
java
package cs.brown.edu.aelp.commands; import cs.brown.edu.aelp.pokemmo.data.authentication.User; import cs.brown.edu.aelp.pokemmo.data.authentication.UserManager; import java.util.Arrays; import java.util.List; public class KickCommand extends Command { public KickCommand() { super("kick", Arrays.asList(Arrays.asList("user_id")), "Kick a player (and remove them from memory, " + "effectively rolling their character back to the previous savepoint).", false, false); } @Override protected void call(List<String> args) { try { int id = Integer.parseInt(args.get(0)); User u = UserManager.getUserById(id); if (u == null) { System.out.printf("ERROR: Unknown user id(%d). Are they offline?\n", id); return; } u.kick(); UserManager.forgetUser(u); System.out.printf("Kicked %s (%d).\n", u.getUsername(), u.getId()); } catch (NumberFormatException e) { System.out .println("ERROR: All inputs must be integers. See 'kick help'."); } } }
[ "louis_kilfoyle@brown.edu" ]
louis_kilfoyle@brown.edu
c965dcaf0829f63b44b28a8bf6200145b77f2af3
01fca965bef744a9d066894ba42e6e75370581a8
/assignment05/flattened/_jtricoz1_assignment05-jtricozzi_BookClub.java
480443126f212eee88133966e8c460133337bd33
[]
no_license
gwint/Grading_Scripts
362a95dea4da093562ddc5e7e3e47dc3b2ce1b15
cb0ce4e6d3b65572f7876d92bee46393df6d3cde
refs/heads/master
2021-06-28T15:32:52.798929
2020-09-05T20:39:05
2020-09-05T20:39:05
146,123,672
0
1
null
2020-03-30T01:41:41
2018-08-25T19:27:27
Java
UTF-8
Java
false
false
888
java
package assignment05; import java.util.HashSet; import java.util.Set; public class BookClub{ private Set<BookClubMember> members = new HashSet<>(); private Set<LeisureBook> readings = new HashSet<>(); public void addMember(BookClubMember bcm) { members.add(bcm); for(LeisureBook b : readings) { bcm.addReading(b); } } public void addNewReading(LeisureBook book) { readings.add(book); for(BookClubMember m : members) { m.addReading(book); } } public double getAveragePercentRead(Book book) { if(members.size() == 0) { return 0.0; }else { double sum = 0; for (BookClubMember m : members) { sum += m.getPercentRead(book); } return (sum / members.size()); } } public double getCompletionPercentage() { double sum = 0; for(Book b : readings) { sum += getAveragePercentRead(b); } return(sum / readings.size()); } }
[ "davedefazio1@gmail.com" ]
davedefazio1@gmail.com
524b6e48445bb3f959ec12284b8a4f66329164f6
5e1476099ba1bf2a316a952d9c589fc6e744baec
/HclLabAssignment2/src/com/lab2/q5/Vehicle.java
961e64ca9aed58880877c2cf0145a4c3a0be54ca
[]
no_license
sravanthi-paruvada/HCL_TRAINING
2f5a048b80e672c44e2cf243e8a7378ea72a62a4
b0fd63b3bf91e6823e22075bd2e9b69a1dc195ca
refs/heads/main
2023-01-23T13:42:56.626965
2020-11-27T09:40:27
2020-11-27T09:40:27
305,773,188
0
1
null
null
null
null
UTF-8
Java
false
false
466
java
package com.lab2.q5; public class Vehicle { int noOfWheels; int noOfPassenger; int model; String make; public Vehicle(int noOfWheels, int noOfPassenger, int model, String make) { this.noOfWheels = noOfWheels; this.noOfPassenger = noOfPassenger; this.model = model; this.make = make; } void display() { System.out.println(" Wheels: "+noOfWheels+ " No of seats: "+noOfWheels+ " model: "+model+ " make "+make); } }
[ "noreply@github.com" ]
noreply@github.com
bf29ad9a0af8d57ad24150357e53343c127cffc4
0316e7cae7d1342bf4d41f3c2c9565dc321a3de4
/mybatis-examples/src/main/java/com/example/mybatisexamples/example05/UserMapper05.java
9fce668bea6d0ec64e6e2d3c257d527b35135e68
[]
no_license
Anni-Gao/Springboot-example-an
45c1446cc292795aff396bd63d873f8c4ac3b89b
e49f58ec0efb88b519d5bd6253cdc4785648c1f7
refs/heads/master
2023-04-21T12:25:46.009797
2021-05-06T02:35:00
2021-05-06T02:35:00
362,733,129
0
0
null
null
null
null
UTF-8
Java
false
false
1,174
java
package com.example.mybatisexamples.example05; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.example.mybatisexamples.entity.User; import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Repository; import java.util.List; @Repository @Mapper public interface UserMapper05 extends BaseMapper<User> { // 不推荐。不如在业务层组合对象 @Results(value = { @Result(column = "id", property = "addresses", javaType = List.class, many = @Many(select = "com.example.mybatisexamples.example05.AddressMapper05.listAddresses")) }) @Select("select * from user where id=#{uid}") UserDTO05 getById(long uid); // ----------------------- @ResultMap("userDTOResultMap") @Select("select u.*, " + "a.id a_id, a.detail a_detail, a.user_id a_user_id, a.create_time a_create_time " + "from user u join address a on u.id=a.user_id " + "where u.id=#{uid}") UserDTO05 getByXML(long uid); // SQL语句映射等,声明在xml里 UserDTO05 getByXML2(long uid); }
[ "1183723408@qq.com" ]
1183723408@qq.com
bd2de6b4b41b3a8c1701e00249939b29877be763
ebcc920fe275f2010f4bffbe25cd42ec8dfae525
/telefonica-jsf-programa/src/com/atrium/hibernate/modelo/Gestion_Roles.java
2e6d9f7d151b31019a5540476f2516491f6b8226
[]
no_license
javiermartinalonso/TestTaxi
5785d88a4660c0585de0241f736b37b5a79d360c
fe98ee9d1b54d783bec15119be917fb71978e114
refs/heads/master
2021-01-13T03:48:05.155937
2016-12-23T11:17:46
2016-12-23T11:17:46
77,216,554
0
0
null
null
null
null
UTF-8
Java
false
false
572
java
package com.atrium.hibernate.modelo; import java.io.Serializable; import java.util.List; import com.atrium.hibernate.Roles; import com.atrium.hibernate.dao.RolesDAO; public class Gestion_Roles implements IGestion_Roles, Serializable { private RolesDAO rol_DAO; @Override public List<Roles> consultar_Todos() { return rol_DAO.findAll(); } public Roles consultar_PorClave(Byte clave_rol) { return rol_DAO.findById(clave_rol); } // ACCESORES PARA SPRING public void setRol_DAO(RolesDAO rol_DAO) { this.rol_DAO = rol_DAO; } }
[ "xavimartin@hotmail.com" ]
xavimartin@hotmail.com
cd20ca9672bfac1c87f4e48528cbc73ee889a02f
180e44eb66fefa3527a88241fc4c242baf8fbf07
/Java_DB/Spring Data/10-XML-Processing/Car dealer/src/main/java/cardealder/config/AppBeanConfig.java
54c2139a6dfc4061a4fccb58ae19c04b2bf4118d
[]
no_license
rumenrashev/SoftUni
b60f2e08e677eb776d8ea74707ff2a6ee5cd467f
41225d41f20db26cbf2c6f0884976bdd93367441
refs/heads/master
2023-01-23T17:57:53.969487
2020-11-25T10:49:53
2020-11-25T10:49:53
294,444,219
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
package cardealder.config; import cardealder.util.api.XmlParser; import cardealder.util.impl.XmlParserImpl; import org.modelmapper.ModelMapper; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class AppBeanConfig { @Bean public ModelMapper modelMapper(){ return new ModelMapper(); } @Bean public XmlParser xmlParser(){ return new XmlParserImpl(); } }
[ "57558028+rumenrashev@users.noreply.github.com" ]
57558028+rumenrashev@users.noreply.github.com
06b101a98a95f20c781bd90955b4bc6efaa7aafa
37a4a4f21f6a948de85be3acd462bdc4ffded735
/Kattis Solutions/different.java
dc30002c1e3762c5c469f0ba3fbb6a26b2ac1206
[]
no_license
shawnhatchwell/Competitive-Programming
86dc8e242edf180685addc97b0ef35d792472bdc
e0e3caf0b18a36da589fa888efb037dde3c60f23
refs/heads/master
2021-07-10T20:04:45.325918
2020-07-01T03:49:14
2020-07-01T03:49:14
162,651,441
0
0
null
null
null
null
UTF-8
Java
false
false
575
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class different { public static void main(String[] args) throws IOException { BufferedReader f=new BufferedReader(new InputStreamReader(System.in)); while(true){ StringTokenizer tk=new StringTokenizer(f.readLine().trim()); long a=Long.parseLong(tk.nextToken()); long b=Long.parseLong(tk.nextToken()); if(a>b){ System.out.println(a-b); } else{ System.out.println(b-a); } } } }
[ "noreply@github.com" ]
noreply@github.com
5d8704c2359ed911b9e00800d5fe53354c4fa4cb
81b410c035cee6d3a29d63e879bc71aab32380c6
/src/com/yi/model/Movie.java
c6597ab97f19ffa702a083e6b2538834dc85b93a
[]
no_license
hotdog1247/movie_Exam
5e4897041b9b252fe314c363426c35ba3a3eb615
7a9b79345fbbcad4821b0f4cbe570af100d9599c
refs/heads/master
2021-05-19T03:41:18.965178
2020-03-31T06:05:08
2020-03-31T06:05:08
251,512,820
0
0
null
null
null
null
UTF-8
Java
false
false
1,425
java
package com.yi.model; public class Movie { private int mNo; private String mName; private String mContent; private String mImg; private String mTime; public Movie() { super(); // TODO Auto-generated constructor stub } public Movie(int mNo) { super(); this.mNo = mNo; } public Movie(int mNo, String mName, String mTime) { this.mNo = mNo; this.mName = mName; this.mTime = mTime; } public Movie(int mNo, String mName, String mContent, String mImg, String mTime) { super(); this.mNo = mNo; this.mName = mName; this.mContent = mContent; this.mImg = mImg; this.mTime = mTime; } public int getmNo() { return mNo; } public void setmNo(int mNo) { this.mNo = mNo; } public String getmName() { return mName; } public void setmName(String mName) { this.mName = mName; } public String getmContent() { return mContent; } public void setmContent(String mContent) { this.mContent = mContent; } public String getmImg() { return mImg; } public void setmImg(String mImg) { this.mImg = mImg; } public String getmTime() { return mTime; } public void setmTime(String mTime) { this.mTime = mTime; } @Override public String toString() { return "Movie [mNo=" + mNo + ", mName=" + mName + ", mContent=" + mContent + ", mImg=" + mImg + ", mTime=" + mTime + "]"; } }
[ "ku0788@yahoo.com" ]
ku0788@yahoo.com
1b8715e42f72a435788d1a355d20ec9f4ded6fd8
8ccd9f38a82edcc9098db9e70f76cf73796c12fd
/src/main/java/Solution35.java
8d4f8929670481414c38aedb0d4a92855188d31e
[]
no_license
wxq-rww/gitIDEtest
759ab583602880aab8b671554176f1b99134484c
2d3aaef101adeb6e81e0629581211ac5a52a6843
refs/heads/master
2023-03-13T04:41:08.796245
2021-02-26T03:23:15
2021-02-26T03:23:15
342,442,440
0
0
null
null
null
null
UTF-8
Java
false
false
773
java
public class Solution35 { public int searchInsert1(int[] nums, int target) { if (nums==null||nums.length==0){ return 0; } for (int i = 0; i <nums.length ; i++) { if (nums[i]>=target){ return i; } } return nums.length; } public int searchInsert2(int[] nums, int target) { if (nums==null||nums.length==0){ return 0; } int left=0; int right=nums.length-1; while (left<right){ int mid=left+(right-left)/2; if (nums[mid]==target){ return mid; }else if (nums[mid]>target){ right=mid; }else { left=mid+1; } } return nums[left]<target?left+1:left; } }
[ "844284339@qq.com" ]
844284339@qq.com
12dcf779f8385e19b8ae06b158563feef4e6bc26
ab6915f4f6835864cb65ad0951bd577a4b6b7c8f
/TestTask_NetCracker/src/main/java/su/vistar/testtask_netcracker/dto/TableDto.java
a2f494838a4c06cd572635a9b95c3710ea33431d
[]
no_license
lDanlte/TestTask_NetCracker
1b4e0ee809206c605974279a2d94a884fde4968e
dfdf3d2c3135774df5f98784c33aca0f2071bebb
refs/heads/master
2022-12-24T21:19:57.546754
2016-07-04T11:19:49
2016-07-04T11:19:49
62,556,450
0
0
null
2022-12-16T06:47:47
2016-07-04T11:15:30
Java
UTF-8
Java
false
false
835
java
package su.vistar.testtask_netcracker.dto; import com.fasterxml.jackson.annotation.JsonProperty; /** * * @author dantonov */ public class TableDto { @JsonProperty("id") private Integer id; @JsonProperty("name") private String name; @JsonProperty("desc") private String desc; public TableDto() { } public TableDto(Integer id, String name, String desc) { this.id = id; this.name = name; this.desc = desc; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } }
[ "dantonov@vistar.su" ]
dantonov@vistar.su
fea6deefddf586cfaed6127c332972848d48e1f6
5210e28e636562834a98ea820be00bcbf3aae5eb
/src/main/java/com/teammetallurgy/aquaculture/client/renderer/tileentity/NeptunesBountyRenderer.java
7eeac988e358bbc8c146a2d780b1e0d1a5012ee9
[]
no_license
farsdewibs0n/Aquaculture
fde1e5acbb0c4841d962c19a2d15ded017a588ca
b76eedeb10c2065a9cddc4f8447056997b0b3bd3
refs/heads/master
2023-08-21T23:59:19.555213
2021-10-22T21:09:21
2021-10-22T21:09:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,755
java
package com.teammetallurgy.aquaculture.client.renderer.tileentity; import com.teammetallurgy.aquaculture.Aquaculture; import com.teammetallurgy.aquaculture.block.tileentity.NeptunesBountyTileEntity; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.blockentity.ChestRenderer; import net.minecraft.client.resources.model.Material; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.state.properties.ChestType; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import javax.annotation.Nonnull; @Mod.EventBusSubscriber(modid = Aquaculture.MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD) public class NeptunesBountyRenderer extends ChestRenderer<NeptunesBountyTileEntity> { public static NeptunesBountyRenderer instance; private static final ResourceLocation NEPTUNES_BOUNTY = new ResourceLocation(Aquaculture.MOD_ID, "entity/tileentity/neptunes_bounty"); public NeptunesBountyRenderer(BlockEntityRendererProvider.Context context) { super(context); instance = this; } @Override @Nonnull protected Material getMaterial(@Nonnull NeptunesBountyTileEntity tileEntity, @Nonnull ChestType chestType) { return new Material(Sheets.CHEST_SHEET, NEPTUNES_BOUNTY); } @SubscribeEvent public static void onTextureStitch(TextureStitchEvent.Pre event) { if (event.getMap().location().equals(Sheets.CHEST_SHEET)) { event.addSprite(NEPTUNES_BOUNTY); } } }
[ "faj10@msn.com" ]
faj10@msn.com
ca8c2cf19a92c12371577c82457c7df8cd2d38f8
986bd73a63265cf6ddaace69087a3870748a56e6
/app/src/main/java/com/example/xuan/designmode/factory/Factory/AaPizza.java
c9f46e2de1641297d6589e355f4e3d086bf0a0d3
[]
no_license
DrownCoder/DesignMode
95f4843ad2f20b8fcd90d0f435a492633e1926fb
a71327c8ba47c63e52831bc9cdbcdb93169f4928
refs/heads/master
2021-07-14T03:30:41.608919
2017-10-18T11:40:08
2017-10-18T11:40:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
248
java
package com.example.xuan.designmode.factory.Factory; /** * Author : xuan. * Data : 2017/8/15. * Description :input the description of this file. */ public class AaPizza extends Pizza { public AaPizza() { desc = "AaPizza"; } }
[ "2994734692@qq.com" ]
2994734692@qq.com
c25e9909d12a276837106ac2f307dbf801bb9477
1e8b583e919c7ac639c36bbfa46a810511b0a0a3
/app/src/test/java/com/example/receiversms/ExampleUnitTest.java
b15aca381d085976fac754d7eed4e3e8cefdf01e
[]
no_license
IurgiGarmendia/ReceiverSMS
b8fca19317fc81a7636b71f6c7bdcab4af8ed4cc
e3827601479805f74b90c745b28dbfd890afd78b
refs/heads/master
2021-01-17T16:12:10.274798
2017-06-26T17:11:16
2017-06-26T17:11:16
95,470,203
0
0
null
null
null
null
UTF-8
Java
false
false
401
java
package com.example.receiversms; 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); } }
[ "Iurgi1@gmail.com" ]
Iurgi1@gmail.com
78b7fc6de9e9555622ca2b87d20c81b1ecbf917a
08ef6e4fc9504fb6e975ad1824bb50769546bd0e
/src/main/java/com/foxminded/university/domain/Lecture.java
2181640000ba4d42ca9ec6fd7f19993c3425bd92
[]
no_license
s3ld0n/University-Management-App
4965329df6a99a13214fad623d1622c0ee14e438
77d89d29b501f3d46a71bcf6f668d96d089de575
refs/heads/master
2021-10-27T19:35:56.409089
2019-04-04T17:13:42
2019-04-04T17:13:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,240
java
package com.foxminded.university.domain; import java.io.Serializable; import com.foxminded.university.utils.Period; public class Lecture implements Serializable { private int id; private Period period; private Subject subject; private Lector lector; private Group group; private LectureHall lectureHall; public Lecture() { } public Lecture(int id, Period period, Subject subject, Lector lector, Group group, LectureHall lectureHall) { this.id = id; this.period = period; this.subject = subject; this.lector = lector; this.group = group; this.lectureHall = lectureHall; } public int getId() { return id; } public void setId(int id) { this.id = id; } public Period getPeriod() { return period; } public void setPeriod(Period period) { this.period = period; } public Subject getSubject() { return subject; } public void setSubject(Subject subject) { this.subject = subject; } public Lector getLector() { return lector; } public void setLector(Lector lector) { this.lector = lector; } public Group getGroup() { return group; } public void setGroup(Group group) { this.group = group; } public LectureHall getLectureHall() { return lectureHall; } public void setLectureHall(LectureHall lectureHall) { this.lectureHall = lectureHall; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + id; return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Lecture other = (Lecture) obj; if (id != other.id) return false; return true; } @Override public String toString() { return "Lecture [id=" + id + ", period=" + period + ", subject=" + subject + ", lector=" + lector + ", group=" + group + "]"; } }
[ "ashavrn@protonmail.com" ]
ashavrn@protonmail.com
58ab69f5fdf419593d645767c5773f76b65919a3
6f5e0155fd459ea7d8e7fccf64a9b85048f7b5eb
/ProjectDAO-07-MapOperations_subclasses/src/main/java/kcp/spring/dao/PlayerListDAOImpl.java
3136e44def30c2a9bcb4e4ed59518f812e301ad1
[]
no_license
kalia1506/springDAO
ddc5f96369b9ec7b666bb8ebe2acf387351c6be4
71e56199b15f5eda411f38c865d942360cb13375
refs/heads/master
2022-06-24T15:52:01.057479
2020-04-11T18:22:44
2020-04-11T18:22:44
254,928,365
0
0
null
2022-06-21T03:11:42
2020-04-11T18:18:43
Java
UTF-8
Java
false
false
3,352
java
package kcp.spring.dao; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; import java.util.List; import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.SqlParameter; import org.springframework.jdbc.object.MappingSqlQuery; import org.springframework.jdbc.object.SqlUpdate; import org.springframework.stereotype.Repository; import kcp.spring.bo.PlayerListBO; import kcp.spring.jdbcQuerys.JdbcQuerys; @Repository("playerDAO") public class PlayerListDAOImpl implements PlayerListDAO { private PlayerListSelecter selecter; private PlayerlistselecterByType selecter1; private PlayerListHikeSalByType selecter2; @Autowired private DataSource ds; public PlayerListDAOImpl(DataSource ds) { selecter = new PlayerListSelecter(ds, JdbcQuerys.playerNamebyId); selecter1 = new PlayerlistselecterByType(ds, JdbcQuerys.PlayerListByType); selecter2 = new PlayerListHikeSalByType(ds, JdbcQuerys.PlayerListhikeSalByType); this.ds = ds; } @Override public PlayerListBO getPlayerNameBYid(int pid) { return selecter.findObject(pid); } @Override public List<PlayerListBO> getPlayerListByType(String type1, String type2) { return selecter1.execute(type1, type2); } @Override public int hikeSalaryByType(String type2, double addSal) { return selecter2.update(addSal, type2); } //inner classes public class PlayerListSelecter extends MappingSqlQuery<PlayerListBO> { public PlayerListSelecter(DataSource ds, String playernamebyid) { super(ds, playernamebyid); super.declareParameter(new SqlParameter(Types.INTEGER)); super.compile(); } @Override public PlayerListBO mapRow(ResultSet rs, int rowNum) throws SQLException { PlayerListBO bo = null; bo = new PlayerListBO(); bo.setPid(Integer.parseInt(rs.getString(1))); bo.setPlayerName(rs.getString(2)); bo.setPlayer_type(rs.getString(3)); bo.setCountry(rs.getString(4)); bo.setSalary(Integer.parseInt(rs.getString(5))); bo.setGrade(rs.getString(6)); return bo; } } public class PlayerlistselecterByType extends MappingSqlQuery<PlayerListBO> { public PlayerlistselecterByType(DataSource ds, String playerlistbytype) { super(ds, playerlistbytype); super.declareParameter(new SqlParameter(Types.VARCHAR)); super.declareParameter(new SqlParameter(Types.VARCHAR)); super.compile(); } @Override protected PlayerListBO mapRow(ResultSet rs, int rowNum) throws SQLException { PlayerListBO bo = null; bo = new PlayerListBO(); // bo.setPid(rs.getInt(1)); bo.setPid(Integer.parseInt(rs.getString(1))); bo.setPlayerName(rs.getString(2)); bo.setPlayer_type(rs.getString(3)); bo.setCountry(rs.getString(4)); bo.setSalary(Integer.parseInt(rs.getString(5))); bo.setGrade(rs.getString(6)); return bo; } } private class PlayerListHikeSalByType extends SqlUpdate { public PlayerListHikeSalByType(DataSource ds, String playerlisthikesalbytype) { super(ds, playerlisthikesalbytype); System.out.println(playerlisthikesalbytype); super.declareParameter(new SqlParameter(Types.VARCHAR)); super.declareParameter(new SqlParameter(Types.VARCHAR)); super.declareParameter(new SqlParameter(Types.DOUBLE)); super.compile(); } } }
[ "56771744+Kalia1110@users.noreply.github.com" ]
56771744+Kalia1110@users.noreply.github.com
ff6a2febf7475a4f8246c43a30c0b296b4c69241
21a3d38a933565f9fe43c75f244009142eb2aa1f
/common/src/main/java/common/utils/utils/screenrecorder/MicRecorder.java
46877f90c0f2a2db84de6205f2a4e22207890879
[]
no_license
lnkywd/CommonUtils
da62b0cb2445dbc45c6ba022eb31477a5b376ce1
20d21170b9f3dbec5ac9a74453a36d5dfcfb68e6
refs/heads/master
2021-07-12T01:59:16.196781
2020-05-26T15:34:55
2020-05-26T15:34:55
130,184,553
0
0
null
null
null
null
UTF-8
Java
false
false
14,070
java
/* * Copyright (c) 2017 Yrom Wang <http://www.yrom.net> * * 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 common.utils.utils.screenrecorder; import android.annotation.TargetApi; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaCodec; import android.media.MediaFormat; import android.media.MediaRecorder; import android.os.Build; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import android.os.SystemClock; import android.util.Log; import android.util.SparseLongArray; import java.io.IOException; import java.nio.ByteBuffer; import java.util.LinkedList; import java.util.Locale; import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; import static android.media.MediaCodec.BUFFER_FLAG_END_OF_STREAM; import static android.media.MediaCodec.BUFFER_FLAG_KEY_FRAME; import static android.media.MediaCodec.INFO_OUTPUT_FORMAT_CHANGED; import static android.os.Build.VERSION_CODES.N; /** * @author yrom * @version 2017/12/4 */ @TargetApi(Build.VERSION_CODES.LOLLIPOP) class MicRecorder implements Encoder { private static final String TAG = "MicRecorder"; private static final boolean VERBOSE = false; private static final int MSG_PREPARE = 0; private static final int MSG_FEED_INPUT = 1; private static final int MSG_DRAIN_OUTPUT = 2; private static final int MSG_RELEASE_OUTPUT = 3; private static final int MSG_STOP = 4; private static final int MSG_RELEASE = 5; private static final int LAST_FRAME_ID = -1; private final AudioEncoder mEncoder; private final HandlerThread mRecordThread; private RecordHandler mRecordHandler; private AudioRecord mMic; // access in mRecordThread only! private int mSampleRate; private int mChannelConfig; private int mFormat = AudioFormat.ENCODING_PCM_16BIT; private AtomicBoolean mForceStop = new AtomicBoolean(false); private BaseEncoder.Callback mCallback; private CallbackDelegate mCallbackDelegate; private int mChannelsSampleRate; private SparseLongArray mFramesUsCache = new SparseLongArray(2); MicRecorder(AudioEncodeConfig config) { mEncoder = new AudioEncoder(config); mSampleRate = config.sampleRate; mChannelsSampleRate = mSampleRate * config.channelCount; if (VERBOSE) Log.i(TAG, "in bitrate " + mChannelsSampleRate * 16 /* PCM_16BIT*/); mChannelConfig = config.channelCount == 2 ? AudioFormat.CHANNEL_IN_STEREO : AudioFormat.CHANNEL_IN_MONO; mRecordThread = new HandlerThread(TAG); } private static AudioRecord createAudioRecord(int sampleRateInHz, int channelConfig, int audioFormat) { int minBytes = AudioRecord.getMinBufferSize(sampleRateInHz, channelConfig, audioFormat); if (minBytes <= 0) { Log.e(TAG, String.format(Locale.US, "Bad arguments: getMinBufferSize(%d, %d, %d)", sampleRateInHz, channelConfig, audioFormat)); return null; } AudioRecord record = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRateInHz, channelConfig, audioFormat, minBytes * 2); if (record.getState() == AudioRecord.STATE_UNINITIALIZED) { Log.e(TAG, String.format(Locale.US, "Bad arguments to new AudioRecord %d, %d, %d", sampleRateInHz, channelConfig, audioFormat)); return null; } if (VERBOSE) { Log.i(TAG, "created AudioRecord " + record + ", MinBufferSize= " + minBytes); if (Build.VERSION.SDK_INT >= N) { Log.d(TAG, " size in frame " + record.getBufferSizeInFrames()); } } return record; } public void setCallback(BaseEncoder.Callback callback) { this.mCallback = callback; } @Override public void prepare() throws IOException { Looper myLooper = Objects.requireNonNull(Looper.myLooper(), "Should prepare in HandlerThread"); // run callback in caller thread mCallbackDelegate = new CallbackDelegate(myLooper, mCallback); mRecordThread.start(); mRecordHandler = new RecordHandler(mRecordThread.getLooper()); mRecordHandler.sendEmptyMessage(MSG_PREPARE); } @Override public void stop() { // clear callback queue mCallbackDelegate.removeCallbacksAndMessages(null); mForceStop.set(true); if (mRecordHandler != null) mRecordHandler.sendEmptyMessage(MSG_STOP); } @Override public void release() { if (mRecordHandler != null) mRecordHandler.sendEmptyMessage(MSG_RELEASE); mRecordThread.quitSafely(); } @Override public void setCallback(Callback callback) { this.mCallback = (BaseEncoder.Callback) callback; } void releaseOutputBuffer(int index) { if (VERBOSE) Log.d(TAG, "audio encoder released output buffer index=" + index); Message.obtain(mRecordHandler, MSG_RELEASE_OUTPUT, index, 0).sendToTarget(); } ByteBuffer getOutputBuffer(int index) { return mEncoder.getOutputBuffer(index); } /** * NOTE: Should waiting all output buffer disappear queue input buffer */ private void feedAudioEncoder(int index) { if (index < 0 || mForceStop.get()) return; final AudioRecord r = Objects.requireNonNull(mMic, "maybe release"); final boolean eos = r.getRecordingState() == AudioRecord.RECORDSTATE_STOPPED; final ByteBuffer frame = mEncoder.getInputBuffer(index); int offset = frame.position(); int limit = frame.limit(); int read = 0; if (!eos) { read = r.read(frame, limit); if (VERBOSE) Log.d(TAG, "Read frame data size " + read + " for index " + index + " buffer : " + offset + ", " + limit); if (read < 0) { read = 0; } } long pstTs = calculateFrameTimestamp(read << 3); int flags = BUFFER_FLAG_KEY_FRAME; if (eos) { flags = BUFFER_FLAG_END_OF_STREAM; } // feed frame to encoder if (VERBOSE) Log.d(TAG, "Feed codec index=" + index + ", presentationTimeUs=" + pstTs + ", flags=" + flags); mEncoder.queueInputBuffer(index, offset, read, pstTs, flags); } /** * Gets presentation time (us) of polled frame. * 1 sample = 16 bit */ private long calculateFrameTimestamp(int totalBits) { int samples = totalBits >> 4; long frameUs = mFramesUsCache.get(samples, -1); if (frameUs == -1) { frameUs = samples * 1000_000 / mChannelsSampleRate; mFramesUsCache.put(samples, frameUs); } long timeUs = SystemClock.elapsedRealtimeNanos() / 1000; // accounts the delay of polling the audio sample data timeUs -= frameUs; long currentUs; long lastFrameUs = mFramesUsCache.get(LAST_FRAME_ID, -1); if (lastFrameUs == -1) { // it's the first frame currentUs = timeUs; } else { currentUs = lastFrameUs; } if (VERBOSE) Log.i(TAG, "count samples pts: " + currentUs + ", time pts: " + timeUs + ", samples: " + samples); // maybe too late to acquire sample data if (timeUs - currentUs >= (frameUs << 1)) { // reset currentUs = timeUs; } mFramesUsCache.put(LAST_FRAME_ID, currentUs + frameUs); return currentUs; } private static class CallbackDelegate extends Handler { private BaseEncoder.Callback mCallback; CallbackDelegate(Looper l, BaseEncoder.Callback callback) { super(l); this.mCallback = callback; } void onError(final Encoder encoder, final Exception exception) { Message.obtain(this, new Runnable() { @Override public void run() { if (mCallback != null) { mCallback.onError(encoder, exception); } } }).sendToTarget(); } void onOutputFormatChanged(final BaseEncoder encoder, final MediaFormat format) { Message.obtain(this, new Runnable() { @Override public void run() { if (mCallback != null) { mCallback.onOutputFormatChanged(encoder, format); } } }).sendToTarget(); } void onOutputBufferAvailable(final BaseEncoder encoder, final int index, final MediaCodec.BufferInfo info) { Message.obtain(this, new Runnable() { @Override public void run() { if (mCallback != null) { mCallback.onOutputBufferAvailable(encoder, index, info); } } }).sendToTarget(); } } private class RecordHandler extends Handler { private LinkedList<MediaCodec.BufferInfo> mCachedInfos = new LinkedList<>(); private LinkedList<Integer> mMuxingOutputBufferIndices = new LinkedList<>(); private int mPollRate = 2048_000 / mSampleRate; // poll per 2048 samples RecordHandler(Looper l) { super(l); } @Override public void handleMessage(Message msg) { switch (msg.what) { case MSG_PREPARE: AudioRecord r = createAudioRecord(mSampleRate, mChannelConfig, mFormat); if (r == null) { Log.e(TAG, "create audio record failure"); mCallbackDelegate.onError(MicRecorder.this, new IllegalArgumentException()); break; } else { r.startRecording(); mMic = r; } try { mEncoder.prepare(); } catch (Exception e) { mCallbackDelegate.onError(MicRecorder.this, e); break; } case MSG_FEED_INPUT: if (!mForceStop.get()) { int index = pollInput(); if (VERBOSE) Log.d(TAG, "audio encoder returned input buffer index=" + index); if (index >= 0) { feedAudioEncoder(index); // tell encoder to eat the fresh meat! if (!mForceStop.get()) sendEmptyMessage(MSG_DRAIN_OUTPUT); } else { // try later... if (VERBOSE) Log.i(TAG, "try later to poll input buffer"); sendEmptyMessageDelayed(MSG_FEED_INPUT, mPollRate); } } break; case MSG_DRAIN_OUTPUT: offerOutput(); pollInputIfNeed(); break; case MSG_RELEASE_OUTPUT: mEncoder.releaseOutputBuffer(msg.arg1); mMuxingOutputBufferIndices.poll(); // Nobody care what it exactly is. if (VERBOSE) Log.d(TAG, "audio encoder released output buffer index=" + msg.arg1 + ", remaining=" + mMuxingOutputBufferIndices.size()); pollInputIfNeed(); break; case MSG_STOP: if (mMic != null) { mMic.stop(); } mEncoder.stop(); break; case MSG_RELEASE: if (mMic != null) { mMic.release(); mMic = null; } mEncoder.release(); break; default: } } private int pollInput() { return mEncoder.getEncoder().dequeueInputBuffer(0); } private void offerOutput() { while (!mForceStop.get()) { MediaCodec.BufferInfo info = mCachedInfos.poll(); if (info == null) { info = new MediaCodec.BufferInfo(); } int index = mEncoder.getEncoder().dequeueOutputBuffer(info, 1); if (VERBOSE) Log.d(TAG, "audio encoder returned output buffer index=" + index); if (index == INFO_OUTPUT_FORMAT_CHANGED) { mCallbackDelegate.onOutputFormatChanged(mEncoder, mEncoder.getEncoder().getOutputFormat()); } if (index < 0) { info.set(0, 0, 0, 0); mCachedInfos.offer(info); break; } mMuxingOutputBufferIndices.offer(index); mCallbackDelegate.onOutputBufferAvailable(mEncoder, index, info); } } private void pollInputIfNeed() { if (mMuxingOutputBufferIndices.size() <= 1 && !mForceStop.get()) { // need fresh data, right now! removeMessages(MSG_FEED_INPUT); sendEmptyMessageDelayed(MSG_FEED_INPUT, 0); } } } }
[ "18842602830@163.com" ]
18842602830@163.com
f066b7c4080fa8c6d8598c7634a00405434eb60c
9890aad26394ed7700906bbf4bb805119b971fc4
/medialibrary/src/main/java/com/cgfay/media/recorder/VideoRecorder.java
5ed8c33d2d91d6fdef2f9a78a1e992e6af67232d
[]
no_license
Uenchi/StitchesCamera
551161b8ece309c35bd8df2f256fcb1e980a1b32
1813df8bb24c8850d52b310600c86804206ff60e
refs/heads/master
2023-04-01T03:10:03.839197
2021-04-12T06:35:35
2021-04-12T06:35:35
357,048,621
8
4
null
null
null
null
UTF-8
Java
false
false
10,362
java
package com.cgfay.media.recorder; import android.os.Handler; import android.os.Looper; import android.os.Message; import androidx.annotation.NonNull; import android.util.Log; import com.cgfay.filter.gles.EglCore; import com.cgfay.filter.gles.WindowSurface; import com.cgfay.filter.glfilter.base.GLImageFilter; import com.cgfay.filter.glfilter.utils.OpenGLUtils; import com.cgfay.filter.glfilter.utils.TextureRotationUtils; import java.io.IOException; import java.lang.ref.WeakReference; import java.nio.FloatBuffer; /** * 视频录制器 * @author CainHuang * @date 2019/6/30 */ public final class VideoRecorder implements Runnable, VideoEncoder.OnEncodingListener { private static final String TAG = "VideoRecorder"; private static final boolean VERBOSE = true; // 开始录制 private static final int MSG_START_RECORDING = 0; // 停止录制 private static final int MSG_STOP_RECORDING = 1; // 录制帧可用 private static final int MSG_FRAME_AVAILABLE = 2; // 退出录制 private static final int MSG_QUIT = 3; // 录制用的OpenGL上下文和EGLSurface private WindowSurface mInputWindowSurface; private EglCore mEglCore; private GLImageFilter mImageFilter; private FloatBuffer mVertexBuffer; private FloatBuffer mTextureBuffer; // 视频编码器 private VideoEncoder mVideoEncoder; // 录制Handler; private volatile RecordHandler mHandler; // 录制状态锁 private final Object mReadyFence = new Object(); private boolean mReady; private boolean mRunning; // 录制监听器 private OnRecordListener mRecordListener; // 倍速录制索引你 private int mDrawFrameIndex; // 绘制帧索引,用于表示预览的渲染次数,用于大于1.0倍速录制的丢帧操作 private long mFirstTime; // 录制开始的时间,方便开始录制 /** * 设置录制监听器 * @param listener */ public void setOnRecordListener(OnRecordListener listener) { mRecordListener = listener; } /** * 开始录制 * @param params 录制参数 */ public void startRecord(VideoParams params) { if (VERBOSE) { Log.d(TAG, "VideoRecorder: startRecord()"); } synchronized (mReadyFence) { if (mRunning) { Log.w(TAG, "VideoRecorder thread already running"); return; } mRunning = true; new Thread(this, "VideoRecorder").start(); while (!mReady) { try { mReadyFence.wait(); } catch (InterruptedException ie) { // ignore } } } mDrawFrameIndex = 0; mFirstTime = -1; mHandler.sendMessage(mHandler.obtainMessage(MSG_START_RECORDING, params)); } /** * 停止录制 */ public void stopRecord() { if (mHandler != null) { mHandler.sendMessage(mHandler.obtainMessage(MSG_STOP_RECORDING)); mHandler.sendMessage(mHandler.obtainMessage(MSG_QUIT)); } } /** * 释放所有资源 */ public void release() { if (mHandler != null) { mHandler.sendMessage(mHandler.obtainMessage(MSG_QUIT)); } } /** * 判断是否正在录制 * @return */ public boolean isRecording() { synchronized (mReadyFence) { return mRunning; } } /** * 录制帧可用状态 * @param texture * @param timestamp */ public void frameAvailable(int texture, long timestamp) { synchronized (mReadyFence) { if (!mReady) { return; } } // 时间戳为0时,不可用 if (timestamp == 0) { return; } if (mHandler != null) { mHandler.sendMessage(mHandler.obtainMessage(MSG_FRAME_AVAILABLE, (int) (timestamp >> 32), (int) timestamp, texture)); } } // 编码回调 @Override public void onEncoding(long duration) { if (mRecordListener != null) { mRecordListener.onRecording(MediaType.VIDEO, duration); } } @Override public void run() { Looper.prepare(); synchronized (mReadyFence) { mHandler = new RecordHandler(this); mReady = true; mReadyFence.notify(); } Looper.loop(); Log.d(TAG, "Video record thread exiting"); synchronized (mReadyFence) { mReady = mRunning = false; mHandler = null; } } /** * 录制Handler */ private static class RecordHandler extends Handler { private WeakReference<VideoRecorder> mWeakRecorder; public RecordHandler(VideoRecorder encoder) { mWeakRecorder = new WeakReference<VideoRecorder>(encoder); } @Override public void handleMessage(Message inputMessage) { int what = inputMessage.what; Object obj = inputMessage.obj; VideoRecorder encoder = mWeakRecorder.get(); if (encoder == null) { Log.w(TAG, "RecordHandler.handleMessage: encoder is null"); return; } switch (what) { case MSG_START_RECORDING: { encoder.onStartRecord((VideoParams) obj); break; } case MSG_STOP_RECORDING: { encoder.onStopRecord(); break; } case MSG_FRAME_AVAILABLE: { long timestamp = (((long) inputMessage.arg1) << 32) | (((long) inputMessage.arg2) & 0xffffffffL); encoder.onRecordFrameAvailable((int)obj, timestamp); break; } case MSG_QUIT: { Looper.myLooper().quit(); break; } default: throw new RuntimeException("Unhandled msg what=" + what); } } } /** * 开始录制 * @param params */ private void onStartRecord(@NonNull VideoParams params) { if (VERBOSE) { Log.d(TAG, "onStartRecord " + params); } mVertexBuffer = OpenGLUtils.createFloatBuffer(TextureRotationUtils.CubeVertices); mTextureBuffer = OpenGLUtils.createFloatBuffer(TextureRotationUtils.TextureVertices); try { mVideoEncoder = new VideoEncoder(params, this); } catch (IOException ioe) { throw new RuntimeException(ioe); } // 创建EGL上下文和Surface mEglCore = new EglCore(params.getEglContext(), EglCore.FLAG_RECORDABLE); mInputWindowSurface = new WindowSurface(mEglCore, mVideoEncoder.getInputSurface(), true); mInputWindowSurface.makeCurrent(); // 创建录制用的滤镜 mImageFilter = new GLImageFilter(null); mImageFilter.onInputSizeChanged(params.getVideoWidth(), params.getVideoHeight()); mImageFilter.onDisplaySizeChanged(params.getVideoWidth(), params.getVideoHeight()); // 录制开始回调 if (mRecordListener != null) { mRecordListener.onRecordStart(MediaType.VIDEO); } } /** * 停止录制 */ private void onStopRecord() { if (mVideoEncoder == null) { return; } if (VERBOSE) { Log.d(TAG, "onStopRecord"); } mVideoEncoder.drainEncoder(true); mVideoEncoder.release(); if (mImageFilter != null) { mImageFilter.release(); mImageFilter = null; } if (mInputWindowSurface != null) { mInputWindowSurface.release(); mInputWindowSurface = null; } if (mEglCore != null) { mEglCore.release(); mEglCore = null; } // 录制完成回调 if (mRecordListener != null) { mRecordListener.onRecordFinish(new RecordInfo(mVideoEncoder.getVideoParams().getVideoPath(), mVideoEncoder.getDuration(), MediaType.VIDEO)); } mVideoEncoder = null; } /** * 录制帧可用 * @param texture * @param timestampNanos */ private void onRecordFrameAvailable(int texture, long timestampNanos) { if (VERBOSE) { Log.d(TAG, "onRecordFrameAvailable"); } if (mVideoEncoder == null) { return; } SpeedMode mode = mVideoEncoder.getVideoParams().getSpeedMode(); // 快速录制的时候,需要做丢帧处理 if (mode == SpeedMode.MODE_FAST || mode == SpeedMode.MODE_EXTRA_FAST) { int interval = 2; if (mode == SpeedMode.MODE_EXTRA_FAST) { interval = 3; } if (mDrawFrameIndex % interval == 0) { drawFrame(texture, timestampNanos); } } else { drawFrame(texture, timestampNanos); } mDrawFrameIndex++; } /** * 绘制编码一帧数据 * @param texture * @param timestampNanos */ private void drawFrame(int texture, long timestampNanos) { mInputWindowSurface.makeCurrent(); mImageFilter.drawFrame(texture, mVertexBuffer, mTextureBuffer); mInputWindowSurface.setPresentationTime(getPTS(timestampNanos)); mInputWindowSurface.swapBuffers(); mVideoEncoder.drainEncoder(false); } /** * 计算时间戳 * @return */ private long getPTS(long timestampNanos) { SpeedMode mode = mVideoEncoder.getVideoParams().getSpeedMode(); if (mode == SpeedMode.MODE_NORMAL) { // 正常录制的时候,使用SurfaceTexture传递过来的时间戳 return timestampNanos; } else { // 倍速状态下,需要根据帧间间隔来算实际的时间戳 long time = System.nanoTime(); if (mFirstTime <= 0) { mFirstTime = time; } return (long) (mFirstTime + (time - mFirstTime) / mode.getSpeed()); } } }
[ "ondecember8@163.com" ]
ondecember8@163.com
a34d58a142cb5c0ab3a8530cfbaa1f0724591ded
d6a3787f522a4c1150a6e3cf66c8a8301c607a72
/build/web/WEB-INF/lib/build/web/WEB-INF/lib/build/web/WEB-INF/lib/build/web/WEB-INF/lib/build/web/WEB-INF/lib/build/web/WEB-INF/lib/build/web/WEB-INF/lib/src/java/dao/FeedbackDAO.java
9876ccd67bcfb40e20d353b314f1328f4bbed878
[]
no_license
dungpham9400/IWS-Final
96945af39ceeb4ac1fad4ca229dbdfcaf7af1192
c11d5d3dcec166ea58f37987b6f3dc6a3dd90b5e
refs/heads/master
2023-04-27T11:25:28.487499
2021-05-20T03:46:44
2021-05-20T03:46:44
367,838,031
0
0
null
null
null
null
UTF-8
Java
false
false
1,690
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 dao; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import model.Feedback; /** * * @author sontriplelift */ public class FeedbackDAO extends DBContext{ public void insertFeedback(String username, String email, String phone, String content){ try { String sql="insert into FeedBack(Username,Email,Phone,Content)\n" + "values (?,?,?,?)"; PreparedStatement ps = con.prepareStatement(sql); ps.setString(1, username); ps.setString(2, email); ps.setString(3, phone); ps.setString(4, content); ps.executeUpdate(); } catch (SQLException e) { System.out.println(e); } } public List<Feedback> getListFeedbacks(){ List<Feedback> list = new ArrayList<>(); try { String sql = "select * from [FeedBack]"; PreparedStatement ps = con.prepareStatement(sql); ResultSet rs = ps.executeQuery(); while (rs.next()) { Feedback f = new Feedback(); f.setFname(rs.getString("Username")); f.setFmail(rs.getString("Email")); f.setFphone(rs.getString("Phone")); f.setContent(rs.getString("Content")); list.add(f); } } catch (Exception e) { } return list; } }
[ "1801040034@s.hanu.edu.vn" ]
1801040034@s.hanu.edu.vn
70441bc3ce157b3ac3cbec43fd4dc1bc9957ad87
ad624807211cd929e2bc9eec2f91cddc3aeb296a
/src/main/java/win/sinno/common/util/TimeTracer.java
3fdbaa53ccb5228a81bd02b6996bd1878e7d9bb4
[]
no_license
clz619/sinno-common
069ec266c4859c5968b90891002e50064ce4307f
523307de408549994aaa5c3b56e51311bb254a6d
refs/heads/master
2022-11-21T22:24:58.672099
2019-08-18T15:26:02
2019-08-18T15:26:02
81,036,907
0
0
null
2022-11-16T12:34:30
2017-02-06T01:46:28
Java
UTF-8
Java
false
false
4,270
java
package win.sinno.common.util; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; /** * time trace * * @author : admin@chenlizhong.cn * @version : 1.0 * @since : 2017-05-24 10:23. */ public class TimeTracer { private String identify; private int i = 0; private AtomicBoolean first = new AtomicBoolean(); private TimeTuple timeTuple; private List<TraceEvent> traceEventList; private TimeTracer(String identify) { this.identify = identify; timeTuple = new TimeTuple(); traceEventList = new ArrayList<>(); } public static TimeTracer newInstance(String identify) { return new TimeTracer(identify); } public long getBeginTs() { return timeTuple.getBeginTs(); } public long getTotalUseTs() { return timeTuple.getEndTs() - timeTuple.getBeginTs(); } public long getEndTs() { return timeTuple.getEndTs(); } public int getTraceNum() { return traceEventList.size(); } public void begin() { if (first.compareAndSet(false, true)) { timeTuple.setBeginTs(System.currentTimeMillis()); timeTuple.setNowTs(timeTuple.getBeginTs()); } } public synchronized void trace(String msg) { begin(); timeTuple.setPreTs(timeTuple.getNowTs()); timeTuple.setNowTs(System.currentTimeMillis()); addTraceEvent(++i, msg, timeTuple.getNowTs() - timeTuple.getPreTs()); } public synchronized void end() { timeTuple.setEndTs(timeTuple.getNowTs()); } private void addTraceEvent(int idx, String msg, long useTs) { TraceEvent traceEvent = new TraceEvent(); traceEvent.setIdx(idx); traceEvent.setMsg(msg); traceEvent.setUseTs(useTs); traceEventList.add(traceEvent); } public String report() { Iterator<TraceEvent> it = traceEventList.iterator(); StringBuilder sb = new StringBuilder(); sb.append("[identify="); sb.append(identify); sb.append(", step="); sb.append(i); sb.append(", totalUseTs="); sb.append(getTotalUseTs()); sb.append("ms"); sb.append(", beginTs="); sb.append(timeTuple.getBeginTs()); sb.append(" , endTs="); sb.append(timeTuple.getEndTs()); sb.append("]"); sb.append(" trace detail:["); while (it.hasNext()) { TraceEvent traceEvent = it.next(); sb.append(" idx="); sb.append(traceEvent.getIdx()); sb.append(","); sb.append(" msg="); sb.append(traceEvent.getMsg()); sb.append(","); sb.append(" useTs="); sb.append(traceEvent.getUseTs()); sb.append("ms. "); } sb.append("]"); return sb.toString(); } /** * 时间元数据 */ public static class TimeTuple { private long beginTs; private long preTs; private long nowTs; private long endTs; public long getBeginTs() { return beginTs; } public void setBeginTs(long beginTs) { this.beginTs = beginTs; } public long getPreTs() { return preTs; } public void setPreTs(long preTs) { this.preTs = preTs; } public long getNowTs() { return nowTs; } public void setNowTs(long nowTs) { this.nowTs = nowTs; } public long getEndTs() { return endTs; } public void setEndTs(long endTs) { this.endTs = endTs; } @Override public String toString() { return "TimeTuple{" + "beginTs=" + beginTs + ", preTs=" + preTs + ", nowTs=" + nowTs + ", endTs=" + endTs + '}'; } } /** * 跟踪事件 */ public static class TraceEvent { private int idx; private String msg; private long useTs; public int getIdx() { return idx; } public void setIdx(int idx) { this.idx = idx; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public long getUseTs() { return useTs; } public void setUseTs(long useTs) { this.useTs = useTs; } @Override public String toString() { return "TraceEvent{" + "idx=" + idx + ", msg='" + msg + '\'' + ", useTs=" + useTs + '}'; } } }
[ "admin@chenlizhong.cn" ]
admin@chenlizhong.cn
d50afb16310737817baa04c9f9a2180a12127148
bd936dcbf17e119a468f209bb772d90a381c33ea
/src/main/java/science/mengxin/springbootjokes/controller/JokeController.java
72998202b581b92480a4615b53983fdda2d77177
[]
no_license
xmeng1/spring-boot-jokes
8de1f31b548c1fc69eadf399cc0d3139e36006d2
d7ff14fe7e7ac61df9c2f8e3ddc722ed2ee85ff0
refs/heads/master
2020-03-12T07:36:45.154638
2018-04-22T08:45:09
2018-04-22T08:45:09
130,509,776
0
0
null
null
null
null
UTF-8
Java
false
false
764
java
package science.mengxin.springbootjokes.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import science.mengxin.springbootjokes.services.JokeService; /** * <p>Date: 22/04/18 * * @author mengxin * @version 1.0 */ @Controller public class JokeController { private JokeService jokeService; @Autowired public JokeController(JokeService jokeService) { this.jokeService = jokeService; } @RequestMapping({"/",""}) public String showJoke(Model model) { model.addAttribute("joke", jokeService.getJoke()); return "chucknorris"; } }
[ "mengxin.city@gmail.com" ]
mengxin.city@gmail.com
109e3d33d1668d64043559c7277c949d229aeedd
2f7ed85390e6d07fbceb52c3097c14f5c65d52a4
/src/by/it/a_khmelev/calc_v3_with_log_and_savevars/Var.java
bad8c02d982b229cf1d16d4f62d20fc752c7efdb
[]
no_license
migeniya/JD2018-12-10
4def3baf833eb0d9450baff7588f096dc44ce4ae
bf227c0e1b3c4da93d41b3beb1fa2d3ea04dab6e
refs/heads/master
2020-04-12T09:47:01.862944
2019-06-24T07:44:47
2019-06-24T07:44:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,107
java
package by.it.a_khmelev.calc_v3_with_log_and_savevars; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.HashMap; import java.util.Map; abstract class Var implements Operation { private static Map<String, Var> vars = new HashMap<>(); private static String varsFile = System.getProperty("user.dir") + "" + "/src/by/it/a_khmelev/calc_v3_with_log_and_savevars/" + "vars.txt"; @Override public Var add(Var other) throws CalcException { throw new CalcException("Сложение " + this + " и " + other + " невозможно."); } @Override public Var sub(Var other) throws CalcException { System.out.println("Вычитание " + this + " и " + other + " невозможно."); return null; } @Override public Var mul(Var other) throws CalcException { System.out.println("Умножение " + this + " и " + other + " невозможно."); return null; } @Override public Var div(Var other) throws CalcException { System.out.println("Деление " + this + " и " + other + " невозможно."); return null; } @Override public String toString() { return "Какая-то непонятная переменная"; } static Var createVar(String operand) throws CalcException { operand = operand.trim(); if (operand.matches(Patterns.SCALAR)) return new Scalar(operand); else if (operand.matches(Patterns.VECTOR)) return new Vector(operand); else if (operand.matches(Patterns.MATRIX)) return new Matrix(operand); else if (vars.containsKey(operand)) return vars.get(operand); throw new CalcException("Переменная " + operand + " не определена"); } static void saveVar(String nameVar, Var value) { vars.put(nameVar, value); } static void saveVarToFile() { try ( BufferedWriter out = new BufferedWriter( new FileWriter(varsFile, true) ) ) { for (Map.Entry<String, Var> entry : vars.entrySet()) { out.write(String.format("%s=%s\n", entry.getKey(), entry.getValue())); } out.flush(); } catch (IOException e) { e.printStackTrace(); } } static void loadVarFromFile() { if (!new File(varsFile).exists()) return; Parcer parcer = new Parcer(); try (BufferedReader reader = new BufferedReader( new FileReader(varsFile) )) { for (; ; ) { String s = reader.readLine(); if (s == null) return; parcer.calc(s); } } catch (IOException | CalcException e) { e.printStackTrace(); } } }
[ "demo@it-academy.by" ]
demo@it-academy.by
51454a7a7515096459f554d3e2ef6476bbc2c673
6b5aa001251c6b61cee31338458006076ea8c476
/src/main/java/com/squapl/sa/service/UserService.java
33e0f9f4d7f5133dee889fb89ee734be306f0450
[]
no_license
sivadinesh1/atb-backend
4b111e486c21bbd20455aec407ca0b897f76c340
ad43dedc3f2891fbc6d9a32fa63584b62c654de4
refs/heads/master
2020-04-23T21:05:01.500634
2019-02-19T11:11:09
2019-02-19T11:11:09
171,458,604
0
0
null
null
null
null
UTF-8
Java
false
false
1,466
java
package com.squapl.sa.service; import java.util.List; import java.util.Set; import com.squapl.sa.domain.User; import com.squapl.sa.domain.security.UserRole; import com.squapl.sa.util.constants.UserStatus; public interface UserService { User findByUsername(String username); User findByEmail(String email); User getUser(String name); boolean checkUserExists(String username, String email); boolean checkUserExists(String username); boolean checkUsernameExists(String username); boolean checkEmailExists(String email); void save (User user); User createUser(User user, Set<UserRole> userRoles); User saveUser (User user); List<User> findUserList(); void enableUser (String username); void disableUser (String username); void deleteUserById(Long userId); User findUserById(Long clientId); List<User> findByEnabledUser(UserStatus enable); List<User> findByDisabledUser(UserStatus disable); User findUsersByQuery(); int updateProfileImgUrl(String profileimgurl, Long userid); int resettemppassword(Long userId, String newpassword) throws Exception; boolean checkFBSocialIdExists(String socialid); boolean checkGPSocialIdExists(String socialid); User createFBUser(User user, Set<UserRole> userRoles); User createGPUser(User user, Set<UserRole> userRoles); }
[ "sivadinesh@gmail.com" ]
sivadinesh@gmail.com
4fd26668a7933dcb2081716736bb5476ffb124ee
e28e2ba758b61ead9e8e024f8601e575e661b907
/src/main/java/com/cloudfoundry/vmc/swing/dialog/other/Common.java
a645c48e14516efe571f729cc0a45306daf0417d
[]
no_license
oscloud/swing-cloud
1586250b1a65d07260dbf2cb76893bd914b42b7b
3a22c4c63ae6f8e212f65034a0e8c6649ef9b74d
refs/heads/master
2020-05-20T14:04:34.296318
2013-01-24T08:56:11
2013-01-24T08:56:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,983
java
package com.cloudfoundry.vmc.swing.dialog.other; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import com.cloudfoundry.vmc.common.Json; import com.cloudfoundry.vmc.swing.frame.BaseInternalFrame; public class Common extends BaseInternalFrame { private static final long serialVersionUID = -8607149290281591829L; private static Common common; private JPanel jPanel; private JButton btnRefresh; private static JTextArea txtInfo; private JScrollPane jscroll; public Common() { this.initGUI(); this.initAction(); } private void initResource() { jPanel = new JPanel(); btnRefresh = new JButton("Refresh"); txtInfo = new JTextArea(); txtInfo.setEditable(false); jscroll = new JScrollPane(txtInfo); } private void initAction() { btnRefresh.addActionListener(this); } public void initGUI() { initResource(); this.setMaximizable(true); this.setIconifiable(true); this.setClosable(true); this.add(jPanel,BorderLayout.NORTH); this.add(jscroll, BorderLayout.CENTER); jPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); jPanel.add(btnRefresh); this.setSize(700, 400); this.setLocation(50, 8); } public static Common getInstance(Object object) { if (null == common) { common = new Common(); } updateInformation(object == null ? "Nothing.." : Json.formatObjectAsString(object)); return common; } public static void updateInformation(String s) { txtInfo.setText(s); } public void actionPerformed(ActionEvent e) { Object obj = (Object) e.getSource(); if (obj == btnRefresh) { } } }
[ "mail.test@qq.com" ]
mail.test@qq.com
043d03e441fe9e8247768bd6675779c0acbaa0ae
9ab5bdb918b886f1f2d09d81efb63ff83a86bfb0
/client/src/main/java/com/jdt/fedlearn/client/multi/TrainProcess.java
e5672b4a6a9057da15d8ee307602275ce1af9d8c
[ "Apache-2.0" ]
permissive
BestJex/fedlearn
75a795ec51c4a37af34886c551874df419da3a9c
15395f77ac3ddd983ae3affb1c1a9367287cc125
refs/heads/master
2023-06-17T01:27:36.143351
2021-07-19T10:43:09
2021-07-19T10:43:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,360
java
/* Copyright 2020 The FedLearn Authors. 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. 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.jdt.fedlearn.client.multi; import com.jdt.fedlearn.client.cache.ModelCache; import com.jdt.fedlearn.client.constant.Constant; import com.jdt.fedlearn.client.service.TrainService; import com.jdt.fedlearn.core.entity.Message; import com.jdt.fedlearn.core.loader.common.TrainData; import com.jdt.fedlearn.core.model.Model; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TrainProcess implements Runnable { private static final Logger logger = LoggerFactory.getLogger(TrainProcess.class); private Model model; private String stamp; private String modelToken; private int phase; private String parameterData; private TrainData trainData; public TrainProcess(Model model, String stamp, String modelToken, int phase, String parameterData, TrainData trainData) { this.model = model; this.stamp = stamp; this.modelToken = modelToken; this.phase = phase; this.parameterData = parameterData; this.trainData = trainData; } @Override public void run() { try { logger.info("enter TrainProcess run!!!"); Message restoreMessage = Constant.serializer.deserialize(parameterData); Message trainResult = model.train(phase, restoreMessage, trainData); String strMessage = Constant.serializer.serialize(trainResult); ModelCache modelCache = ModelCache.getInstance(); modelCache.put(modelToken, model); TrainService.responseQueue.put(stamp, strMessage); } catch (Exception e) { logger.error(" phase: " + this.phase + " + modeltoken: " + this.modelToken + " stemp : " + this.stamp); logger.error("train process error:", e); } } }
[ "wangpeiqi@jd.com" ]
wangpeiqi@jd.com
5223475a0ba7c49620d62b27d07ae5778cac5575
79659a704e44f2df9a5a100623145c97a8d4abaa
/src/chap2/interview5/Interview5Q1Test.java
a046ada553cc3b73f12f2aedc5298a352bcdddcc
[]
no_license
yelantingxue/CodeInterview
876fa4b3ceba7d88c6b985df8afb4c3f7550865d
e7efd3b5e51136b856125e784ce5d7b525df357e
refs/heads/master
2021-09-08T12:07:51.834454
2018-03-09T13:02:33
2018-03-09T13:02:33
110,949,972
0
0
null
null
null
null
UTF-8
Java
false
false
3,078
java
package chap2.interview5; import org.junit.Test; public class Interview5Q1Test { /** * Space is at the middle of the string. */ @Test public void test1() { String str = "hello world"; char[] charArray = new char[20]; for(int i = 0; i < str.length(); i++) { charArray[i] = str.charAt(i); } Interview5Q1.replaceBlank(charArray, 20); System.out.println(Interview5Q1.replaceBlank(str)); System.out.println(charArray); } /** * Space is at the start of the string. */ @Test public void test2() { String str = " helloworld"; char[] charArray = new char[20]; for(int i = 0; i < str.length(); i++) { charArray[i] = str.charAt(i); } Interview5Q1.replaceBlank(charArray, 20); System.out.println(Interview5Q1.replaceBlank(str)); System.out.println(charArray); } /** * Space is at the end of the string. */ @Test public void test3() { String str = "helloworld "; char[] charArray = new char[20]; for(int i = 0; i < str.length(); i++) { charArray[i] = str.charAt(i); } Interview5Q1.replaceBlank(charArray, 20); System.out.println(Interview5Q1.replaceBlank(str)); System.out.println(charArray); } /** * There are two consecutive spaces in the string. */ @Test public void test4() { String str = "hello world"; char[] charArray = new char[20]; for(int i = 0; i < str.length(); i++) { charArray[i] = str.charAt(i); } Interview5Q1.replaceBlank(charArray, 20); System.out.println(Interview5Q1.replaceBlank(str)); System.out.println(charArray); } /** * The input string is empty. */ @Test public void test5() { String str = ""; char[] charArray = new char[20]; for(int i = 0; i < str.length(); i++) { charArray[i] = str.charAt(i); } Interview5Q1.replaceBlank(charArray, 20); System.out.println(Interview5Q1.replaceBlank(str)); System.out.println(charArray); } /** * The input string is just a space. */ @Test public void test6() { String str = " "; char[] charArray = new char[20]; for(int i = 0; i < str.length(); i++) { charArray[i] = str.charAt(i); } Interview5Q1.replaceBlank(charArray, 20); System.out.println(Interview5Q1.replaceBlank(str)); System.out.println(charArray); } /** * The input string doesn't consist of spaces. */ @Test public void test7() { String str = "helloworld"; char[] charArray = new char[20]; for(int i = 0; i < str.length(); i++) { charArray[i] = str.charAt(i); } Interview5Q1.replaceBlank(charArray, 20); System.out.println(Interview5Q1.replaceBlank(str)); System.out.println(charArray); } /** * The input string only consists of spaces. */ @Test public void test8() { String str = " "; char[] charArray = new char[20]; for(int i = 0; i < str.length(); i++) { charArray[i] = str.charAt(i); } Interview5Q1.replaceBlank(charArray, 20); System.out.println(Interview5Q1.replaceBlank(str)); System.out.println(charArray); } }
[ "zsdsywr2014@126.com" ]
zsdsywr2014@126.com
84619936c51321f6ec99c75f660a9256555902cb
32e197c69a1e0c0d6709df29552335214c293f2c
/src/innards/signal/FloatProviderFilter.java
4b19b1213a18f1c42641f35be49490c536fd57c2
[]
no_license
zuchermann/ZachMXJ
d8c287ab2c0d9b608e2a95ca7337c9184a1cf6dd
7a9f6eb0fdfb9047699f17e8884fb528993a75ca
refs/heads/master
2021-03-16T09:01:33.322408
2019-01-07T00:11:57
2019-01-07T00:11:57
74,169,159
0
0
null
null
null
null
UTF-8
Java
false
false
1,446
java
package innards.signal; import innards.provider.iFloatProvider; import innards.*; /** * Low Pass Filter acts as Float Provider - buffers signal from another floatProvider. * TODO - have people pass in actual filtering system, so it can be other than simple low pass. (also do that to SmoothSetener, which is kinda the opposite of this class (push in stead of pull)) */ public class FloatProviderFilter implements iFloatProvider, iUpdateable{ iFloatProvider source; float filterAmount; boolean iGetUpdated = false; //1 means never move from initial. //0 means no filtering, value just goes staight through. public FloatProviderFilter(iFloatProvider source, float filterAmount){ if(filterAmount < 0 || filterAmount > 1.0f){ throw new IllegalArgumentException("filterAmount must be between 0 and 1; got <"+filterAmount+">"); } this.source = source; this.filterAmount = filterAmount; this.last = source.evaluate(); } protected float last; public float evaluate(){ if(iGetUpdated){ return last; }else{ float lastRequested = source.evaluate(); float r = lastRequested*(1-filterAmount) + last * filterAmount; last = r; return r; } } //if i get updated, then only update my value every update. //otherwise, update every evaluate. public void update(){ iGetUpdated = true; float lastRequested = source.evaluate(); float r = lastRequested*(1-filterAmount) + last*filterAmount; last = r; } }
[ "zachk414@gmail.com" ]
zachk414@gmail.com
5bb4ab298cad95f1b30a6c351c3b2846b0350a95
a7e31218b1a29e62be405a5b34ae9f45472791c9
/EntitiesInTwoDimentionalSpace/Project JIC/Display2DArray.java
c31c3f24390727e26b426cf9ef26d0f90da038d8
[]
no_license
LoganRichardson/Projects
c4cab77b3749f76ebf2532f3098f5d77025ad6a4
609e6ba8f913c714477453b9a3760f7f6292e093
refs/heads/master
2021-09-27T00:13:10.353375
2021-09-21T07:55:41
2021-09-21T07:55:41
152,376,267
0
0
null
null
null
null
UTF-8
Java
false
false
11,739
java
package project; import java.awt.*; import java.io.*; import java.awt.event.*; //****************************************************************************************** //****************************************************************************************** //Class: Display2DArray //Description: Implements the paint() routine using one or more 2D arrays containing the // image (one for grayscale or binary images, 3 for color images). Assumes // that the image is oriented correctly (i.e,. paint() does not flip it). // Allows for showing an image one time or continuously (for example, if it // is being constantly updated by a digital camera. // Provides routines for referencing or copying image data. The referencing // options provide for potentially faster processing but at the expense of // creating aliases. The copy options are slower but safer. // Also includes the capability to show text on the image. //Author: Steve Donaldson //Date: 8/29/08 public class Display2DArray extends Frame { public int imageType; //1=24 bit color;2=256 level gray scale;3=binary (b/w) public int imageWidth; //image width in pixels public int imageHeight; //image height in pixels public int imageSize; //height*width (*3 for images of type 1) public int pixels[][]; //pixel values in 2D for type 1 or type 2 images public int redPixels[][]; //red pixel values for type 1 images public int greenPixels[][]; //green pixel values for type 1 images public int bluePixels[][]; //blue pixel values for type 1 images public boolean showOnce; //true=show the image one time; false=continuously //redraw the image. The "false" option is useful for //situations such as those when the image pixels are //constantly changing in the source file, such as //may occur when the file is being constantly //updated by a digital camera. The choice to //continuously redraw only has effect if the //sourceImage parameter is not null. ImageClass sourceImage; //if the image to be displayed is based on an object //of type ImageClass, this is that object (null //otherwise) public static int windowHeaderOffset = 30; //space for window title bar public static int windowSideOffset = 4; //space for window side bar(s) public static int windowBotttomOffset = 4; //space for window bottom bar public int textLineCount; //the number of lines of text in array text[] public String text[]; //each row contains a line of text to be displayed public int textPosition[][]; //the row and column positions in the image at which //to display the text //************************************************************************************** Display2DArray(int type, int width, int height, int size, int redValues[][], int greenValues[][], int blueValues[][], int values[][], ImageClass source) { imageType = type; imageWidth = width; imageHeight = height; imageSize = size; redPixels=redValues; greenPixels = greenValues; bluePixels = blueValues; pixels = values; sourceImage = source; showOnce = true; textLineCount = 0; text = null; textPosition = null; } //************************************************************************************** Display2DArray(ImageClass imageObject) { imageType = imageObject.imageType; imageWidth = imageObject.imageWidth; imageHeight = imageObject.imageHeight; imageSize = imageObject.imageSize; redPixels = imageObject.redPixels; greenPixels = imageObject.greenPixels; bluePixels = imageObject.bluePixels; pixels = imageObject.pixels; sourceImage = imageObject; showOnce = true; textLineCount = 0; text = null; textPosition = null; } //************************************************************************************** Display2DArray(Display2DArray displayObject) { imageType = displayObject.imageType; imageWidth = displayObject.imageWidth; imageHeight = displayObject.imageHeight; imageSize = displayObject.imageSize; redPixels = displayObject.redPixels; greenPixels = displayObject.greenPixels; bluePixels = displayObject.bluePixels; pixels = displayObject.pixels; sourceImage = displayObject.sourceImage; showOnce = true; } //************************************************************************************** //Method: referenceColorArrayData //Description: Makes the color arrays for this image reference the RGB pixel values // from a specified set of color arrays. Note that a change to the source // arrays will be reflected in this image if subsequently displayed. //Parameters: redValues[][] - source red pixels // greenValues[][] - source green pixels // blueValues[][] - source blue pixels //Returns: true if successful; false otherwise //Calls: nothing public boolean referenceColorArrayData(int redValues[][], int greenValues[][], int blueValues[][]) { if ((redValues != null) && (greenValues != null) && (blueValues != null)) { redPixels=redValues; greenPixels = greenValues; bluePixels = blueValues; return true; } return false; } //************************************************************************************** //Method: referenceGrayArrayData //Description: Makes the grayscale array for this image reference the gray pixel values // from a specified grayscale array. Note that a change to the source // array will be reflected in this image if subsequently displayed. //Parameters: values[][] - source gray pixels //Returns: true if successful; false otherwise //Calls: nothing public boolean referenceGrayArrayData(int values[][]) { if (values != null) { pixels = values; return true; } return false; } //************************************************************************************** //Method: copyColorArrayData //Description: Copies RGB pixel values from a specified set of arrays into the arrays // for this image. Making a copy prevents a change to the source arrays // from subsequently affecting this image. //Parameters: redValues[][] - source red pixels // greenValues[][] - source green pixels // blueValues[][] - source blue pixels //Returns: true if successful; false otherwise //Calls: nothing public boolean copyColorArrayData(int redValues[][], int greenValues[][], int blueValues[][]) { if ((redValues != null) && (greenValues != null) && (blueValues != null)) { redPixels = new int[imageHeight][imageWidth]; greenPixels = new int[imageHeight][imageWidth]; bluePixels = new int[imageHeight][imageWidth]; for (int r = 0; r < imageHeight; r++) for (int c = 0; c < imageWidth; c++) { redPixels[r][c] = redValues[r][c]; greenPixels[r][c] = greenValues[r][c]; bluePixels[r][c] = blueValues[r][c]; } return true; } return false; } //************************************************************************************** //Method: copyGrayArrayData //Description: Copies grayscale pixel values from a specified array into the array // for this image. Making a copy prevents a change to the source array // from subsequently affecting this image. //Parameters: values[][] - source gray pixels //Returns: true if successful; false otherwise //Calls: nothing public boolean copyGrayArrayData(int values[][]) { if (values != null) { pixels = new int[imageHeight][imageWidth]; for(int r=0;r<imageHeight;r++) for(int c=0;c<imageWidth;c++) pixels[r][c] = values[r][c]; return true; } return false; } //************************************************************************************** //Method: showImage //Description: Initializes graphics window parameters and displays its contents. //Parameters: title - title of the graphics window // displayOnce - show the image a single time or display it continuously // (i.e., as for continuous digital camera input) //Returns: nothing //Calls: various Java graphics routines public void showImage(String title, boolean displayOnce) { addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); showOnce = displayOnce; setTitle(title); setSize(imageWidth + 2 * windowSideOffset, imageHeight + windowHeaderOffset + windowBotttomOffset); setVisible(true); } //************************************************************************************** //Method: closeImageDisplay //Description: Terminates continuous display (if applicable) and closes the graphics // window. //Parameters: none //Returns: nothing //Calls: Java setVisible public void closeImageDisplay() { showOnce = true; //exit endless loop in paint() setVisible(false); } //************************************************************************************** //Method: paint //Description: Display an image stored in a 2D array. Overrides the paint method // inherited from Frame (via Container). Allows for showing an image // one time or continuously (for example, if it is being constantly // updated by a digital camera. //Parameters: g - the graphics object //Returns: nothing //Calls: setColorValues for an ImageClass object // setGrayValues for an ImageClass object // referenceColorArrayData // referenceGrayArrayData // plus various Java graphics routines public void paint(Graphics g) { int row, column, pixel; Color color = new Color(0); int i, a = 0, b = 0; while (a == b) { if (imageType == 1) { for (row = 0; row < imageHeight; row++) { for (column = 0; column < imageWidth; column++) { color = new Color(redPixels[row][column], greenPixels[row][column], bluePixels[row][column]); g.setColor(color); g.drawLine(column + windowSideOffset, row + windowHeaderOffset, column + windowSideOffset, row + windowHeaderOffset); } } } else if ((imageType == 2) || (imageType == 3)) { for (row = 0; row < imageHeight; row++) { for (column = 0; column < imageWidth; column++) { pixel = pixels[row][column]; color = new Color(pixel, pixel, pixel); g.setColor(color); g.drawLine(column + windowSideOffset, row + windowHeaderOffset, column + windowSideOffset, row + windowHeaderOffset); } } } g.setColor(Color.white); Font f = new Font("sansserif", Font.BOLD, 12); g.setFont(f); for (i = 0; i < textLineCount; i++) g.drawString(text[i], textPosition[i][1] + windowSideOffset, textPosition[i][0] + windowHeaderOffset); if (showOnce) b++; //exit else { if (sourceImage != null) { sourceImage.getRawPixelData(); if (imageType == 1) { sourceImage.setColorValues(); referenceColorArrayData(sourceImage.redPixels, sourceImage.greenPixels, sourceImage.bluePixels); } else { sourceImage.setGrayValues(); referenceGrayArrayData(sourceImage.pixels); } } //else //removed to allow for continuous display based on updates to this object other than from // b++; //an ImageClass object } } } //end paint() //************************************************************************************** } //end Display2DArray class //****************************************************************************************** //******************************************************************************************
[ "noreply@github.com" ]
noreply@github.com
2de3deac4a35443f5ca7aaf5db0b87eb7565efbc
8f213f538138b5d4b03bb14b4cbc5fe7d709311c
/src/main/java/model/Analista.java
761222f72a97610e6415d63af5b61064aab475a3
[]
permissive
jgjoao/pos-javaweb
8ee626f08263f6f5eff11b91be06479e4549adde
6d82702c4cf0ab98c9d42d64b7f29e4f802c3ca5
refs/heads/master
2020-12-27T22:59:34.333628
2020-02-09T14:01:32
2020-02-09T14:01:32
238,095,900
0
0
MIT
2020-02-04T01:12:59
2020-02-04T01:12:59
null
UTF-8
Java
false
false
1,453
java
package model; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.NotEmpty; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; @Entity public class Analista implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotEmpty private String nome; private String sexo; @Column(nullable = false, updatable = false) @Temporal(TemporalType.TIMESTAMP) @CreatedDate private Date dtupdate; @Temporal(TemporalType.TIMESTAMP) @LastModifiedDate private Date dtcriacao; public Date getDtupdate() { return dtupdate; } public void setDtupdate(Date dtupdate) { this.dtupdate = dtupdate; } public Date getDtcriacao() { return dtcriacao; } public void setDtcriacao(Date dtcriacao) { this.dtcriacao = dtcriacao; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getSexo() { return sexo; } public void setSexo(String sexo) { this.sexo = sexo; } }
[ "j.g.345@hotmail.com" ]
j.g.345@hotmail.com
b8f83ce6a9606d88fb44059464ec5303f3186125
06219239b78d442a48ca5ad92ece66998f2b1c55
/app/src/main/java/com/example/popmovies/ui/pages/moviedetails/MovieDetailsViewModelFactory.java
2f6c01e5879f1e35a57518c7321adb9ded92bf84
[]
no_license
andyy1976/PopMovies
2a3a8f8d6b6a59985855cfe84e25ddf087e98a4a
2ccece45c985a2098c314b722095d1a57c63f219
refs/heads/master
2020-08-12T16:04:49.093455
2019-08-23T10:05:15
2019-08-23T10:05:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
634
java
package com.example.popmovies.ui.pages.moviedetails; import android.arch.lifecycle.ViewModel; import android.arch.lifecycle.ViewModelProvider; import com.example.popmovies.database.AppDatabase; public class MovieDetailsViewModelFactory extends ViewModelProvider.NewInstanceFactory { private final AppDatabase mDb; private final int mTaskId; public MovieDetailsViewModelFactory(AppDatabase database, int taskId) { mDb = database; mTaskId = taskId; } @Override public <T extends ViewModel> T create(Class<T> modelClass) { return (T) new MovieDetailsViewModel(mDb, mTaskId); } }
[ "hrisi_13@yahoo.com" ]
hrisi_13@yahoo.com
4289b8d0d7d3f8839869b3194075005f7f26ce75
4baf4719b1e34569bc4439419bddcacdb9836bf0
/Section 1/Chapter09/airline-booking/src/main/java/springfive/airline/airlinebooking/domain/Flight.java
7e6def0c07a3089760873d3243bcd105e5f72dbe
[ "MIT" ]
permissive
PacktPublishing/Developing-Java-Applications-with-Spring-and-Spring-Boot
1cd94c3ba5b5f4b98709fa1f5e90ade3952817d3
dc480767ddcbc7053b68682b28ba19fa93f420d3
refs/heads/master
2023-07-24T04:06:15.159293
2023-01-30T08:10:32
2023-01-30T08:10:32
136,295,735
24
16
MIT
2023-07-18T20:52:04
2018-06-06T08:14:12
Java
UTF-8
Java
false
false
467
java
package springfive.airline.airlinebooking.domain; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import java.time.LocalDateTime; import lombok.Data; import org.springframework.data.mongodb.core.mapping.Field; @Data @JsonInclude(Include.NON_NULL) public class Flight { @Field("flight_id") String id; String number; LocalDateTime departureAt; LocalDateTime arriveAt; Plane plane; }
[ "32731556+mehulsingh7@users.noreply.github.com" ]
32731556+mehulsingh7@users.noreply.github.com
64eadbf76a80044ed396b46bb9e0b3d0f3ef523a
7188b0c284a0f19f542d7830f3369b43dc4e9cdc
/src/main/java/org/example/util/FileReadingUtil.java
cdefb5a7f9daca0eeeb76849fe226dce1c52932d
[]
no_license
claudiopollice/DataReadAndMergeSort
c427606fafaf34b4a35b4425f4e2794fc0f312b9
899e427c8a2a5295b97b0c7ef7c41d7640ae87ac
refs/heads/master
2022-12-30T06:11:03.456373
2020-10-18T19:32:07
2020-10-18T19:32:07
305,177,417
0
0
null
null
null
null
UTF-8
Java
false
false
1,114
java
package org.example.util; import lombok.NonNull; import org.example.model.error.SystemError; import java.io.*; import java.nio.channels.FileChannel; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardOpenOption; import java.util.EnumSet; public class FileReadingUtil { public static long getFileSize(@NonNull File file) throws SystemError { long fileSize; try (FileChannel fileChannel = (FileChannel) Files.newByteChannel(Path.of(file.getPath()), EnumSet.of(StandardOpenOption.READ))) { fileSize = fileChannel.size(); } catch (IOException e) { throw SystemError.fileReadingError(file.getName()); } return fileSize; } public static BufferedReader openFileForReading(String fileName) throws SystemError { BufferedReader bufferedReader; try { bufferedReader = new BufferedReader(new FileReader(fileName)); } catch (FileNotFoundException e) { throw SystemError.fileNotFoundError(fileName); } return bufferedReader; } }
[ "claudio.pollice@ing.com" ]
claudio.pollice@ing.com
fadcd3206966146227e52cc6047170df58d15a24
6374fce0f875c162e89e0c652aa9d26b8bb5c6a4
/src/by/it/voronovich/project/java/CommandAdminCabGood.java
1f1527ad5b8d7f2e63c04c9cb81eabaacf6055d3
[]
no_license
romanfilimonchik/JD2016-08-22
092611384219dc4d489bd81c21cab5a1938c1754
8394adde1c7b2c749c602fcf24fe31b1f7bf01f0
refs/heads/master
2020-12-26T03:34:02.273094
2016-11-22T12:50:13
2016-11-22T12:50:13
67,052,639
0
0
null
2016-08-31T15:59:58
2016-08-31T15:59:56
Java
UTF-8
Java
false
false
2,342
java
package by.it.voronovich.project.java; import by.it.voronovich.project.java.bean.CatalogGood; import by.it.voronovich.project.java.dao.CatalogGoodDAO; import by.it.voronovich.project.java.dao.DAO; import javax.servlet.http.HttpServletRequest; import java.util.List; public class CommandAdminCabGood implements ActionCommand{ @Override public String execute(HttpServletRequest request) { String page = Action.ADMINCABGOOD.inPage; List<CatalogGood> goodList = new CatalogGoodDAO().getAll(""); if (!goodList.isEmpty()) { request.setAttribute("goodList", goodList); } DAO dao= DAO.getDAO(); if (FormHelper.isPost(request)){ CatalogGood cg=new CatalogGood(); try { cg.setIdCatalog(Integer.parseInt(request.getParameter("idCatalog"))); cg.setBrand(request.getParameter("Brand")); cg.setModel(request.getParameter("Model")); cg.setPrice(Double.parseDouble(request.getParameter("Price"))); cg.setReleaseDate(request.getParameter("ReleaseDate")); cg.setWeight(request.getParameter("Weight")); if (cg.getIdCatalog()>0){ if(dao.cg.update(cg)) { request.setAttribute(Action.msgMessage, "Изменения приняты"); page = Action.ADMINCABGOOD.okPage; } } if (cg.getIdCatalog()<0){ cg.setIdCatalog(cg.getIdCatalog()*(-1)); if(dao.cg.delete(cg)){ request.setAttribute(Action.msgMessage, "Товар удален"); page = Action.ADMINCABGOOD.okPage; } } if (cg.getIdCatalog()==0){ if(dao.cg.create(cg)){ request.setAttribute(Action.msgMessage, "Товар добавлен"); page = Action.ADMINCABGOOD.okPage; } } } catch (Exception e) { e.printStackTrace(); request.setAttribute(Action.msgMessage,"Ошибка!!!"); } } request.setAttribute("goodList",dao.cg.getAll("")); return page; } }
[ "dd.versus@gmail.com" ]
dd.versus@gmail.com
ed3e0a916335d3c96982d93f5718656727d58416
0fe1d9b6e50ce09a604dbcffa6477e609b5aa619
/src/main/java/net/dandielo/citizens/traders_v3/core/exceptions/attributes/AttributeValueNotFoundException.java
5cf9eb3f8b96cee3018b9d398f54a600c12ec1a7
[]
no_license
Dandielo/dtlTraders
48e6b7a49b4fcf4d9738239025057cd027a01a58
83e2d89551631be1216405e3498bbf6cb14e4bd7
refs/heads/master
2020-12-24T06:33:10.164398
2016-07-18T13:56:58
2016-07-18T13:56:58
10,086,873
3
18
null
2016-06-15T10:06:20
2013-05-15T20:03:32
Java
UTF-8
Java
false
false
197
java
package net.dandielo.citizens.traders_v3.core.exceptions.attributes; public class AttributeValueNotFoundException extends AttributeException { private static final long serialVersionUID = 1L; }
[ "daniel.penkala@gmail.com" ]
daniel.penkala@gmail.com
11e21baa5ca75294e91e2ddb178489426d172f34
aee99deee0eb53951497650d2016af58b8f2e836
/src/Plants/Milk.java
6b9c84be760eb69a853872cb178f952d8432a77a
[]
no_license
Materson/Jolaria
1b9dfabfa0a7658cbe9a4ae7ad023861cdbbf716
f714b467e02704580b27866985d36a17b3763f81
refs/heads/master
2023-04-26T18:28:39.949517
2017-05-18T17:13:14
2017-05-18T17:13:14
372,085,495
0
0
null
null
null
null
UTF-8
Java
false
false
534
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 Plants; import Worlds.World; /** * * @author Materson */ public class Milk extends Plant{ public Milk(int power, World world, int x, int y) { super(power, world, x, y); image = 'm'; } @Override public void action(int dx, int dy) { for (int i = 0; i < 3; i++) { super.action(dx, dy); } } }
[ "mater@153.19.219.201" ]
mater@153.19.219.201
491cfd5e8a780b6deb8ff1befa4cf697494fece7
ebedcda4111385e994638f85c581a491e2c3e066
/ProxyHsNoSpring/src/com/wolf/cache/PathDataCache.java
eb000c6e7ed155c0b86909123da00e3e2947276e
[ "Apache-2.0" ]
permissive
wangscript007/w-io
4aac9983f09435a7f85e1c24ce4a98e44acf9cec
de230023c968d82c876f294f5c4f893316600848
refs/heads/master
2021-10-18T23:30:31.896954
2019-02-15T09:53:07
2019-02-15T09:53:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,990
java
package com.wolf.cache; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import java.nio.charset.Charset; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantReadWriteLock; //路径缓存 public class PathDataCache { private static ConcurrentMap<String,ByteBuf> bytebufCache = new ConcurrentHashMap<String, ByteBuf>(); private static ReentrantReadWriteLock lock = new ReentrantReadWriteLock(false); public static ByteBuf getBytebufCache(String path){ boolean islock; try { islock = lock.readLock().tryLock(10, TimeUnit.SECONDS); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } try { if(!bytebufCache.containsKey(path)){ return null; } ByteBuf bf = bytebufCache.get(path).retain(); return bf.duplicate(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return null; }finally{ if(islock){ lock.readLock().unlock(); } } } @SuppressWarnings("static-access") public static void putCache(String message,String path){ boolean islock; try { islock = lock.writeLock().tryLock(10, TimeUnit.SECONDS); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); return; } try { if(bytebufCache.containsKey(path)){ ByteBuf bf = bytebufCache.get(path); int refCnt = bf.refCnt(); if(refCnt > 0){ bf.release(refCnt); } } byte[] bytes = message.getBytes(Charset.forName("utf-8")); bytebufCache.put(path, Unpooled.directBuffer().writeBytes(bytes)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ if(islock){ lock.writeLock().unlock(); } } } // // public static void putCache(ByteBuf bytebuf,String path){ // bytebufCache.put(path, bytebuf); // } }
[ "chenze_sr@neusiri.com" ]
chenze_sr@neusiri.com
95c65b6e6d842d8d1e00d25a0211c261c720a6a2
fe2abf8ceb7a667d020db11155891d1ffd3149c3
/app/src/main/java/com/wsyzj/android/offer/bean/AcupointA.java
e0b32ef15bd5ca5e3cad94473e365b8615e262a5
[]
no_license
woshiyizhijiao/Offer
3001cb5918ad28f2e5c58e696b8fae8a85454105
e61f4216eaad6337c9779ccbb2f0401b750d7d72
refs/heads/master
2021-01-19T12:59:22.057534
2019-09-13T08:36:44
2019-09-13T08:36:44
82,354,908
4
0
null
null
null
null
UTF-8
Java
false
false
252
java
package com.wsyzj.android.offer.bean; /** * author : 焦洋 * time : 2017/11/6 11:41 * desc : AcupointA */ public class AcupointA { public String Letters; public String ArticleID; public String ClassID; public String Title; }
[ "jiao35478729@163.com" ]
jiao35478729@163.com
ae2bcb73f6f28f87506af232c2138b4ddfe2e0e8
3cf40f78c06550f86c9522690195148f0b61210e
/src/MisComponentes/txtPlaca.java
cd37539b2b7da1f0abc62cff01222c89b8044411
[]
no_license
drom457/Viaje-Autos
91a18b02dc0673326384ce5d7e6363560a8fe9f2
7f05adbd0282b83471a4bb5e3c814c4b9b473aa0
refs/heads/master
2022-09-02T18:27:24.535895
2017-06-14T15:50:25
2017-06-14T15:50:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,864
java
/* JEFFERSON TORRES * 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. JEFFERSON TORRES */ package MisComponentes; import java.awt.Color; import java.awt.event.KeyEvent; import javax.swing.BorderFactory; import javax.swing.JOptionPane; import javax.swing.JTextField; /** * * @author Jefferson */ public class txtPlaca extends JTextField { int i; public txtPlaca() { this.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { txtPlacaKeyTyped(evt); } }); this.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { txtPlacaFocusLost(evt); } }); } public Integer GettextAsInteger() { Integer retorno = 0; if (this.getText() == null) { return 0; } else { retorno = Integer.valueOf(this.getText()); } return retorno; } private void txtPlacaFocusLost(java.awt.event.FocusEvent evt) { // TODO add your handling code here: } private void txtPlacaKeyTyped(java.awt.event.KeyEvent evt) { // TODO add your handling code here: this.setBorder(BorderFactory.createLineBorder(Color.lightGray)); char c; c = evt.getKeyChar(); if ((c!=KeyEvent.VK_BACK_SPACE&&!Character.isDigit(c)&&!Character.isLetter(c))) { evt.consume(); getToolkit().beep(); } if (this.getText().length()>=8) { evt.consume(); getToolkit().beep(); } } }
[ "danie@DORO" ]
danie@DORO
e22d5dd8e177546091081cc6df1067975f70a7b2
3b91ed788572b6d5ac4db1bee814a74560603578
/com/tencent/mm/plugin/appbrand/jsapi/a/c$11.java
21ad1b0fed53406c202affe0109271e0ca563939
[]
no_license
linsir6/WeChat_java
a1deee3035b555fb35a423f367eb5e3e58a17cb0
32e52b88c012051100315af6751111bfb6697a29
refs/heads/master
2020-05-31T05:40:17.161282
2018-08-28T02:07:02
2018-08-28T02:07:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,693
java
package com.tencent.mm.plugin.appbrand.jsapi.a; import android.text.SpannableString; import android.text.TextUtils; import android.text.method.LinkMovementMethod; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.tencent.mm.ab.b; import com.tencent.mm.ipcinvoker.wx_extension.b.a; import com.tencent.mm.modelappbrand.b.f; import com.tencent.mm.plugin.appbrand.config.WxaExposedParams; import com.tencent.mm.plugin.appbrand.jsapi.a.c.12; import com.tencent.mm.plugin.appbrand.jsapi.a.c.15; import com.tencent.mm.plugin.appbrand.n; import com.tencent.mm.plugin.appbrand.s; import com.tencent.mm.plugin.appbrand.s$d; import com.tencent.mm.plugin.appbrand.s.g; import com.tencent.mm.plugin.appbrand.s.j; import com.tencent.mm.protocal.c.apa; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.ui.base.h; import org.json.JSONException; import org.json.JSONObject; class c$11 implements a { final /* synthetic */ c fKg; c$11(c cVar) { this.fKg = cVar; } public final void a(int i, int i2, String str, b bVar) { if (i == 0 && i2 == 0 && bVar.dIE.dIL != null) { x.i("MicroMsg.JsApiGetPhoneNumber", "JsOperateWxData success"); final apa apa = (apa) bVar.dIE.dIL; this.fKg.fJQ.getContentView().post(new Runnable() { public final void run() { c cVar = c$11.this.fKg; apa apa = apa; x.i("MicroMsg.JsApiGetPhoneNumber", "handleOperateWxData"); Object obj = ""; if (apa.hbs != null) { obj = apa.hbs.cfV(); } x.i("MicroMsg.JsApiGetPhoneNumber", "resp data:%s", new Object[]{obj}); if (TextUtils.isEmpty(obj)) { x.e("MicroMsg.JsApiGetPhoneNumber", "resp data is empty"); cVar.fJQ.E(cVar.fFd, cVar.f("fail:resp data is empty", null)); return; } String str; CharSequence charSequence; Object obj2 = apa.rbh; CharSequence charSequence2 = apa.jSv; String str2 = ""; String str3 = ""; if (apa.rRk != null) { str2 = apa.rRk.jOS; cVar.fJU = apa.rRk.fJU; str = apa.rRk.rQD; charSequence = str2; } else { str = str3; Object charSequence3 = str2; } x.i("MicroMsg.JsApiGetPhoneNumber", "appName:%s, desc:%s, IconUrl:%s, ext_desc:%s", new Object[]{charSequence2, charSequence3, obj2, cVar.fJU}); JSONObject jSONObject = null; try { jSONObject = new JSONObject(obj); } catch (JSONException e) { x.e("MicroMsg.JsApiGetPhoneNumber", "new data json exception:%s", new Object[]{e.getMessage()}); } if (jSONObject == null) { x.e("MicroMsg.JsApiGetPhoneNumber", "jsonObj is null"); cVar.fJQ.E(cVar.fFd, cVar.f("fail:jsonObj is null", null)); return; } boolean z; cVar.fJS = jSONObject.optString("data"); JSONObject optJSONObject = jSONObject.optJSONObject("data"); if (optJSONObject == null && !TextUtils.isEmpty(cVar.fJS)) { try { optJSONObject = new JSONObject(cVar.fJS); } catch (JSONException e2) { x.e("MicroMsg.JsApiGetPhoneNumber", "new dataJson exist exception, e:%s", new Object[]{e2.getMessage()}); } } if (optJSONObject != null) { cVar.bTi = optJSONObject.optString("mobile"); boolean optBoolean = optJSONObject.optBoolean("need_auth", false); cVar.fJV = optJSONObject.optBoolean("allow_send_sms", false); z = optBoolean; } else { z = false; } cVar.signature = jSONObject.optString("signature"); cVar.fJT = jSONObject.optString("encryptedData"); cVar.atm = jSONObject.optString("iv"); x.i("MicroMsg.JsApiGetPhoneNumber", "mobile:%s, need_auth:%b, allow_send_sms:%b", new Object[]{cVar.bTi, Boolean.valueOf(z), Boolean.valueOf(cVar.fJV)}); if (cVar.fKc == 0) { if (TextUtils.isEmpty(cVar.bTi)) { cVar.fKc = 3; } else if (z) { cVar.fKc = 2; } else { cVar.fKc = 1; } } if (TextUtils.isEmpty(cVar.bTi)) { x.i("MicroMsg.JsApiGetPhoneNumber", "show the confirm bind phone dialog"); h.a(cVar.fJQ.mContext, false, cVar.fJQ.getContentView().getResources().getString(j.app_brand_get_phone_number_no_bind_phone_msg), cVar.fJQ.getContentView().getResources().getString(j.app_brand_get_phone_number_no_bind_phone_title), cVar.fJQ.getContentView().getResources().getString(j.app_brand_get_phone_number_to_bind_phone), cVar.fJQ.getContentView().getResources().getString(j.app_cancel), new 15(cVar), new c$16(cVar), s$d.green_text_color, s$d.green_text_color); return; } x.i("MicroMsg.JsApiGetPhoneNumber", "show the confirm login dialog"); LayoutInflater layoutInflater = (LayoutInflater) cVar.fJQ.mContext.getSystemService("layout_inflater"); View inflate = layoutInflater.inflate(s.h.app_brand_get_phone_number_do_login, null); ImageView imageView = (ImageView) inflate.findViewById(g.app_brand_get_phone_number_logo); TextView textView = (TextView) inflate.findViewById(g.app_brand_get_phone_number_brand_name); ImageView imageView2 = (ImageView) inflate.findViewById(g.app_brand_get_phone_number_question); TextView textView2 = (TextView) inflate.findViewById(g.app_brand_get_phone_number_desc); TextView textView3 = (TextView) inflate.findViewById(g.app_brand_get_phone_number_phone); View inflate2 = layoutInflater.inflate(s.h.app_brand_get_phone_number_do_expose, null); TextView textView4 = (TextView) inflate2.findViewById(g.app_brand_get_phone_number_expose_url); if (bi.oW(str)) { str = cVar.fJQ.getContentView().getResources().getString(j.app_brand_get_phone_number_expose_desc_default); } String string = cVar.fJQ.getContentView().getResources().getString(j.app_brand_get_phone_number_expose_desc_end); WxaExposedParams.a aVar = new WxaExposedParams.a(); aVar.appId = cVar.fJQ.mAppId; aVar.bVs = cVar.fJQ.gns.getPageURL(); aVar.bJu = 8; a aVar2 = new a(n.a(aVar.aeo())); CharSequence spannableString = new SpannableString(str + string); spannableString.setSpan(aVar2, str.length(), str.length() + string.length(), 18); textView4.setMovementMethod(LinkMovementMethod.getInstance()); textView4.setText(spannableString); if (TextUtils.isEmpty(charSequence2)) { textView.setVisibility(8); } else { textView.setText(charSequence2); textView.setVisibility(0); } textView2.setText(charSequence3); if (TextUtils.isEmpty(cVar.fJU)) { textView3.setVisibility(8); } else { textView3.setText(cVar.fJU); textView3.setVisibility(0); } if (TextUtils.isEmpty(obj2)) { imageView.setImageDrawable(com.tencent.mm.modelappbrand.b.a.JZ()); } else { com.tencent.mm.modelappbrand.b.b.Ka().a(imageView, obj2, com.tencent.mm.modelappbrand.b.a.JZ(), f.dGr); } imageView2.setOnClickListener(new 12(cVar, inflate2)); h.a(cVar.fJQ.mContext, false, cVar.fJQ.getContentView().getResources().getString(j.app_brand_get_phone_number_has_phone_title), inflate, cVar.fJQ.getContentView().getResources().getString(j.app_brand_get_phone_number_has_phone_do_login), cVar.fJQ.getContentView().getResources().getString(j.app_cancel), new c$13(cVar, z), new c$14(cVar)); } }); return; } x.e("MicroMsg.JsApiGetPhoneNumber", "getPhoneNumber JsOperateWxData cgi failed, errType = %d, errCode = %d, errMsg = %s, rr.resp = %s", new Object[]{Integer.valueOf(i), Integer.valueOf(i2), str, bVar.dIE.dIL}); this.fKg.fJQ.E(this.fKg.fFd, this.fKg.f("fail:JsOperateWxData cgi fail", null)); } }
[ "707194831@qq.com" ]
707194831@qq.com
e9258d3408e7bd4fd64c1fdeac2b4cccc87bc4b5
7639d1c6f5cda7a6f2bc3a3ac34f10cc0f3b816e
/checklistbank-mybatis-service/src/main/java/org/gbif/checklistbank/service/mybatis/DatasetMetricsServiceMyBatis.java
761a0063963369ec222cae08882df2292ad4fd3c
[ "Apache-2.0" ]
permissive
marcoskichel/checklistbank
fc6e6c1ab550ef06dbcd0d15c1c211f6419e484b
c6784a84bf73dd2648048f47549e2943a2ab280e
refs/heads/master
2021-01-23T03:16:22.866095
2014-11-25T08:14:20
2014-11-25T08:14:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,645
java
package org.gbif.checklistbank.service.mybatis; import org.gbif.api.model.checklistbank.DatasetMetrics; import org.gbif.api.service.checklistbank.DatasetMetricsService; import org.gbif.checklistbank.service.mybatis.mapper.DatasetMetricsMapper; import java.util.Date; import java.util.List; import java.util.UUID; import com.google.common.collect.ComparisonChain; import com.google.common.collect.Ordering; import com.google.inject.Inject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Implements the NameUsageService using MyBatis. * All PagingResponses will not have the count set as it can be too costly sometimes. */ public class DatasetMetricsServiceMyBatis implements DatasetMetricsService { private static final Logger LOG = LoggerFactory.getLogger(DatasetMetricsServiceMyBatis.class); private final DatasetMetricsMapper mapper; @Inject DatasetMetricsServiceMyBatis(DatasetMetricsMapper mapper) { this.mapper = mapper; } public static class Count<T> implements Comparable<Count<T>>{ private T key; private Integer count; public Count() { } public Count(T key, Integer count) { this.key = key; this.count = count; } public T getKey() { return key; } public void setKey(T key) { this.key = key; } public Integer getCount() { return count; } public void setCount(Integer count) { this.count = count; } @Override public int compareTo(Count<T> that) { return ComparisonChain.start() .compare(this.count, that.count, Ordering.natural().reverse().nullsLast()) .compare(this.key.toString(), that.key.toString()) .result(); } } /** * Returns the latest metric for the given dataset. */ @Override public DatasetMetrics get(UUID datasetKey) { return mapper.get(datasetKey); } /** * Method that calculates all dataset metrics and then persists them as a new dataset_metrics record. * @param datasetKey * @param downloaded the date the dataset was last downloaded from the publisher */ public DatasetMetrics create(UUID datasetKey, Date downloaded) { LOG.info("Create new dataset metrics for {}", datasetKey); mapper.insert(datasetKey, downloaded); return get(datasetKey); } @Override public List<DatasetMetrics> list(UUID datasetKey) { return mapper.list(datasetKey); } /** * @return The percentage of total that count covers, or 0 should the total be 0 */ protected static int getPercentage(int count, int total) { return total > 0 ? count * 100 / total : 0; } }
[ "mdoering@gbif.org" ]
mdoering@gbif.org
e5d67a3794cb4abfd4ba1ad7d000aeb9e9fa0378
29fc88d3ff074543a03aa73efd69b51d957528da
/rongy/src/main/java/com/cd/service/TeamActivityRelUserInfoService.java
d13a1a401f63659ad43650af9387d916b7efc410
[]
no_license
jwnming/rongy
e8a2fc686db1432992c31591aa46e5399328dc60
5d9a77391320991b0887e93582bfabc28a610415
refs/heads/master
2023-08-19T04:20:35.152466
2021-10-11T13:16:19
2021-10-11T13:16:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
210
java
package com.cd.service; import com.cd.entity.TeamActivityType; import java.util.List; public interface TeamActivityRelUserInfoService { List<TeamActivityType> queryTeamActTypeByUserNo(String userNo); }
[ "jwnmingjava@163.com" ]
jwnmingjava@163.com
09cb1527278b4504dab6c519bb93a82f431b39be
4f2940b5eb3f27e407ba1723e95ffff9bc5df72c
/mikeypl/tools/errors/UnknownArmourError.java
9cf19c2156a8f5a84c6701caa8b704f3471d1154
[]
no_license
mikeypl0001/13th-Age
8008022ae4247cbe8fcbe6b4a36ecac4b3ccd859
abf249e4885fe139120f6d81fd75ae697c9c2dc5
refs/heads/master
2021-04-06T10:39:17.373708
2018-03-15T14:32:28
2018-03-15T14:32:28
122,496,911
0
0
null
null
null
null
UTF-8
Java
false
false
365
java
package mikeypl.tools.errors; import java.lang.RuntimeException; // This class is used to throw an error if the value of something is negative public class UnknownArmourError extends RuntimeException { public UnknownArmourError() { super("Invalid Armour, should be none, light, or heavy"); } public UnknownArmourError(String msg) { super(msg); } }
[ "36650702+mikeypl0001@users.noreply.github.com" ]
36650702+mikeypl0001@users.noreply.github.com
8bd720e9eb75626ff93019e7471d065191534a9c
e9687ae0871b5216bf34bef2445ccfc902e9ee34
/akitha_db/vehicledb.java
04de6f7b769d09aebc5b800f519e5b52ea9e34c8
[]
no_license
Irushan22/ITP-Final-2018
dfb1d33e46b321447618323b280de55d29ce75c0
a28bc213e2efc6ce0f25e450f8fdaddd89bfc1a4
refs/heads/master
2022-01-23T22:34:18.039093
2019-08-01T02:07:18
2019-08-01T02:07:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
943
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 akitha_db; import com.mysql.jdbc.Connection; import java.sql.DriverManager; import java.sql.ResultSet; /** * * @author iddak */ public class vehicledb { public static Connection connect(){ Connection conn = null; try { Class.forName("com.mysql.jdbc.Driver"); conn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/itpfinal","root",""); } catch (Exception e) { System.out.println(e); } return conn; } public ResultSet searchQuery(String string) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
[ "noreply@github.com" ]
noreply@github.com
54c3b8b6d3a479cf3840a39179d738dc39d1c524
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
/crash-reproduction-ws/results/XWIKI-14263-116-15-Single_Objective_GGA-WeightedSum/org/xwiki/container/servlet/filters/internal/SavedRequestRestorerFilter_ESTest.java
67dffdb463c8778a9f036aef07ec0a76c854a270
[ "MIT", "CC-BY-4.0" ]
permissive
STAMP-project/Botsing-basic-block-coverage-application
6c1095c6be945adc0be2b63bbec44f0014972793
80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da
refs/heads/master
2022-07-28T23:05:55.253779
2022-04-20T13:54:11
2022-04-20T13:54:11
285,771,370
0
0
null
null
null
null
UTF-8
Java
false
false
603
java
/* * This file was automatically generated by EvoSuite * Wed Apr 01 06:11:36 UTC 2020 */ package org.xwiki.container.servlet.filters.internal; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class SavedRequestRestorerFilter_ESTest extends SavedRequestRestorerFilter_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
970998bf22de0c6b3c70386fd419c7bf983355fb
3130765f287269f474dde937930a6adc00f0806a
/src/main/java/net/minecraft/server/BlockMobSpawner.java
2eec8a141f31a0cd1403396bd51a653e4f38f1fe
[]
no_license
airidas338/mc-dev
928e105789567d1f0416028f1f0cb75a729bd0ec
7b23ae7f3ba52ba8405d14cdbfed8da9f5f7092a
refs/heads/master
2016-09-05T22:12:23.138874
2014-09-26T03:57:07
2014-09-26T03:57:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
781
java
package net.minecraft.server; import java.util.Random; public class BlockMobSpawner extends BlockContainer { protected BlockMobSpawner() { super(Material.STONE); } public TileEntity a(World var1, int var2) { return new TileEntityMobSpawner(); } public Item a(IBlockData var1, Random var2, int var3) { return null; } public int a(Random var1) { return 0; } public void dropNaturally(World var1, Location var2, IBlockData var3, float var4, int var5) { super.dropNaturally(var1, var2, var3, var4, var5); int var6 = 15 + var1.random.nextInt(15) + var1.random.nextInt(15); this.dropExperience(var1, var2, var6); } public boolean c() { return false; } public int b() { return 3; } }
[ "sam.sun469@gmail.com" ]
sam.sun469@gmail.com
5b702d00b8b86e79e32a58a1d90cf1f068038f3a
a25e60d3fbcdd45d20a2a9f127824fcca1d117c7
/core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/DarkPreviewPanel.java
2cd8fff64f94d82934b2d6b0a0ca8f114999d491
[ "MIT" ]
permissive
shefass/darklaf
c36578dd77a9da292e15a7b67ad7310c059c0538
8101b3aa967f3e63c9f2b3a50ed266c39453c773
refs/heads/master
2022-11-06T07:08:20.472922
2020-06-29T14:51:48
2020-06-29T14:51:48
275,797,309
0
0
MIT
2020-06-29T11:42:23
2020-06-29T11:42:22
null
UTF-8
Java
false
false
7,704
java
/* * MIT License * * Copyright (c) 2020 Jannis Weis * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ package com.github.weisj.darklaf.ui.colorchooser; import java.awt.*; import javax.swing.*; import sun.swing.SwingUtilities2; import com.github.weisj.darklaf.graphics.GraphicsContext; import com.github.weisj.darklaf.graphics.GraphicsUtil; /** * @author Jannis Weis */ public class DarkPreviewPanel extends JPanel { private static final int SQUARE_SIZE = 28; private static final int SQUARE_GAP = 4; private static final int INNER_GAP = 4; private static final int SWATCH_WIDTH = 75; private static final int TEXT_GAP = 5; private String sampleText; private Color oldColor = null; public void paintComponent(final Graphics g) { if (oldColor == null) oldColor = getForeground(); g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); if (this.getComponentOrientation().isLeftToRight()) { int squareWidth = paintSquares(g, 0); int textWidth = paintText(g, squareWidth); paintSwatch(g, squareWidth + textWidth); } else { int swatchWidth = paintSwatch(g, 0); int textWidth = paintText(g, swatchWidth); paintSquares(g, swatchWidth + textWidth); } } public Dimension getPreferredSize() { JComponent host = getColorChooser(); if (host == null) { host = this; } FontMetrics fm = host.getFontMetrics(getFont()); int height = fm.getHeight(); int width = SwingUtilities2.stringWidth(host, fm, getSampleText()); int y = height * 3 + TEXT_GAP * 3; int x = SQUARE_SIZE * 3 + SQUARE_GAP * 2 + SWATCH_WIDTH + width + TEXT_GAP * 3; return new Dimension(x, y); } private int paintSquares(final Graphics g, final int offsetX) { Color color = getForeground(); g.setColor(Color.white); g.fillRect(offsetX, 0, SQUARE_SIZE, SQUARE_SIZE); g.setColor(color); g.fillRect(offsetX + INNER_GAP, INNER_GAP, SQUARE_SIZE - (INNER_GAP * 2), SQUARE_SIZE - (INNER_GAP * 2)); g.setColor(Color.white); g.fillRect(offsetX + INNER_GAP * 2, INNER_GAP * 2, SQUARE_SIZE - (INNER_GAP * 4), SQUARE_SIZE - (INNER_GAP * 4)); g.setColor(color); g.fillRect(offsetX, SQUARE_SIZE + SQUARE_GAP, SQUARE_SIZE, SQUARE_SIZE); g.translate(SQUARE_SIZE + SQUARE_GAP, 0); g.setColor(Color.black); g.fillRect(offsetX, 0, SQUARE_SIZE, SQUARE_SIZE); g.setColor(color); g.fillRect(offsetX + INNER_GAP, INNER_GAP, SQUARE_SIZE - (INNER_GAP * 2), SQUARE_SIZE - (INNER_GAP * 2)); g.setColor(Color.white); g.fillRect(offsetX + INNER_GAP * 2, INNER_GAP * 2, SQUARE_SIZE - (INNER_GAP * 4), SQUARE_SIZE - (INNER_GAP * 4)); g.translate(-(SQUARE_SIZE + SQUARE_GAP), 0); g.translate(SQUARE_SIZE + SQUARE_GAP, SQUARE_SIZE + SQUARE_GAP); g.setColor(Color.white); g.fillRect(offsetX, 0, SQUARE_SIZE, SQUARE_SIZE); g.setColor(color); g.fillRect(offsetX + INNER_GAP, INNER_GAP, SQUARE_SIZE - (INNER_GAP * 2), SQUARE_SIZE - (INNER_GAP * 2)); g.translate(-(SQUARE_SIZE + SQUARE_GAP), -(SQUARE_SIZE + SQUARE_GAP)); g.translate((SQUARE_SIZE + SQUARE_GAP) * 2, 0); g.setColor(Color.white); g.fillRect(offsetX, 0, SQUARE_SIZE, SQUARE_SIZE); g.setColor(color); g.fillRect(offsetX + INNER_GAP, INNER_GAP, SQUARE_SIZE - (INNER_GAP * 2), SQUARE_SIZE - (INNER_GAP * 2)); g.setColor(Color.black); g.fillRect(offsetX + INNER_GAP * 2, INNER_GAP * 2, SQUARE_SIZE - (INNER_GAP * 4), SQUARE_SIZE - (INNER_GAP * 4)); g.translate(-((SQUARE_SIZE + SQUARE_GAP) * 2), 0); g.translate((SQUARE_SIZE + SQUARE_GAP) * 2, (SQUARE_SIZE + SQUARE_GAP)); g.setColor(Color.black); g.fillRect(offsetX, 0, SQUARE_SIZE, SQUARE_SIZE); g.setColor(color); g.fillRect(offsetX + INNER_GAP, INNER_GAP, SQUARE_SIZE - (INNER_GAP * 2), SQUARE_SIZE - (INNER_GAP * 2)); g.translate(-((SQUARE_SIZE + SQUARE_GAP) * 2), -(SQUARE_SIZE + SQUARE_GAP)); return (SQUARE_SIZE * 3 + SQUARE_GAP * 2); } private int paintText(final Graphics g, final int offsetX) { GraphicsContext config = GraphicsUtil.setupAntialiasing(g); g.setFont(getFont()); JComponent host = getColorChooser(); if (host == null) { host = this; } FontMetrics fm = SwingUtilities2.getFontMetrics(host, g); int ascent = fm.getAscent(); int height = fm.getHeight(); int width = SwingUtilities2.stringWidth(host, fm, getSampleText()); int textXOffset = offsetX + TEXT_GAP; Color color = getForeground(); g.setColor(color); SwingUtilities2.drawString(host, g, getSampleText(), textXOffset + (TEXT_GAP / 2), ascent); g.fillRect(textXOffset, (height) + TEXT_GAP, width + (TEXT_GAP), height + 2); g.setColor(Color.black); SwingUtilities2.drawString(host, g, getSampleText(), textXOffset + (TEXT_GAP / 2), height + ascent + TEXT_GAP + 2); g.setColor(Color.white); g.fillRect(textXOffset, (height + TEXT_GAP) * 2, width + (TEXT_GAP), height + 2); g.setColor(color); SwingUtilities2.drawString(host, g, getSampleText(), textXOffset + (TEXT_GAP / 2), ((height + TEXT_GAP) * 2) + ascent + 2); config.restore(); return width + TEXT_GAP * 3; } private int paintSwatch(final Graphics g, final int offsetX) { g.setColor(oldColor); g.fillRect(offsetX, 0, SWATCH_WIDTH, SQUARE_SIZE + SQUARE_GAP / 2); g.setColor(getForeground()); g.fillRect(offsetX, SQUARE_SIZE + SQUARE_GAP / 2, SWATCH_WIDTH, SQUARE_SIZE + SQUARE_GAP / 2); return (offsetX + SWATCH_WIDTH); } private JColorChooser getColorChooser() { return (JColorChooser) SwingUtilities.getAncestorOfClass(JColorChooser.class, this); } private String getSampleText() { if (this.sampleText == null) { this.sampleText = UIManager.getString("ColorChooser.sampleText", getLocale()); } return this.sampleText; } }
[ "weisj@arcor.de" ]
weisj@arcor.de
f98ea889b3ef1904a8b2100f1c6032529ff78e50
884056b6a120b2a4c1c1202a4c69b07f59aecc36
/java projects/jtop/jtopas/versions.alt/seeded/v3/src/de/susebox/java/io/PaxHeaders.74544/ExtIOException.java
d608f4f575c50caa740ba4f32371fa74e16d46d6
[ "MIT" ]
permissive
NazaninBayati/SMBFL
a48b16dbe2577a3324209e026c1b2bf53ee52f55
999c4bca166a32571e9f0b1ad99085a5d48550eb
refs/heads/master
2021-07-17T08:52:42.709856
2020-09-07T12:36:11
2020-09-07T12:36:11
204,252,009
3
0
MIT
2020-01-31T18:22:23
2019-08-25T05:47:52
Java
UTF-8
Java
false
false
60
java
30 atime=1476297918.864899312 30 ctime=1476297918.866549439
[ "n.bayati20@gmail.com" ]
n.bayati20@gmail.com
262e6a0e9a177d5ca9f4fef3f59afbfbf36e1292
99e7e34054d67fde190f6a87001c801100f1b4a6
/JavaSE/src/basic_grammar/ConversionDemo.java
f41bca145f0fb7477ca11e6b788d4b09e777b319
[]
no_license
GuangkunYu/Java
759999b809ec62df44cb47386fa2ce031c27f92f
649aab562e4dd8f0ffea3ebdb05cce0a1d291b73
refs/heads/master
2023-01-12T15:37:46.298422
2020-11-17T11:27:52
2020-11-17T11:27:52
283,760,278
0
0
null
null
null
null
UTF-8
Java
false
false
879
java
package basic_grammar; /* 类型转换: 自动类型转换: 把一个表示数据范围小的数值或者变量赋值给另一个表示数据范围大的变量 范例:double d = 10; byte -> short -> int -> long -> float -> double char -> 强制类型转换: 把一个表示数据范围大的数值或者变量赋值给另一个表示数据范围小的变量 格式: 目标数据类型 变量名 = (目标数据类型)值或者变量; 范例: int k = (int)88.88; */ public class ConversionDemo{ public static void main(String[] args){ // 自动类型转换 double d = 10; System.out.println(d); // 定义byte类型的变量 byte b = 10; short s = b; int i = b; // 这是不兼容的 // char c = b; // 强制类型转换:不建议,有数据的丢失 int k = (int)88.88; System.out.println(k); } }
[ "1795056480@qq.com" ]
1795056480@qq.com