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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
df74edd63284dfd541c91a77f2b9c17ea91a9fb7 | 6cc663ea8e50dce19a78dc9a608cfe1bfa9c32cc | /src/com/buy/views/LoaingPageView.java | 74aadec884c269d00060d70694bee11c12a1a4ea | [] | no_license | hai046/Taose | 634ca5940af60f907632f8333aaed5e21d59a5c4 | 6cba2064654e6820ecd19eeb4a08bb1973529943 | refs/heads/master | 2020-04-06T19:01:37.324811 | 2013-03-11T10:58:10 | 2013-03-11T10:58:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,647 | java | package com.buy.views;
import java.util.ArrayList;
import android.content.Context;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import com.brunjoy.taose.R;
public class LoaingPageView extends BaseView implements OnClickListener {
private ArrayList<View> list = new ArrayList<View>( );
private ArrayList<Integer> listId = new ArrayList<Integer>( );
public LoaingPageView(Context mContext) {
super( mContext );
ViewPager mViewPager = new ViewPager( mContext );
setContentView( mViewPager );
initDates( );
mViewPager.setAdapter( new PagerAdapter( ) {
@Override
public boolean isViewFromObject(View arg0, Object arg1) {
return arg0 == arg1;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
View view = list.get( position );
((ViewPager) container).addView( view, 0 );
return view;
}
public void destroyItem(ViewGroup container, int position, Object object) {
((ViewPager) container).removeView( (View) object );
}
@Override
public Parcelable saveState() {
return null;
}
@Override
public int getCount() {
return list.size( );
}
} );
}
protected View getItemView(int index) {
View view = getLayoutInflater( ).inflate( R.layout.loading_help_item, null );
ImageView image = (ImageView) view.findViewById( R.id.loading_help_image );
image.setImageResource( listId.get( index ) );
Button btn = (Button) view.findViewById( R.id.loading_help_close );
if (index == listId.size( ) - 1) {
btn.setOnClickListener( this );
btn.setVisibility( View.VISIBLE );
}
return view;
}
private void initDates() {
listId.add( R.drawable.yindao1 );
listId.add( R.drawable.yindao2 );
listId.add( R.drawable.yindao3 );
listId.add( R.drawable.yindao4 );
for (int i=0;i<listId.size( );i++) {
list.add( getItemView( i ) );
}
}
@Override
public void onClick(View v) {
finish( );
}
}
| [
"haizhu12345@gmail.com"
] | haizhu12345@gmail.com |
f335ea0cea07c52b94972c4215c990237f6dea05 | 790f45ad5e96a414ef783c812cf41d37e37f8508 | /android/sample/src/androidTest/java/com/localytics/mediatracker/ApplicationTest.java | 61d7c29590ea7150b8cba81726a8dc9413faa05b | [] | no_license | localytics/media-trackers | 54ac82b4e9feaaa25daa147c24932d174ff64235 | f9717e16c694a4d448601189fa9566dd7975aae5 | refs/heads/master | 2020-12-25T21:44:39.631425 | 2016-07-29T17:34:03 | 2016-07-29T17:34:03 | 35,297,115 | 1 | 0 | null | 2016-07-29T17:34:04 | 2015-05-08T19:12:05 | Java | UTF-8 | Java | false | false | 358 | java | package com.localytics.mediatracker;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"mriegelhaupt@localytics.com"
] | mriegelhaupt@localytics.com |
ff8fc3b2f31d582b77a5a75afaac08e22e0d5985 | 4becf04b0eee2ff6edd7a8191b7269fb1aab3bf9 | /HbaseGo/src/com/thonnn/hbasego/soul/package-info.java | e75fb72ea851131a545cb33beb8487ab6b85fdad | [
"Apache-2.0"
] | permissive | Thonnn/HbaseSchool | 22861cca2093940f03ee43adaa98355404949497 | 65f096d8936260ed9bfab90f31b47aed5b6c2b85 | refs/heads/Hbase-1.2.5 | 2018-12-06T12:03:48.301398 | 2018-09-10T14:44:48 | 2018-09-10T14:44:48 | 112,150,578 | 4 | 0 | null | 2018-09-04T04:56:06 | 2017-11-27T05:16:23 | Java | UTF-8 | Java | false | false | 142 | java | /**
* HbaseGo 状态收集器所在的包
* @author Thonnn 2018-04-19
* @version 1.2.0
* @since 1.2.0
*/
package com.thonnn.hbasego.soul; | [
"thonnn@163.com"
] | thonnn@163.com |
ebf056103ef95df748ea94979520d808e787516f | 3694ea5eb086dc1278f0143f2c7e4ce591f67cf1 | /myBatisEx04/src/MyBatisEx02.java | 30390717a278e4812fdb1711da56b06fd17d4df4 | [] | no_license | dev-dahye/JSP-practice | 1fbaa8f429749df2970bf42284dc60c8ae62ae74 | d90305b95bb6cf03d848e84c841de31abbaf8fd1 | refs/heads/master | 2023-02-17T16:00:06.452006 | 2021-01-21T00:16:25 | 2021-01-21T00:16:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,266 | java | import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
public class MyBatisEx02 {
public static void main(String[] args) {
// TODO Auto-generated method stub
String resource = "myBatisConfig.xml";
InputStream is = null;
SqlSession sqlSession = null;
try {
is = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(is);
System.out.println("호출 성공");
sqlSession = sqlSessionFactory.openSession(true); //자동 커밋
System.out.println("연결 성공");
int result = sqlSession.delete("delete1", "70");
if(result==1) {
System.out.println("성공");
}else {
System.out.println("실패");
}
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("에러 : " + e.getMessage());
} finally {
if(sqlSession!=null) sqlSession.close();
if(is!=null) try { is.close(); } catch (IOException e) {}
}
}
}
| [
"clo_udhye@naver.com"
] | clo_udhye@naver.com |
c2eddac1d301082368d9204821344342e6c30695 | 815d806c8c56314d96e2dbbae8bab3d9bbd49bc8 | /src/com/company/Application.java | 0fd4cd44ca3a5639bf1cce3d746069a15782199e | [] | no_license | MaxBar/SFMLChessGame | f7c378d90acffd216cc181baf5b83e840eeeec70 | d9d5a2184cdf682728de2c0e119552f7617bd3e6 | refs/heads/master | 2021-05-08T09:57:33.814937 | 2019-05-07T08:52:29 | 2019-05-07T08:52:29 | 119,820,295 | 0 | 0 | null | 2018-02-21T11:44:31 | 2018-02-01T10:27:24 | Java | UTF-8 | Java | false | false | 1,160 | java | package com.company;
import com.company.Engine.GameEngine;
import com.company.GameStates.InitState;
import org.jsfml.graphics.RenderWindow;
import org.jsfml.window.VideoMode;
import java.io.IOException;
import java.sql.Time;
public class Application {
public void run() throws IOException {
//DeltaTime testing
long lastTime = System.nanoTime();
RenderWindow window = new RenderWindow();
window.create(new VideoMode(1600, 1024), "The Ultimate Chess Game!");
window.setFramerateLimit(120);
GameEngine game = new GameEngine();
game.init();
game.changeState(InitState.getInstance(), window);
while(window.isOpen()) {
while (game.running()) {
long time = System.nanoTime();
float deltaTime = (time - lastTime) / 1000000;
lastTime = time;
game.handleEvents(window, deltaTime);
game.update(window, deltaTime);
game.draw(window);
}
}
System.out.println(game.running());
}
}
| [
"max.barnell@gmail.com"
] | max.barnell@gmail.com |
6dda0e0b4dbc3356477cd565d0a056f5b7198961 | 2c2aa1e338ed9c8c70c48a2696e016811fc835bc | /app/src/main/java/com/rndtechnosoft/fooddaily/Model/CategoryList.java | 7d000a9038f8730289c51fe2caac0fb7c18f1424 | [] | no_license | ankrana111994/foodUser | f15d81a5465cba46f400355728c7d4c17a31a1f3 | cea6a1591849e80fe694c43689b3e4e6a0d7a4d9 | refs/heads/main | 2023-01-28T14:10:35.027223 | 2020-10-11T07:33:10 | 2020-10-11T07:33:10 | 303,052,078 | 0 | 0 | null | 2020-12-07T04:15:13 | 2020-10-11T05:52:03 | Java | UTF-8 | Java | false | false | 1,053 | java | package com.rndtechnosoft.fooddaily.Model;
import java.io.Serializable;
public class CategoryList implements Serializable {
String id, category_name, category_image, count;
public CategoryList(String id, String category_name, String category_image, String count) {
this.id = id;
this.category_name = category_name;
this.category_image = category_image;
this.count = count;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCategory_name() {
return category_name;
}
public void setCategory_name(String category_name) {
this.category_name = category_name;
}
public String getCategory_image() {
return category_image;
}
public void setCategory_image(String category_image) {
this.category_image = category_image;
}
public String getCount() {
return count;
}
public void setCount(String count) {
this.count = count;
}
}
| [
"ankush@studiographene.com"
] | ankush@studiographene.com |
04fe7a4fde89c78895c86d4d600a3decd48bd470 | 4948bbdcb491cc6d848ea31ca8715429d521673f | /appserver/src/main/java/com/skylon/server/service/ipl/ReceiverServiceImpl.java | 6d8364fc1a188874ddabb62813d08d1c2a04b9b6 | [] | no_license | JohnTaylor9485/PortWatchingSystem | 6a5c469f5c9c2164c2738ad3c2f3985a53f3bebb | d8368ef68be00f129b5a47de5070aacb3c20fe76 | refs/heads/master | 2022-12-21T14:33:23.807335 | 2018-08-08T06:21:50 | 2018-08-08T06:21:50 | 143,968,349 | 0 | 0 | null | 2022-12-16T00:42:20 | 2018-08-08T06:09:05 | Java | UTF-8 | Java | false | false | 944 | java | package com.skylon.server.service.ipl;
import com.skylon.server.dao.RealtimeMonitoringDao;
import com.skylon.server.service.ReceiverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.IOException;
/**
* @author Jiaming Duan
*/
@Service
public class ReceiverServiceImpl implements ReceiverService{
private ServerStarter serverStarter;
@Autowired
RealtimeMonitoringDao realtimeMonitoringDao;
@Value("${server-port}")
private int port;
@Override
public void startSystem() {
try {
serverStarter = new ServerStarter(realtimeMonitoringDao,port);
serverStarter.start();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void dodestory() {
serverStarter.shutdowm();
}
}
| [
"35509433+JohnTaylor9485@users.noreply.github.com"
] | 35509433+JohnTaylor9485@users.noreply.github.com |
4e30df340eaa2843359403c0a7debacd1a99b44e | 526c98a0dcdc67f46522a91ec39ff9a347aecff1 | /material-intro-screen/src/main/java/id/project/materialintroscreen/adapter/SlidesAdapter.java | b554bd21d8f461eb044779b4853a140c6ffb6938 | [
"MIT"
] | permissive | renalprahardis/FoodOrder | 79e3f39e6a6385577374a0bb2b4db7667dcea4c8 | fc1e835ae6dac4ff829208a7e87df503a325b9d9 | refs/heads/master | 2020-04-10T06:59:51.676809 | 2018-03-07T17:21:49 | 2018-03-07T17:21:49 | 124,266,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,586 | java | package id.project.materialintroscreen.adapter;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;
import java.util.ArrayList;
import id.project.materialintroscreen.SlideFragment;
public class SlidesAdapter extends FragmentStatePagerAdapter {
private ArrayList<SlideFragment> fragments = new ArrayList<>();
public SlidesAdapter(FragmentManager fragmentManager) {
super(fragmentManager);
}
@Override
public SlideFragment getItem(int position) {
return fragments.get(position);
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
SlideFragment fragment = (SlideFragment) super.instantiateItem(container, position);
fragments.set(position, fragment);
return fragment;
}
@Override
public int getCount() {
return fragments.size();
}
public void addItem(SlideFragment fragment) {
fragments.add(getCount(), fragment);
notifyDataSetChanged();
}
public int getLastItemPosition() {
return getCount() - 1;
}
public boolean isLastSlide(int position) {
return position == getCount() - 1;
}
public boolean shouldFinish(int position) {
return position == getCount() && getItem(getCount() - 1).canMoveFurther();
}
public boolean shouldLockSlide(int position) {
SlideFragment fragment = getItem(position);
return !fragment.canMoveFurther() || fragment.hasNeededPermissionsToGrant();
}
}
| [
"renalprahardis@gmail.com"
] | renalprahardis@gmail.com |
22f9eb8dfe0752c8b3ea5877db495f910c706d2c | 1d73b22f0d4765f194361d2a7805e058e0947ad8 | /ilts-server/src/main/java/com/ilts/anywhere/response/NewOrderResponse.java | 9d5d5e00305ffea9ca17a6ea5e62e007c0c54550 | [] | no_license | jalapeno30/aaaw | cfd07e2796f347e149f2fb32177bf4c3342cd5e5 | 325f46176c8d030d7110948f36a2837640813553 | refs/heads/master | 2021-01-17T19:17:53.300542 | 2016-06-10T19:57:21 | 2016-06-10T19:57:21 | 60,873,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package com.ilts.anywhere.response;
public class NewOrderResponse extends Response {
NewOrderResponse() {
super(ResponseType.SUCCESSNEWORDER);
construct();
}
@Override
protected void construct() {
System.out.println("Successfully added order");
setStatus("success");
}
}
| [
"tdelaney@corp.ilts.com"
] | tdelaney@corp.ilts.com |
1b133cb10bd1ea88b42467e1c1a241aca2ea9fb6 | 79dbcbe32ea0839c5ba95b06dfc70b60f36b46db | /src/main/java/org/apache/ibatis/reflection/invoker/package-info.java | 84067b190b2fe57195ca739204dfb304caf66a7e | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | Yhongwu/mybatis-3.4-src | 4df26684c056eb1bb9f5f192425888feaef8d5e7 | 18150d1538f420614953e11527e95830c5e93bab | refs/heads/master | 2022-06-30T13:06:56.394448 | 2019-10-28T08:57:33 | 2019-10-28T08:57:33 | 213,336,726 | 0 | 0 | Apache-2.0 | 2022-06-29T19:33:11 | 2019-10-07T08:54:52 | Java | UTF-8 | Java | false | false | 732 | java | /**
* Copyright ${license.git.copyrightYears} the original author or authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
* <p>
* Unused.
*/
/**
* Unused.
*/
package org.apache.ibatis.reflection.invoker;
| [
"hongwu39028@163.com"
] | hongwu39028@163.com |
f76644a75b1ba3f532fb30916cc94b6dbfa9a905 | 98852ecc1f5bab35ad6a8220a2bb82631b8a0601 | /javaExamples/structures_book/ch14 Code/jss2/exceptions/FullNodeException.java | 30fe3df1f2332d7a7ab1e480e980548a538a5705 | [] | no_license | frsilent/random | 502c86f1468bab52bc734647984ae3ad0860e5e2 | c728c56b71f5d543352d6a2f132d072dc83e5469 | refs/heads/master | 2020-12-24T08:49:55.311550 | 2017-01-28T16:27:58 | 2017-01-28T16:27:58 | 20,199,810 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | //********************************************************************
// FullNodeException.java Authors: Lewis/Chase
//
// Represents the situation in which a node in an ancestor tree
// already has two parents and an attempt has been made to add
// another parent.
//
//********************************************************************
package jss2.exceptions;
public class FullNodeException extends RuntimeException
{
/******************************************************************
Sets up this exception with an appropriate message.
******************************************************************/
public FullNodeException (String collection)
{
super ("The selected node already has two parents");
}
}
| [
"rheintze@linux.com"
] | rheintze@linux.com |
ee9c924f18f93fbeaee6ca40eef674aae44fa5d7 | 99fbd4967c7d2e2e8935c858afe63acbd10605ac | /random.java | 889f9c37fd9cd7e1293bade4a052c199619f56f7 | [] | no_license | pranithareddy-123/cts | 6c991a2bd337b5d78cdfca099e1f9829cf734d91 | f2a7889a8beee0c70006581af8cfdc9af9e6cf97 | refs/heads/master | 2022-12-21T22:47:47.717427 | 2020-02-18T09:00:24 | 2020-02-18T09:00:24 | 235,055,706 | 0 | 0 | null | 2022-03-31T22:05:12 | 2020-01-20T08:44:01 | HTML | UTF-8 | Java | false | false | 182 | java | import java.lang.Math;
class Random{
public static void main(String args[]){
int b=60;
double d=46.4;
System.out.println(Math.floor(b));
System.out.println(Math.ceil(d));
}
} | [
"noreply@github.com"
] | noreply@github.com |
bc1610855e00e8f169af9c073e1cf65297e980e3 | 2888c00fd8a4c954ec732d9c3413d6eb649b5ac3 | /cavery/src/com/me/cavery/entities/Entity.java | ae7697dc5bacfd46a833bfb9b4b94091b5f66671 | [] | no_license | Benji4R/CaveryGame | 18304de240806aa1df4630273be94f0e20fc85a2 | c6c62710dfa873dd07ace60b3fac8a9b19399a73 | refs/heads/master | 2020-05-31T15:22:44.220593 | 2013-07-26T04:31:04 | 2013-07-26T04:31:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | /**
*
*/
package com.me.cavery.entities;
/**
* @author Sparky
*
*/
public class Entity {
public boolean isSolid = false;
}
| [
"toni.schiemank@live.com"
] | toni.schiemank@live.com |
2b47bfb85f65b2acc8e9d576e08e782b0059686f | a5de1c545dc410ba04e60686ac2893aa9c667bc6 | /src/test/me/salimm/allconfig/XMLTest.java | d8b575878a2046147151aa1a12c71a276a822725 | [] | no_license | salimm/AllConfig | 96bb1b1211e6d6759c9e6d19e3bd87a9bec3dacb | 4be37616e5cb85725e202fa10b2a0281ef89b1fe | refs/heads/master | 2021-01-22T17:39:03.489065 | 2018-09-20T11:45:02 | 2018-09-20T11:45:02 | 60,346,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,696 | java | package test.me.salimm.allconfig;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import org.junit.Test;
import me.salimm.allconfig.core.Config;
import me.salimm.allconfig.core.types.XMLConfig;
public class XMLTest {
@Test
public void parseFile() throws Exception {
Config conf = new XMLConfig("samples/sample_conf.xml");
assertNotNull(conf);
}
@Test
public void parseInputStreamXML() throws Exception {
Config conf = new XMLConfig(new FileInputStream("samples/sample_conf.xml"));
assertNotNull(conf);
}
@Test
public void getValueTest() throws FileNotFoundException, Exception {
Config conf = new XMLConfig(new FileInputStream("samples/sample_conf.xml"));
assertEquals(conf.getBoolean("conf.test.args.useSSL"), false);
assertEquals(conf.getInteger("conf.test.TEST.X"), 1);
assertEquals(conf.getInteger("conf.test.TEST.x"), 2);
assertEquals(conf.getString("conf.test.DB_USER"), "TEST_USER");
}
@Test
public void getValueTestDefault() throws FileNotFoundException, Exception {
Config conf = new XMLConfig(new FileInputStream("samples/sample_conf.xml"));
assertEquals(conf.getBoolean("conf.test.args.useSSL",true), false);
assertEquals(conf.getBoolean("conf.test.args.NOT_FOUND",true), true);
assertEquals(conf.getInteger("conf.test.TEST.X",1), 1);
assertEquals(conf.getInteger("conf.test.TEST.Y",3), 3);
}
@Test
public void getMapTest() throws FileNotFoundException, Exception {
Config conf = new XMLConfig(new FileInputStream("samples/sample_conf.xml"));
assertEquals(conf.getBoolean("conf.test.args.useSSL",true), false);
}
}
| [
"salimm@cs.pitt.edu"
] | salimm@cs.pitt.edu |
3c7329c87cddbcd9cc23fb62cea6468ca609db7c | 60feada88a66bf1c9a68a74ecf588c5dc9d42e1a | /src/test/java/com/bookerdimaio/scrabble/config/timezone/HibernateTimeZoneIT.java | 59fe44bf36fea57a9a085772d4edada539410c3b | [] | no_license | cmavelis/scr-gate | a877c40aec4ec2c8cd97856289407905b020677a | be55a73622ac8bd0fd12e9b8ec88fc201eb6231a | refs/heads/master | 2022-12-24T22:32:37.880800 | 2019-08-22T16:18:40 | 2019-08-22T16:18:40 | 204,721,722 | 0 | 0 | null | 2022-12-16T05:03:16 | 2019-08-27T14:30:35 | TypeScript | UTF-8 | Java | false | false | 6,900 | java | package com.bookerdimaio.scrabble.config.timezone;
import com.bookerdimaio.scrabble.ScrabblecompanionApp;
import com.bookerdimaio.scrabble.repository.timezone.DateTimeWrapper;
import com.bookerdimaio.scrabble.repository.timezone.DateTimeWrapperRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.transaction.annotation.Transactional;
import java.time.*;
import java.time.format.DateTimeFormatter;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for the UTC Hibernate configuration.
*/
@SpringBootTest(classes = ScrabblecompanionApp.class)
public class HibernateTimeZoneIT {
@Autowired
private DateTimeWrapperRepository dateTimeWrapperRepository;
@Autowired
private JdbcTemplate jdbcTemplate;
private DateTimeWrapper dateTimeWrapper;
private DateTimeFormatter dateTimeFormatter;
private DateTimeFormatter timeFormatter;
private DateTimeFormatter dateFormatter;
@BeforeEach
public void setup() {
dateTimeWrapper = new DateTimeWrapper();
dateTimeWrapper.setInstant(Instant.parse("2014-11-12T05:50:00.0Z"));
dateTimeWrapper.setLocalDateTime(LocalDateTime.parse("2014-11-12T07:50:00.0"));
dateTimeWrapper.setOffsetDateTime(OffsetDateTime.parse("2011-12-14T08:30:00.0Z"));
dateTimeWrapper.setZonedDateTime(ZonedDateTime.parse("2011-12-14T08:30:00.0Z"));
dateTimeWrapper.setLocalTime(LocalTime.parse("14:30:00"));
dateTimeWrapper.setOffsetTime(OffsetTime.parse("14:30:00+02:00"));
dateTimeWrapper.setLocalDate(LocalDate.parse("2016-09-10"));
dateTimeFormatter = DateTimeFormatter
.ofPattern("yyyy-MM-dd HH:mm:ss.S")
.withZone(ZoneId.of("UTC"));
timeFormatter = DateTimeFormatter
.ofPattern("HH:mm:ss")
.withZone(ZoneId.of("UTC"));
dateFormatter = DateTimeFormatter
.ofPattern("yyyy-MM-dd");
}
@Test
@Transactional
public void storeInstantWithUtcConfigShouldBeStoredOnGMTTimeZone() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("instant", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeFormatter.format(dateTimeWrapper.getInstant());
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeLocalDateTimeWithUtcConfigShouldBeStoredOnGMTTimeZone() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("local_date_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getLocalDateTime()
.atZone(ZoneId.systemDefault())
.format(dateTimeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeOffsetDateTimeWithUtcConfigShouldBeStoredOnGMTTimeZone() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("offset_date_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getOffsetDateTime()
.format(dateTimeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeZoneDateTimeWithUtcConfigShouldBeStoredOnGMTTimeZone() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("zoned_date_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getZonedDateTime()
.format(dateTimeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeLocalTimeWithUtcConfigShouldBeStoredOnGMTTimeZoneAccordingToHis1stJan1970Value() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("local_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getLocalTime()
.atDate(LocalDate.of(1970, Month.JANUARY, 1))
.atZone(ZoneId.systemDefault())
.format(timeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeOffsetTimeWithUtcConfigShouldBeStoredOnGMTTimeZoneAccordingToHis1stJan1970Value() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("offset_time", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getOffsetTime()
.toLocalTime()
.atDate(LocalDate.of(1970, Month.JANUARY, 1))
.atZone(ZoneId.systemDefault())
.format(timeFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
@Test
@Transactional
public void storeLocalDateWithUtcConfigShouldBeStoredWithoutTransformation() {
dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
String request = generateSqlRequest("local_date", dateTimeWrapper.getId());
SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
String expectedValue = dateTimeWrapper
.getLocalDate()
.format(dateFormatter);
assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
}
private String generateSqlRequest(String fieldName, long id) {
return format("SELECT %s FROM jhi_date_time_wrapper where id=%d", fieldName, id);
}
private void assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(SqlRowSet sqlRowSet, String expectedValue) {
while (sqlRowSet.next()) {
String dbValue = sqlRowSet.getString(1);
assertThat(dbValue).isNotNull();
assertThat(dbValue).isEqualTo(expectedValue);
}
}
}
| [
"cmavelis@gmail.com"
] | cmavelis@gmail.com |
c135380f9642c58bea8e25ce3cb8dc1df7b27e1d | 13a8a3ee0edebb1b00d235b34415dda01e562208 | /app/src/main/java/com/cmpinspector/app/HomeSection/BasicDetails_1_SaveActivity.java | 0cdb7a6358293a8d599be01686c40df07b9ca699 | [] | no_license | shivM9794/CMPInspector | 401283b0e885c62be8125a2892c50316b1582f03 | 84c75a5e6ea93f888579cba936c076c082b5098a | refs/heads/master | 2023-08-04T20:10:33.077231 | 2021-09-13T19:25:09 | 2021-09-13T19:25:09 | 406,102,011 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,272 | java | package com.cmpinspector.app.HomeSection;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import com.cmpinspector.app.R;
public class BasicDetails_1_SaveActivity extends AppCompatActivity {
ImageView imageView;
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_basic_details1_save);
button = findViewById(R.id.btn_save1);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(BasicDetails_1_SaveActivity.this,BasicDetails_2_SaveActivity.class);
startActivity(i);
}
});
imageView = findViewById(R.id.basic_detail1_img1);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(BasicDetails_1_SaveActivity.this,BasicDetails1Activity.class);
startActivity(intent);
}
});
}
} | [
"mishra.shivam.shivam29@gmail.com"
] | mishra.shivam.shivam29@gmail.com |
cd045667ec4954841cbd79e23bdde5df1251d967 | 9e62f2c6ae62be2806e3e53fbaa59b79a4fa5ea6 | /blazeds-ex1-web/src/main/java/kaizencreek/service/TimeService.java | 495fc331189ac0e80f5684b0246e1e6f95ee5483 | [] | no_license | drmikeh/DrMikeH_MVN_Flex_Mate_Spring_BlazeDS_EX1 | 13ba557fa1583ddab4fb30c2420986f48b94a028 | f010ac68e050321156931eb581d81741e3772d3b | refs/heads/master | 2021-01-01T16:25:03.780565 | 2011-03-31T23:28:05 | 2011-03-31T23:28:05 | 381,974 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 159 | java | /**
*
*/
package kaizencreek.service;
import java.util.Date;
/**
* @author michaelhopper
*
*/
public interface TimeService {
public Date getTime();
}
| [
"mhopper@modosports.com"
] | mhopper@modosports.com |
ce2637b1cab2cc3552cf348d2d1c3246d4d4d160 | a0e313d6577c6e93509c5cde0380d6d425d83729 | /src/cn/codexin/questions/Q0803_Bricks_Falling_When_Hit.java | 3d35930d768c667f9a9e8f00f8cebd7a352aabd8 | [] | no_license | Xin98/LeetCodePractice | f56fec1f9831441756e9d0a725be8f2385b95693 | c6c44c9cd14e9fac188398162d010773b8feefbc | refs/heads/master | 2021-08-15T23:55:44.681129 | 2021-07-22T15:17:45 | 2021-07-22T15:17:45 | 250,441,453 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,508 | java | package cn.codexin.questions;
import java.util.Arrays;
/**
* Created by xinGao 2021/1/16
*/
public class Q0803_Bricks_Falling_When_Hit {
private int m;
private int n;
class UnionFind {
private int[] f;
private int[] size;
public UnionFind(int n) {
f = new int[n];
size = new int[n];
for (int i = 0; i < n; i++) {
f[i] = i;
}
Arrays.fill(size, 1);
}
public int search(int x) {
if (x != f[x]) {
f[x] = search((f[x]));
}
return f[x];
}
public void merge(int x, int y) {
int fx = search(x);
int fy = search(y);
if (fx != fy) {
f[fx] = fy;
size[fy] += size[fx];
}
}
public int getSize(int x) {
return size[search(x)];
}
}
private int getIndex(int x, int y) {
return x * n + y;
}
private boolean inArea(int x, int y) {
return x >= 0 && y >= 0 && x < m && y < n;
}
public int[] hitBricks(int[][] grid, int[][] hits) {
this.m = grid.length;
this.n = grid[0].length;
int[][] dirs = new int[][]{{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
int size = m * n;
UnionFind uf = new UnionFind(size + 1);
int[][] cp = new int[m][n];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
cp[i][j] = grid[i][j];
}
}
//1. remove all hit bricks
for (int[] hit : hits) {
int i = hit[0];
int j = hit[1];
cp[i][j] = 0;
}
//2. merge all top-connected bricks
for (int j = 0; j < n; j++) {
if (cp[0][j] == 1) {
uf.merge(j, size);
}
}
//3. merge all connected bricks
for (int i = 1; i < m; i++) {
for (int j = 0; j < n; j++) {
if (cp[i][j] != 1) {
continue;
}
if (j > 0 && cp[i][j - 1] == 1) {
uf.merge(getIndex(i, j), getIndex(i, j - 1));
}
if (cp[i - 1][j] == 1) {
uf.merge(getIndex(i, j), getIndex(i - 1, j));
}
}
}
//4. restore bricks by reverse hit order
int hitLen = hits.length;
int[] res = new int[hitLen];
for (int i = hitLen - 1; i >= 0; i--) {
int x = hits[i][0];
int y = hits[i][1];
// empty hit will change nothing.
if (grid[x][y] == 0) {
continue;
}
int origin = uf.getSize(size);
if (x == 0) {
uf.merge(y, size);
}
for (int[] dir : dirs) {
int nx = x + dir[0];
int ny = y + dir[1];
if (inArea(nx, ny) && cp[nx][ny] == 1) {
uf.merge(getIndex(x, y), getIndex(nx, ny));
}
}
int current = uf.getSize(size);
res[i] = Math.max(0, current - origin - 1);
cp[x][y] = 1;
}
return res;
}
public static void main(String[] args) {
Q0803_Bricks_Falling_When_Hit Q = new Q0803_Bricks_Falling_When_Hit();
Q.hitBricks(new int[][]{{1, 0, 1}, {1, 1, 1}}, new int[][]{{0, 0}, {0, 2}, {1, 1}});
}
}
| [
"emgaox@163.com"
] | emgaox@163.com |
aace6cffb6c0d791d68f94ab79889fe0c6ff73c4 | a885671d5f7bdc89b3015f9d6a972c9b69befab8 | /src/main/java/com/demo/todolist/service/ToDoListService.java | df5642650c23a879bed6f76e42fc7133a578864f | [] | no_license | doriereiter44/to-do-list | 8ae02025d4b6a7e8a57f40f5371b1c49797b71c1 | db874f6c67b7a80941cb573e6e365476a910abbb | refs/heads/master | 2023-02-26T11:14:17.992599 | 2021-01-29T04:19:58 | 2021-01-29T04:19:58 | 334,032,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 592 | java | package com.demo.todolist.service;
import com.demo.todolist.exception.ToDoListException;
import com.demo.todolist.model.ToDoItem;
import com.demo.todolist.model.ToDoList;
import java.util.List;
import java.util.Map;
public interface ToDoListService {
void createToDoList(ToDoList toDoList) throws ToDoListException;
String addItemToMostRecentCreatedList(ToDoItem toDoItem) throws ToDoListException;
void addItemToList(ToDoItem toDoItem, String listName) throws ToDoListException;
List<Map<String, Object>> getAllItemsForList(String listName) throws ToDoListException;
}
| [
"Dorie.Reiter@aexp.com"
] | Dorie.Reiter@aexp.com |
018e40335dcf46a696d76b844acbe24fe2d643cd | 6a76262b74d2b749533b46da277f218f14bf8759 | /src/com/ibs/akalimullin/task3/Arrays.java | be0e4dc18b94c7e397c2387a311b1762bd264c6f | [] | no_license | theVillageCoder/appline_java | d53f19b5cc674049d06883598ce6f3b0970d885b | 1f9270c8fb6ddf7af6390dc7930196714b659f86 | refs/heads/main | 2023-07-12T17:53:32.534168 | 2021-08-24T01:06:31 | 2021-08-24T01:06:31 | 394,462,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package com.ibs.akalimullin.task3;
public class Arrays {
public static void main(String[] args) {
int[] arr = {1, 2, 3, 4, 5};
int temp = arr[0];
arr[0] = arr[arr.length - 1];
arr[arr.length - 1] = temp;
System.out.println(arr[0] + arr[arr.length/2]);
}
}
| [
"mrchestalker@gmail.com"
] | mrchestalker@gmail.com |
fe8d32f7e042830e6d7da15c7c6f700dc476ccd5 | 42b257419d3f9635d45c897509a74a39d3c00f32 | /src/beatbox/BeatBox.java | 1c34fb670639dae28b0750ab3baaafdb289a181b | [] | no_license | doper1234/BeatBox | 99ebc5b21b5a5208a0986309440225f799a92c6f | 2cb688512fb17145e9b308d1ab37058b5af928e1 | refs/heads/master | 2016-09-05T09:08:30.744300 | 2015-08-10T09:46:45 | 2015-08-10T09:46:45 | 40,474,524 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,297 | 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 beatbox;
import java.awt.*;
import javax.swing.*;
import javax.sound.midi.*;
import java.util.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class BeatBox implements ChangeListener{
JPanel mainPanel;
JLabel sliderValue;
JSlider changeTempo;
ArrayList<JCheckBox> checkboxList;
Sequencer sequencer;
Sequence sequence;
Track track;
JFrame theFrame;
String[] instrumentNames = {"Bass Drum", "Closed Hi-Hat", "Open Hi-Hat",
"Acoustic Snare", "Crash Cymbal", "Hand Clap", "High Tom", "Hi Bongo",
"Maracas", "Whistle", "Low Conga", "Cowbell", "Vibraslap", "Low-Mid Tom",
"High Agogo", "Open Hi Conga"};
int[] instruments = {35,42,46,38,49,39,50,60,70,72,64,56,58,47,67,63};
public static void main(String[] args) {
new BeatBox().buildGUI();
}
public void buildGUI(){
theFrame = new JFrame("Cyber BeatBox");
theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
BorderLayout layout = new BorderLayout();
JPanel background = new JPanel(layout);
background.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
checkboxList = new ArrayList<JCheckBox>();
Box buttonBox = new Box(BoxLayout.Y_AXIS);
JButton start = new JButton("Start");
start.addActionListener(new MyStartListener());
buttonBox.add(start);
JButton stop = new JButton("Stop");
stop.addActionListener(new MyStopListener());
buttonBox.add(stop);
changeTempo = new JSlider(JSlider.HORIZONTAL,0,220, 120);
changeTempo.addChangeListener(this);
sliderValue = new JLabel("120");
buttonBox.add(sliderValue);
buttonBox.add(changeTempo);
JButton upTempo = new JButton("Tempo Up");
upTempo.addActionListener(new MyUpTempoListener());
buttonBox.add(upTempo);
JButton downTempo = new JButton("Tempo Down");
downTempo.addActionListener(new MyDownTempoListener());
buttonBox.add(downTempo);
JButton reset = new JButton("reset");
reset.addActionListener(new MyResetListener());
buttonBox.add(reset);
JButton serialize = new JButton("Save(serialize)");
serialize.addActionListener(new MySendListener());
buttonBox.add(serialize);
JButton restore = new JButton("Load(restore)");
restore.addActionListener(new MyReadInListener());
buttonBox.add(restore);
JButton exit = new JButton("exit");
exit.addActionListener(new MyExitListener());
buttonBox.add(exit);
Box nameBox = new Box(BoxLayout.Y_AXIS);
for(int i = 0; i < 16; i ++){
nameBox.add(new Label(instrumentNames[i]));
}
background.add(BorderLayout.EAST, buttonBox);
background.add(BorderLayout.WEST, nameBox);
theFrame.getContentPane().add(background);
GridLayout grid = new GridLayout(16,16);
grid.setVgap(1);
grid.setHgap(2);
mainPanel = new JPanel(grid);
background.add(BorderLayout.CENTER, mainPanel);
for(int i = 0; i < 256; i++){
JCheckBox c = new JCheckBox();
c.setSelected(false);
checkboxList.add(c);
mainPanel.add(c);
}
setUpMidi();
theFrame.setBounds(50, 50, 300, 300);
theFrame.pack();
theFrame.setVisible(true);
}
public void setUpMidi(){
try{
sequencer = MidiSystem.getSequencer();
sequencer.open();
sequence = new Sequence(Sequence.PPQ,4);
track = sequence.createTrack();
sequencer.setTempoInBPM(120);
}catch(Exception e) {e.printStackTrace();}
}
public void buildTrackAndStart(){
int[] trackList = null;
sequence.deleteTrack(track);
track = sequence.createTrack();
for(int i = 0; i < 16; i++){
trackList = new int[16];
int key = instruments[i];
for(int j = 0; j < 16; j ++){
JCheckBox jc = checkboxList.get(j+16*i);
if( jc.isSelected()){
trackList[j] = key;
}
else{
trackList[j] = 0;
}
}
makeTracks(trackList);
track.add(makeEvent(176,1,127,0,16));
}
track.add(makeEvent(192,9,1,0,15));
try{
sequencer.setSequence(sequence);
sequencer.setLoopCount(sequencer.LOOP_CONTINUOUSLY);
sequencer.start();
sequencer.setTempoInBPM(120);
}
catch(Exception e){
e.printStackTrace();
}
}
@Override
public void stateChanged(ChangeEvent ce) {
sliderValue.setText(Integer.toString(changeTempo.getValue()));
sequencer.setTempoInBPM(changeTempo.getValue());
}
public class MyStartListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent ae) {
buildTrackAndStart();
}
}
public class MyStopListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent ae) {
sequencer.stop();
}
}
public class MyUpTempoListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent ae) {
float tempoFactor = sequencer.getTempoFactor();
sequencer.setTempoFactor((float)(tempoFactor * 1.03));
changeTempo.setValue((int)(sequencer.getTempoInBPM()));
sliderValue.setText(Integer.toString(changeTempo.getValue()));
}
}
public class MyDownTempoListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent ae) {
float tempoFactor = sequencer.getTempoFactor();
sequencer.setTempoFactor((float)(tempoFactor * 0.97));
}
}
public class MyResetListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent ae) {
for(int i = 0; i < checkboxList.size(); i ++){
JCheckBox c = (JCheckBox) checkboxList.get(i);
c.setSelected(false);
}
}
}
public class MyExitListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent ae) {
int exit = JOptionPane.showConfirmDialog(null, "Are you sure you want to quit?", "Warning", JOptionPane.YES_NO_OPTION);
if(exit == JOptionPane.YES_OPTION){
System.exit(0);
}
}
}
public void makeTracks(int[] list){
for(int i = 0; i < 16; i++){
int key = list[i];
if(key != 0){
track.add(makeEvent(144,9,key,100,i));
track.add(makeEvent(128,9,key,100,i+1));
}
}
}
public MidiEvent makeEvent(int comd, int chan, int one, int two, int tick){
MidiEvent event = null;
try{
ShortMessage a = new ShortMessage();
a.setMessage(comd, chan, one, two);
event = new MidiEvent(a, tick);
}
catch(Exception e){
e.printStackTrace();
}
return event;
}
public class MySendListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent ae) {
boolean[] checkboxState = new boolean[256];
for (int i = 0; i < checkboxState.length; i ++){
JCheckBox check = (JCheckBox) checkboxList.get(i);
if(check.isSelected()){
checkboxState[i] = true;
}
}
try{
JFileChooser fileSave = new JFileChooser();
fileSave.showSaveDialog(theFrame);
FileOutputStream fileStream = new FileOutputStream(fileSave.getSelectedFile());
ObjectOutputStream os = new ObjectOutputStream(fileStream);
os.writeObject(checkboxState);
}
catch(Exception ex){
ex.printStackTrace();
}
}
}
public class MyReadInListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent ae) {
boolean[] checkboxState = null;
try{
JFileChooser fileOpen = new JFileChooser();
fileOpen.showOpenDialog(theFrame);
FileInputStream fileIn = new FileInputStream(fileOpen.getSelectedFile());
ObjectInputStream is = new ObjectInputStream(fileIn);
checkboxState = (boolean[]) is.readObject();
}
catch(Exception ex){
ex.printStackTrace();
}
for(int i = 0; i < checkboxState.length; i ++){
JCheckBox check = (JCheckBox) checkboxList.get(i);
if(checkboxState[i]){
check.setSelected(true);
}
else{
check.setSelected(false);
}
}
sequencer.stop();
buildTrackAndStart();
}
}
}
| [
"metroidprm3.0@hotmail.com"
] | metroidprm3.0@hotmail.com |
67f853728c17a65a52840927f5576c0838dc4f48 | dbeb131c25608575482d4777abab6258b6082cfa | /Gramaticas/Insert/InsertParserSym.java | dc8176f88b8976cad9fbc28248a9b0df679c3440 | [] | no_license | froi0409/GCIC | 51bae0e392ad7218697aed90b9f7feb7374ae72b | 2fd4b63906165d1555466512e0e8abe296e179bd | refs/heads/main | 2023-04-28T16:32:22.755126 | 2021-05-18T19:49:15 | 2021-05-18T19:49:15 | 359,643,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,495 | java |
//----------------------------------------------------
// The following code was generated by CUP v0.11b 20160615 (GIT 4ac7450)
//----------------------------------------------------
/** CUP generated class containing symbol constants. */
public class InsertParserSym {
/* terminals */
public static final int AQUA = 51;
public static final int LEFT = 60;
public static final int FONTFAMILY = 23;
public static final int HEXADECIMAL = 52;
public static final int MENOR_QUE = 76;
public static final int COLUMN = 69;
public static final int H1 = 16;
public static final int TYPE = 25;
public static final int TEAL = 38;
public static final int RIGHT = 61;
public static final int ROWS = 29;
public static final int CHECKBOX = 67;
public static final int NAME = 27;
public static final int ROW = 68;
public static final int TEXTO = 72;
public static final int MAROON = 41;
public static final int SANS_SERIF = 59;
public static final int BLUE = 40;
public static final int ALT = 34;
public static final int YELLOW = 50;
public static final int FUCHSIA = 45;
public static final int WHITE = 47;
public static final int BLACK = 36;
public static final int MAYOR_QUE = 78;
public static final int GRAY = 43;
public static final int PIXELES = 53;
public static final int BACKGROUND = 20;
public static final int CENTER = 62;
public static final int TEXT = 64;
public static final int PURPLE = 48;
public static final int WIDTH = 32;
public static final int CLASS = 30;
public static final int SELECT = 10;
public static final int NUMBER = 65;
public static final int TEXTAREA = 9;
public static final int IGUAL = 81;
public static final int OLIVE = 37;
public static final int COLS = 28;
public static final int PORCENTAJE = 54;
public static final int ALLCHAR = 73;
public static final int JUSTIFY = 63;
public static final int TEXTALIGN = 24;
public static final int INPUT = 8;
public static final int GCIC = 2;
public static final int DIV = 12;
public static final int NAVY = 42;
public static final int MENOR_CIERRE = 77;
public static final int P = 17;
public static final int CORC = 80;
public static final int COURIER = 55;
public static final int CORA = 79;
public static final int DIGITO_COM = 75;
public static final int LINK = 5;
public static final int EOF = 0;
public static final int ARIAL = 57;
public static final int BUTTON = 15;
public static final int SPAM = 7;
public static final int VERDANA = 56;
public static final int GENEVA = 58;
public static final int SCRIPTING = 18;
public static final int SRC = 31;
public static final int ID_ETIQUETA = 70;
public static final int BODY = 6;
public static final int HREF = 19;
public static final int TITLE = 4;
public static final int error = 1;
public static final int ID = 26;
public static final int COLOR = 21;
public static final int HEAD = 3;
public static final int SILVER = 49;
public static final int LIME = 44;
public static final int IMG = 13;
public static final int FONTSIZE = 22;
public static final int RADIO = 66;
public static final int HEIGHT = 33;
public static final int BR = 14;
public static final int RED = 39;
public static final int ALFANUMERICO = 71;
public static final int OPTION = 11;
public static final int ONCLICK = 35;
public static final int ALLCHARNOSPACE = 74;
public static final int GREEN = 46;
public static final String[] terminalNames = new String[] {
"EOF",
"error",
"GCIC",
"HEAD",
"TITLE",
"LINK",
"BODY",
"SPAM",
"INPUT",
"TEXTAREA",
"SELECT",
"OPTION",
"DIV",
"IMG",
"BR",
"BUTTON",
"H1",
"P",
"SCRIPTING",
"HREF",
"BACKGROUND",
"COLOR",
"FONTSIZE",
"FONTFAMILY",
"TEXTALIGN",
"TYPE",
"ID",
"NAME",
"COLS",
"ROWS",
"CLASS",
"SRC",
"WIDTH",
"HEIGHT",
"ALT",
"ONCLICK",
"BLACK",
"OLIVE",
"TEAL",
"RED",
"BLUE",
"MAROON",
"NAVY",
"GRAY",
"LIME",
"FUCHSIA",
"GREEN",
"WHITE",
"PURPLE",
"SILVER",
"YELLOW",
"AQUA",
"HEXADECIMAL",
"PIXELES",
"PORCENTAJE",
"COURIER",
"VERDANA",
"ARIAL",
"GENEVA",
"SANS_SERIF",
"LEFT",
"RIGHT",
"CENTER",
"JUSTIFY",
"TEXT",
"NUMBER",
"RADIO",
"CHECKBOX",
"ROW",
"COLUMN",
"ID_ETIQUETA",
"ALFANUMERICO",
"TEXTO",
"ALLCHAR",
"ALLCHARNOSPACE",
"DIGITO_COM",
"MENOR_QUE",
"MENOR_CIERRE",
"MAYOR_QUE",
"CORA",
"CORC",
"IGUAL"
};
}
| [
"ferrubocana@gmail.com"
] | ferrubocana@gmail.com |
4a81ab04c4cb324a9dff6a6af9bce15cc0fc7e79 | 6d76c729c9cad529f85befc603cca3b97866a721 | /src/main/java/com/avgorkin/httpdownloader/model/datahandlers/DownloadWorker.java | a80491211c7d8f1994ad410796b184462c3a1301 | [] | no_license | uysnon/httpdownloader | d060b1d3859280752343294624991ef29be1d996 | ff1f9590e8a37a272f8c01a29fa99d721dcbd92d | refs/heads/master | 2023-01-19T14:10:53.700789 | 2020-11-19T20:23:42 | 2020-11-19T20:23:42 | 314,361,323 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,541 | java | package com.avgorkin.httpdownloader.model.datahandlers;
import lombok.*;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.util.List;
/**
* "Рабочий", занимается скачиванием файла
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public abstract class DownloadWorker implements Runnable {
/**
* Размер буфера
*/
private static final int BUFFER_SIZE = 1024;
private final Object $lock = new Object[0];
/**
* id потока
*/
private int threadId;
/**
* url адрес, из которого скачивается файл
*/
private String address;
/**
* timeout на попытку соединения
*/
private int connectTimeout;
/**
* timeout на чтение
*/
private int readTimeout;
/**
* Файл, в который ведется запись
*/
private File fileToWriteContent;
/**
* Кол-во кб, которое было загружено (считывается Downloader-ом для вычисления скорости скачивания)
*/
private int infoDownloadedCountKb;
/**
* Слушатели, ожидающие информацию о заверении скачивания (в нашем случае слушателем является Downloader)
*/
private List<WorkerFinishedDownloadListener> finishDownloadListeners;
public DownloadWorker(int threadId, String address, int connectTimeout, int readTimeout, File fileToWriteContent, @Singular List<WorkerFinishedDownloadListener> finishDownloadListeners) {
this.threadId = threadId;
this.address = address;
this.connectTimeout = connectTimeout;
this.readTimeout = readTimeout;
this.fileToWriteContent = fileToWriteContent;
this.finishDownloadListeners = finishDownloadListeners;
}
protected abstract HttpURLConnection buildHttpConnection();
protected abstract int getStartIndexFileWriting();
@Synchronized
public int getInfoDownloadedCountKb() {
return infoDownloadedCountKb;
}
@Synchronized
public void setInfoDownloadedCountKb(int infoDownloadedCountKb) {
this.infoDownloadedCountKb = infoDownloadedCountKb;
}
@Override
public void run() {
HttpURLConnection httpConnection = buildHttpConnection();
try {
InputStream inputStream = httpConnection.getInputStream();
RandomAccessFile raf = new RandomAccessFile(fileToWriteContent, "rw");
raf.seek(getStartIndexFileWriting());
byte[] array = new byte[BUFFER_SIZE];
int len = -1;
while ((len = inputStream.read(array)) != -1) {
raf.write(array, 0, len);
synchronized ($lock) {
infoDownloadedCountKb++;
}
}
inputStream.close();
raf.close();
httpConnection.disconnect();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
finishDownloadListeners.forEach(WorkerFinishedDownloadListener::downloadFinished);
}
@Synchronized
public void resetInfoDownloadedCounter() {
infoDownloadedCountKb = 0;
}
}
| [
"avgorkin1@gmail.com"
] | avgorkin1@gmail.com |
c79abdfcbf925d3b842e60e53fba35b5c7a4b6b8 | 7488ae6e743f6f26aab2784144c3e314da104e1d | /src/main/java/test_facebook/test_facebook/ScreenShotByRobot.java | c9a24e57bb9fea691de6bc53890e17402bd601e2 | [] | no_license | akashshiv/selenium-facebook | 0130f8b461bdd45f0e49b47ddf47e8747224a777 | e601193c187794421dfeba44e890eae8d6f2242f | refs/heads/master | 2020-04-14T02:50:41.654208 | 2019-02-07T16:23:18 | 2019-02-07T16:23:18 | 163,593,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,023 | java | package test_facebook.test_facebook;
import java.awt.AWTException;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.imageio.ImageIO;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class ScreenShotByRobot {
public static void main(String[] args) throws IOException, AWTException {
System.setProperty("webdriver.chrome.driver", "/Users/akash/Downloads/chromedriver");
WebDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("https://paytm.com/");
Robot r= new Robot();
BufferedImage source = r.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(source, "jpg", new File("/Users/akash/Downloads/newImagescreenshot.jpg"));
//driver.quit();
}
}
| [
"akash@bldm2882-mac.corp.bluejeans.com"
] | akash@bldm2882-mac.corp.bluejeans.com |
fc582315f2d919047899a56eae553d517ece63c2 | ea0e813154886506cb1fca49baf48178a470f30a | /Week2/Abstract_class&Interface/Animal/src/com/codegym/AbstrctAndInterfaceTests.java | 3eab35be1bd9266c10dcb8dee8dc6aba4f12f980 | [] | no_license | Just625/Java | e584d16dcd77c6cd549b6933d6fe6e7fcf8e3137 | 3910ab60dc06a286cd3a0d431245a97057dd33d5 | refs/heads/master | 2023-07-13T11:42:50.354564 | 2021-07-20T09:26:45 | 2021-07-20T09:26:45 | 353,946,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 788 | java | package com.codegym;
public class AbstrctAndInterfaceTests {
public static void main(String[] args) {
// write your code here
Animal[] animals = new Animal[2];
animals[0] = new Tiger();
animals[1] = new Chicken();
for(Animal animal : animals){
System.out.println(animal.makeSound());
if(animal instanceof Chicken){
// Edible edibler = (Chicken) animal;
// System.out.println(edibler.howtoEat());
System.out.println(((Chicken)animal).howtoEat());
}
}
Fruit[] fruits = new Fruit[2];
fruits[0] = new Apple();
fruits[1] = new Orange();
for(Fruit fruit:fruits){
System.out.println(fruit.howtoEat());
}
}
}
| [
"bloodseekerofdota@gmail.com"
] | bloodseekerofdota@gmail.com |
24b728dc2ed5547ee87f1369dbc54d203a18338d | 1c5e8605c1a4821bc2a759da670add762d0a94a2 | /easrc/markesupplier/subase/app/MarketSupplierAttachListController.java | 98abbf1e65c95d65b3e95522750b74d8eeec1746 | [] | no_license | shxr/NJG | 8195cfebfbda1e000c30081399c5fbafc61bb7be | 1b60a4a7458da48991de4c2d04407c26ccf2f277 | refs/heads/master | 2020-12-24T06:51:18.392426 | 2016-04-25T03:09:27 | 2016-04-25T03:09:27 | 19,804,797 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,049 | java | package com.kingdee.eas.port.markesupplier.subase.app;
import com.kingdee.bos.BOSException;
//import com.kingdee.bos.metadata.*;
import com.kingdee.bos.framework.*;
import com.kingdee.bos.util.*;
import com.kingdee.bos.Context;
import java.lang.String;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.eas.port.markesupplier.subase.MarketSupplierAttachListCollection;
import com.kingdee.eas.framework.app.DataBaseController;
import com.kingdee.eas.port.markesupplier.subase.MarketSupplierAttachListInfo;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.eas.framework.CoreBaseCollection;
import com.kingdee.bos.util.*;
import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.eas.framework.CoreBaseInfo;
import com.kingdee.bos.framework.*;
import java.rmi.RemoteException;
import com.kingdee.bos.framework.ejb.BizController;
public interface MarketSupplierAttachListController extends DataBaseController
{
public MarketSupplierAttachListInfo getMarketSupplierAttachListInfo(Context ctx, IObjectPK pk) throws BOSException, EASBizException, RemoteException;
public MarketSupplierAttachListInfo getMarketSupplierAttachListInfo(Context ctx, IObjectPK pk, SelectorItemCollection selector) throws BOSException, EASBizException, RemoteException;
public MarketSupplierAttachListInfo getMarketSupplierAttachListInfo(Context ctx, String oql) throws BOSException, EASBizException, RemoteException;
public MarketSupplierAttachListCollection getMarketSupplierAttachListCollection(Context ctx) throws BOSException, RemoteException;
public MarketSupplierAttachListCollection getMarketSupplierAttachListCollection(Context ctx, EntityViewInfo view) throws BOSException, RemoteException;
public MarketSupplierAttachListCollection getMarketSupplierAttachListCollection(Context ctx, String oql) throws BOSException, RemoteException;
} | [
"shxr_code@126.com"
] | shxr_code@126.com |
917bebfa443bb3f4b76e38d445f96a59dac40810 | 3d4e4df3feb2cc446a0fe5ae29e5a06f4589c97c | /src/main/java/com/sucheng/query/RawMaterialsQuery.java | bf76a6d5d5304a28386d869c738e29016f97276c | [] | no_license | ZC7025/CashRegister | 93805eca2fc439edaa4954627a5a4046eb619f10 | 5927784f5c45652fe097254e3fc131d2c4f6b3a2 | refs/heads/master | 2020-03-18T14:10:17.258310 | 2018-06-21T08:27:29 | 2018-06-21T08:27:29 | 134,834,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,096 | java | package com.sucheng.query;
import java.math.BigDecimal;
import java.util.Date;
/**
* RawMaterialsQuery查询对象类<br/>
*
* 创建于2018-05-24<br/>
*
* @author 7025
* @version 1.0
*/
public class RawMaterialsQuery extends BaseQuery {
private static final long serialVersionUID = -9223372036488744033L;
/**
*
*/
private Integer id;
/**
*商品名
*/
private String name;
/**
*进价
*/
private BigDecimal price;
/**
* 数量
*/
private Float amount;
/**
*单位
*/
private String unit;
/**
*单位
*/
private Integer unitId;
/**
*供应商id
*/
private Integer supplierId;
/**
* 供应商名称
*/
private String supplierName;
/**
* 供应商电话
*/
private String phone;
/**
*生产日期
*/
private Date birthTime;
/**
*保质期
*/
private String shelfTime;
/**
*过期时间
*/
private Date deadTime;
/**
*
*/
private Integer minStock;
/**
*
*/
private Integer maxStock;
/**
*
*/
private Integer storeId;
/**
*
*/
private String status;
/**
*
*/
private Date createdTime;
public RawMaterialsQuery () {}
public RawMaterialsQuery(Integer id, String name, Float amount,
BigDecimal price, String unit, Integer supplierId,
String supplierName, String phone, Date birthTime,
String shelfTime, Date deadTime, Integer minStock,
Integer maxStock, Integer storeId, String status, Date createdTime) {
this.id = id;
this.name = name;
this.amount = amount;
this.price = price;
this.unit = unit;
this.supplierId = supplierId;
this.supplierName = supplierName;
this.phone = phone;
this.birthTime = birthTime;
this.shelfTime = shelfTime;
this.deadTime = deadTime;
this.minStock = minStock;
this.maxStock = maxStock;
this.storeId = storeId;
this.status = status;
this.createdTime = createdTime;
}
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 Float getAmount() {
return amount;
}
public void setAmount(Float amount) {
this.amount = amount;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public Integer getUnitId() {
return unitId;
}
public void setUnitId(Integer unitId) {
this.unitId = unitId;
}
public Integer getSupplierId() {
return supplierId;
}
public void setSupplierId(Integer supplierId) {
this.supplierId = supplierId;
}
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Date getBirthTime() {
return birthTime;
}
public void setBirthTime(Date birthTime) {
this.birthTime = birthTime;
}
public String getShelfTime() {
return shelfTime;
}
public void setShelfTime(String shelfTime) {
this.shelfTime = shelfTime;
}
public Date getDeadTime() {
return deadTime;
}
public void setDeadTime(Date deadTime) {
this.deadTime = deadTime;
}
public Integer getMinStock() {
return minStock;
}
public void setMinStock(Integer minStock) {
this.minStock = minStock;
}
public Integer getMaxStock() {
return maxStock;
}
public void setMaxStock(Integer maxStock) {
this.maxStock = maxStock;
}
public Integer getStoreId() {
return storeId;
}
public void setStoreId(Integer storeId) {
this.storeId = storeId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
@Override
public String toString() {
return "RawMaterialsDO{" +
"}";
}
}
| [
"1531952273@qq.com"
] | 1531952273@qq.com |
2840f6cbf16c2d2fe3d17ec0f2eef88915b40f53 | d1a6d1e511df6db8d8dd0912526e3875c7e1797d | /genny_JavaWithoutLambdasApi21_ReducedClassCount/applicationModule/src/main/java/applicationModulepackageJava8/Foo569.java | 939770394dcc7fcf7077b159cc219f2e88ca8722 | [] | no_license | NikitaKozlov/generated-project-for-desugaring | 0bc1443ab3ddc84cd289331c726761585766aea7 | 81506b3711004185070ca4bb9a93482b70011d36 | refs/heads/master | 2020-03-20T00:35:06.996525 | 2018-06-12T09:30:37 | 2018-06-12T09:30:37 | 137,049,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package applicationModulepackageJava8;
public class Foo569 {
public void foo0() {
new applicationModulepackageJava8.Foo568().foo9();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
public void foo6() {
foo5();
}
public void foo7() {
foo6();
}
public void foo8() {
foo7();
}
public void foo9() {
foo8();
}
}
| [
"nikita.e.kozlov@gmail.com"
] | nikita.e.kozlov@gmail.com |
304984b945dd8f4980c2c656c2961377fcb34228 | 45c6bd200e76e4db246035b4fa42e346c5ca7465 | /BubbleSort.java | e79c25f842fae571b8697f887773928281575553 | [] | no_license | kajal-mittal/sorting-algorithms | 0d8d87073f450a9621d780449334d0ef1030c12f | a0ca598bf036c820afd74d3b1d5398ebea666a3a | refs/heads/master | 2020-03-27T01:25:10.716559 | 2018-08-29T08:00:35 | 2018-08-29T08:00:35 | 145,708,645 | 0 | 0 | null | 2018-08-28T12:15:03 | 2018-08-22T12:51:24 | null | UTF-8 | Java | false | false | 601 | java |
import java.lang.*;
public class BubbleSort {
public static void main(String args[]) {
System.out.println("Hello, World!");
int arr[] = {5, 3, 6, 7, 2, 1, 8};
for (int i = 0; i < arr.length - 1; i++) {
for (int j = 0; j < arr.length - 1; j++) {
if (arr[j] > arr[j + 1]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
for (int k = 0; k < arr.length - 1; k++) {
System.out.println(arr[k]);
}
}
}
| [
"punchh_kajal@Punchh-Kajals-MacBook-Pro.local"
] | punchh_kajal@Punchh-Kajals-MacBook-Pro.local |
2bd5a72b7a849515d7f6d781a44b532c22f620f2 | 7bfa2ecec38459b156d981ac4526e4a36733f6e5 | /src/test/java/utils/TestSessionInitiator.java | 80b27a116288305d9c1062cc1bd7fd8c4c0ae53a | [] | no_license | surajbhadhoriya/IMDB-Rating-Framework-V2.0 | b813e17d37c018754da5e163ca816cb552fd7079 | bd354073ce3d728a92a402a5fdb6b7376cb375d5 | refs/heads/master | 2023-05-29T12:04:08.034335 | 2021-06-21T12:58:58 | 2021-06-21T12:58:58 | 378,930,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,253 | java | package utils;
import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.BeforeClass;
import com.qait.Actions.detailsPage;
import com.qait.Actions.logInPage;
import com.qait.Actions.loginPROVersion;
import com.qait.Actions.searchPage;
public class TestSessionInitiator {
protected WebDriver driver;
WebDriverIntiator wdriver = new WebDriverIntiator();
public void initialize() throws MalformedURLException {
driver = wdriver.getWebDriver(DriverType.CHROME);
driver.get("https://www.imdb.com/");
}
/*
* public void launchApplication() { driver.get("https://www.imdb.com/"); }
*/
// create object of action classes
public searchPage SearchPages;
public detailsPage DetailsPages;
public logInPage LoginPages;
public loginPROVersion LoginPRO;
public void initPage() {
SearchPages = new searchPage(driver);
DetailsPages = new detailsPage(driver);
LoginPages = new logInPage(driver);
LoginPRO = new loginPROVersion(driver);
}
public void waitForsync(int time) {
driver.manage().timeouts().implicitlyWait(time, TimeUnit.SECONDS);
}
public TestSessionInitiator() throws MalformedURLException {
initialize();
initPage();
}
}
| [
"surajkumar@qainfotech.com"
] | surajkumar@qainfotech.com |
95e50847a0b1df5aa495fcfc059a407c5adf17d7 | 0429dcef9cd5609462f16da6e1483971eaa403ca | /test/com/ms/silverking/cloud/dht/client/namespace/version/ClientSpecifiedVersionUnrestrictedRevisionsTest.java | a5e5f5610e751eda8ad69daa853e823df668c5be | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | thomascharbonnel/SilverKing | 40df0754c21c2963cbd821c288c317686418eb92 | dd1f611f4f61d49df0527a96d5578e24eb7ab294 | refs/heads/master | 2020-03-18T09:30:50.692530 | 2018-05-23T05:14:32 | 2018-05-23T05:14:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,569 | java | package com.ms.silverking.cloud.dht.client.namespace.version;
import static com.ms.silverking.cloud.dht.client.namespace.version.TestUtil.*;
import java.io.IOException;
import org.junit.BeforeClass;
import org.junit.Test;
import static com.ms.silverking.cloud.dht.NamespaceVersionMode.*;
import static com.ms.silverking.cloud.dht.RevisionMode.*;
import com.ms.silverking.cloud.dht.client.ClientException;
import com.ms.silverking.cloud.dht.client.DHTSession;
import com.ms.silverking.cloud.dht.client.Namespace;
import com.ms.silverking.cloud.dht.client.PutException;
import com.ms.silverking.cloud.dht.client.RetrievalException;
import com.ms.silverking.cloud.dht.client.SynchronousNamespacePerspective;
import com.ms.silverking.testing.Util;
import com.ms.silverking.testing.annotations.SkLarge;
@SkLarge
public class ClientSpecifiedVersionUnrestrictedRevisionsTest {
private static SynchronousNamespacePerspective<String, String> syncNsp;
private static final String namespaceName = ClientSpecifiedVersionUnrestrictedRevisionsTest.class.getSimpleName();
@BeforeClass
public static void setUpBeforeClass() throws ClientException, IOException {
DHTSession session = createSession();
Namespace ns = createNamespace(session, namespaceName, CLIENT_SPECIFIED, UNRESTRICTED_REVISIONS);
syncNsp = ns.openSyncPerspective(String.class, String.class);
}
@Test
public void test_Put() throws PutException, RetrievalException {
_put( k1, v1);
_checkGet(k1, v1);
}
@Test
public void test_Put_WithVersion() throws PutException {
_putVersion(k2, v1, version1);
}
@Test
public void test_PutKeyTwice_SameValue() throws PutException, RetrievalException {
_put( k3, v1);
_put( k3, v1);
checkGets(k3, v1, v1);
}
// failing
@Test
public void test_PutKeyTwice_DiffValue() throws PutException, RetrievalException {
_put( k4, v1);
_put( k4, v2);
checkGets(k4, v1, v2);
}
// failing b/c of version
@Test
public void test_PutKeyTwice_SameValue_WithVersion() throws PutException, RetrievalException {
_put( k5, v1);
_putVersion( k5, v1, version1);
checkGetsWithVersion(k5, v1, v1, version1);
}
// failing on version
@Test
public void test_PutKeyTwice_DiffValue_WithVersion() throws PutException, RetrievalException {
_put( k6, v1);
_putVersion( k6, v2, version2);
checkGetsWithVersion(k6, v2, v1, version2);
}
private void checkGetsWithVersion(String k, String valueLeast, String valueGreatest, int version) throws RetrievalException {
checkGets(k, valueLeast, valueGreatest);
_checkGetExactMatch(k, valueLeast, version);
_checkGetLeastVersion( k, version, true);
_checkGetGreatestVersion( k, version, false);
_checkGetExactMatchVersion(k, version);
}
private void checkGets(String k, String valueLeast, String valueGreatest) throws RetrievalException {
_checkGet( k, valueGreatest);
_checkGetLeast( k, valueLeast);
_checkGetGreatest(k, valueGreatest);
}
// failing on version
@Test
public void test_PutKeyTwice_DiffValue_WithVersion_Increasing_Linear() throws PutException, RetrievalException {
_putVersion(k7, v1, version1);
_putVersion(k7, v2, version2);
checkGets_Twice_Linear(k7);
}
// failing on version
@Test
public void test_PutKeyTwice_DiffValue_WithVersion_Decreasing_Linear() throws PutException, RetrievalException {
_putVersion(k8, v2, version2);
_putVersion(k8, v1, version1);
checkGets_Twice_Linear(k8);
}
private void checkGets_Twice_Linear(String k) throws RetrievalException {
checkGets(k, v1, v2);
_checkGetExactMatch(k, v1, version1);
_checkGetExactMatch(k, v2, version2);
_checkGetLeastVersion( k, version1, true);
_checkGetGreatestVersion( k, version2, true);
_checkGetExactMatchVersion(k, version1);
_checkGetExactMatchVersion(k, version2);
}
// failing on version
@Test
public void test_PutKeyThrice_DiffValue_WithVersion_Increasing_Skipping() throws PutException, RetrievalException {
_putVersion(k9, v1, version1);
_putVersion(k9, v3, version3);
_putVersion(k9, v5, version5);
checkGets_Thrice_Skipping(k9);
}
// failing on version
@Test
public void test_PutKeyThrice_DiffValue_WithVersion_Decreasing_Skipping() throws PutException, RetrievalException {
_putVersion(k10, v5, version5);
_putVersion(k10, v3, version3);
_putVersion(k10, v1, version1);
checkGets_Thrice_Skipping(k10);
}
private void checkGets_Thrice_Skipping(String k) throws RetrievalException {
checkGets(k, v1, v5);
_checkGetExactMatch(k, v1, version1);
_checkGetExactMatch(k, v3, version3);
_checkGetExactMatch(k, v5, version5);
_checkGetLeastVersion( k, version1, true);
_checkGetGreatestVersion( k, version5, true);
_checkGetExactMatchVersion(k, version1);
_checkGetExactMatchVersion(k, version3);
_checkGetExactMatchVersion(k, version5);
}
private void _put(String k, String v) throws PutException {
put(syncNsp, k, v);
}
private void _putVersion(String k, String v, int version) throws PutException {
put(syncNsp, k, v, version);
}
private void _checkGet(String k, String expectedValue) throws RetrievalException {
checkGet(syncNsp, k, expectedValue);
}
private void _checkGetLeast(String k, String expectedValue) throws RetrievalException {
checkGetLeast(syncNsp, k, expectedValue);
}
private void _checkGetGreatest(String k, String expectedValue) throws RetrievalException {
checkGetGreatest(syncNsp, k, expectedValue);
}
private void _checkGetExactMatch(String k, String expectedValue, int version) throws RetrievalException {
checkGetExactMatch(syncNsp, k, expectedValue, version);
}
private void _checkGetLeastVersion(String k, int version, boolean shouldMatch) throws RetrievalException {
checkGetLeastVersion(syncNsp, k, shouldMatch, version);
}
private void _checkGetGreatestVersion(String k, int version, boolean shouldMatch) throws RetrievalException {
checkGetGreatestVersion(syncNsp, k, shouldMatch, version);
}
private void _checkGetExactMatchVersion(String k, int version) throws RetrievalException {
checkGetExactMatchVersion(syncNsp, k, version);
}
public static void main(String[] args) {
Util.runTests(ClientSpecifiedVersionUnrestrictedRevisionsTest.class);
}
}
| [
"gjms@users.noreply.github.com"
] | gjms@users.noreply.github.com |
7dbb57e4f9360e9fea548678a623772851ca5f26 | 8e93089b906fd9d0cd4dd94c39b5c4588a97dbe6 | /src/main/java/com/seven/enums/SortRule.java | ec9c75d9c60ef862f7ff7a3ae49067c1d9b3194d | [] | no_license | sevenyjl/project_foodie_dev | 8cb77f7fcad67e075ddd340193e858cf6071bafe | ccf6232dff0b9e39c820e5bd5b23be98350acb26 | refs/heads/master | 2023-05-29T07:52:24.158329 | 2020-05-07T09:23:51 | 2020-05-07T09:23:51 | 257,781,823 | 0 | 0 | null | 2021-06-04T21:58:10 | 2020-04-22T03:30:39 | PLpgSQL | UTF-8 | Java | false | false | 292 | java | package com.seven.enums;
import lombok.Getter;
@Getter
public enum SortRule {
DEFAULT("k","默认"),SALES("c","销量"),PRICE("p","价格");
private String code;
private String info;
SortRule(String code,String info){
this.code=code;
this.info=info;
}
}
| [
"sevenyjl@gmail.com"
] | sevenyjl@gmail.com |
e9fd2d31c30d7332d2147adbd8cd050c7be67149 | 3de0920a99ebc9579ffb7b66e44a9aeb82ec95a9 | /jnavigator-util/src/main/java/at/uni_salzburg/cs/ckgroup/util/StringUtils.java | c77da777388961f624a91fc46325a00ec339a124 | [] | no_license | cksystemsgroup/JNavigator | c54784b7667c30e200a0ab52ae7b3e7bcc3b185e | 5979d8c9165efe7a5493a610a55453e247045596 | refs/heads/master | 2023-07-20T01:48:33.240881 | 2023-07-14T08:48:41 | 2023-07-14T08:48:41 | 7,882,274 | 3 | 3 | null | 2023-09-03T19:58:51 | 2013-01-29T00:45:20 | Java | UTF-8 | Java | false | false | 2,300 | java | /*
* @(#) StringUtils.java
*
* This code is part of the JAviator project: javiator.cs.uni-salzburg.at
* Copyright (c) 2009 Clemens Krainer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package at.uni_salzburg.cs.ckgroup.util;
import java.util.Vector;
/**
* This class implements some basic string manipulation functionality, because
* the IBM WSRT JVM for ARM embedded systems lacks compatibility to more recent
* Java versions.
*
* @author Clemens Krainer
*/
public class StringUtils {
/**
* Split a given <code>String</code> object on a given character and trim
* every string in the result. The equivalent Java 1.4 code is
*
* <pre>
* String[] otherStrings = someString.trim().split("\\s*,\\s*");
* </pre>
*
* @param line
* the line to be splitted as a <code>String</code> object.
* @return
*/
public static String[] splitOnCharAndTrim (char splitter, String line) {
Vector<StringBuffer> strs = new Vector<>();
StringBuffer buf = new StringBuffer ();
for (int k=0; k < line.length(); ++k) {
char ch = line.charAt(k);
if (ch == splitter) {
strs.add(buf);
buf = new StringBuffer ();
} else {
buf.append(ch);
}
}
if (line.length() != 0)
strs.add(buf);
String [] sa = new String [strs.size()];
for (int i=0; i < sa.length; ++i) {
StringBuffer e = (StringBuffer) strs.elementAt(i);
if (e.length() == 0) {
sa[i] = "";
continue;
}
int o = 0;
while (e.charAt(o) == ' ') ++o;
int l = e.length()-1;
while (e.charAt(l) == ' ') --l;
sa[i] = e.substring(o, l+1);
}
return sa;
}
}
| [
"clemens.krainer@gmail.com"
] | clemens.krainer@gmail.com |
0d00d1d86ef367649e552e2d7270a99946ad06ef | a7411ef55c38058448d73e64fd11eca2943abb83 | /app/src/main/java/com/client/git/presenter/Presenter.java | 28e7abee8595c0e7f560f0e69ae99308f0d82f18 | [] | no_license | elref/GitHubClient | 0da6f95ed2864f5be2c5c4ae21c47083f4a64072 | 6243fcd7886d598536ccb98ae272261a5dbcc4c8 | refs/heads/master | 2021-07-03T20:27:38.663761 | 2017-09-25T23:15:52 | 2017-09-25T23:15:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 131 | java | package com.client.git.presenter;
/**
* Created by TechnoA on 22.09.2017.
*/
public interface Presenter {
void onStop();
}
| [
"david.tavis@gmail.com"
] | david.tavis@gmail.com |
0d78f39844982acab3f7a5bc2718dd38e356e7ca | 0b842611cf08f404cab4fabbd15d34d3ee0ffc14 | /app/src/main/java/com/anjile/shineourlove/rxjavaapplication/adapter/PersonalTitleAdapter.java | ef8bd6ea9a12a411e237c45c25e041a7fbd6e1ba | [] | no_license | shineourlove/RXJavaDemo | d411c053720b71327cc6ff516dc0a15bb054c07f | df44d7de706cfd945f4e10f6468e2bea9406b664 | refs/heads/master | 2021-08-14T09:49:13.008953 | 2017-11-15T08:31:05 | 2017-11-15T08:31:05 | 104,311,203 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,677 | java | package com.anjile.shineourlove.rxjavaapplication.adapter;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.anjile.shineourlove.rxjavaapplication.R;
import com.anjile.shineourlove.rxjavaapplication.activity.MajorSelectActivity;
import com.anjile.shineourlove.rxjavaapplication.activity.PersonalMajorRankActivity;
import com.anjile.shineourlove.rxjavaapplication.common.RequestCode;
import com.anjile.shineourlove.rxjavaapplication.db.PersonalAllBean;
import com.anjile.shineourlove.rxjavaapplication.db.PersonalRegisterBean;
import com.anjile.shineourlove.rxjavaapplication.db.PersonalTitleBean;
import com.anjile.shineourlove.rxjavaapplication.eventbuscontrol.PersonalMajorControl;
import org.greenrobot.eventbus.EventBus;
import java.util.List;
/**
* Created by Administrator on 2017/10/12.
*/
public class PersonalTitleAdapter extends RecyclerView.Adapter<PersonalTitleAdapter.ArchitectureHolder> {
private List<PersonalTitleBean> beanList;
private Context context;
private Activity activity;
private String type;
public PersonalTitleAdapter(List<PersonalTitleBean> companyList, Context context, Activity activity, String type) {
this.beanList = companyList;
this.context = context;
this.activity = activity;
this.type = type;
}
@Override
public ArchitectureHolder onCreateViewHolder(ViewGroup parent, int viewType) {
ArchitectureHolder holder = new ArchitectureHolder(
LayoutInflater.from(context).inflate(R.layout.personal_setting_adapter, parent, false));
return holder;
}
@Override
public void onBindViewHolder(ArchitectureHolder holder, int position) {
if (position == beanList.size() - 1) {
holder.txtLine.setVisibility(View.GONE);
} else {
holder.txtLine.setVisibility(View.VISIBLE);
}
if (beanList.get(position).getName() != null)
holder.txtPersonalSettingAdapterName.setText(beanList.get(position).getName());
else
holder.txtPersonalSettingAdapterName.setText("");
if (beanList.get(position).getNumber() != null)
holder.txtPersonalSettingAdapterNumber.setText(beanList.get(position).getNumber());
else
holder.txtPersonalSettingAdapterNumber.setText("");
if (beanList.get(position).getRank() != null)
holder.txtPersonalSettingAdapterGrade.setText(beanList.get(position).getRank());
else
holder.txtPersonalSettingAdapterGrade.setText("");
}
@Override
public int getItemCount() {
if (beanList == null)
return 0;
else
return beanList.size();
}
public class ArchitectureHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
LinearLayout llPersonalSettingAdapterName;
LinearLayout llPersonalSettingAdapterGrade;
LinearLayout llPersonalSettingAdapterNumber;
TextView txtPersonalSettingAdapterName;
TextView txtPersonalSettingAdapterGrade;
TextView txtPersonalSettingAdapterNumber;
TextView txtPersonalSettingAdapterDelete;
TextView txtPersonalSettingAdapterClear;
TextView txtLine;
public ArchitectureHolder(View itemView) {
super(itemView);
llPersonalSettingAdapterName = itemView.findViewById(R.id.ll_personal_setting_adapter_name);
llPersonalSettingAdapterGrade = itemView.findViewById(R.id.ll_personal_setting_adapter_grade);
llPersonalSettingAdapterNumber = itemView.findViewById(R.id.ll_personal_setting_adapter_number);
txtPersonalSettingAdapterName = itemView.findViewById(R.id.txt_personal_setting_adapter_name);
txtPersonalSettingAdapterGrade = itemView.findViewById(R.id.txt_personal_setting_adapter_grade);
txtPersonalSettingAdapterNumber = itemView.findViewById(R.id.txt_personal_setting_adapter_number);
txtPersonalSettingAdapterDelete = itemView.findViewById(R.id.txt_personal_setting_adapter_delete);
txtPersonalSettingAdapterClear = itemView.findViewById(R.id.txt_personal_setting_adapter_clear);
txtLine = itemView.findViewById(R.id.txt_personal_setting_adapter_line);
llPersonalSettingAdapterName.setOnClickListener(this);
llPersonalSettingAdapterGrade.setOnClickListener(this);
llPersonalSettingAdapterNumber.setOnClickListener(this);
txtPersonalSettingAdapterDelete.setOnClickListener(this);
txtPersonalSettingAdapterClear.setOnClickListener(this);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.ll_personal_setting_adapter_name:
Intent intentMajor = new Intent(context, MajorSelectActivity.class);
intentMajor.putExtra("type", type);
intentMajor.putExtra("position", getAdapterPosition());
StringBuilder builder = new StringBuilder();
for (int i = 0; i < beanList.size(); i++) {
if (beanList.get(i).getName() != null && i != getAdapterPosition())
builder.append(beanList.get(i).getName() + ",");
}
intentMajor.putExtra("checked", builder.toString());
activity.startActivityForResult(intentMajor, RequestCode.PERSONAL_SETTING_MAJOR);
break;
case R.id.ll_personal_setting_adapter_grade:
if (beanList.get(getAdapterPosition()).getName() != null) {
if (beanList.get(getAdapterPosition()).getName().equals("")) {
Toast.makeText(context, "请先选择专业!", Toast.LENGTH_SHORT).show();
} else {
if (beanList.get(getAdapterPosition()).getRank().equals("此专业不分等级")) {
Toast.makeText(context, "此专业不分等级!", Toast.LENGTH_SHORT).show();
} else {
Intent intentRank = new Intent(context, PersonalMajorRankActivity.class);
intentRank.putExtra("type", beanList.get(getAdapterPosition()).getName());
intentRank.putExtra("position", getAdapterPosition());
activity.startActivityForResult(intentRank, RequestCode.PERSONAL_SETTING_MAJOR_RANK);
}
}
} else {
Toast.makeText(context, "请先选择专业!", Toast.LENGTH_SHORT).show();
}
break;
case R.id.ll_personal_setting_adapter_number:
if (beanList.get(getAdapterPosition()).getName() != null && beanList.get(getAdapterPosition()).getRank() != null) {
if (beanList.get(getAdapterPosition()).getName().equals("") || beanList.get(getAdapterPosition()).getRank().equals("")) {
Toast.makeText(context, "请先选择专业和等级!", Toast.LENGTH_SHORT).show();
} else {
EventBus.getDefault().post(new PersonalMajorControl(new PersonalAllBean(), 2, getAdapterPosition()));
}
} else {
Toast.makeText(context, "请先选择专业和等级!", Toast.LENGTH_SHORT).show();
}
break;
case R.id.txt_personal_setting_adapter_delete:
beanList.remove(getAdapterPosition());
notifyDataSetChanged();
break;
case R.id.txt_personal_setting_adapter_clear:
beanList.get(getAdapterPosition()).setName("");
beanList.get(getAdapterPosition()).setRank("");
beanList.get(getAdapterPosition()).setDetails("");
beanList.get(getAdapterPosition()).setNumber("");
notifyDataSetChanged();
break;
}
}
@Override
public boolean onLongClick(View view) {
return false;
}
}
}
| [
"215631443@qq.com"
] | 215631443@qq.com |
27796b190e9971f3249849db888b26bc58f6b293 | b02d10077f2e63fe4bb4d5d408ec7c2da15c3eb7 | /src/Logica/Juego.java | 810725723f4465c595a2676a1c0e2fdad66d1a38 | [] | no_license | AgustinEscobar/EscobarAgustin-Proyecto2 | 433739b523ef72de9eede6c27449269f564403ff | d32512fe9e49c9cc1d3abfac7d0c5c32fc684105 | refs/heads/master | 2023-01-08T11:27:16.513116 | 2020-10-25T21:37:50 | 2020-10-25T21:37:50 | 307,194,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,869 | java | package Logica;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Random;
/**
* Modela el juego sudoku.
*
* @author Agustin Escobar.
*/
public class Juego {
private Celda[][] tablero;
private Celda[] opciones;
private int[][] matriz_archivo;
private Celda celda_presionada;
private boolean continua_juego; // Indica si puede continuar jugando.
/**
* Inicializa el juego.
* @throws InvalidFileException
*/
public Juego() throws InvalidFileException {
tablero = new Celda[9][9];
matriz_archivo = new int[9][9];
String ruta = "File/archivo.txt";
// Inicializo el tablero de celdas con los valores de la matriz del archivo.
if (validar_archivo(ruta)) {
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
Random rand = new Random();
int value = rand.nextInt(2);
tablero[i][j] = new Celda();
// Seteo a cada celda su fila y columna en el tablero.
tablero[i][j].set_fila(i);
tablero[i][j].set_columna(j);
setear_cuadrante(i, j, tablero[i][j]);
if (value == 0) { // De acuerdo a value decidir si asignar un valor o no
tablero[i][j].set_valor(9);
} else {
tablero[i][j].set_valor(matriz_archivo[i][j] - 1);
tablero[i][j].set_habilitada(false);
}
}
}
// A cada boton del panel de opciones, le establezco una celda con su imagen
// correspondiente.
opciones = new Celda[10];
for (int i = 0; i < 10; i++) {
opciones[i] = new Celda();
opciones[i].set_valor(i);
}
continua_juego = true;
} else {
throw new InvalidFileException("Archivo invalido. ");
}
}
/**
* Consulta si el tablero esta completo y es correcto para indicar si termino el juego.
*
* @return Verdadero si el tablero esta completo y la solucion es valida, falso
* en caso contrario.
*/
public boolean termino() {
// Recorro el tablero consultando si alguna celda es nula.
// Si encuentra una celda nula, no termino el juego.
boolean esta = true;
for (int i = 0; i < 9 && esta; i++) {
for (int j = 0; j < 9 && esta; j++) {
// Si la celda tiene una imagen "nula".
if (tablero[i][j].get_valor() == 9) {
esta = false;
}
}
}
return esta;
}
/**
* Actualiza la celda presionada.
*
* @param c Celda a actualizar.
* @param valor Valor del boton apretado.
*/
public void accionar(Celda c, int valor) {
c.actualizar(valor);
}
/**
* Establece la celda presionada con la celda parametrizada.
*
* @param c Celda presionada.
*/
public void set_celda_presionada(Celda c) {
celda_presionada = c;
}
/**
* Obtiene la celda presionada.
*
* @return Celda
*/
public Celda get_celda_presionada() {
return celda_presionada;
}
/**
* Establece si continua el juego, con el valor parametrizado.
*
* @param continua Es verdadero en caso de continuar, falso caso contrario.
*/
public void set_continua_juego(boolean continua) {
continua_juego = continua;
}
/**
* Consulta si las celdas del juego son correctas para poder seguir jugando.
*
* @return Verdadero si continua el juego, falso en caso contrario.
*/
public boolean get_continua_juego() {
return continua_juego;
}
/**
* Obtiene la celda en la posicion i del arreglo de opciones.
*
* @param i Posicion del arreglo de opciones
* @return Celda
*/
public Celda get_opcion(int i) {
return this.opciones[i];
}
/**
* Obtiene la celda en la posicion [i][j] de la matriz tablero.
*
* @param i fila de la celda.
* @param j columna de la celda.
* @return
*/
public Celda get_celda(int i, int j) {
return this.tablero[i][j];
}
/**
* Setea el cuadrante en el que se encuentra cada celda del tablero.
*
* @param fila Fila de la celda.
* @param col Columna de la celda.
* @param c Ultima celda presionada.
*/
private void setear_cuadrante(int fila, int col, Celda c) {
if (fila < 3) {
if (col < 3)
c.set_cuadrante(1);
else if (col > 2 && col < 6)
c.set_cuadrante(2);
else
c.set_cuadrante(3);
} else if (fila > 2 && fila < 6) {
if (col < 3)
c.set_cuadrante(4);
else if (col > 2 && col < 6)
c.set_cuadrante(5);
else
c.set_cuadrante(6);
} else {
if (col < 3)
c.set_cuadrante(7);
else if (col > 2 && col < 6)
c.set_cuadrante(8);
else
c.set_cuadrante(9);
}
}
/**
* Consulta si el archivo es valido.
*
* @param ruta ubicacion del archivo.
* @return Verdadero si el archivo es valido, falso en caso contrario.
*/
private boolean validar_archivo(String ruta) {
BufferedReader br = null;
String[] arreglo;
String linea;
boolean archivo_valido = true;
int f = 0, c = 0;
try {
// Apertura del archivo y creacion de BufferedReader para poder hacer una
// lectura comoda (disponer del metodo readLine())
InputStream in = Juego.class.getClassLoader().getResourceAsStream(ruta);
InputStreamReader inr = new InputStreamReader(in);
br = new BufferedReader(inr);
// Lectura del archivo
while ((linea = br.readLine()) != null && f < matriz_archivo.length && archivo_valido) {
arreglo = linea.split(" "); // Crea un arreglo que almacena las palabras del archivo por linea, //
// separandolas por espacios.
if (arreglo.length == 9) { // Paso el contenido del archivo a matriz_archivo.
for (int i = 0; i < arreglo.length; i++) {
if (!is_numeric(arreglo[i])) {
archivo_valido = false;
} else {
matriz_archivo[f][c] = Integer.parseInt(arreglo[i]);
c++;
}
}
f++;
c = 0;
} else {
archivo_valido = false;
}
}
if (linea != null) {
archivo_valido = false;
}
for (int i = 0; i < 9 && archivo_valido; i++) {
archivo_valido = validar_fila(i);
}
for (int i = 0; i < 9 && archivo_valido; i++) {
archivo_valido = validar_columna(i);
}
br.close();
} catch (IOException e) {
e.printStackTrace();
}
return archivo_valido;
}
/**
* Consulta si el String recibido es un numero.
*
* @param cadena
* @return Verdadero si el String es un numero, falso en caso contrario.
*/
private static boolean is_numeric(String cadena) {
boolean resultado;
try {
Integer.parseInt(cadena);
resultado = true;
} catch (NumberFormatException excepcion) {
resultado = false;
}
return resultado;
}
/**
* Consulta si la fila tiene numeros repetidos.
*
* @param num Numero del boton presionado.
* @param celda_presionada Celda presionada.
* @return Verdadero si la fila no tiene numeros repetidos, falso en caso
* contrario.
*/
public boolean fila_valida(int num, Celda celda_presionada) {
boolean es_valida = true;
int fila = celda_presionada.get_fila();
for (int i = 0; i < 9; i++) {
if (tablero[fila][i].get_valor() == num && tablero[fila][i] != celda_presionada) {
tablero[fila][i].set_invalida(true);
es_valida = false;
} else {
tablero[fila][i].set_invalida(false);
}
}
return es_valida;
}
/**
* Consulta si la comlumna tiene numeros repetidos.
*
* @param num Numero del boton presionado.
* @param celda_presionada Celda presionada.
* @return Verdadero si la columna no tiene numeros repetidos, falso en caso
* contrario.
*/
public boolean columna_valida(int num, Celda celda_presionada) {
boolean es_valida = true;
int col = celda_presionada.get_columna();
for (int i = 0; i < 9; i++) {
if (tablero[i][col].get_valor() == num && tablero[i][col] != celda_presionada) {
tablero[i][col].set_invalida(true);
es_valida = false;
} else {
tablero[i][col].set_invalida(false);
}
}
return es_valida;
}
/**
* Consulta si el cuadrante es valido.
*
* @param num Es el numero de contiene la celda presionada.
* @param celda_presionada Celda presionada.
* @return Verdadero si el cuadrante es valido, falso caso contrario.
*/
public boolean cuadrante_valido(int num, Celda celda_presionada) {
int cuadrante = celda_presionada.get_cuadrante() - 1;
boolean es_valido = true;
int fila = (cuadrante / 3) * 3;
int columna = (cuadrante % 3) * 3;
for (int i = fila; i < fila + 3; i++) {
for (int j = columna; j < columna + 3; j++) {
if (tablero[i][j].get_valor() == num && tablero[i][j] != celda_presionada) {
es_valido = false;
tablero[i][j].set_invalida(true);
} else {
tablero[i][j].set_invalida(false);
}
}
}
return es_valido;
}
/**
* Consulta si la fila del archivo es valida. Asegurandose que no contenga
* numeros repetidos entre el 1 y el 9.
*
* @param fil Fila a verificar.
* @return Verdadero si la fila es valida, falso en caso contrario.
*/
public boolean validar_fila(int fil) {
boolean es_valida = true;
boolean esta_num = false;
int num = 1;
while (es_valida && num < 10) {
for (int i = 0; i < 9 && !esta_num; i++) {
if (matriz_archivo[fil][i] == num) {
esta_num = true;
num++;
} else {
if (i == 8)
es_valida = false;
}
}
esta_num = false;
}
return es_valida;
}
/**
* Consulta si la columna del archivo es valida. Asegurandose que no contenga
* numeros repetidos entre el 1 y el 9.
*
* @param col Columna a verificar.
* @return Verdadero si la columna es valida, falso en caso contrario.
*/
public boolean validar_columna(int col) {
boolean es_valida = true;
boolean esta_num = false;
int num = 1;
while (es_valida && num < 10) {
for (int i = 0; i < 9 && !esta_num; i++) {
if (matriz_archivo[i][col] == num) {
esta_num = true;
num++;
} else {
if (i == 8)
es_valida = false;
}
}
esta_num = false;
}
return es_valida;
}
}
| [
"agustinescobar700@gmail.com"
] | agustinescobar700@gmail.com |
54aa9752289e7c866335faedb7d3953c2f15ef8d | f79e008a864703cac6fc10a46cc96d90412b893d | /src/main/java/com/nerisa/datarepo/model/User.java | a007eb45ffa816500f612894cf2885c106246a87 | [] | no_license | nerisa/thesis-datarepo | 80c7b75fde5cfb7b8254b7430557d4147f594ab1 | 80ad068602f882491d3a2a73ac38b7a09effd558 | refs/heads/master | 2020-03-08T12:47:33.121350 | 2018-05-10T04:45:18 | 2018-05-10T04:45:18 | 128,137,098 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,762 | java | package com.nerisa.datarepo.model;
import com.nerisa.datarepo.incentive.CustodianLevel;
import com.nerisa.datarepo.utils.Constant;
/**
* Created by nerisa on 3/15/18.
*/
public class User {
private Long id;
private String email;
private String token;
private Long lastLoggedIn;
private boolean isCustodian;
private long monumentId;
private CustodianLevel level;
public User(){}
public User(String email, String token, Long lastLoggedIn) {
this.email = email;
this.token = token;
this.lastLoggedIn = lastLoggedIn;
this.isCustodian = Boolean.FALSE;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public Long getLastLoggedIn() {
return lastLoggedIn;
}
public void setLastLoggedIn(Long lastLoggedIn) {
this.lastLoggedIn = lastLoggedIn;
}
public boolean isCustodian() {
return isCustodian;
}
public void setCustodian(boolean isCustodian) {
this.isCustodian = isCustodian;
}
public String createUri(){
return Constant.USER_BASE_URI + "/" + id;
}
public long getMonumentId() {
return monumentId;
}
public void setMonumentId(long monumentId) {
this.monumentId = monumentId;
}
public CustodianLevel getLevel() {
return level;
}
public void setLevel(CustodianLevel level) {
this.level = level;
}
}
| [
"st118437@ait.asia"
] | st118437@ait.asia |
b1bc7c0d2167ab3e7b0e65dadf300ebfe45c59c6 | 7a362443b83d599487c44d356b3485c2853ce54d | /PipesAndFiltersFramework/src/framework/filters/source/AbstractSource.java | 7c28e4c3745475225662c78a5673a6492c8f0594 | [] | no_license | christianLins/PipesAndFilters | 8371502cea851883cf9b66a49fde76feedd342a3 | 7377b51c92606d657948aff8b443ef1dd33a4e7f | refs/heads/master | 2020-03-29T21:06:44.770607 | 2012-12-03T08:16:08 | 2012-12-03T08:16:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,008 | java | package framework.filters.source;
import java.util.Collection;
import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;
import framework.PipelineDataObject;
import framework.Writeable;
/**
* this abstract class supports basic functionality for a source
* extend this class for your own source
*
* @author Chris
*
* @param <out>
*/
public abstract class AbstractSource<out extends PipelineDataObject<out>> implements Source<out> {
protected Collection<Writeable<out>> outputs = new LinkedList<Writeable<out>>();
protected Queue<out> buffer = new LinkedBlockingQueue<>();
protected boolean isEOF = false;
public synchronized void addOutput(Writeable<out> out) {
outputs.add(out);
}
public synchronized void removeOutput(Writeable<out> out) {
outputs.remove(out);
}
@Override
public out read() {
if (!isEOF) {
getSource();
}
if (buffer.isEmpty()) {
return null; // eof
} else {
return buffer.poll();
}
}
}
| [
"christian.lins87@gmail.com"
] | christian.lins87@gmail.com |
659879d67529bbcec51f35c33f277f64e5d8b7c3 | b2767f7e94ece5bfe325164dda866d9597a9958c | /MyAlbumSlideshow/src/vn/techmaster/myalbumslideshow/MyAlbumScreen.java | d541c70bae8588255363119a3edf7568ed9d98e4 | [
"Apache-2.0"
] | permissive | techmaster-prj/AlbumSlideShowApp | 6f36f323bd8e46cda0082114f8aa524326dfd395 | 845f0fc42c7deae2c92559235f51b49680445127 | refs/heads/master | 2021-01-10T02:55:49.232874 | 2015-11-06T03:07:03 | 2015-11-06T03:07:03 | 45,655,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package vn.techmaster.myalbumslideshow;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MyAlbumScreen extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_album_screen);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.my_album_screen, menu);
return true;
}
}
| [
"phantichhoang@gmail.com"
] | phantichhoang@gmail.com |
ec7930b608695965fd8218c2b3dd128352a2b6e3 | 69bfd49117846cca74844edb81e071b4208ac208 | /src/lifei/jobserver/config/Config.java | 3fe25c6f05530f45cf11c096902764a3f46442c5 | [] | no_license | yubingzhong/JobServer | a997503436334a765b6fd26b979e0fc6a1ef478e | 24de05d888b0e64e2fa22b764d8b0115d4675b51 | refs/heads/master | 2021-01-25T10:00:27.089211 | 2011-05-26T02:43:21 | 2011-05-26T02:43:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,275 | java | package lifei.jobserver.config;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.commons.configuration.Configuration;
import org.apache.log4j.Logger;
public class Config {
private static Logger logger = Logger.getLogger("Config");
private static Map<String, String> _map = new HashMap<String, String>();
private Config() {
}
public static Map<String, String> getMap() {
return _map;
}
public static String get(String key) {
String ret = _map.get(key);
return ret == null ? "":ret;
}
public static void put(String key, String value) {
_map.put(key, value);
}
public static void build(Configuration config) {
// 路径默认值
Config.put("jobserver.path.runtimes.dir",
System.getProperty("user.dir") + System.getProperty("file.separator") + "runtimes");
// 邮箱设置默认值
Config.put("jobserver.email", "false");
Config.put("jobserver.email.smtp", null);
Config.put("jobserver.email.username", null);
Config.put("jobserver.email.password", null);
Config.put("jobserver.email.ssl", "false");
Config.put("jobserver.email.cc", null);
// 日志默认值
Config.put("logging.config.file", "conf/logger.xml");
// Hibernet配置文件
Config.put("hibernate.config.file", "conf/hibernate.cfg.xml");
// Job线程池
Config.put("jobserver.jobthreadpool.core_pool_size", "10");
Config.put("jobserver.jobthreadpool.max_pool_size", "15");
Config.put("jobserver.jobthreadpool.keep_alive_time", "0");
Config.put("jobserver.jobthreadpool.work_queue_size", "15");
// 邮件线程池
Config.put("jobserver.mailthreadpool.core_pool_size", "10");
Config.put("jobserver.mailthreadpool.max_pool_size", "15");
Config.put("jobserver.mailthreadpool.keep_alive_time", "0");
Config.put("jobserver.mailthreadpool.work_queue_size", "15");
// 端口号
Config.put("jobserver.port", "10086");
@SuppressWarnings("unchecked")
Iterator<String> iter = config.getKeys();
while(iter.hasNext()) {
String key = iter.next();
_map.put(key, config.getString(key));
logger.info("读取配置参数:" + key + "=" + config.getString(key));
}
}
}
| [
"lifei@kuxun.com"
] | lifei@kuxun.com |
bee10d1e87b251227958aee1437d9ece8856bb9a | ab49e486c43ae92e4be440f4d2b45a95c7ac080e | /src/main/java/com/xianlei/base/filter/RequestFilter.java | 8881a6ad6abd6bee898aec26ad2b09a5d83ea881 | [] | no_license | xianleii/spring-mx1 | 72ca8858658347631ba3e1abc6ecb66b075694c9 | cd82a81768464d05012a291546bf1d6f610af8a9 | refs/heads/master | 2021-08-14T09:55:15.476980 | 2017-11-15T09:12:35 | 2017-11-15T09:12:35 | 110,790,919 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,312 | java | package com.xianlei.base.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
public class RequestFilter implements Filter {
@Override
public void destroy() {
System.out.println("MyFilter destroy...");
}
@Override
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
String path = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+ request.getContextPath();
request.setAttribute("path",path);
request.setAttribute("webRoot",path);
request.setAttribute("resRoot",path+"/assets");
// Subject subject = SecurityUtils.getSubject();
// request.setAttribute(Constants.LOGIN_USER, subject.getPrincipal());
RequestContext.setRequest(request);
chain.doFilter(req, resp);
}
@Override
public void init(FilterConfig arg0) throws ServletException {
System.out.println("MyFilter init...");
}
}
| [
"strong_xian@163.com"
] | strong_xian@163.com |
771f41ce2e295d2401620b6f380055fbd7a75d24 | 6d1305349894c08a2fe750ea14a0d9b73b9481d1 | /kubernetes-itests/src/test/java/io/fabric8/kubernetes/LeaderIT.java | 75cf2c64d20a5d60625dd6764e005f9c1a070853 | [
"Apache-2.0"
] | permissive | fabric8io/kubernetes-client | 14cae444e52b22fee89cb332cdd27a48dda77ca1 | 43ee1c1a7356d48691cb1662f03b7a2b00490b73 | refs/heads/main | 2023-09-05T03:33:13.209066 | 2023-09-04T11:11:46 | 2023-09-04T12:46:35 | 38,829,639 | 3,232 | 1,587 | Apache-2.0 | 2023-09-14T11:20:55 | 2015-07-09T15:43:13 | Java | UTF-8 | Java | false | false | 3,067 | java | /**
* Copyright (C) 2015 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.fabric8.kubernetes;
import io.fabric8.junit.jupiter.api.RequireK8sSupport;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import io.fabric8.kubernetes.api.model.coordination.v1.Lease;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.extended.leaderelection.LeaderCallbacks;
import io.fabric8.kubernetes.client.extended.leaderelection.LeaderElectionConfigBuilder;
import io.fabric8.kubernetes.client.extended.leaderelection.LeaderElector;
import io.fabric8.kubernetes.client.extended.leaderelection.resourcelock.LeaseLock;
import org.junit.jupiter.api.Test;
import java.time.Duration;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@RequireK8sSupport(Lease.class)
class LeaderIT {
KubernetesClient client;
@Test
void testLeadershipCycle() throws InterruptedException, ExecutionException, TimeoutException {
final String lockIdentity = UUID.randomUUID().toString();
CompletableFuture<Void> leading = new CompletableFuture<>();
CompletableFuture<Void> stopped = new CompletableFuture<>();
CompletableFuture<String> changed = new CompletableFuture<>();
LeaderElector leader = client.leaderElector()
.withConfig(
new LeaderElectionConfigBuilder()
.withReleaseOnCancel()
.withName("Sample Leader Election configuration")
.withLeaseDuration(Duration.ofSeconds(30L))
.withLock(new LeaseLock(new ObjectMetaBuilder().withName("sample").withNamespace(client.getNamespace()).build(),
lockIdentity))
.withRenewDeadline(Duration.ofSeconds(10L))
.withRetryPeriod(Duration.ofSeconds(2L))
.withLeaderCallbacks(new LeaderCallbacks(
() -> leading.complete(null),
() -> stopped.complete(null),
changed::complete))
.build())
.build();
CompletableFuture<?> f = leader.start();
leading.get(10, TimeUnit.SECONDS);
assertTrue(!stopped.isDone());
f.cancel(true);
stopped.get(10, TimeUnit.SECONDS);
assertEquals(lockIdentity, changed.getNow(null));
}
}
| [
"marc@marcnuri.com"
] | marc@marcnuri.com |
cbdbec1e0d9ead00ccf54e42d59dfc63b366bba2 | 4f6929e8ff5a2ab76e068791212e4750ba50c1c5 | /gaoxiong-parent/order-server/src/main/java/com/gaoxiong/controller/OrderController.java | 05cc65d75c7c83b3387bf888a0d2573440434731 | [] | no_license | gaoxiong523/spring-security-oauth2-jwt-redis | 1a5a7639603f04bd76a6e2ef0abb0abc4af8663a | 258a1a3ae6993bd36a3f3d2867d4d9f72999d3fe | refs/heads/master | 2023-04-02T03:54:19.307680 | 2019-07-19T09:35:20 | 2019-07-19T09:35:20 | 197,151,549 | 0 | 0 | null | 2023-03-22T21:30:47 | 2019-07-16T08:20:00 | CSS | UTF-8 | Java | false | false | 1,436 | java | package com.gaoxiong.controller;
import com.alibaba.fastjson.JSON;
import com.gaoxiong.pojo.User;
import com.gaoxiong.util.AuthUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/**
* @author gaoxiong
* @ClassName OrderController
* @Description TODO
* @date 2019/7/17 11:17
*/
@RestController
@Slf4j
public class OrderController {
@GetMapping("/product/{id}")
public String getProduct( @PathVariable String id, HttpServletRequest req) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
log.info("----"+authentication);
System.out.println("用户名 : " + JSON.toJSONString(authentication.getPrincipal()));
User user = (User) authentication.getPrincipal();
System.out.println(user.getUsername());
System.out.println("封装的传递信息 : " + AuthUtils.getReqUser(req));
return "(Need Auth Request)product id : " + id;
}
@GetMapping("/order/{id}")
public String getOrder(@PathVariable String id) {
return "(No Auth Request)order id : " + id;
}
}
| [
"gaojunchen520"
] | gaojunchen520 |
956578bcf7161449bddbd8348a353be96d868a02 | f3976632aaf0f5b447b99da548652889ebe0e042 | /Assignment02_03/Assignment0203/src/main/java/Assignment0203/utilities/SimulationUtils.java | a21928a30c94fc50b31ff584e7b98697c0d26a1f | [] | no_license | LorenzoChiana/SemanticWeb2020 | 2bd4dd4db21e0e886c68c781c752957db105b23f | 08c9c0906f4233f540ebe322b48b049530330559 | refs/heads/master | 2023-01-28T11:52:35.497384 | 2020-12-14T14:37:16 | 2020-12-14T14:37:16 | 247,454,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,022 | java | package Assignment0203.utilities;
import Assignment0203.SegmentControl;
import Assignment0203.Map;
import Assignment0203.MyCar;
import Assignment0203.SpeedProfile;
import org.semanticweb.owlapi.model.*;
import java.util.*;
import static Assignment0203.utilities.IRIs.*;
public class SimulationUtils {
/** Create the simulation */
public static OWLOntologyUtils createSimulation(boolean speedWarning) {
OWLOntologyUtils myOnto = SimulationUtils.createMyOntology();
initClasses(myOnto);
SegmentControlUtils.createPath(myOnto);
createRunDirectionSWRLRule(myOnto);
createSpeedLimitSWRLRule(myOnto, speedWarning);
myOnto.addAxiom(OntologyUtils.createObjectPropertyAssertionAxiom(
MyCar.getInstance().getMyCarIndividual(),
SegmentControl.getInstance().getOverSpeedWarningThan(),
Map.getInstance().getSpeedLimit()
));
return myOnto;
}
/** Creates a new ontology */
private static OWLOntologyUtils createMyOntology() {
//creation of new empty ontology
OWLOntologyUtils onto = OntologyUtils.newEmptyOntology(myOntologyIRI).get();
OntologyUtils.setOntology(onto);
//import remote ontologies
onto.importOntology(carOntoIRI);
onto.importOntology(controlOntoIRI);
onto.importOntology(mapOntoIRI);
return onto;
}
/** Initialization of classes */
private static void initClasses(OWLOntologyUtils onto) {
//creation of road segment with 2 lanes
MapUtils.addRoadSegment();
MapUtils.connectObjectPropertiesToRoadSegment(onto);
//creation of my car
MyCarUtils.addMyCar();
MyCarUtils.connectPropertiesToMyCar(onto);
//creation class and properties for SWRL about speed
SegmentControlUtils.addClassForSpeedAndGoForwardSWRLRules();
SegmentControlUtils.connectPropertiesForSpeedSWRLRules();
//set the speed profile and speed limit
SpeedProfileUtils.addSpeedProfile();
MapUtils.addSpeedLimit();
MapUtils.connectSpeedMaxProperty(onto);
}
/** Creates SWRL rule for speedLimit */
private static void createSpeedLimitSWRLRule(OWLOntologyUtils ontology, boolean speedWarning) {
SWRLVariable varX = SWRLUtils.createSWRLVariable(varXIRI);
SWRLVariable varY = SWRLUtils.createSWRLVariable(varYIRI);
SWRLVariable varLane = SWRLUtils.createSWRLVariable(varLaneIRI);
//Class atoms: OWL named class and a single argument representing an OWL individual
// OnwWayLane(?Lane)
SWRLClassAtom OneWayLane_Lane = SWRLUtils.createSWRLClassAtom(Map.getInstance().getClassOneWayLane(), varLane);
// SpeedLimit(?Y)
SWRLClassAtom SpeedLimit_Y = SWRLUtils.createSWRLClassAtom(Map.getInstance().getClassSpeedLimit(), varY);
//Property Atoms: OWL object property and two arguments representing OWL individuals
// isRunningOn(?X, ?Lane)
SWRLObjectPropertyAtom isRunningOn_X_Lane = SWRLUtils.createSWRLObjectPropertyAtom(MyCar.getInstance().getIsRunningOn(), varX, varLane);
// overSpeedWarningThan(?X, ?Y)
SWRLObjectPropertyAtom overSpeedWarningThan_X_Y = SWRLUtils.createSWRLObjectPropertyAtom(SegmentControl.getInstance().getOverSpeedWarningThan(), varX, varY);
// Body's atom: isRunningOn(?X, ?Lane) ^ OneWayLane(?Lane)
Set<SWRLAtom> body = new HashSet<>();
body.add(isRunningOn_X_Lane);
body.add(OneWayLane_Lane);
if(speedWarning) {
// isRunningOn(?X, ?Lane) ^ OneWayLane(?Lane) ^ SpeedLimit(?Y) ^ overSpeedWarningThan(?X, ?Y)
body.add(SpeedLimit_Y);
body.add(overSpeedWarningThan_X_Y);
}
// isRunningOn(?X, ?Lane) ^ OneWayLane(?Lane) ^ SpeedLimit(?Y) ^ overSpeedWarningThan(?X, ?Y) -> constantSpeed(?X)
// isRunningOn(?X, ?Lane) ^ OneWayLane(?Lane) -> acceleration(?X)
SWRLClassAtom head = (speedWarning) ? SWRLUtils.createSWRLClassAtom(SpeedProfile.getInstance().getConstantSpeed(), varX) : SWRLUtils.createSWRLClassAtom(SpeedProfile.getInstance().getAcceleration(), varX);
// rule creation
SWRLRule rule = SWRLUtils.createAnonymousSWRLRule(body, Collections.singleton(head));
ontology.addAxiom(rule);
}
/** Created SWRL rule for run direction */
public static void createRunDirectionSWRLRule(OWLOntologyUtils ontology) {
SWRLVariable varX = SWRLUtils.createSWRLVariable(varXIRI);
SWRLVariable varLane = SWRLUtils.createSWRLVariable(varLaneIRI);
SWRLVariable varNextLane = SWRLUtils.createSWRLVariable(varNextLaneIRI);
// isRunningOn(?X, ?Lane)
SWRLObjectPropertyAtom isRunningOn_X_Lane = SWRLUtils.createSWRLObjectPropertyAtom(MyCar.getInstance().getIsRunningOn(), varX, varLane);
// goStraightTo(?Lane, ?NextLane)
SWRLObjectPropertyAtom goStraightTo_Lane_NextLane = SWRLUtils.createSWRLObjectPropertyAtom(Map.getInstance().getGoStraightTo(), varLane, varNextLane);
// GoForward(?X)
SWRLClassAtom GoForward_X = SWRLUtils.createSWRLClassAtom(SegmentControl.getInstance().getGoForward(), varX);
// nextPathSegment(?Lane, ?NextLane)
SWRLObjectPropertyAtom nextPathSegment_Lane_NextLane = SWRLUtils.createSWRLObjectPropertyAtom(SegmentControl.getInstance().getNextPathSegment(), varLane, varNextLane);
// isRunningOn(?X, ?Lane) ^ goStraightTo(?lane, ?NextLane) ^ nextPathSegment(?Lane, ?NextLane)
Set<SWRLAtom> body = new HashSet<>();
body.add(isRunningOn_X_Lane);
body.add(goStraightTo_Lane_NextLane);
body.add(nextPathSegment_Lane_NextLane);
// isRunningOn(?X, ?Lane) ^ goStraightTo(?Lane, ?NextLane) ^ nextPathSegment(?Lane, ?NextLane) -> GoForward(?X)
SWRLRule rule = SWRLUtils.createAnonymousSWRLRule(
body,
Collections.singleton(GoForward_X)
);
ontology.addAxiom(rule);
}
}
| [
"lorenzo.chiana@gmail.com"
] | lorenzo.chiana@gmail.com |
f31cea5a789f4c82e17898fb61eb65643e8efff1 | c09572431ee03fc2c4d4679203e26172634ebcb9 | /Clickinica/controller/IndicatoreController.java | cdf0f9d7d2498aeb45be2e55a12dc09edab8dac7 | [] | no_license | cridicicco/CLickINICA | 1e31d8a4a3d703ca909fe8e0ebdf78ff55ae4d9e | edd2cadb936fed71f44d4e7c226937cbf1cc3652 | refs/heads/master | 2020-04-05T23:07:49.620356 | 2020-01-13T09:57:29 | 2020-01-13T09:57:29 | 59,196,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,670 | java | package it.uniroma3.controller;
import java.util.List;
import it.uniroma3.facade.IndicatoreFacade;
import it.uniroma3.facade.PrerequisitoFacade;
import it.uniroma3.facade.RisultatoFacade;
import it.uniroma3.facade.UtenteFacade;
import it.uniroma3.model.Esame;
import it.uniroma3.model.Indicatore;
import it.uniroma3.model.Prerequisito;
import it.uniroma3.model.Risultato;
import it.uniroma3.model.Utente;
import javax.ejb.EJB;
import javax.ejb.EJBException;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.enterprise.context.SessionScoped;
@ManagedBean
public class IndicatoreController {
@ManagedProperty(value="#{param.id}")
private Long id;
private String nome;
private Indicatore indicatore;
private List<Indicatore> indicatori;
@EJB
private IndicatoreFacade indicatoreFacade;
public String createIndicatore() {
this.indicatore = indicatoreFacade.createIndicatore(nome);
return "indicatore";
}
public String listIndicatoriTipologia(long id) {
this.indicatori = indicatoreFacade.getAllIndicatoriTipologia( id);
return "indicatori";
}
public String findIndicatore() {
this.indicatore = indicatoreFacade.getIndicatore(id);
return "indicatore";
}
public String findIndicatore(long id) {
this.indicatore = indicatoreFacade.getIndicatore(id);
return "indicatore";
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String name) {
this.nome = name;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
8f9489bdde9f521e161a75801c2717855f83d5e8 | fee36ba1d4fd00180de95287818416f1be54aa04 | /Java/src/ex16_1_System_in_out_error/System4_getenv.java | 47372488b9bfb0f818ce21672a1941749820f62f | [] | no_license | JungWonHong/Spring | 721f53f48ca1795198ae87211cee6e899e32d706 | bfdaaeb286fb9b1770db68f5c39f5d86b19eceb6 | refs/heads/master | 2020-04-16T13:40:14.444198 | 2019-01-14T09:56:16 | 2019-01-14T09:56:16 | 165,637,644 | 1 | 0 | null | null | null | null | UHC | Java | false | false | 589 | java | //환경 변수는 운영체제에 속하는 변수로 주로 프로그램의 실행환경을 설정하는 데 사용합니다.
//환경변수 path의 값을 읽어오는 예제
package ex16_1_System_in_out_error;
public class System4_getenv {
public static void main(String[] args) {
//getenv() 메소드 : 환경 변수 "path"를 읽어옵니다.
//"path"를 제외한 다른 환경 변수들을 운영체제마다 이름도 다르고
//사용 목적도 달라서 시스템 프로퍼티를 사용합니다.
String str = System.getenv("path");
System.out.println(str);
}
}
| [
"sungwoo808@naver.com"
] | sungwoo808@naver.com |
fe54e6dc70683327c5afa162d545c00dd68f0b80 | 9e60577127d40b38c8930391f9ee30d069a87e24 | /facebook/src/main/java/com/facebook/internal/NativeProtocol.java | 8dead7a5d693c1339cb8be1dee651e991cf1d6f1 | [] | no_license | StarNeit/Android-360Video-VR | a77c1820cad5abde95d5849c3f7e68644e54ae41 | 93118f001ed1a7418f151ecdd966c868833442c1 | refs/heads/master | 2021-06-08T09:34:09.997285 | 2016-11-13T20:23:09 | 2016-11-13T20:23:09 | 73,640,682 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 35,940 | java | /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
* copy, modify, and distribute this software in source code or binary form for use
* in connection with the web services and APIs provided by Facebook.
*
* As with any software that integrates with the Facebook platform, your use of
* this software is subject to the Facebook Developer Principles and Policies
* [http://developers.facebook.com/policy/]. This copyright 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.facebook.internal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ProviderInfo;
import android.content.pm.ResolveInfo;
import android.content.pm.Signature;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import com.facebook.FacebookException;
import com.facebook.FacebookOperationCanceledException;
import com.facebook.FacebookSdk;
import com.facebook.login.DefaultAudience;
/**
* com.facebook.internal is solely for the use of other packages within the Facebook SDK for
* Android. Use of any of the classes in this package is unsupported, and they may be modified or
* removed without warning at any time.
*/
public final class NativeProtocol {
public static final int NO_PROTOCOL_AVAILABLE = -1;
private static final String FACEBOOK_PROXY_AUTH_ACTIVITY = "com.facebook.katana.ProxyAuth";
private static final String FACEBOOK_TOKEN_REFRESH_ACTIVITY =
"com.facebook.katana.platform.TokenRefreshService";
public static final String FACEBOOK_PROXY_AUTH_PERMISSIONS_KEY = "scope";
public static final String FACEBOOK_PROXY_AUTH_APP_ID_KEY = "client_id";
public static final String FACEBOOK_PROXY_AUTH_E2E_KEY = "e2e";
// ---------------------------------------------------------------------------------------------
// Native Protocol updated 2012-11
static final String INTENT_ACTION_PLATFORM_ACTIVITY = "com.facebook.platform.PLATFORM_ACTIVITY";
static final String INTENT_ACTION_PLATFORM_SERVICE = "com.facebook.platform.PLATFORM_SERVICE";
public static final int PROTOCOL_VERSION_20121101 = 20121101;
public static final int PROTOCOL_VERSION_20130502 = 20130502;
public static final int PROTOCOL_VERSION_20130618 = 20130618;
public static final int PROTOCOL_VERSION_20131107 = 20131107;
public static final int PROTOCOL_VERSION_20140204 = 20140204;
public static final int PROTOCOL_VERSION_20140324 = 20140324;
public static final int PROTOCOL_VERSION_20140701 = 20140701;
public static final int PROTOCOL_VERSION_20141001 = 20141001;
public static final int PROTOCOL_VERSION_20141028 = 20141028;
public static final int PROTOCOL_VERSION_20141107 = 20141107; // Bucketed Result Intents
public static final int PROTOCOL_VERSION_20141218 = 20141218;
public static final String EXTRA_PROTOCOL_VERSION =
"com.facebook.platform.protocol.PROTOCOL_VERSION";
public static final String EXTRA_PROTOCOL_ACTION =
"com.facebook.platform.protocol.PROTOCOL_ACTION";
public static final String EXTRA_PROTOCOL_CALL_ID =
"com.facebook.platform.protocol.CALL_ID";
public static final String EXTRA_GET_INSTALL_DATA_PACKAGE =
"com.facebook.platform.extra.INSTALLDATA_PACKAGE";
public static final String EXTRA_PROTOCOL_BRIDGE_ARGS =
"com.facebook.platform.protocol.BRIDGE_ARGS";
public static final String EXTRA_PROTOCOL_METHOD_ARGS =
"com.facebook.platform.protocol.METHOD_ARGS";
public static final String EXTRA_PROTOCOL_METHOD_RESULTS =
"com.facebook.platform.protocol.RESULT_ARGS";
public static final String BRIDGE_ARG_APP_NAME_STRING = "app_name";
public static final String BRIDGE_ARG_ACTION_ID_STRING = "action_id";
public static final String BRIDGE_ARG_ERROR_BUNDLE = "error";
public static final String EXTRA_DIALOG_COMPLETE_KEY =
"com.facebook.platform.extra.DID_COMPLETE";
public static final String EXTRA_DIALOG_COMPLETION_GESTURE_KEY =
"com.facebook.platform.extra.COMPLETION_GESTURE";
public static final String RESULT_ARGS_DIALOG_COMPLETE_KEY = "didComplete";
public static final String RESULT_ARGS_DIALOG_COMPLETION_GESTURE_KEY = "completionGesture";
// Messages supported by PlatformService:
public static final int MESSAGE_GET_ACCESS_TOKEN_REQUEST = 0x10000;
public static final int MESSAGE_GET_ACCESS_TOKEN_REPLY = 0x10001;
static final int MESSAGE_GET_PROTOCOL_VERSIONS_REQUEST = 0x10002;
static final int MESSAGE_GET_PROTOCOL_VERSIONS_REPLY = 0x10003;
public static final int MESSAGE_GET_INSTALL_DATA_REQUEST = 0x10004;
public static final int MESSAGE_GET_INSTALL_DATA_REPLY = 0x10005;
public static final int MESSAGE_GET_LIKE_STATUS_REQUEST = 0x10006;
public static final int MESSAGE_GET_LIKE_STATUS_REPLY = 0x10007;
// MESSAGE_ERROR_REPLY data keys:
// See STATUS_*
// MESSAGE_GET_ACCESS_TOKEN_REQUEST data keys:
// EXTRA_APPLICATION_ID
// MESSAGE_GET_ACCESS_TOKEN_REPLY data keys:
// EXTRA_ACCESS_TOKEN
// EXTRA_EXPIRES_SECONDS_SINCE_EPOCH
// EXTRA_PERMISSIONS
// MESSAGE_GET_LIKE_STATUS_REQUEST data keys:
// EXTRA_APPLICATION_ID
// EXTRA_OBJECT_ID
// MESSAGE_GET_LIKE_STATUS_REPLY data keys:
// EXTRA_OBJECT_IS_LIKED
// EXTRA_LIKE_COUNT_STRING_WITH_LIKE
// EXTRA_LIKE_COUNT_STRING_WITHOUT_LIKE
// EXTRA_SOCIAL_SENTENCE_WITH_LIKE
// EXTRA_SOCIAL_SENTENCE_WITHOUT_LIKE
// EXTRA_UNLIKE_TOKEN
// MESSAGE_GET_PROTOCOL_VERSIONS_REPLY data keys:
static final String EXTRA_PROTOCOL_VERSIONS = "com.facebook.platform.extra.PROTOCOL_VERSIONS";
// Values of EXTRA_PROTOCOL_ACTION supported by PlatformActivity:
public static final String ACTION_FEED_DIALOG =
"com.facebook.platform.action.request.FEED_DIALOG";
public static final String ACTION_MESSAGE_DIALOG =
"com.facebook.platform.action.request.MESSAGE_DIALOG";
public static final String ACTION_OGACTIONPUBLISH_DIALOG =
"com.facebook.platform.action.request.OGACTIONPUBLISH_DIALOG";
public static final String ACTION_OGMESSAGEPUBLISH_DIALOG =
"com.facebook.platform.action.request.OGMESSAGEPUBLISH_DIALOG";
public static final String ACTION_LIKE_DIALOG =
"com.facebook.platform.action.request.LIKE_DIALOG";
// The value of ACTION_APPINVITE_DIALOG is different since that is what is on the server.
public static final String ACTION_APPINVITE_DIALOG =
"com.facebook.platform.action.request.APPINVITES_DIALOG";
// Extras supported for ACTION_LOGIN_DIALOG:
public static final String EXTRA_PERMISSIONS = "com.facebook.platform.extra.PERMISSIONS";
public static final String EXTRA_APPLICATION_ID = "com.facebook.platform.extra.APPLICATION_ID";
public static final String EXTRA_APPLICATION_NAME =
"com.facebook.platform.extra.APPLICATION_NAME";
public static final String EXTRA_USER_ID = "com.facebook.platform.extra.USER_ID";
// Extras returned by setResult() for ACTION_LOGIN_DIALOG
public static final String EXTRA_ACCESS_TOKEN = "com.facebook.platform.extra.ACCESS_TOKEN";
public static final String EXTRA_EXPIRES_SECONDS_SINCE_EPOCH =
"com.facebook.platform.extra.EXPIRES_SECONDS_SINCE_EPOCH";
// EXTRA_PERMISSIONS
public static final String RESULT_ARGS_ACCESS_TOKEN = "access_token";
public static final String RESULT_ARGS_EXPIRES_SECONDS_SINCE_EPOCH =
"expires_seconds_since_epoch";
public static final String RESULT_ARGS_PERMISSIONS = "permissions";
// OG objects will have this key to set to true if they should be created as part of OG Action
// publish
public static final String OPEN_GRAPH_CREATE_OBJECT_KEY = "fbsdk:create_object";
// Determines whether an image is user generated
public static final String IMAGE_USER_GENERATED_KEY = "user_generated";
// url key for images
public static final String IMAGE_URL_KEY = "url";
// Keys for status data in MESSAGE_ERROR_REPLY from PlatformService and for error
// extras returned by PlatformActivity's setResult() in case of errors:
public static final String STATUS_ERROR_TYPE = "com.facebook.platform.status.ERROR_TYPE";
public static final String STATUS_ERROR_DESCRIPTION =
"com.facebook.platform.status.ERROR_DESCRIPTION";
public static final String STATUS_ERROR_CODE = "com.facebook.platform.status.ERROR_CODE";
public static final String STATUS_ERROR_SUBCODE = "com.facebook.platform.status.ERROR_SUBCODE";
public static final String STATUS_ERROR_JSON = "com.facebook.platform.status.ERROR_JSON";
public static final String BRIDGE_ARG_ERROR_TYPE = "error_type";
public static final String BRIDGE_ARG_ERROR_DESCRIPTION = "error_description";
public static final String BRIDGE_ARG_ERROR_CODE = "error_code";
public static final String BRIDGE_ARG_ERROR_SUBCODE = "error_subcode";
public static final String BRIDGE_ARG_ERROR_JSON = "error_json";
// Expected values for ERROR_KEY_TYPE. Clients should tolerate other values:
public static final String ERROR_UNKNOWN_ERROR = "UnknownError";
public static final String ERROR_PROTOCOL_ERROR = "ProtocolError";
public static final String ERROR_USER_CANCELED = "UserCanceled";
public static final String ERROR_APPLICATION_ERROR = "ApplicationError";
public static final String ERROR_NETWORK_ERROR = "NetworkError";
public static final String ERROR_PERMISSION_DENIED = "PermissionDenied";
public static final String ERROR_SERVICE_DISABLED = "ServiceDisabled";
public static final String WEB_DIALOG_URL = "url";
public static final String WEB_DIALOG_ACTION = "action";
public static final String WEB_DIALOG_PARAMS = "params";
public static final String WEB_DIALOG_IS_FALLBACK = "is_fallback";
public static final String AUDIENCE_ME = "only_me";
public static final String AUDIENCE_FRIENDS = "friends";
public static final String AUDIENCE_EVERYONE = "everyone";
private static final String CONTENT_SCHEME = "content://";
private static final String PLATFORM_PROVIDER = ".provider.PlatformProvider";
private static final String PLATFORM_PROVIDER_VERSIONS = PLATFORM_PROVIDER + "/versions";
// Columns returned by PlatformProvider
private static final String PLATFORM_PROVIDER_VERSION_COLUMN = "version";
private static abstract class NativeAppInfo {
abstract protected String getPackage();
private static final String FBI_HASH = "a4b7452e2ed8f5f191058ca7bbfd26b0d3214bfc";
private static final String FBL_HASH = "5e8f16062ea3cd2c4a0d547876baa6f38cabf625";
private static final String FBR_HASH = "8a3c4b262d721acd49a4bf97d5213199c86fa2b9";
private static final HashSet<String> validAppSignatureHashes = buildAppSignatureHashes();
private TreeSet<Integer> availableVersions;
private static HashSet<String> buildAppSignatureHashes() {
HashSet<String> set = new HashSet<String>();
set.add(FBR_HASH);
set.add(FBI_HASH);
set.add(FBL_HASH);
return set;
}
public boolean validateSignature(Context context, String packageName) {
String brand = Build.BRAND;
int applicationFlags = context.getApplicationInfo().flags;
if (brand.startsWith("generic") &&
(applicationFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
// We are debugging on an emulator, don't validate package signature.
return true;
}
PackageInfo packageInfo = null;
try {
packageInfo = context.getPackageManager().getPackageInfo(packageName,
PackageManager.GET_SIGNATURES);
} catch (PackageManager.NameNotFoundException e) {
return false;
}
for (Signature signature : packageInfo.signatures) {
String hashedSignature = Utility.sha1hash(signature.toByteArray());
if (validAppSignatureHashes.contains(hashedSignature)) {
return true;
}
}
return false;
}
public TreeSet<Integer> getAvailableVersions() {
if (availableVersions == null) {
fetchAvailableVersions(false);
}
return availableVersions;
}
private synchronized void fetchAvailableVersions(boolean force) {
if (force || availableVersions == null) {
availableVersions = fetchAllAvailableProtocolVersionsForAppInfo(this);
}
}
}
private static class KatanaAppInfo extends NativeAppInfo {
static final String KATANA_PACKAGE = "com.facebook.katana";
@Override
protected String getPackage() {
return KATANA_PACKAGE;
}
}
private static class MessengerAppInfo extends NativeAppInfo {
static final String MESSENGER_PACKAGE = "com.facebook.orca";
@Override
protected String getPackage() {
return MESSENGER_PACKAGE;
}
}
private static class WakizashiAppInfo extends NativeAppInfo {
static final String WAKIZASHI_PACKAGE = "com.facebook.wakizashi";
@Override
protected String getPackage() {
return WAKIZASHI_PACKAGE;
}
}
private static final NativeAppInfo FACEBOOK_APP_INFO = new KatanaAppInfo();
private static List<NativeAppInfo> facebookAppInfoList = buildFacebookAppList();
private static Map<String, List<NativeAppInfo>> actionToAppInfoMap = buildActionToAppInfoMap();
private static AtomicBoolean protocolVersionsAsyncUpdating = new AtomicBoolean(false);
private static List<NativeAppInfo> buildFacebookAppList() {
List<NativeAppInfo> list = new ArrayList<NativeAppInfo>();
// Katana needs to be the first thing in the list since it will get selected as the default
// FACEBOOK_APP_INFO
list.add(FACEBOOK_APP_INFO);
list.add(new WakizashiAppInfo());
return list;
}
private static Map<String, List<NativeAppInfo>> buildActionToAppInfoMap() {
Map<String, List<NativeAppInfo>> map = new HashMap<String, List<NativeAppInfo>>();
ArrayList<NativeAppInfo> messengerAppInfoList = new ArrayList<NativeAppInfo>();
messengerAppInfoList.add(new MessengerAppInfo());
// Add individual actions and the list they should try
map.put(ACTION_OGACTIONPUBLISH_DIALOG, facebookAppInfoList);
map.put(ACTION_FEED_DIALOG, facebookAppInfoList);
map.put(ACTION_LIKE_DIALOG, facebookAppInfoList);
map.put(ACTION_APPINVITE_DIALOG, facebookAppInfoList);
map.put(ACTION_MESSAGE_DIALOG, messengerAppInfoList);
map.put(ACTION_OGMESSAGEPUBLISH_DIALOG, messengerAppInfoList);
return map;
}
static Intent validateActivityIntent(Context context, Intent intent, NativeAppInfo appInfo) {
if (intent == null) {
return null;
}
ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(intent, 0);
if (resolveInfo == null) {
return null;
}
if (!appInfo.validateSignature(context, resolveInfo.activityInfo.packageName)) {
return null;
}
return intent;
}
static Intent validateServiceIntent(Context context, Intent intent, NativeAppInfo appInfo) {
if (intent == null) {
return null;
}
ResolveInfo resolveInfo = context.getPackageManager().resolveService(intent, 0);
if (resolveInfo == null) {
return null;
}
if (!appInfo.validateSignature(context, resolveInfo.serviceInfo.packageName)) {
return null;
}
return intent;
}
public static Intent createProxyAuthIntent(
Context context,
String applicationId,
Collection<String> permissions,
String e2e,
boolean isRerequest,
boolean isForPublish,
DefaultAudience defaultAudience) {
for (NativeAppInfo appInfo : facebookAppInfoList) {
Intent intent = new Intent()
.setClassName(appInfo.getPackage(), FACEBOOK_PROXY_AUTH_ACTIVITY)
.putExtra(FACEBOOK_PROXY_AUTH_APP_ID_KEY, applicationId);
if (!Utility.isNullOrEmpty(permissions)) {
intent.putExtra(
FACEBOOK_PROXY_AUTH_PERMISSIONS_KEY, TextUtils.join(",", permissions));
}
if (!Utility.isNullOrEmpty(e2e)) {
intent.putExtra(FACEBOOK_PROXY_AUTH_E2E_KEY, e2e);
}
intent.putExtra(
ServerProtocol.DIALOG_PARAM_RESPONSE_TYPE,
ServerProtocol.DIALOG_RESPONSE_TYPE_TOKEN_AND_SIGNED_REQUEST);
intent.putExtra(
ServerProtocol.DIALOG_PARAM_RETURN_SCOPES,
ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
if (isForPublish) {
intent.putExtra(
ServerProtocol.DIALOG_PARAM_DEFAULT_AUDIENCE,
defaultAudience.getNativeProtocolAudience());
}
// Override the API Version for Auth
intent.putExtra(
ServerProtocol.DIALOG_PARAM_LEGACY_OVERRIDE,
ServerProtocol.GRAPH_API_VERSION);
// Set the re-request auth type for requests
if (isRerequest) {
intent.putExtra(
ServerProtocol.DIALOG_PARAM_AUTH_TYPE,
ServerProtocol.DIALOG_REREQUEST_AUTH_TYPE);
}
intent = validateActivityIntent(context, intent, appInfo);
if (intent != null) {
return intent;
}
}
return null;
}
public static Intent createTokenRefreshIntent(Context context) {
for (NativeAppInfo appInfo : facebookAppInfoList) {
Intent intent = new Intent()
.setClassName(appInfo.getPackage(), FACEBOOK_TOKEN_REFRESH_ACTIVITY);
intent = validateServiceIntent(context, intent, appInfo);
if (intent != null) {
return intent;
}
}
return null;
}
public static final int getLatestKnownVersion() {
return KNOWN_PROTOCOL_VERSIONS.get(0);
}
// Note: be sure this stays sorted in descending order; add new versions at the beginning
private static final List<Integer> KNOWN_PROTOCOL_VERSIONS =
Arrays.asList(
PROTOCOL_VERSION_20141218,
PROTOCOL_VERSION_20141107,
PROTOCOL_VERSION_20141028,
PROTOCOL_VERSION_20141001,
PROTOCOL_VERSION_20140701,
PROTOCOL_VERSION_20140324,
PROTOCOL_VERSION_20140204,
PROTOCOL_VERSION_20131107,
PROTOCOL_VERSION_20130618,
PROTOCOL_VERSION_20130502,
PROTOCOL_VERSION_20121101
);
private static Intent findActivityIntent(
Context context,
String activityAction,
String internalAction) {
List<NativeAppInfo> list = actionToAppInfoMap.get(internalAction);
if (list == null) {
return null;
}
Intent intent = null;
for (NativeAppInfo appInfo : list) {
intent = new Intent()
.setAction(activityAction)
.setPackage(appInfo.getPackage())
.addCategory(Intent.CATEGORY_DEFAULT);
intent = validateActivityIntent(context, intent, appInfo);
if (intent != null) {
return intent;
}
}
return intent;
}
public static boolean isVersionCompatibleWithBucketedIntent(int version) {
return KNOWN_PROTOCOL_VERSIONS.contains(version) && version >= PROTOCOL_VERSION_20140701;
}
/**
* Will create an Intent that can be used to invoke an action in a Facebook app via the
* Native Protocol
*/
public static Intent createPlatformActivityIntent(
Context context,
String callId,
String action,
int version,
Bundle extras) {
Intent intent = findActivityIntent(context, INTENT_ACTION_PLATFORM_ACTIVITY, action);
if (intent == null) {
return null;
}
setupProtocolRequestIntent(intent, callId, action, version, extras);
return intent;
}
/**
* Will setup the passed in Intent in the shape of a Native Protocol request Intent.
*/
public static void setupProtocolRequestIntent(
Intent intent,
String callId,
String action,
int version,
Bundle params) {
String applicationId = FacebookSdk.getApplicationId();
String applicationName = FacebookSdk.getApplicationName();
intent.putExtra(EXTRA_PROTOCOL_VERSION, version)
.putExtra(EXTRA_PROTOCOL_ACTION, action)
.putExtra(EXTRA_APPLICATION_ID, applicationId);
if (isVersionCompatibleWithBucketedIntent(version)) {
// This is a bucketed intent
Bundle bridgeArguments = new Bundle();
bridgeArguments.putString(BRIDGE_ARG_ACTION_ID_STRING, callId);
Utility.putNonEmptyString(bridgeArguments, BRIDGE_ARG_APP_NAME_STRING, applicationName);
intent.putExtra(EXTRA_PROTOCOL_BRIDGE_ARGS, bridgeArguments);
Bundle methodArguments = (params == null) ? new Bundle() : params;
intent.putExtra(EXTRA_PROTOCOL_METHOD_ARGS, methodArguments);
} else {
// This is the older flat intent
intent.putExtra(EXTRA_PROTOCOL_CALL_ID, callId);
if (!Utility.isNullOrEmpty(applicationName)) {
intent.putExtra(EXTRA_APPLICATION_NAME, applicationName);
}
intent.putExtras(params);
}
}
/**
* Use this method to set a result on an Activity, where the result needs to be in the shape
* of the native protocol used for native dialogs.
*/
public static Intent createProtocolResultIntent(
Intent requestIntent,
Bundle results,
FacebookException error) {
UUID callId = NativeProtocol.getCallIdFromIntent(requestIntent);
if (callId == null) {
return null;
}
Intent resultIntent = new Intent();
resultIntent.putExtra(EXTRA_PROTOCOL_VERSION, getProtocolVersionFromIntent(requestIntent));
Bundle bridgeArguments = new Bundle();
bridgeArguments.putString(BRIDGE_ARG_ACTION_ID_STRING, callId.toString());
if (error != null) {
bridgeArguments.putBundle(
BRIDGE_ARG_ERROR_BUNDLE, NativeProtocol.createBundleForException(error));
}
resultIntent.putExtra(EXTRA_PROTOCOL_BRIDGE_ARGS, bridgeArguments);
if (results != null) {
resultIntent.putExtra(EXTRA_PROTOCOL_METHOD_RESULTS, results);
}
return resultIntent;
}
public static Intent createPlatformServiceIntent(Context context) {
for (NativeAppInfo appInfo : facebookAppInfoList) {
Intent intent = new Intent(INTENT_ACTION_PLATFORM_SERVICE)
.setPackage(appInfo.getPackage())
.addCategory(Intent.CATEGORY_DEFAULT);
intent = validateServiceIntent(context, intent, appInfo);
if (intent != null) {
return intent;
}
}
return null;
}
public static int getProtocolVersionFromIntent(Intent intent) {
return intent.getIntExtra(EXTRA_PROTOCOL_VERSION, 0);
}
public static UUID getCallIdFromIntent(Intent intent) {
if (intent == null) {
return null;
}
int version = getProtocolVersionFromIntent(intent);
String callIdString = null;
if (isVersionCompatibleWithBucketedIntent(version)) {
Bundle bridgeArgs = intent.getBundleExtra(EXTRA_PROTOCOL_BRIDGE_ARGS);
if (bridgeArgs != null) {
callIdString = bridgeArgs.getString(BRIDGE_ARG_ACTION_ID_STRING);
}
} else {
callIdString = intent.getStringExtra(EXTRA_PROTOCOL_CALL_ID);
}
UUID callId = null;
if (callIdString != null) {
try {
callId = UUID.fromString(callIdString);
} catch (IllegalArgumentException exception) {
}
}
return callId;
}
public static Bundle getBridgeArgumentsFromIntent(Intent intent) {
int version = getProtocolVersionFromIntent(intent);
if (!isVersionCompatibleWithBucketedIntent(version)) {
return null;
}
return intent.getBundleExtra(EXTRA_PROTOCOL_BRIDGE_ARGS);
}
public static Bundle getMethodArgumentsFromIntent(Intent intent) {
int version = getProtocolVersionFromIntent(intent);
if (!isVersionCompatibleWithBucketedIntent(version)) {
return intent.getExtras();
}
return intent.getBundleExtra(EXTRA_PROTOCOL_METHOD_ARGS);
}
public static Bundle getSuccessResultsFromIntent(Intent resultIntent) {
int version = getProtocolVersionFromIntent(resultIntent);
Bundle extras = resultIntent.getExtras();
if (!isVersionCompatibleWithBucketedIntent(version) || extras == null) {
return extras;
}
return extras.getBundle(EXTRA_PROTOCOL_METHOD_RESULTS);
}
public static boolean isErrorResult(Intent resultIntent) {
Bundle bridgeArgs = getBridgeArgumentsFromIntent(resultIntent);
if (bridgeArgs != null) {
return bridgeArgs.containsKey(BRIDGE_ARG_ERROR_BUNDLE);
} else {
return resultIntent.hasExtra(STATUS_ERROR_TYPE);
}
}
public static Bundle getErrorDataFromResultIntent(Intent resultIntent) {
if (!isErrorResult(resultIntent)) {
return null;
}
Bundle bridgeArgs = getBridgeArgumentsFromIntent(resultIntent);
if (bridgeArgs != null) {
return bridgeArgs.getBundle(BRIDGE_ARG_ERROR_BUNDLE);
}
return resultIntent.getExtras();
}
public static FacebookException getExceptionFromErrorData(Bundle errorData) {
if (errorData == null) {
return null;
}
String type = errorData.getString(BRIDGE_ARG_ERROR_TYPE);
if (type == null) {
type = errorData.getString(STATUS_ERROR_TYPE);
}
String description = errorData.getString(BRIDGE_ARG_ERROR_DESCRIPTION);
if (description == null) {
description = errorData.getString(STATUS_ERROR_DESCRIPTION);
}
if (type != null && type.equalsIgnoreCase(ERROR_USER_CANCELED)) {
return new FacebookOperationCanceledException(description);
}
/* TODO parse error values and create appropriate exception class */
return new FacebookException(description);
}
public static Bundle createBundleForException(FacebookException e) {
if (e == null) {
return null;
}
Bundle errorBundle = new Bundle();
errorBundle.putString(BRIDGE_ARG_ERROR_DESCRIPTION, e.toString());
if (e instanceof FacebookOperationCanceledException) {
errorBundle.putString(BRIDGE_ARG_ERROR_TYPE, ERROR_USER_CANCELED);
}
return errorBundle;
}
public static int getLatestAvailableProtocolVersionForService(final int minimumVersion) {
// Services are currently always against the Facebook App
return getLatestAvailableProtocolVersionForAppInfoList(
facebookAppInfoList, new int[]{minimumVersion});
}
public static int getLatestAvailableProtocolVersionForAction(
String action,
int[] versionSpec) {
List<NativeAppInfo> appInfoList = actionToAppInfoMap.get(action);
return getLatestAvailableProtocolVersionForAppInfoList(appInfoList, versionSpec);
}
private static int getLatestAvailableProtocolVersionForAppInfoList(
List<NativeAppInfo> appInfoList,
int[] versionSpec) {
// Kick off an update
updateAllAvailableProtocolVersionsAsync();
if (appInfoList == null) {
return NO_PROTOCOL_AVAILABLE;
}
// Could potentially cache the NativeAppInfo to latestProtocolVersion
for (NativeAppInfo appInfo : appInfoList) {
int protocolVersion =
computeLatestAvailableVersionFromVersionSpec(
appInfo.getAvailableVersions(),
getLatestKnownVersion(),
versionSpec);
if (protocolVersion != NO_PROTOCOL_AVAILABLE) {
return protocolVersion;
}
}
return NO_PROTOCOL_AVAILABLE;
}
public static void updateAllAvailableProtocolVersionsAsync() {
if (!protocolVersionsAsyncUpdating.compareAndSet(false, true)) {
return;
}
FacebookSdk.getExecutor().execute(new Runnable() {
@Override
public void run() {
try {
for (NativeAppInfo appInfo : facebookAppInfoList) {
appInfo.fetchAvailableVersions(true);
}
} finally {
protocolVersionsAsyncUpdating.set(false);
}
}
});
}
private static TreeSet<Integer> fetchAllAvailableProtocolVersionsForAppInfo(
NativeAppInfo appInfo) {
TreeSet<Integer> allAvailableVersions = new TreeSet<>();
Context appContext = FacebookSdk.getApplicationContext();
ContentResolver contentResolver = appContext.getContentResolver();
String [] projection = new String[]{ PLATFORM_PROVIDER_VERSION_COLUMN };
Uri uri = buildPlatformProviderVersionURI(appInfo);
Cursor c = null;
try {
// First see if the base provider exists as a check for whether the native app is
// installed. We do this prior to querying, to prevent errors from being output to
// logcat saying that the provider was not found.
PackageManager pm = FacebookSdk.getApplicationContext().getPackageManager();
String contentProviderName = appInfo.getPackage() + PLATFORM_PROVIDER;
ProviderInfo pInfo = pm.resolveContentProvider(contentProviderName, 0);
if (pInfo != null) {
c = contentResolver.query(uri, projection, null, null, null);
if (c != null) {
while (c.moveToNext()) {
int version = c.getInt(c.getColumnIndex(PLATFORM_PROVIDER_VERSION_COLUMN));
allAvailableVersions.add(version);
}
}
}
return allAvailableVersions;
} finally {
if (c != null) {
c.close();
}
}
}
public static int computeLatestAvailableVersionFromVersionSpec(
TreeSet<Integer> allAvailableFacebookAppVersions,
int latestSdkVersion,
int[] versionSpec) {
// Remember that these ranges are sorted in ascending order and can be unbounded. So we are
// starting from the end of the version-spec array and working backwards, to try get the
// newest possible version
int versionSpecIndex = versionSpec.length - 1;
Iterator<Integer> fbAppVersionsIterator =
allAvailableFacebookAppVersions.descendingIterator();
int latestFacebookAppVersion = -1;
while (fbAppVersionsIterator.hasNext()) {
int fbAppVersion = fbAppVersionsIterator.next();
// We're holding on to the greatest fb-app version available.
latestFacebookAppVersion = Math.max(latestFacebookAppVersion, fbAppVersion);
// If there is a newer version in the versionSpec, throw it away, we don't have it
while (versionSpecIndex >= 0 && versionSpec[versionSpecIndex] > fbAppVersion) {
versionSpecIndex--;
}
if (versionSpecIndex < 0) {
// There was no fb app version that fell into any range in the versionSpec - or -
// the versionSpec was empty, which means that this action is not supported.
return NO_PROTOCOL_AVAILABLE;
}
// If we are here, we know we are within a range specified in the versionSpec. We should
// see if it is a disabled or enabled range.
if (versionSpec[versionSpecIndex] == fbAppVersion) {
// if the versionSpecIndex is even, it is enabled; if odd, disabled
return (
versionSpecIndex % 2 == 0 ?
Math.min(latestFacebookAppVersion, latestSdkVersion) :
NO_PROTOCOL_AVAILABLE
);
}
}
return NO_PROTOCOL_AVAILABLE;
}
private static Uri buildPlatformProviderVersionURI(NativeAppInfo appInfo) {
return Uri.parse(CONTENT_SCHEME + appInfo.getPackage() + PLATFORM_PROVIDER_VERSIONS);
}
}
| [
"you@example.com"
] | you@example.com |
a090d11c7e3c5cc2d5d5232bba57e35b88eef04f | ba410522f5f0a4fd6dee2184366f4a83ecdc7c5e | /app/src/test/java/com/example/android/athensview/ExampleUnitTest.java | 262373896a9adbd67bf8e234e76a9f950a9169c1 | [] | no_license | vassilia/AthensView | 230187328d92111ab7d2d34abe7480efc4ac58ac | 2a8deba780b9f1e14f21826a76724aa81d079741 | refs/heads/master | 2021-01-01T15:47:56.103056 | 2017-07-19T12:47:13 | 2017-07-19T12:47:13 | 97,704,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package com.example.android.athensview;
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);
}
} | [
"vcostarides@biomed.ntua.gr"
] | vcostarides@biomed.ntua.gr |
a6d3672e74bfd8fb111caff76d960674cd755ffd | c83f250584db1b5acb47d792a2e54d40d10a096e | /src/mvj/practice/better/NewAlbumServlet.java | b1380cb4e8a4ad4fa534ea99b4e77e74eb1fd1be | [] | no_license | acrosshistory/AlbumMachine | 6f11169da960576a151ebdc06780c7ae984f88d4 | 76531e7d32f56699ca43e64281ca9ee6509573dc | refs/heads/master | 2020-05-16T18:26:47.311938 | 2014-06-12T17:12:54 | 2014-06-12T17:12:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,971 | java | package mvj.practice.better;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class NewAlbumServlet
*/
@WebServlet("/NewAlbumServlet")
public class NewAlbumServlet extends HttpServlet {
package edu.austinacc.capstone;
import java.io.IOException;
import javax.annotation.Resource;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.sun.tools.internal.ws.processor.model.Request;
/**
* Servlet implementation class NewQuoteServlet
*/
@WebServlet("/new")
public class NewAlbumServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Resource(name="jdbc/quoteDB")
javax.sql.DataSource ds;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getRequestDispatcher("/WEB-INF/NewJSP.jsp").forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String text = request.getParameter("album");
String author = request.getParameter("artist");
System.out.println("post" + album + " -> " + artist);
Album album = new Album(album,artist);
AlbumManager manager = new AlbumManager(ds);
if (manager.newAlbum(album)) {
response.sendRedirect("/");
} else{
request.getRequestDispatcher("/WEB-INF/NewJSP.jsp").forward(request, response);
}
}
}
| [
"mvjensenphotography@gmail.com"
] | mvjensenphotography@gmail.com |
7197f830e7a12f33c42807c8355da1044fe96c03 | e7c2a56226b6c7a267bf2dc8cd03faeacfb4ee69 | /WebISproject-master/src/main/java/lms/repository/PlaceRepository.java | 6a22543f0214af98ab2b6000ca1f5ca18031ea32 | [] | no_license | lukazec97/Student-service | 72b2ee1d6227825ab45e3d487e8581fceab2107f | 7c18342176f894605f9891a2fa5c8d30bc227e4e | refs/heads/master | 2023-01-10T21:41:12.194187 | 2020-02-08T14:52:12 | 2020-02-08T14:52:12 | 239,148,924 | 0 | 0 | null | 2023-01-07T14:37:00 | 2020-02-08T14:50:28 | Java | UTF-8 | Java | false | false | 252 | java | package lms.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import lms.domain.Place;
@Repository
public interface PlaceRepository extends JpaRepository<Place, Long>{
}
| [
"luka.zec97@gmail.com"
] | luka.zec97@gmail.com |
7ff7684be6e2b4f31afa9f7814169ee083a382a6 | bb5a2ca54618cd40c5653a20b4d2f9509936b364 | /src/model/ModelServer.java | 2b55d198c0b6a8afc7694f4d73871a46cda49557 | [] | no_license | DylanYu/virtual-environment-builder | 9021c3581c66617a978a5fb89505c1e53915e635 | 1dd2955cb93265bc42ff61ac61a9e835757057f1 | refs/heads/master | 2020-03-29T15:07:16.947556 | 2015-03-29T16:20:03 | 2015-03-29T16:20:03 | 27,127,155 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,570 | java | package model;
public class ModelServer {
private ModelImage image;
private ModelFlavor flavor;
private ModelNetwork[] networks;
private String id;
// TODO networks are for creation while addresses are for operation
private String[] addresses;
public ModelImage getImage() {
return image;
}
public void setImage(ModelImage image) {
this.image = image;
}
public ModelFlavor getFlavor() {
return flavor;
}
public void setFlavor(ModelFlavor flavor) {
this.flavor = flavor;
}
public ModelNetwork[] getNetworks() {
return networks;
}
public void setNetworks(ModelNetwork[] networks) {
this.networks = networks;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String[] getAddresses() {
return addresses;
}
public void setAddresses(String[] addresses) {
this.addresses = addresses;
}
public String toString() {
String addrs = "";
for (String a : addresses)
addrs += (a + ",");
String nets = "";
for (ModelNetwork net : networks)
nets += (net + ",");
return String.format("Server: {\n" +
"\tID: %s\n" +
"\tIP_addresses: [%s]\n" +
"\tNetworks: %s\n" +
"\tFlavor: %s\n" +
"\tImage: %s\n}",
this.id,
addrs,
nets,
this.flavor,
this.image);
}
}
| [
"yudl.nju@gmail.com"
] | yudl.nju@gmail.com |
afae73e1c7512724542d4002bb80d40d0fecde15 | 1b1a730a449db3e93a239753681f397e651e0f1b | /cloud-hystrix/src/test/java/com/july/cloudhystrix/CloudHystrixApplicationTests.java | b5fd41f12cda241946b10a19df7aacaaec254694 | [] | no_license | zengxueqi-yu/springcloud-hystrix | fd6ceab791af5625046905003a75cf60ab878dfd | a2b0eb21e0e0aa178d8c30cc75109a5a573a69ee | refs/heads/master | 2020-09-16T21:32:44.880798 | 2019-11-25T07:59:59 | 2019-11-25T07:59:59 | 223,892,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 228 | java | package com.july.cloudhystrix;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CloudHystrixApplicationTests {
@Test
void contextLoads() {
}
}
| [
"zengxueqi-yu@outlook.com"
] | zengxueqi-yu@outlook.com |
13cdb3725d99e1ea541113c5ba7d4ad550bc8c50 | 671d0f675d98cf682c2dd99a8405f2b088e3fb31 | /src/test/java/ru/workshop/firstproject/FirstprojectApplicationTests.java | c24cfb2d1ca2365fb46a162dcab4dff688d9dfa0 | [] | no_license | Faoxis/firstproject | 5ca6ef7143957af64f69a73058638eb0e6f69f96 | 00b85efddea1560d477d82d0f99dcaa84cafd3e2 | refs/heads/master | 2020-03-06T18:00:56.487951 | 2018-03-27T14:22:27 | 2018-03-27T14:22:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package ru.workshop.firstproject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class FirstprojectApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"SGSamoylov@alfabank.ru"
] | SGSamoylov@alfabank.ru |
4e7fc37eac4403cdb56763cad9497cc51a7def8a | c8e0beb1d7c2fff2280561863ae1df472c804f9a | /src/main/java/com/example/service/StudentService.java | 3228597248a2a1403c092e58fb8a39bcdefc1f76 | [] | no_license | apap-2017/tutorial8_1306386642 | 7f25e1376ff30007ded4d258908465e44a961abb | 2858aaed54772d91340c35c73571dcb40ac00b27 | refs/heads/master | 2021-05-07T04:38:51.527818 | 2017-11-18T12:32:45 | 2017-11-18T12:32:45 | 111,203,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 517 | java | package com.example.service;
import java.util.List;
import com.example.model.CourseModel;
import com.example.model.StudentModel;
public interface StudentService
{
StudentModel selectStudent (String npm);
List<StudentModel> selectAllStudents ();
void addStudent (StudentModel student);
void deleteStudent (String npm);
void updateStudent(StudentModel student);
CourseModel selectCourse (String id_course);
List<CourseModel> selectAllCourse ();
}
| [
"hasbyrosyadi1995@gmail.com"
] | hasbyrosyadi1995@gmail.com |
1bd2105ebae42a7575abe9999b28fe370f07232f | caf2b56e0aa5b1fb851159e4fc6bc995749252c2 | /day02/demo01/Demo01LogIn.java | 1198e772033572ea91aeb3d5fb4ba13d4518a515 | [] | no_license | Carriage77/ClassWork | eaf03f56919b83613eb3b3cf643a05e2c71da0db | a9e61e9410c3af4de0aba7b76d78913784a45069 | refs/heads/master | 2020-07-27T10:38:01.891177 | 2019-11-17T07:40:42 | 2019-11-17T07:40:42 | 209,061,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 872 | java | package cn.xycode.day02.demo01;
/**
* Description:Devise A System Of LogIn
* Author:Mr.Ma
* Date:2019-9-20
* 练习字符串比较 public boolean equals(Object obj);//不区分大小写
*/
import java.util.Scanner;
public class Demo01LogIn {
public static void main(String[] args) {
LogIn person = new LogIn();
System.out.println("====登录测试====");
System.out.print("输入账号:");
Scanner scan01 = new Scanner(System.in);
String id = scan01.next();
System.out.print("输入密码:");
Scanner scan02 = new Scanner(System.in);
String password = scan02.next();
if (id.equals(person.getId()) && password.equals(person.getPassword()) == true) {
System.out.println("登录成功!");
} else {
System.out.println("登录失败!");
}
}
}
| [
"402152203@qq.com"
] | 402152203@qq.com |
0b272bfe200e97b82eaf2c3c7db4e966e3e2f32e | e31d48add00ac374c0adfe55173d78d9efb26cf9 | /design-mode/src/main/java/cn/ff/proxy/dynamic/JdkSon.java | 1c74c925dd5e126372d8e023da3ba4ab617c00ba | [] | no_license | gaofeifan/thread-model | a29c1858e6c6ba011827a2e670e2e756dc1dae96 | 2201f1003dcd3b90f84823e923876ef76796e566 | refs/heads/master | 2020-06-22T16:04:22.103952 | 2018-12-29T10:35:58 | 2018-12-29T10:35:58 | 197,742,247 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 280 | java | package cn.ff.proxy.dynamic;
public class JdkSon implements JdkPerson{
@Override
public void findLove() {
System.out.println("jdk 找对象 超白 超富 超美");
}
@Override
public void eat(String name) {
System.out.println("吃"+ name);
}
}
| [
"1315697146@qq.com"
] | 1315697146@qq.com |
a1e00def1a0b4724c45d309c050df61523a40d30 | 8c21419769d709bd33e239dbe8b8c9526bf898e2 | /tarea3/Serviciomusica/app/src/main/java/es/upv/serviciomusica/ReceptorLlamadas.java | 823068a549a9ab4e110494efd8d3051e45330ac4 | [] | no_license | raul2222/Macbook_Android | 934a919d83013419205d73dc81cc885cd5341758 | 903e9d208bb40a7fe0e5a0187eff7ebb7c728aa5 | refs/heads/master | 2020-09-22T14:41:24.779166 | 2020-01-07T08:51:57 | 2020-01-07T08:51:57 | 225,242,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,679 | java | package es.upv.serviciomusica;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.Log;
import androidx.core.app.NotificationCompat;
public class ReceptorLlamadas extends BroadcastReceiver {
@Override public void onReceive(Context context, Intent intent) {
// Sacamos información de la intención
String estado = "", numero = "";
Bundle extras = intent.getExtras();
Log.e("llega","hola");
if (extras != null) {
estado = extras.getString(TelephonyManager.EXTRA_STATE);
if (estado.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
numero = extras.getString(
TelephonyManager.EXTRA_INCOMING_NUMBER);
String info = estado + " " + numero;
Log.e("ReceptorAnuncio", info + " intent=" + intent);
NotificationCompat.Builder notificacion = new
NotificationCompat.Builder(context)
.setContentTitle("Llamada entrante ")
.setContentText(info)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentIntent(PendingIntent.getActivity(context, 0,
new Intent(context, MainActivity.class), 0));
((NotificationManager) context.getSystemService(Context.
NOTIFICATION_SERVICE)).notify(1,notificacion.build());
}
}
}
} | [
"eaeaea7@gmail.com"
] | eaeaea7@gmail.com |
36815c3ccbfbc1d388fc4a950446d7ed5207bd31 | 8727b1cbb8ca63d30340e8482277307267635d81 | /PolarWorld/src/com/game/recharge/RechargeEntry.java | d49ddfcb35112bfda24babbac8361668cefdf787 | [] | no_license | taohyson/Polar | 50026903ded017586eac21a7905b0f1c6b160032 | b0617f973fd3866bed62da14f63309eee56f6007 | refs/heads/master | 2021-05-08T12:22:18.884688 | 2015-12-11T01:44:18 | 2015-12-11T01:44:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,732 | java | package com.game.recharge;
import java.util.HashMap;
/**
*
* @author
*
*/
public class RechargeEntry {
private static final String UID = "UID";
private static final String OID = "OID";
private static final String SID="SID";
private static final String MONEY = "MONEY";
private static final String GOLD = "GOLD";
private static final String BINDGOLD = "BINDGOLD";
private static final String IP = "IP";
private static final String TYPE = "TYPE"; // 充值类型 内部充值9 真实充值0
private static final String REMARK = "REMARK";
private static final String TIME = "TIME";
private static final String SIGN="SIGN";
private static final String RMB="RMB";
private String paramValue;
private HashMap<String, String> param = new HashMap<String, String>();
// sid=55&uid=222&oid=111&type=1&num=100&ip=210.110.110.110&time=1254984732&sign=asdfadf
public RechargeEntry(HashMap<String, String> param,String json) {
this.param=param;
paramValue=json;
}
@Override
public String toString() {
return paramValue;
}
public String getIp() {
return param.get(IP);
}
public String getGold() {
return param.get(GOLD);
}
public String getBindGold() {
return param.get(BINDGOLD);
}
public String getRemark(){
return param.get(REMARK);
}
public String getMoney() {
return param.get(MONEY);
}
public String getUid() {
return param.get(UID);
}
public String getOid() {
return param.get(OID);
}
public String getRMB(){
return param.get(RMB);
}
public String getSid(){
return param.get(SID);
}
public String getType() {
return param.get(TYPE);
}
public String getTime() {
return param.get(TIME);
}
public String getSign(){
return param.get(SIGN);
}
}
| [
"zhuyuanbiao@ZHUYUANBIAO.rd.com"
] | zhuyuanbiao@ZHUYUANBIAO.rd.com |
e6d81a678baba30b63bbaf53e296498aa5f6f1fe | 8b9022dda67a555c3fd70e652fa9159e5b517602 | /src/main/java/org/drip/sample/loan/Shahjahanpur.java | fb4116707f6d61f34e2fbca0415711dc6120fc09 | [
"Apache-2.0"
] | permissive | BugHunterPhilosopher/DROP | 19b77d184fea32366c4892d7d2ca872a16b10c1c | 166c1fc6276045aad97ffacf4226caccfa23ce10 | refs/heads/master | 2022-07-05T22:13:09.331395 | 2020-05-04T03:41:08 | 2020-05-04T03:41:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,329 | java |
package org.drip.sample.loan;
import org.drip.analytics.cashflow.*;
import org.drip.analytics.date.*;
import org.drip.numerical.common.FormatUtil;
import org.drip.param.market.CurveSurfaceQuoteContainer;
import org.drip.param.valuation.ValuationParams;
import org.drip.product.creator.BondBuilder;
import org.drip.product.credit.BondComponent;
import org.drip.product.params.EmbeddedOptionSchedule;
import org.drip.service.env.EnvManager;
import org.drip.service.scenario.*;
import org.drip.service.template.LatentMarketStateBuilder;
import org.drip.state.discount.MergedDiscountForwardCurve;
import org.drip.state.identifier.FloaterLabel;
/*
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*/
/*!
* Copyright (C) 2020 Lakshmi Krishnamurthy
* Copyright (C) 2019 Lakshmi Krishnamurthy
* Copyright (C) 2018 Lakshmi Krishnamurthy
* Copyright (C) 2017 Lakshmi Krishnamurthy
*
* This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics,
* asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment
* analytics, and portfolio construction analytics within and across fixed income, credit, commodity,
* equity, FX, and structured products. It also includes auxiliary libraries for algorithm support,
* numerical analysis, numerical optimization, spline builder, model validation, statistical learning,
* and computational support.
*
* https://lakshmidrip.github.io/DROP/
*
* DROP is composed of three modules:
*
* - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/
* - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
* - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/
*
* DROP Product Core implements libraries for the following:
* - Fixed Income Analytics
* - Loan Analytics
* - Transaction Cost Analytics
*
* DROP Portfolio Core implements libraries for the following:
* - Asset Allocation Analytics
* - Asset Liability Management Analytics
* - Capital Estimation Analytics
* - Exposure Analytics
* - Margin Analytics
* - XVA Analytics
*
* DROP Computational Core implements libraries for the following:
* - Algorithm Support
* - Computation Support
* - Function Analysis
* - Model Validation
* - Numerical Analysis
* - Numerical Optimizer
* - Spline Builder
* - Statistical Learning
*
* Documentation for DROP is Spread Over:
*
* - Main => https://lakshmidrip.github.io/DROP/
* - Wiki => https://github.com/lakshmiDRIP/DROP/wiki
* - GitHub => https://github.com/lakshmiDRIP/DROP
* - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md
* - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html
* - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
* - Release Versions => https://lakshmidrip.github.io/DROP/version.html
* - Community Credits => https://lakshmidrip.github.io/DROP/credits.html
* - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues
* - JUnit => https://lakshmidrip.github.io/DROP/junit/index.html
* - Jacoco => https://lakshmidrip.github.io/DROP/jacoco/index.html
*
* 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.
*/
/**
* <i>Shahjahanpur</i> demonstrates the Analytics Calculation/Reconciliation for the Loan Shahjahanpur.
*
* <br><br>
* <ul>
* <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ProductCore.md">Product Core Module</a></li>
* <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FixedIncomeAnalyticsLibrary.md">Fixed Income Analytics</a></li>
* <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/README.md">DROP API Construction and Usage</a></li>
* <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/loan/README.md">Loan Relative Value Metrics Generation</a></li>
* </ul>
* <br><br>
*
* @author Lakshmi Krishnamurthy
*/
public class Shahjahanpur {
private static final void SetEOS (
final BondComponent bond,
final EmbeddedOptionSchedule eosCall,
final EmbeddedOptionSchedule eosPut)
throws java.lang.Exception
{
if (null != eosPut) bond.setEmbeddedPutSchedule (eosPut);
if (null != eosCall) bond.setEmbeddedCallSchedule (eosCall);
}
public static final void main (
final String[] astArgs)
throws Exception
{
EnvManager.InitEnv ("");
JulianDate dtSpot = DateUtil.CreateFromYMD (
2017,
DateUtil.OCTOBER,
10
);
String[] astrDepositTenor = new String[] {
"2D"
};
double[] adblDepositQuote = new double[] {
0.0130411 // 2D
};
double[] adblFuturesQuote = new double[] {
0.01345, // 98.655
0.01470, // 98.530
0.01575, // 98.425
0.01660, // 98.340
0.01745, // 98.255
0.01845 // 98.155
};
String[] astrFixFloatTenor = new String[] {
"02Y",
"03Y",
"04Y",
"05Y",
"06Y",
"07Y",
"08Y",
"09Y",
"10Y",
"11Y",
"12Y",
"15Y",
"20Y",
"25Y",
"30Y",
"40Y",
"50Y"
};
double[] adblFixFloatQuote = new double[] {
0.016410, // 2Y
0.017863, // 3Y
0.019030, // 4Y
0.020035, // 5Y
0.020902, // 6Y
0.021660, // 7Y
0.022307, // 8Y
0.022879, // 9Y
0.023363, // 10Y
0.023820, // 11Y
0.024172, // 12Y
0.024934, // 15Y
0.025581, // 20Y
0.025906, // 25Y
0.025973, // 30Y
0.025838, // 40Y
0.025560 // 50Y
};
String[] astrGovvieTenor = new String[] {
"1Y",
"2Y",
"3Y",
"5Y",
"7Y",
"10Y",
"20Y",
"30Y"
};
double[] adblGovvieYield = new double[] {
0.01219, // 1Y
0.01391, // 2Y
0.01590, // 3Y
0.01937, // 5Y
0.02200, // 7Y
0.02378, // 10Y
0.02677, // 20Y
0.02927 // 30Y
};
String[] astrCreditTenor = new String[] {
"06M",
"01Y",
"02Y",
"03Y",
"04Y",
"05Y",
"07Y",
"10Y"
};
double[] adblCreditQuote = new double[] {
10., // 6M
12., // 1Y
15., // 2Y
19., // 3Y
24., // 4Y
28., // 5Y
38., // 7Y
51. // 10Y
};
double dblFX = 1;
int iSettleLag = 3;
double dblSpread = 0.0;
String strCurrency = "USD";
double dblCleanPrice = 1.0041375;
double dblIssuePrice = 0.99875;
double dblSpreadBump = 20.;
String strTreasuryCode = "UST";
double dblIssueAmount = 7.50e8;
double dblSpreadDurationMultiplier = 5.;
double dblResetRate = 0.045552 - dblSpread;
JulianDate dtEffective = DateUtil.CreateFromYMD (
2017,
4,
7
);
JulianDate dtMaturity = DateUtil.CreateFromYMD (
2024,
3,
31
);
BondComponent bond = BondBuilder.CreateSimpleFloater (
"Shahjahanpur",
"USD",
"USD-3M",
"Shahjahanpur",
dblSpread,
4,
"Act/360",
dtEffective,
dtMaturity,
null,
null
);
SetEOS (
bond,
EmbeddedOptionSchedule.FromAmerican (
dtSpot.julian(),
new int[] {
DateUtil.CreateFromYMD (2017, 4, 7).julian(),
DateUtil.CreateFromYMD (2017, 10, 7).julian(),
DateUtil.CreateFromYMD (2024, 3, 31).julian(),
},
new double[] {
1.01,
1.00,
1.00,
},
false,
15,
15,
false,
Double.NaN,
"",
Double.NaN
),
null
);
CompositeFloatingPeriod cfp = (CompositeFloatingPeriod) bond.stream().containingPeriod (dtSpot.julian());
int iResetDate = ((org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) (cfp.periods().get
(0))).referenceIndexPeriod().fixingDate();
MergedDiscountForwardCurve mdfc = LatentMarketStateBuilder.SmoothFundingCurve (
dtSpot,
strCurrency,
astrDepositTenor,
adblDepositQuote,
"ForwardRate",
adblFuturesQuote,
"ForwardRate",
astrFixFloatTenor,
adblFixFloatQuote,
"SwapRate"
);
BondReplicator abr = BondReplicator.CorporateLoan (
dblCleanPrice,
dblIssuePrice,
dblIssueAmount,
dtSpot,
astrDepositTenor,
adblDepositQuote,
adblFuturesQuote,
astrFixFloatTenor,
adblFixFloatQuote,
dblSpreadBump,
dblSpreadDurationMultiplier,
strTreasuryCode,
astrGovvieTenor,
adblGovvieYield,
astrCreditTenor,
adblCreditQuote,
dblFX,
dblResetRate,
iSettleLag,
bond
);
BondReplicationRun abrr = abr.generateRun();
System.out.println (abrr.display());
System.out.println ("\t||----------------------------------------------------------------------------------------------------------------------||");
System.out.println();
CurveSurfaceQuoteContainer csqc = abr.creditBaseCSQC();
FloaterLabel fl = bond.floaterSetting().fri();
csqc.setFixing (iResetDate, fl, dblResetRate);
ValuationParams valParams = ValuationParams.Spot (dtSpot.julian());
double dblYield = bond.yieldFromPrice (
ValuationParams.Spot (dtSpot.julian()),
csqc,
null,
dblCleanPrice
);
System.out.println ("Price In : " + dblCleanPrice);
System.out.println ("Yield Out : " + dblYield);
System.out.println ("Price Out : " +
bond.priceFromYield (
ValuationParams.Spot (dtSpot.julian()),
csqc,
null,
dblYield
)
);
System.out.println ("\t||----------------------------------------------------------------------------------------------------------------------||");
System.out.println ("\t|| PERIOD LABELS AND CURVE FACTORS ||");
System.out.println ("\t||----------------------------------------------------------------------------------------------------------------------||");
System.out.println ("\t|| L -> R: ||");
System.out.println ("\t|| - Period Start Date ||");
System.out.println ("\t|| - Period End Date ||");
System.out.println ("\t|| - Period Credit Label ||");
System.out.println ("\t|| - Period Funding Label ||");
System.out.println ("\t|| - Period Coupon Rate (%) ||");
System.out.println ("\t|| - Period Coupon Year Fraction ||");
System.out.println ("\t|| - Period Coupon Amount ||");
System.out.println ("\t|| - Period Principal Amount ||");
System.out.println ("\t|| - Period Discount Factor ||");
System.out.println ("\t|| - Period Survival Probability ||");
System.out.println ("\t|| - Period Recovery ||");
System.out.println ("\t||----------------------------------------------------------------------------------------------------------------------||");
for (CompositePeriod p : bond.couponPeriods()) {
int iEndDate = p.endDate();
int iPayDate = p.payDate();
int iStartDate = p.startDate();
double dblCouponRate = bond.couponMetrics (
iPayDate,
valParams,
csqc
).rate();
double dblCouponDCF = p.couponDCF();
System.out.println ("\t|| " +
DateUtil.YYYYMMDD (iStartDate) + " => " +
DateUtil.YYYYMMDD (iEndDate) + " | ? | " +
p.fundingLabel().fullyQualifiedName() + " | " +
p.floaterLabel().fullyQualifiedName() + " | " +
FormatUtil.FormatDouble (dblCouponRate, 1, 2, 100.) + "% | " +
FormatUtil.FormatDouble (dblCouponDCF, 1, 4, 1.) + " | " +
FormatUtil.FormatDouble (dblCouponRate * dblCouponDCF * p.notional (iEndDate) * p.couponFactor (iEndDate), 1, 4, 1.) + " | " +
FormatUtil.FormatDouble (p.notional (iStartDate) - p.notional (iEndDate), 1, 4, 1.) + " | " +
FormatUtil.FormatDouble (p.df (csqc), 1, 4, 1.) + " | " +
FormatUtil.FormatDouble (p.survival (csqc), 1, 4, 1.) + " | " +
FormatUtil.FormatDouble (p.recovery (csqc), 2, 0, 100.) + "% ||"
);
}
System.out.println ("\t|| " +
DateUtil.YYYYMMDD (dtEffective.julian()) + " => " +
DateUtil.YYYYMMDD (dtMaturity.julian()) + " | ? | " +
bond.fundingLabel().fullyQualifiedName() + " | " +
bond.forwardLabel().get (bond.name()).fullyQualifiedName() + " | " +
FormatUtil.FormatDouble (0., 1, 2, 100.) + "% | " +
FormatUtil.FormatDouble (0., 1, 4, 1.) + " | " +
FormatUtil.FormatDouble (0., 1, 4, 1.) + " | " +
FormatUtil.FormatDouble (bond.notional (dtMaturity.julian()), 1, 4, 1.) + " | " +
FormatUtil.FormatDouble (mdfc.df (dtMaturity), 1, 4, 1.) + " | " +
FormatUtil.FormatDouble (1., 1, 4, 1.) + " | " +
FormatUtil.FormatDouble (1., 2, 0, 100.) + "% ||"
);
System.out.println ("\t||----------------------------------------------------------------------------------------------------------------------||");
System.out.println();
EnvManager.TerminateEnv();
}
}
| [
"lakshmimv7977@gmail.com"
] | lakshmimv7977@gmail.com |
74fe7ef4c8592caf86733877203dddbeaa786653 | 0585c503600709cd60b3a810c4ff08ba7ea9b856 | /src/main/java/com/test/rest/controller/CategoryController.java | 57477186357a84d3d5b384cd916706fa358b689a | [] | no_license | paolog22/RESTfull-API-SportShop | 76ea959817cbb493b2e14be0ef08a2359a33cf50 | b489acf372b9db0ce54d010cc9b4a5982af0ce76 | refs/heads/master | 2021-01-20T12:24:35.967652 | 2017-01-05T18:18:29 | 2017-01-05T18:18:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,542 | java | package com.test.rest.controller;
import com.test.model.dto.CategoryDto;
import com.test.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Created by Павел on 19.11.2016.
*/
@RestController
public class CategoryController {
@Autowired
private CategoryService categoryService;
@RequestMapping(value = "categories", method = RequestMethod.GET)
public ResponseEntity<?> getRootCategories() throws Exception {
List<CategoryDto> categoryDtos;
try {
categoryDtos = categoryService.getRootCategories();
} catch (Exception e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
return new ResponseEntity<>(categoryDtos, HttpStatus.OK);
}
@RequestMapping(value = "category/{id}", method = RequestMethod.GET)
public ResponseEntity<?> getSubcategories(@PathVariable Long id) throws Exception {
List<CategoryDto> categoryDtos;
try {
categoryDtos = categoryService.getSubcategories(id);
} catch (Exception e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
return new ResponseEntity<>(categoryDtos, HttpStatus.OK);
}
@RequestMapping(value = "admin/category/update", method = RequestMethod.PUT)
public ResponseEntity<?> updateCategory(@RequestBody CategoryDto categoryDto,
@RequestHeader(name = "Authorization") String token) throws Exception {
CategoryDto existingCategoryDto;
try {
existingCategoryDto = categoryService.editCategory(categoryDto);
} catch (Exception e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
return new ResponseEntity<>(existingCategoryDto, HttpStatus.OK);
}
@RequestMapping(value = "admin/category/add", method = RequestMethod.POST)
public ResponseEntity<?> addCategory(@RequestBody CategoryDto categoryDto,
@RequestHeader(name = "Authorization") String token) throws Exception {
CategoryDto existingCategoryDto;
try {
existingCategoryDto = categoryService.addCategory(categoryDto);
} catch (Exception e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
return new ResponseEntity<>(existingCategoryDto, HttpStatus.OK);
}
@RequestMapping(value = "admin/category/{id}/delete", method = RequestMethod.DELETE)
public ResponseEntity<?> deleteCategory(@PathVariable Long id,
@RequestHeader(name = "Authorization") String token) throws Exception {
try {
categoryService.deleteCategory(id);
} catch (Exception e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
return ResponseEntity.ok().build();
}
@RequestMapping(value = "admin/subcategory/{childId}/add/category/{parentId}", method = RequestMethod.PUT)
public ResponseEntity<?> setParentToChild(@PathVariable("childId") Long childId,
@PathVariable("parentId") Long parentId,
@RequestHeader(name = "Authorization") String token) throws Exception {
CategoryDto existingCategoryDto;
try {
existingCategoryDto = categoryService.setParentToChild(childId, parentId);
} catch (Exception e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
return new ResponseEntity<>(existingCategoryDto, HttpStatus.OK);
}
@RequestMapping(value = "admin/subcategory/{childId}/delete/category", method = RequestMethod.PUT)
public ResponseEntity<?> deleteParentFromChild(@PathVariable("childId") Long childId,
@RequestHeader(name = "Authorization") String token) throws Exception {
try {
categoryService.deleteParentFromChild(childId);
} catch (Exception e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
return ResponseEntity.ok().build();
}
}
| [
"bavenka@gmail.com"
] | bavenka@gmail.com |
bf964d1c2cf346349af8f9b102a10d60edb7d3b5 | fa570b8f2fc601d01c4de9e1200c529a86346a65 | /crowd-funding01-admin-parent/crowd-funding03-admin-component/src/main/java/com/zs/crowdfunding/mvc/config/security/SecurityAdmin.java | 1ef45a223e7f24f703fc2f41e3ac7ebdcd6580b4 | [] | no_license | freecode2656983360/shangcouwang | f775657ba1e7a074cb3e766ef381024648ebc757 | 42b0fa2ab88814e817ac909f46cb1c4a6f89645a | refs/heads/master | 2022-12-13T10:36:12.556687 | 2020-09-05T14:00:25 | 2020-09-05T14:00:25 | 293,083,231 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 691 | java | package com.zs.crowdfunding.mvc.config.security;
import java.util.List;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;
import com.zs.crowdfunding.entity.Admin;
public class SecurityAdmin extends User {
private Admin admin;
private static final long serialVersionUID = 1L;
// 调用父类构造
public SecurityAdmin(Admin admin, List<GrantedAuthority> GrantedAuthority) {
super(admin.getLoginAcct(), admin.getUserPswd(), GrantedAuthority);
this.admin = admin;
}
public Admin getAdmin() {
return admin;
}
public void setAdmin(Admin admin) {
this.admin = admin;
}
}
| [
"2656983360@qq.com"
] | 2656983360@qq.com |
4b662cb724335046257c20f0dc15149162d001ac | 4e0d6f80d0f70e6a62435f29f29893976089e4c6 | /TweetApplication-master/src/main/java/com/tweetapp/controller/AuthenticationController.java | 6dfe246c0a5c1ae313434331812ff5dc6c50b32a | [] | no_license | Niharika505/TweetApp | cf5e6a1ff7a3d9721c9917d706be6bbb08c20829 | 57ab362bbd05e539f71d2e900ab68bcc341aa832 | refs/heads/main | 2023-04-21T15:08:26.058040 | 2021-05-06T06:35:29 | 2021-05-06T06:35:29 | 364,808,080 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,349 | java | package com.tweetapp.controller;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;
import com.tweetapp.entities.UsersEntity;
import com.tweetapp.kafka.Producer;
import com.tweetapp.repo.UsersRepo;
import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
@RestController
@CrossOrigin("http://localhost:3000")
public class AuthenticationController {
@Autowired
UsersRepo userRepository;
private final Logger logger = LoggerFactory.getLogger(AuthenticationController.class);
@GetMapping("/authenticate")
public HashMap<String, String> authenticate(@RequestHeader(value = "Authorization") String authHeader) {
HashMap<String, String> map = new HashMap<>();
String user = getUser(authHeader);
String[] name = user.split(":");
String token = generateJwt(user);
map.put("user", name[0]);
UsersEntity users = userRepository.findByLoginId(name[0]);
users.setLoggedIn(true);
userRepository.save(users);
map.put("Role", users.getRoles().get(0));
map.put("token", token);
logger.info("AuthenticationController class" +"in authenicate method() call");
return map;
}
private String getUser(String authHeader) {
String encoded = authHeader.substring(6).toString();
Base64.Decoder decoder = Base64.getMimeDecoder();
String decoded = new String(decoder.decode(encoded));
logger.info("AuthenticationController class" +"in getUser method() call");
return decoded;
}
private String generateJwt(String user) {
JwtBuilder builder = Jwts.builder();
builder.setSubject(user);
// Set the token issue time as current time
builder.setIssuedAt(new Date());
// Set the token expiry as 20 minutes from now
builder.setExpiration(new Date((new Date()).getTime() + 1200000));
builder.signWith(SignatureAlgorithm.HS256, "secretkey");
String token = builder.compact();
logger.info("AuthenticationController class" +"in generateJwt method() call");
return token;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
100e90a9167f7d86c360b8372a676f6be3cf1bb3 | 83885796bbc2ee075f75b777d26ba0888753db2b | /src/main/java/com/app/service/LogService.java | 3fb92adef8832dbe8e1ddfe9a2c79b4db52d97c4 | [] | no_license | jiangcaijun/Public-library-management-system | 70a0173fb2d68b049f12584fa0e883355160c6fd | 95d4b773eaf808c10f2b09d6ec6e5b7f77b93a5a | refs/heads/master | 2016-09-12T15:58:51.163907 | 2016-04-21T01:52:13 | 2016-04-21T01:52:13 | 56,733,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,046 | java | package com.app.service;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.app.dao.LogDAO;
import com.app.model.Book;
import com.app.model.Log;
@Service
@Transactional
public class LogService {
@Autowired
private LogDAO logDAO;
@Transactional(propagation = Propagation.REQUIRED)
public void returnBook(HttpSession session) {
System.out.println("LogService日志==============================");
Log log = new Log();
log.setUid(session.getAttribute("username1").toString());
Date date = new Date();
log.setCreateTime(date);
log.setOperate("还书");
logDAO.save(log);
}
@Transactional(propagation = Propagation.REQUIRED)
public List<Log> findAllLog(String operate) {
List<Log> list = logDAO.findAllLog(operate);
return list;
}
}
| [
"Jiang Caijun"
] | Jiang Caijun |
e5c099cb9731c24ad63f18d32338852084b5c567 | 621e2e41c1116e1b4b64b43ede10ff9bdda91b43 | /src/Controller/NextImageCommand.java | 31762995199aeacb0660a7fa8c65e1c11624fa44 | [] | no_license | gabrielaescrich/ImageViewer | c958f4205c9f2ff4718162247b7474b4f0c0f5bc | 307cfbce4ee3aab82951a921bc67d17d41151846 | refs/heads/master | 2021-01-22T09:17:29.671194 | 2015-01-17T15:44:05 | 2015-01-17T15:44:05 | 29,388,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 441 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Controller;
import us.ImageViewer;
/**
*
* @author GABY
*/
public class NextImageCommand extends ImageCommand{
public NextImageCommand(ImageViewer imageViewer) {
super(imageViewer);
}
@Override
public void execute() {
this.getImageViewer().showNextImage();
}
}
| [
"GABY@10.230.170.198"
] | GABY@10.230.170.198 |
bff62847674b74a022892619eef2b14a200b3eb2 | df43133bcebf342d2b1de060cb0b8f757fb56646 | /src/main/java/com/softeam/flight/services/ReservationServices.java | 7fbba272b860f062d97e3f40a222b80f50a65158 | [] | no_license | Salvamend/flightbooking | ee2335a68dbf35489fdc463ae82eb2d7f12a263b | f85dca48e2bd5b7f360188eed7c4bd754306e229 | refs/heads/master | 2022-12-02T15:13:28.129718 | 2020-01-03T16:06:44 | 2020-01-03T16:06:44 | 224,875,255 | 0 | 0 | null | 2022-11-24T09:27:06 | 2019-11-29T15:05:28 | Java | UTF-8 | Java | false | false | 80 | java | package com.softeam.flight.services;
public interface ReservationServices {
}
| [
"mendes@MacBook-Pro-de-MENDES.local"
] | mendes@MacBook-Pro-de-MENDES.local |
a7290b8c1821cf752c1fbe516755fa5a91f84ab9 | cf79b50279139633d08cd0e8841500abbf224bf7 | /department-management-service-api/src/main/java/com/epam/brest/courses/service/EmployeeService.java | e1992390169c871549db416c8882eca88bb03759 | [
"MIT"
] | permissive | Brest-Java-Course-2020/afedasiuk-department-mngmnt | d8d4d3081ef288f53ddc0f60754b8eea2585001c | 52c793031bc4a2942ba98c29760abfe8cf462292 | refs/heads/master | 2022-12-24T23:32:27.375221 | 2020-03-30T20:31:17 | 2020-03-30T20:31:17 | 240,070,677 | 0 | 7 | MIT | 2022-12-16T05:03:47 | 2020-02-12T17:18:15 | JavaScript | UTF-8 | Java | false | false | 1,241 | java | package com.epam.brest.courses.service;
import com.epam.brest.courses.model.Employee;
import java.util.List;
import java.util.Optional;
public interface EmployeeService {
/**
* Get all employees.
*
* @return list of all employees
*/
List<Employee> findAll();
/**
* Get all employees with specified department id.
*
* @param departmentId department id
* @return list of employees by department id
*/
List<Employee> findByDepartmentId(Integer departmentId);
/**
* Get employee with specified id.
*
* @param employeeId employee id
* @return employee by id
*/
Optional<Employee> findById(Integer employeeId);
/**
* Persist new employee.
*
* @param employee employee
* @return persisted employee id.
*/
Integer create(Employee employee);
/**
* Update employee.
*
* @param employee employee
* @return number of updated records in the database.
*/
int update(Employee employee);
/**
* Delete employee with specified id.
*
* @param employeeId department id
* @return number of updated records in the database.
*/
int delete(Integer employeeId);
} | [
"berdachuk@berdaflex.com"
] | berdachuk@berdaflex.com |
f1ec1b19e9ca2527bfbbe5e603058229044a586d | 1c7c1759264b0e9c9a2215476225dc5c5e697e26 | /src/main/java/nl/smartworkx/admin/model/financialfact/inbox/JournalEntryProposalService.java | aa8591ca17fb78b2f356e2667dc2f8dd2ae3ba9a | [] | no_license | joris77/admin-api | cebc3cce3cf9e57dca8d7db91c7bdb210a3af7e1 | d105a0bd77e2ba316de38e5dbc260925958ebe0e | refs/heads/master | 2020-04-06T03:53:00.705961 | 2017-07-04T21:23:17 | 2017-07-04T21:23:17 | 59,432,071 | 0 | 1 | null | 2016-07-13T15:11:49 | 2016-05-22T20:10:13 | Java | UTF-8 | Java | false | false | 2,446 | java | package nl.smartworkx.admin.model.financialfact.inbox;
import static java.util.Collections.emptyList;
import static nl.smartworkx.admin.model.financialfact.inbox.ProposalUtils.createRecordsFromBank;
import static nl.smartworkx.admin.model.financialfact.inbox.ProposalUtils.createRecordsToCred;
import static nl.smartworkx.admin.model.financialfact.inbox.ProposalUtils.createRecordsToCredWithVat;
import java.util.List;
import java.util.Set;
import org.springframework.stereotype.Service;
import nl.smartworkx.admin.interfaces.web.journal.RecordFormLine;
import nl.smartworkx.admin.model.Amount;
import nl.smartworkx.admin.model.financialfact.FinancialFact;
import nl.smartworkx.admin.model.financialfact.inbox.proposalcreator.ProposalCreator;
import nl.smartworkx.admin.model.ledger.LedgerRepository;
/**
*
*/
@Service
public class JournalEntryProposalService {
private final Set<ProposalCreator> proposalCreators;
private final LedgerRepository ledgerRepository;
public JournalEntryProposalService(Set<ProposalCreator> proposalCreators, LedgerRepository ledgerRepository) {
this.proposalCreators = proposalCreators;
this.ledgerRepository = ledgerRepository;
}
public List<RecordFormLine> createProposedRecords(FinancialFact financialFact) {
return this.proposalCreators.stream()
.filter(proposalCreator -> proposalCreator.matches(financialFact))
.findFirst()
.map(proposalCreator -> proposalCreator
.create(financialFact))
.orElse(emptyList());
}
public List<RecordFormLine> createProposedRecords(JournalEntryProposalParameters parameters) {
final Amount amount = new Amount(parameters.getAmount());
if (parameters.getType().equals(ProposalType.COSTS)) {
if (parameters.getTaxRate() != null) {
return createRecordsToCredWithVat(ledgerRepository, amount, parameters.getTaxRate(), null);
} else {
return createRecordsToCred(ledgerRepository, amount, null);
}
} else if (parameters.getType() == ProposalType.PRIVATE) {
return createRecordsFromBank(ledgerRepository, amount, "PRIVJ");
} else if (parameters.getType() == ProposalType.CREDIT) {
return createRecordsFromBank(ledgerRepository, amount, "CRED");
} else {
return emptyList();
}
}
}
| [
"joris@smartworkx.nl"
] | joris@smartworkx.nl |
e48b0316f2eb3d83c7ada4f48f28d5484b84b493 | c773ea652a045db9945dafd86fde43012a0161fc | /parkClientServer/src/main/java/com/starnetsecurity/parkClientServer/ws/ParkWebSocketHandler.java | d6fbff84933996dc9ddfe6d0e07ec2db76b415d6 | [] | no_license | choufeng2018/PMS-VEHICLE | 82a379ec4556ffd79ed472792dc7b9d336605314 | 8c36dfb021432df03f630c6a1607e6b62d72139c | refs/heads/master | 2020-07-30T20:01:03.321830 | 2019-08-21T05:51:53 | 2019-08-21T05:51:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,647 | java | package com.starnetsecurity.parkClientServer.ws;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.starnetsecurity.common.util.CommonUtils;
import com.starnetsecurity.parkClientServer.entity.AdminUser;
import com.starnetsecurity.parkClientServer.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.WebSocketMessage;
import org.springframework.web.socket.WebSocketSession;
import java.util.ArrayList;
import java.util.List;
/**
* Created by 宏炜 on 2017-10-26.
*/
public class ParkWebSocketHandler implements WebSocketHandler {
private static Logger log = LoggerFactory.getLogger(ParkWebSocketHandler.class);
public static final List<WebSocketUser> socketUser = new ArrayList<>();
@Autowired
UserService userService;
@Override
public void afterConnectionEstablished(WebSocketSession webSocketSession) throws Exception {
//log.info("接入新用户.......");
}
@Override
public void handleMessage(WebSocketSession webSocketSession, WebSocketMessage<?> webSocketMessage) throws Exception {
Object o = webSocketMessage.getPayload();
if(o instanceof String){
String params = String.valueOf(o);
JSONObject json = JSON.parseObject(params);
String userId = json.getString("userId");
AdminUser adminUser = userService.getAdminUserById(userId);
WebSocketUser webSocketUser = new WebSocketUser();
webSocketUser.setAdminUser(adminUser);
webSocketUser.setWebSocketSession(webSocketSession);
socketUser.add(webSocketUser);
//log.info("标识登录用户:{}",adminUser.getUserName());
}
}
@Override
public void handleTransportError(WebSocketSession webSocketSession, Throwable throwable) throws Exception {
}
@Override
public void afterConnectionClosed(WebSocketSession webSocketSession, CloseStatus closeStatus) throws Exception {
WebSocketUser current = null;
for(WebSocketUser webSocketUser : socketUser){
if(webSocketUser.getWebSocketSession().getId().equals(webSocketSession.getId())){
current = webSocketUser;
}
}
if(!CommonUtils.isEmpty(current)){
socketUser.remove(current);
}
}
@Override
public boolean supportsPartialMessages() {
return false;
}
}
| [
"chenbinbin.af@star-net.cn"
] | chenbinbin.af@star-net.cn |
89f10dfbb6fd8438fa4a1d1a09f65252dd072bb2 | c958ca42d6a82dfd9289e809d95925138baa092a | /neo4j_backend/src/main/java/org/ntu/ci/HelloController.java | 763bcd7d599c53f41afd172299c835e3df3b716d | [] | no_license | udarajag/neo4j_backend | 5f500021c31f6e6b7208dcf42a1527c11024c3b2 | 1fbd39a522b36e2d2fddadaacbd562d7be9016f6 | refs/heads/master | 2021-01-02T08:12:46.111623 | 2017-08-03T12:30:47 | 2017-08-03T12:30:47 | 98,962,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package org.ntu.ci;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by Udara on 20/7/17.
*/
@RestController
public class HelloController {
@RequestMapping("/aaa")
public String hello(){
return "hello, how do you do.";
}
}
| [
"Ureka@192.168.0.102"
] | Ureka@192.168.0.102 |
a19b44110c996f837f6d8ceba9b36d64e059352d | bb0fe42a60a829083e37414579ab5716ae20c840 | /src/br/com/battlebits/commons/api/input/anvil/WrappedContainerAnvil.java | dc4d1fa52db73d4d24ae6c6fec15c15281c8a949 | [] | no_license | peytondodd/Commons | cab26e0e476e1013023a072c6fcf6830cb3c4278 | d230df5c9f52f3a5bf7d382a74f351a1259bbef1 | refs/heads/master | 2020-04-04T21:47:44.156962 | 2017-05-27T06:28:05 | 2017-05-27T06:28:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,163 | java | package br.com.battlebits.commons.api.input.anvil;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.bukkit.entity.Player;
import org.bukkit.inventory.InventoryView;
import com.comphenix.protocol.reflect.accessors.Accessors;
import com.comphenix.protocol.reflect.accessors.ConstructorAccessor;
import com.comphenix.protocol.utility.MinecraftReflection;
import com.comphenix.protocol.wrappers.AbstractWrapper;
import com.comphenix.protocol.wrappers.BlockPosition;
import br.com.battlebits.commons.util.reflection.Reflection;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.CtNewMethod;
public class WrappedContainerAnvil extends AbstractWrapper {
private static Class<?> CONTAINER_ANVIL = MinecraftReflection.getMinecraftClass("ContainerAnvil");
private static final Class<?> PLAYER_INVENTORY = MinecraftReflection.getMinecraftClass("PlayerInventory");
private static final Class<?> BLOCK_POSITION = MinecraftReflection.getBlockPositionClass();
private static final Class<?> ENTITY_PLAYER = MinecraftReflection.getEntityPlayerClass();
private static final Class<?> ENTITY_HUMAN = MinecraftReflection.getEntityHumanClass();
private static final Class<?> WORLD = MinecraftReflection.getNmsWorldClass();
static {
try {
CtClass origClazz = ClassPool.getDefault().get(CONTAINER_ANVIL.getName());
CtClass subClass = ClassPool.getDefault()
.makeClass("br.com.battlebits.commons.api.input.anvil.AnvilNoXPContainer", origClazz);
CtMethod m = CtNewMethod.make("public boolean a(net.minecraft.server."
+ MinecraftReflection.getPackageVersion() + ".EntityHuman entityhuman) {return true; }", subClass);
subClass.addMethod(m);
CONTAINER_ANVIL = subClass.toClass();
} catch (Exception e) {
e.printStackTrace();
}
}
public WrappedContainerAnvil(Object anvilContainer) {
super(CONTAINER_ANVIL);
setHandle(anvilContainer);
}
public WrappedContainerAnvil(Player player) {
super(CONTAINER_ANVIL);
try {
Method getHandle = MinecraftReflection.getCraftPlayerClass().getMethod("getHandle");
Object entityPlayer = getHandle.invoke(player);
Object inventory = Reflection.getField(ENTITY_PLAYER, "inventory").get(entityPlayer);
Object world = Reflection.getField(ENTITY_PLAYER, "world").get(entityPlayer);
Object blockPosition = BlockPosition.getConverter().getGeneric(null, BlockPosition.ORIGIN);
ConstructorAccessor CREATE = Accessors.getConstructorAccessorOrNull(CONTAINER_ANVIL, PLAYER_INVENTORY,
WORLD, BLOCK_POSITION, ENTITY_HUMAN);
Object anvilContainer = CREATE.invoke(inventory, world, blockPosition, entityPlayer);
setHandle(anvilContainer);
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
e.printStackTrace();
}
}
public InventoryView getBukkitView() {
try {
return (InventoryView) getHandle().getClass().getMethod("getBukkitView").invoke(getHandle());
} catch (Exception e) {
return null;
}
}
}
| [
"flame.tuner@gmail.com"
] | flame.tuner@gmail.com |
50f55953adb40d2e6369764ef227e14cb4a30f7c | b8b79ab25a7f8a26a873f8ef73112a0c773e6964 | /src/test/java/Pages/Practice_Cybertek_pages/HoversPage.java | 6b8873e606eb32132718a8bd742cd992d3edff6d | [] | no_license | abdumalik198978/yangisi | cba287757858b896992860736a16bc386ebdcecc | 7db9fe21990635a3e9c9ada9d1719a9eef1148d1 | refs/heads/master | 2023-05-14T22:49:53.098925 | 2020-02-10T00:07:02 | 2020-02-10T00:07:02 | 237,026,187 | 0 | 0 | null | 2020-01-29T16:45:47 | 2020-01-29T16:13:39 | Java | UTF-8 | Java | false | false | 876 | java | package Pages.Practice_Cybertek_pages;
import Utilities.Driver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class HoversPage {
public HoversPage(){
PageFactory.initElements(Driver.getDriver(), this);
}
@FindBy(xpath = "(//img[@src ='/img/avatar-blank.jpg'])[1]")
public WebElement user1;
@FindBy(xpath = "(//img[@src ='/img/avatar-blank.jpg'])[2]")
public WebElement user2;
@FindBy(xpath = "(//img[@src ='/img/avatar-blank.jpg'])[3]")
public WebElement user3;
@FindBy(xpath = "(//div[@class='figcaption']/h5)[1]")
public WebElement user1Text;
@FindBy(xpath = "(//div[@class='figcaption']/h5)[2]")
public WebElement user2Text;
@FindBy(xpath = "(//div[@class='figcaption']/h5)[3]")
public WebElement user3Text;
}
| [
"abdumalik1989@yahoo.com"
] | abdumalik1989@yahoo.com |
728875b59b61e20ef1a6af29ce1376eff6872a89 | b87aa6996f3fa452eb301f2fe54edf5a9a248f91 | /app/src/main/java/com/example/adil/academic_guidance/StudentsInfoEEE.java | d1eb6d2a744659d3986765f756f6364b5d6a9d8b | [] | no_license | adil-ahmed/Academic-Guidance | 258d8e6cf6eb4d9740b4844e59d9fa35279d6b40 | 28bd87b1c5647e1e33396b40611c475b616ab74c | refs/heads/master | 2020-12-02T19:33:56.994670 | 2017-07-05T20:59:13 | 2017-07-05T20:59:13 | 96,360,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,762 | java | package com.example.adil.academic_guidance;
import android.content.Intent;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
public class StudentsInfoEEE extends AppCompatActivity {
ListView listView;
/**
* For access ListView from XML
*/
ArrayList<String> BatchList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_students_info_eee);
/** ActionBar This is back button*/
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
/** ActionBar */
listView = (ListView) findViewById(R.id.listView);
BatchList = new ArrayList<String>(); /** Declaring Array */
/** add item on items array */
BatchList.add("9th");
BatchList.add("10th");
BatchList.add("11th");
BatchList.add("12th");
BatchList.add("13th");
BatchList.add("34th");
BatchList.add("15th");
BatchList.add("16th");
BatchList.add("17th");
BatchList.add("18th");
BatchList.add("19th");
BatchList.add("20th");
/** You should create New class named CustomListAdaptera amd a Object named Adapter */
StudentsAdapter adepter = new StudentsAdapter(this,BatchList); /** Constructor of this class */
listView.setAdapter(adepter); /** to set and receive ViewList from CustomListAdapter class */
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String name = BatchList.get(position);
Toast.makeText(getApplicationContext(),"Developed only for CSE 35th Batch",Toast.LENGTH_LONG).show();
/*Intent i = new Intent();
i.putExtra("TAG",name);
finish();*/
//Toast.makeText(getApplicationContext(),name,Toast.LENGTH_LONG).show();
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId())
{
case android.R.id.home:
onBackPressed();
//Toast.makeText(getApplicationContext(),"To sign out tap on action bar!",Toast.LENGTH_LONG).show();
break;
case R.id.app:
Intent p = new Intent(this,AboutApp.class);
startActivity(p);
break;
case R.id.about:
//Toast.makeText(getApplicationContext(),"About",Toast.LENGTH_LONG).show();
Intent i = new Intent(this,Dev1.class);
startActivity(i);
break;
case R.id.signOut:
Intent j = new Intent(this,HomePage.class);
startActivity(j);
break;
default:
return super.onOptionsItemSelected(item);
}
int id = item.getItemId();
return super.onOptionsItemSelected(item);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
}
| [
"https://_redemption@bitbucket.org/_redemption/lu-canteen.git"
] | https://_redemption@bitbucket.org/_redemption/lu-canteen.git |
5ded1eaf69fa3c37297b5455c588b2dad4e7ecd1 | 22ff5bc18a5cafd239c2621d09667e74c86edd03 | /app/src/main/java/com/hbdiye/newlechuangsmart/bean/UserFamilyInfoBean.java | e614cacdba6f123e5bcfa10218a832aa3dd0ea68 | [] | no_license | a1019421612/NewLeChuang | dda9e42b6fd7e7ef80bae8c89c897a838acf215f | d542db2a656ae6221574a8bae36622a01c033834 | refs/heads/master | 2021-07-19T02:28:13.360372 | 2019-01-30T02:17:11 | 2019-01-30T02:17:11 | 150,920,488 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 636 | java | package com.hbdiye.newlechuangsmart.bean;
import java.lang.reflect.Field;
import java.io.Serializable;
import java.util.List;
public class UserFamilyInfoBean implements Serializable {
public String errcode;
public Family family;
public class Family implements Serializable {
public String phone;
public String name;
public String id;
}
public User user;
public class User implements Serializable {
public String familyId;
public String password;
public String phone;
public String name;
public String icon;
public String id;
}
} | [
"1"
] | 1 |
d7b44db4adc7a39b57f38960cc1e97a817013b94 | 4fb7f1f3e46ba54df45db38a3394aca191f65162 | /Latihan6/app/src/main/java/com/rizalhimself/latihan6/SecondFragment.java | 0bcdf1c30859dfb05683fca2f6c39e308ad19cea | [] | no_license | rizalhimself/smt4_pmo | 953b4508a0591910cc46678855261b998984e501 | 009a3e6e5466fa6534a68cc1bac7e1844bd6d0af | refs/heads/master | 2023-06-16T11:47:30.353745 | 2021-07-05T15:41:58 | 2021-07-05T15:41:58 | 347,796,544 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,093 | java | package com.rizalhimself.latihan6;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
public class SecondFragment extends Fragment {
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_second, container, false);
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.findViewById(R.id.button_second).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavHostFragment.findNavController(SecondFragment.this)
.navigate(R.id.action_SecondFragment_to_FirstFragment);
}
});
}
} | [
"sniperinstink@hotmail.com"
] | sniperinstink@hotmail.com |
176ba24075e5ecc0ebdc334bf4a32c0de1af0735 | d7a240a994b7159ef94161c2a3f1081e11147265 | /his-eureka/src/main/java/net/medcrm/yjb/his/eureka/utils/SocketManager.java | eb2e15e05ad0e0e3b9fd9cef289c6df5ffabdaf7 | [] | no_license | lingks/his | f53fe442fdbfd135e0b04b228ffaaf2b06539e8b | ce5f1926370af1bc830ce8f4a11e13fcf9483f95 | refs/heads/master | 2021-05-12T19:10:03.094520 | 2018-01-16T06:35:01 | 2018-01-16T06:35:01 | 117,080,233 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,559 | java | package net.medcrm.yjb.his.eureka.utils;
import io.netty.channel.Channel;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* Created by linsheng on 2017/6/30.
*/
public class SocketManager {
/**
* 最大连接数
*/
private int maxConnection = Constants.maxConnection;
/**
* 当前连接数
*/
private int nowConnection;
/**
* 允许连接请求 true允许 false拒绝
*/
private boolean allowConnection = true;
private List<Channel> clients = null;
private Map<String,String> lines = null;
private static SocketManager manager = null;
public static SocketManager getInstance() {
if (manager == null){
synchronized (SocketManager.class){
if(manager==null){
manager = new SocketManager();
}
}
}
return manager;
}
public Channel getChannelByModelName(String name) {
for (Channel channel : clients) {
String modelName = channel.remoteAddress().toString();
if (modelName.equals(name)) {
return channel;
}
}
return null;
}
private SocketManager() {
clients = new CopyOnWriteArrayList<Channel>();
lines = new ConcurrentHashMap<>();
}
public void addClient(Channel client) {
clients.add(client);
nowConnection = clients.size();
allowConnection = (maxConnection != nowConnection);
}
public void removeClient(Channel client) {
clients.remove(client);
nowConnection = clients.size();
allowConnection = (maxConnection != nowConnection);
}
public int getMaxConnection() {
return maxConnection;
}
public int getNowConnection() {
return nowConnection;
}
public boolean isAllowConnection() {
return allowConnection;
}
public void outLine(String modelName) {
lines.remove(modelName);
}
public void onLine(String modelName, String uniqueKey) {
lines.put(modelName,uniqueKey);
}
public Channel getChannelByUniqueKey(String uniqueKey) {
for (Channel channel : clients) {
String modelName = channel.remoteAddress().toString();
String value = lines.get(modelName);
if (uniqueKey.equals(value)) {
return channel;
}
}
return null;
}
}
| [
"13729827239@126.com"
] | 13729827239@126.com |
22a74b989742d584e8c616b77b7b90ef45e0a688 | 806e1440e92c02d1438bd3d12c86961e99fa8eb3 | /libcommon/src/main/java/com/shoneworn/libcommon/base_recyclerview_adapter_helper/listener/OnItemSwipeListener.java | 1673090bede015dfdf41a33e5caab57607499314 | [] | no_license | shoneworn/SuperMvp | 2d8ff2a33b762e9cde4002277c1c8ccdd303d55e | c92695c9688de3f20a6126f7aeaa19d5efedcf6c | refs/heads/master | 2020-04-05T07:30:39.783434 | 2019-05-17T10:35:37 | 2019-05-17T10:35:37 | 156,678,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,653 | java | package com.shoneworn.libcommon.base_recyclerview_adapter_helper.listener;
import android.graphics.Canvas;
import android.support.v7.widget.RecyclerView;
/**
* Created by luoxw on 2016/6/23.
*/
public interface OnItemSwipeListener {
/**
* Called when the swipe action start.
*/
void onItemSwipeStart(RecyclerView.ViewHolder viewHolder, int pos);
/**
* Called when the swipe action is over.
* If you change the view on the start, you should reset is here, no matter the item has swiped or not.
*
* @param pos If the view is swiped, pos will be negative.
*/
void clearView(RecyclerView.ViewHolder viewHolder, int pos);
/**
* Called when item is swiped, the view is going to be removed from the adapter.
*/
void onItemSwiped(RecyclerView.ViewHolder viewHolder, int pos);
/**
* Draw on the empty edge when swipe moving
*
* @param canvas the empty edge's canvas
* @param viewHolder The ViewHolder which is being interacted by the User or it was
* interacted and simply animating to its original position
* @param dX The amount of horizontal displacement caused by user's action
* @param dY The amount of vertical displacement caused by user's action
* @param isCurrentlyActive True if this view is currently being controlled by the user or
* false it is simply animating back to its original state.
*/
void onItemSwipeMoving(Canvas canvas, RecyclerView.ViewHolder viewHolder, float dX, float dY, boolean isCurrentlyActive);
}
| [
"chenxiangxiang@021.com"
] | chenxiangxiang@021.com |
70c2bdd141012ca77cb974dfe4c9692ab30e9b9c | 8ceaed0c45b786117f8dcbcd06e422971fd7eb1a | /src/main/java/com/shopping/app/model/Product.java | 92955c0d0a0b9f7449369eb8e0a2d6c252d91c2e | [] | no_license | AhamadRaza/shopping | d378e04ee6e7d27c071878cbf56a5435e0c900cd | 58c683730efce4e7fe3851c77838adf788c46d25 | refs/heads/master | 2020-12-19T00:41:04.318401 | 2020-01-24T12:34:03 | 2020-01-24T12:34:03 | 235,568,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,268 | java | package com.shopping.app.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
import java.util.UUID;
@Entity
@Table
public class Product{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String code;
private String name;
private String brand;
private String description;
@Column(name = "unite_price")
private double unitePrice;
private long quantity;
@JsonIgnore
private boolean active;
@OneToOne
@JoinColumn(name = "category_id",referencedColumnName = "id")
@JsonIgnore
private Category categoryId;
@Column(name = "supplier_id")
@JsonIgnore
private long supplierId;
private long purchases;
private long views;
public Product(){
this.code = "PRD"+ UUID.randomUUID().toString().substring(26).toUpperCase();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public double getUnitePrice() {
return unitePrice;
}
public void setUnitePrice(double unitePrice) {
this.unitePrice = unitePrice;
}
public long getQuantity() {
return quantity;
}
public void setQuantity(long quantity) {
this.quantity = quantity;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
public Category getCategoryId() {
return categoryId;
}
public void setCategoryId(Category categoryId) {
this.categoryId = categoryId;
}
public long getSupplierId() {
return supplierId;
}
public void setSupplierId(long supplierId) {
this.supplierId = supplierId;
}
public long getPurchases() {
return purchases;
}
public void setPurchases(long purchases) {
this.purchases = purchases;
}
public long getViews() {
return views;
}
public void setViews(long views) {
this.views = views;
}
@Override
public String toString() {
return "Product{" +
"id=" + id +
", code='" + code + '\'' +
", name='" + name + '\'' +
", brand='" + brand + '\'' +
", description='" + description + '\'' +
", unitePrice=" + unitePrice +
", quantity=" + quantity +
", active=" + active +
", categoryId=" + categoryId +
", supplierId=" + supplierId +
", purchases=" + purchases +
", views=" + views +
'}';
}
} | [
"ahamadraza92786@gmail.com"
] | ahamadraza92786@gmail.com |
3093a2af892ef9690e87423172a37220bd9efc95 | eb54e93ca6925148862edfb96029d8272cde8702 | /core/src/main/java/me/kerfume/jisp/antlr/JispBaseListener.java | c194011eb52e2f5226988095a97004d3c4be154f | [] | no_license | keiSunagawa/jvm-lang-example | 0b91cf267255f642c589dfa1f87f745a6390ca4f | b18f02ac4758f275fc7b231cc1a4076ad58876d6 | refs/heads/master | 2020-12-10T11:45:10.978066 | 2020-01-26T07:51:27 | 2020-01-26T07:51:27 | 233,584,907 | 0 | 0 | null | 2020-01-26T06:12:34 | 2020-01-13T11:55:58 | Scala | UTF-8 | Java | false | false | 2,258 | java | // Generated from ./grammer/Jisp.g4 by ANTLR 4.7
package me.kerfume.jisp.antlr;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
/**
* This class provides an empty implementation of {@link JispListener},
* which can be extended to create a listener which only needs to handle a subset
* of the available methods.
*/
public class JispBaseListener implements JispListener {
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterError(JispParser.ErrorContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitError(JispParser.ErrorContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterValue(JispParser.ValueContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitValue(JispParser.ValueContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterList(JispParser.ListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitList(JispParser.ListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStmts(JispParser.StmtsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStmts(JispParser.StmtsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitTerminal(TerminalNode node) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitErrorNode(ErrorNode node) { }
} | [
"keisunagawa.git@icloud.com"
] | keisunagawa.git@icloud.com |
a63f8c826625bc9e462e5cb490de0483ff3ae4cf | f060f7a7976678cc8b9a1264e6f78e601ecad852 | /day5035_ServletContext_Response/src/org/xueyao/test02/ServletDemo08.java | 2245850002b9a0c075661c3a14f01fe91c2b52c1 | [] | no_license | flowstone/Base-Java | 1a734ea23ae22b4ffd7b05d37c0e020592164535 | 80e8700e696dede08456f4eb7e3c8203dd5dae69 | refs/heads/master | 2020-12-03T04:02:53.070350 | 2017-12-22T12:02:50 | 2017-12-22T12:02:50 | 95,805,211 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 977 | java | package org.xueyao.test02;
import java.io.IOException;
import javax.activation.MimeType;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ServletDemo08 extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//测试通过ServletContext获取MIME类型
//获取ServletContext对象
ServletContext servletContext = getServletContext();
//通过文件后缀名,servletContext在全局web.xml寻找avi对应的文件的mime类型
String mimeType = servletContext.getMimeType("xxx.avi");
System.out.println(mimeType);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
}
| [
"xueyao.me@gmail.com"
] | xueyao.me@gmail.com |
d7b6e2ce6de8875fbc94db95ebc2a3aab741d4fd | 8998ea9cbbdd185fd9e11b3cdab11d4cfacd5e84 | /src/main/java/com/niici/study/algorithm/search/InterpolationSearch.java | 3a977d65456c5bfe72a32153afaf05b4370e702b | [] | no_license | NiiCi/datastructureAndAlgorithm | f0435c8aab174cf554dcb329263f8c364e542e80 | 666f5072bbdf7bd41d4f11bcd51c6cfea71772b0 | refs/heads/main | 2023-09-03T22:17:19.693670 | 2021-10-21T08:32:35 | 2021-10-21T08:32:35 | 386,198,017 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,383 | java | package com.niici.study.algorithm.search;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.List;
/**
* 插值查找
* 插值查找类似于二分查找,不同的是插值查找每次从自适应mid处开始查找。
* mid = left + (right - left) * (value - arr[left]) / (arr[right] - arr[left])
* 大大减少了查找的次数(相比于二分查找)
*
* 二分查找和插值查找区别:
* 二分查找mid: mid = left + 1/2 * (right - left)
* 插值查找mid:mid = left + ((value - arr[left]) / (arr[right] - arr[left])) * (right - left)
* left + x * (right - left) x为系数,二分查找系数为1/2,插值查找为(value - arr[left]) / (arr[right] - arr[left])
*
* 插值查找注意事项:
* 对于数据量较大,关键字分布比较均匀的查找表来说,采用插值查找,速度较快。
* 关键字分布不均匀的情况下,该方法不一定比二分查找要好。
* @author niici
*/
@Slf4j
public class InterpolationSearch extends BaseSearch {
public static void main(String[] args) {
Integer[] arr2 = {-1, 1, 1, 9, 11, 34, 34, 89};
List<Integer> indexs = InterpolationSearch.search(arr2, 0, arr2.length - 1, 1);
log.info("插值查找匹配到的数的下标为:{}", indexs);
}
/**
* 插值查找,当多个数相同时,返回多个下标
* 思路分析:
* 1. 在找到mid时,不要马上返回
* 2. 向mid索引值的左边扫描,将所有满足条件的元素的下标,加入到一个集合中
* 3. 向mid索引值的右边扫描,将所有满足条件的元素的下标,加入到一个集合中
* @param arr
* @param left
* @param right
* @param value
* @return
*/
public static List<Integer> search(Integer[] arr, int left, int right, int value) {
// 向左递归查找时, mid-1后 rightIndex可能小于0,证明数组已经遍历完成
// 向右递归查找时, mid+1后 leftIndex可能大于arr.length - 1,证明数组已经遍历完成
if (left > right || value < arr[0] || value > arr[arr.length - 1]) {
return new ArrayList<>();
}
int mid = left + (right - left) * (value - arr[left]) / (arr[right] - arr[left]);
// 待查找数大于arr[mid],则向右递归查找
if (value > arr[mid]) {
return search(arr, mid + 1, right, value);
} else if (value < arr[mid]){
return search(arr, left, mid - 1, value);
} else {
// 已找到相等的数,则向左向右递归,查找是否仍存在相等的数
List<Integer> indexList = Lists.newArrayList();
// 向左遍历(向左移一位开始遍历排除当前已找到的数)
int temp = mid - 1;
// 有序数组,相同的元素一定相邻
while(temp >= 0 && value == arr[temp]) {
indexList.add(temp);
temp--;
}
indexList.add(mid);
// 向右遍历
temp = mid + 1;
// 有序数组,相同的元素一定相邻
while(temp <= right && value == arr[temp]) {
indexList.add(temp);
temp++;
}
return indexList;
}
}
}
| [
"1125382627@qq.com"
] | 1125382627@qq.com |
b122e23cbf53d6979ee6906248022cedd41cf7cf | 9de96a828175e5edc9b7be35cbf8931cd680c0b3 | /src/main/java/com/entity/MiniPro.java | 8c78deb35845639a3725a692509c881727fefd3c | [] | no_license | huahua-star/longxiweijing | 9aa1e0282a2f328a54bac749de24acbfec043fc6 | 57324fed2c3f1a7a10fd4b4aba36a3f70ae59a80 | refs/heads/master | 2022-12-24T23:23:23.693339 | 2020-10-09T10:03:00 | 2020-10-09T10:03:00 | 299,258,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | package com.entity;
import lombok.Data;
@Data
public class MiniPro {
private String code;
private String descript;
private String price;
private String number;
private String unit;
}
| [
"18749195329@163.com"
] | 18749195329@163.com |
153d45d9d8a49ee09e3d31b1eaa412394b648fa9 | 0bde60c4ec0f181632bd0f7f0bdb22726aae7d47 | /android demo/final-project/app/src/test/java/edu/cmu/stuco/android/yusihao/my2048/ExampleUnitTest.java | 7c1aec507020fc922efd55432359921799c277d5 | [] | no_license | zgu444/pakr | 9d6193b4c4d51bb0aed059ab55ba681d0ae9ce32 | 1039260dbad20f6edb87c2e4d02daaafcc73bd10 | refs/heads/master | 2020-03-29T12:07:35.124080 | 2018-12-07T17:40:10 | 2018-12-07T17:40:10 | 149,885,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | package edu.cmu.stuco.android.yusihao.my2048;
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);
}
} | [
"417824249@qq.com"
] | 417824249@qq.com |
a10d16ff15f13337991b98a767942009e7de8b32 | 1b8f4772a750049be6d7d282e783622673293f65 | /exercise7/exe7_04.java | 282a1cbfb6dd95bd29e3eb6d00e83322735902cd | [] | no_license | dnjsgud0625/javastudy | e934ae0491bf444933e76059f5c38a70fc6e9cb6 | 4558795c973fac4b10253c1c7417d0bf042ca5a8 | refs/heads/main | 2023-04-08T17:42:53.072220 | 2021-04-02T13:02:32 | 2021-04-02T13:02:32 | 337,727,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 429 | java | package exercise7;
import java.util.*;
public class exe7_04 {
static int sumUp(int a) {
if(a==1) return 1;
else {
int total=0;
for(int i=0;i<=a;i++) total+=i;
return total;
}
}
public static void main(String[] args) {
Scanner num = new Scanner(System.in);
System.out.print("자연수 입력 : ");
int a = num.nextInt();
num.close();
System.out.println("1부터 "+a+"까지의 합 : "+sumUp(a));
}
} | [
"dnjsgud0625@naver.com"
] | dnjsgud0625@naver.com |
70357abc3fb891deee9acfbe757c6dc7dc4515d1 | 8b951426a1a83dd305c52641b208426139d3bcd3 | /Proyecto Final/src/Aplicacion/VentanaCasosPoliciales.java | 84782aa7ba88ccc988aaabede3bbf46784698352 | [] | no_license | AlfonsoJRD/PolicialCasesBD | 75fea42f023363c6562dcf2858141ab2f56aaea4 | 13148ff17babe9a07394db98fa8fbe5ffef99621 | refs/heads/master | 2023-03-23T22:02:12.674798 | 2021-03-18T17:41:04 | 2021-03-18T17:41:04 | 349,164,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,247 | java | package Aplicacion;
import Persistencia.caso;
import Persistencia.conexionOracle;
import Persistencia.manejaCaso;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Álvaro Rofa
*/
public class VentanaCasosPoliciales extends javax.swing.JFrame {
DefaultTableModel modeloTCasos = new DefaultTableModel() {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
manejaCaso manejaCasos = null;
public VentanaCasosPoliciales(conexionOracle co) throws SQLException {
manejaCasos = new manejaCaso(co);
jCasos = new JTable(modeloTCasos);
initComponents();
dibujarTablaCasos();
pideCasos();
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); ///Para cerrar solamente esa pestaña, no el programa
}
private void dibujarTablaCasos() {
jCasos.setModel(modeloTCasos);
String[] columnasTabla = {"Código Caso", "Nombre", "Fecha Inicio", "Fecha Fin"};
modeloTCasos.setColumnIdentifiers(columnasTabla);
// Para no permitir el redimensionamiento de las columnas con el ratón
jCasos.getTableHeader().setResizingAllowed(false);
// Así se fija el ancho de las columnas
jCasos.getColumnModel().getColumn(0).setPreferredWidth(80);
jCasos.getColumnModel().getColumn(1).setPreferredWidth(140);
jCasos.getColumnModel().getColumn(2).setPreferredWidth(80);
jCasos.getColumnModel().getColumn(3).setPreferredWidth(80);
}
private void rellenarTablaCasos (ArrayList<caso> casos) {
Object[] columna = new Object[4];
int numRegistros = casos.size();
for (int i = 0; i < numRegistros; i++) {
columna[0] = casos.get(i).getCodCaso();
columna[1] = casos.get(i).getNombre();
columna[2] = casos.get(i).getFechaInicio();
columna[3] = casos.get(i).getFechaFin();
modeloTCasos.addRow(columna);
}
}
private void pideCasos() throws SQLException {
rellenarTablaCasos(manejaCasos.listaCasos());
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jCasos = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jCasos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(jCasos);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(42, 42, 42)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 542, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(44, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(43, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTable jCasos;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}
| [
"cmhpaiv@gmail.com"
] | cmhpaiv@gmail.com |
eaceb0280020d2f5c99cc0977b70fa8927cd370e | d817a10ed306e7ac8fe7ea1a0a755906f145998f | /src/server/ServerCore.java | 77dc7d4b1b50942111d0f47a6d2957c1e9c49899 | [] | no_license | thodoxuan99/AssMMT-java-chat-socket | e77f994e0b9c3f239542c6857f3f3e5eeaaac584 | 2e49d5c50cd16d0eef76714d848eabfb184ba260 | refs/heads/master | 2022-09-11T22:34:27.182813 | 2020-06-03T10:07:59 | 2020-06-03T10:07:59 | 268,000,428 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,029 | java | package server;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import data.Peer;
import data.Friend;
import tags.Decode;
import tags.Tags;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class ServerCore {
private ArrayList<Peer> dataPeer = null;
private static ArrayList<Friend> listFriend = null;
private static ArrayList<Friend> listRequestFr = null;
private ServerSocket server;
private Socket connection;
private ObjectOutputStream obOutputClient;
private ObjectInputStream obInputStream;
public boolean isStop = false, isExit = false;
//Intial server socket
public ServerCore(int port) throws Exception {
server = new ServerSocket(port);
listFriend=loadlistFriend();
listRequestFr=loadlistRequestFriend();
dataPeer=loadPeer();
(new WaitForConnect()).start();
}
// show status of state
private String sendSessionAccept() throws Exception {
String msg = Tags.SESSION_ACCEPT_OPEN_TAG;
int size = dataPeer.size();
for (int i = 0; i < size; i++) {
Peer peer = dataPeer.get(i);
msg += Tags.PEER_OPEN_TAG;
msg += Tags.PEER_NAME_OPEN_TAG;
msg += peer.getName();
msg += Tags.PEER_NAME_CLOSE_TAG;
msg += Tags.IP_OPEN_TAG;
msg += peer.getHost();
msg += Tags.IP_CLOSE_TAG;
msg += Tags.PORT_OPEN_TAG;
msg += peer.getPort();
msg += Tags.PORT_CLOSE_TAG;
msg += Tags.PEER_STATE_OPEN_TAG;
msg += Boolean.toString(peer.getState());
msg += Tags.PEER_STATE_CLOSE_TAG;
msg += Tags.PEER_LISTFR_OPEN_TAG;
for (int j = 0; j < peer.getListFr().size(); j++) {
msg += peer.getListFr().get(j);
msg+= ',';
}
msg += Tags.PEER_LISTFR_CLOSE_TAG;
msg += Tags.PEER_LISTREFR_OPEN_TAG;
for (int j = 0; j < peer.getListRequestFr().size(); j++) {
msg += peer.getListRequestFr().get(j);
msg+= ',';
}
msg += Tags.PEER_LISTREFR_CLOSE_TAG;
msg += Tags.PEER_CLOSE_TAG;
}
msg += Tags.SESSION_ACCEPT_CLOSE_TAG;
return msg;
}
// close server
public void stopserver() throws Exception {
storeListFriend(listFriend);
storeListRequestFriend(listRequestFr);
storePeer(dataPeer);
isStop = true;
server.close();
connection.close();
}
//client connect to server
private boolean waitForConnection() throws Exception {
connection = server.accept();
obInputStream = new ObjectInputStream(connection.getInputStream());
String msg = (String) obInputStream.readObject();
ArrayList<String> getDataUser = Decode.getUser(msg);
ArrayList<String> getDataAccount = Decode.getAccount(msg);
ArrayList<String> getAddFriend = Decode.addfriend(msg);
ArrayList<String> getAcceptFr = Decode.acceptFr(msg);
ServerGui.updateMessage(msg);
if (getDataAccount != null) {
ServerGui.updateMessage("Sign Up");
if (register(getDataAccount.get(0),getDataAccount.get(1),getDataAccount.get(2))) {
saveNewPeer(getDataAccount.get(0),getDataAccount.get(1), connection.getInetAddress()
.toString(), Integer.parseInt(getDataAccount.get(3)));
ServerGui.updateMessage(getDataAccount.get(0));
} else
return false;
}
else if (getDataUser != null) {
ServerGui.updateMessage("Login");
if (isExistsUser(getDataUser.get(0),getDataUser.get(1))) {
setOnline(getDataUser.get(0),getDataUser.get(1), connection.getInetAddress()
.toString(), Integer.parseInt(getDataUser.get(2)));
ServerGui.updateMessage(getDataUser.toString());
ServerGui.updateMessage(getDataUser.get(0));
ServerGui.updateNumberClient();
} else
return false;
}
else if(getAddFriend!=null) {
ServerGui.updateMessage("Addfr");
updateListRequest(getAddFriend.get(0), getAddFriend.get(1));
}
else if(getAcceptFr!=null) {
ServerGui.updateMessage("AcceptFr");
updateListFriend(getAcceptFr.get(0), getAcceptFr.get(1));
}
else {
ServerGui.updateMessage("Exit");
isExit=! Decode.updatePeerOnline(dataPeer, msg);
ServerGui.updateMessage(Boolean.toString(isExit));
if(isExit)ServerGui.decreaseNumberClient();
}
return true;
}
private boolean setOnline(String name,String pwd, String ip, int port) throws Exception {
int size= dataPeer.size();
for (int i = 0; i < size; i++) {
if (dataPeer.get(i).getName().equals(name)) {
dataPeer.get(i).setHost(ip);
dataPeer.get(i).setPort(port);
dataPeer.get(i).setState(true);
return true;
}
}
return false;
}
private void updateListRequest(String sender,String reiceiver) {
boolean a,b;
int temp_int=0;
for (int i = 0; i < dataPeer.size(); i++) {
if (dataPeer.get(i).getName().equals(reiceiver))temp_int=i;
if(dataPeer.get(i).getName().equals(sender)) {
for (int j = 0; j < dataPeer.get(i).getListFr().size(); j++) {
if(dataPeer.get(i).getListFr().equals(reiceiver)) return;
}
}
}
dataPeer.get(temp_int).getListRequestFr().add(sender);
for (int i = 0; i < listRequestFr.size(); i++) {
if(listRequestFr.get(i).getUser().equals(sender)&&listRequestFr.get(i).getUserFriend().equals(reiceiver)) return;
}
for (int i = 0; i < listFriend.size(); i++) {
a=listFriend.get(i).getUser().equals(sender)&&listFriend.get(i).getUserFriend().equals(reiceiver);
b=listFriend.get(i).getUser().equals(reiceiver)&&listFriend.get(i).getUserFriend().equals(sender);
if(a||b) return;
}
Friend friend =new Friend();
friend.setFriend(sender, reiceiver);
listRequestFr.add(friend);
}
private void updateListFriend(String sender,String reiceiver) {
ServerGui.updateMessage(sender);
ServerGui.updateMessage(reiceiver);
Friend friend = new Friend();
for (int i = 0; i < dataPeer.size(); i++) {
if(dataPeer.get(i).getName().equals(sender)) {
dataPeer.get(i).getListRequestFr().remove(reiceiver);
dataPeer.get(i).getListFr().add(reiceiver);
ServerGui.updateMessage("Check");
}
if(dataPeer.get(i).getName().equals(reiceiver))
dataPeer.get(i).getListFr().add(sender);
}
for (int i = 0; i <listRequestFr.size(); i++) {
if(listRequestFr.get(i).getUser().equals(reiceiver)&&listRequestFr.get(i).getUserFriend().equals(sender)) {
listRequestFr.remove(i);
break;
}
}
friend.setFriend(reiceiver, sender);
listFriend.add(friend);
}
private Peer saveNewPeer(String user,String pwd, String ip, int port) throws Exception {
Peer newPeer = new Peer();
if (dataPeer.size() == 0)
dataPeer = new ArrayList<Peer>();
newPeer.setPeer(user,pwd, ip, port,false);
dataPeer.add(newPeer);
return newPeer;
}
private boolean register(String name,String pass,String confirmPass) {
if (! pass.equals(confirmPass)) return false;
int size = dataPeer.size();
for (int i = 0; i < size; i++) {
Peer peer = dataPeer.get(i);
if (peer.getName().equals(name))
return false;
}
return true;
}
private boolean isExistsUser(String name,String pass) throws Exception {
int size = dataPeer.size();
for (int i = 0; i < size; i++) {
Peer peer = dataPeer.get(i);
if (peer.getName().equals(name) && peer.getPass().equals(pass))
return true;
}
return false;
}
private ArrayList<Friend> loadlistFriend() throws IOException{
ArrayList<Friend> listFriend =new ArrayList<Friend>();
Friend newFriend= new Friend();
BufferedReader br =null;
try {
br = new BufferedReader(new FileReader("data\\friend.txt"));
int num=0;
char ch;
int j=0;
String temp="";
while ((num=br.read())!=-1) {
ch=(char)num;
if(num!=13) {
if (ch!='\n') {
if (ch!=',') {
temp=temp+ch;
}else {
switch(j) {
case 0: newFriend.setUser(temp);; break;
case 1: newFriend.setUserFriend(temp);; break;
}
j++;
temp="";
}
}else {
j=0;
listFriend.add(newFriend);
newFriend=new Friend();
}
}
}
} catch (IOException e) {
e.printStackTrace();
}finally {
br.close();
}
return listFriend;
}
public static void storeListFriend(ArrayList<Friend> listFriend) throws IOException {
FileWriter out=null;
Friend friend=new Friend();
try {
out = new FileWriter("data\\friend.txt");
for (int i = 0; i < listFriend.size(); i++) {
friend=listFriend.get(i);
out.write(friend.getUser());out.write(',');
out.write(friend.getUserFriend());out.write(',');
out.write('\n');
}
} catch (IOException e) {
e.printStackTrace();
}finally {
out.close();
}
}
private ArrayList<Friend> loadlistRequestFriend() throws IOException{
ArrayList<Friend> listFriend =new ArrayList<Friend>();
Friend newFriend= new Friend();
BufferedReader br =null;
try {
br = new BufferedReader(new FileReader("data\\requestFriend.txt"));
int num=0;
char ch;
int j=0;
String temp="";
while ((num=br.read())!=-1) {
ch=(char)num;
if(num!=13) {
if (ch!='\n') {
if (ch!=',') {
temp=temp+ch;
}else {
switch(j) {
case 0: newFriend.setUser(temp);; break;
case 1: newFriend.setUserFriend(temp);; break;
}
j++;
temp="";
}
}else {
j=0;
listFriend.add(newFriend);
newFriend=new Friend();
}
}
}
} catch (IOException e) {
e.printStackTrace();
}finally {
br.close();
}
return listFriend;
}
public static void storeListRequestFriend(ArrayList<Friend> listFriend) throws IOException {
FileWriter out=null;
Friend friend=new Friend();
try {
out = new FileWriter("data\\requestFriend.txt");
for (int i = 0; i < listFriend.size(); i++) {
friend=listFriend.get(i);
out.write(friend.getUser());out.write(',');
out.write(friend.getUserFriend());out.write(',');
out.write('\n');
}
} catch (IOException e) {
e.printStackTrace();
}finally {
out.close();
}
}
private ArrayList<Peer> loadPeer() throws IOException{
ArrayList<Peer> listPeer =new ArrayList<Peer>();
Peer newPeer= new Peer();
ArrayList<String> listFriend = null;
ArrayList<String> listRequestFr = null;
BufferedReader br =null;
try {
br = new BufferedReader(new FileReader("data\\account.txt"));
System.out.print("Content\n");
int num=0;
char ch;
int j=0;
String temp="";
while ((num=br.read())!=-1) {
ch=(char)num;
if(num!=13) {
if (ch!='\n') {
if (ch!=',') {
temp=temp+ch;
}else {
switch(j) {
case 0: newPeer.setName(temp); break;
case 1: newPeer.setPass(temp); break;
case 2: newPeer.setHost(temp); break;
case 3: newPeer.setPort(Integer.parseInt(temp) ); break;
case 4: newPeer.setState(Boolean.parseBoolean(temp)); break;
}
j++;
temp="";
}
}else {
j=0;
listFriend=getFriend(newPeer.getName());
newPeer.setListFriend(listFriend);
listRequestFr=getRequestFriend(newPeer.getName());
newPeer.setListRequestFriend(listRequestFr);
listPeer.add(newPeer);
newPeer=new Peer();
}
}
}
} catch (IOException e) {
e.printStackTrace();
}finally {
br.close();
}
for (int i = 0; i < listPeer.size(); i++) {
System.out.print(listPeer.get(i).getName());System.out.print(" ");
System.out.print(listPeer.get(i).getPass());System.out.print(" ");
System.out.print(listPeer.get(i).getHost());System.out.print(" ");
System.out.print(listPeer.get(i).getPort());System.out.print(" ");
System.out.print(listPeer.get(i).getState());System.out.print(" ");
System.out.print(listPeer.get(i).getListFr());System.out.print(" ");
System.out.println(listPeer.get(i).getListRequestFr());
}
return listPeer;
}
public static void storePeer(ArrayList<Peer> listPeer) throws IOException {
FileWriter out=null;
Peer peer=new Peer();
try {
out = new FileWriter("data\\account.txt");
for (int i = 0; i < listPeer.size(); i++) {
peer=listPeer.get(i);
out.write(peer.getName());out.write(',');
out.write(peer.getPass());out.write(',');
out.write(peer.getHost());out.write(',');
out.write(Integer.toString(peer.getPort()));out.write(',');
out.write(Boolean.toString(peer.getState()));out.write(',');
out.write('\n');
}
} catch (IOException e) {
e.printStackTrace();
}finally {
out.close();
}
}
public static ArrayList<String> getFriend(String name){
ArrayList<String> listFriendd =new ArrayList<String>();
for (int i = 0; i < listFriend.size(); i++) {
if ( listFriend.get(i).getUser().equals(name) && !listFriendd.contains(listFriend.get(i).getUserFriend()) ) {
listFriendd.add(listFriend.get(i).getUserFriend());
}
if ( listFriend.get(i).getUserFriend().equals(name)&&!listFriendd.contains(listFriend.get(i).getUser())) {
listFriendd.add(listFriend.get(i).getUser());
}
}
return listFriendd;
}
public static ArrayList<String> getRequestFriend(String name){
ArrayList<String> listReFriendd =new ArrayList<String>();
for (int i = 0; i < listRequestFr.size(); i++) {
if ( listRequestFr.get(i).getUserFriend().equals(name)) {
listReFriendd.add(listRequestFr.get(i).getUser());
}
}
return listReFriendd;
}
public class WaitForConnect extends Thread {
@Override
public void run() {
super.run();
try {
while (!isStop) {
if (waitForConnection()) {
if (isExit) {
isExit = false;
} else {
obOutputClient = new ObjectOutputStream(connection.getOutputStream());
obOutputClient.writeObject(sendSessionAccept());
obOutputClient.flush();
obOutputClient.close();
}
} else {
obOutputClient = new ObjectOutputStream(connection.getOutputStream());
obOutputClient.writeObject(Tags.SESSION_DENY_TAG);
obOutputClient.flush();
obOutputClient.close();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
| [
"tho.dok2017@hcmut.edu.vn"
] | tho.dok2017@hcmut.edu.vn |
631f41bc3217e60a41b23962cd8f248fab9e533e | ea6e3c324cf36d9b59a14598bb619a7a8f14329e | /api/automatiko-engine-common/src/main/java/io/automatiko/engine/services/event/impl/VariableInstanceEventBody.java | 2203e31b8c64c46000a8866b9129529374198409 | [
"Apache-2.0"
] | permissive | automatiko-io/automatiko-engine | 9eaf3a8f5945e645ca704aa317c97c32ea4011da | af7e315d73895798b8b8bdd0fa5d7fcce64d289d | refs/heads/main | 2023-08-24T21:25:17.045726 | 2023-08-16T08:20:56 | 2023-08-16T08:41:53 | 332,492,696 | 60 | 7 | Apache-2.0 | 2023-09-14T00:44:40 | 2021-01-24T16:06:36 | Java | UTF-8 | Java | false | false | 6,891 | java |
package io.automatiko.engine.services.event.impl;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class VariableInstanceEventBody {
public static final String ID_META_DATA = "kogito.processinstance.id";
public static final String PARENT_ID_META_DATA = "kogito.processinstance.parentInstanceId";
public static final String ROOT_ID_META_DATA = "kogito.processinstance.rootInstanceId";
public static final String PROCESS_ID_META_DATA = "kogito.processinstance.processId";
public static final String ROOT_PROCESS_ID_META_DATA = "kogito.processinstance.rootProcessId";
public static final String STATE_META_DATA = "kogito.processinstance.state";
private String variableName;
private Object variableValue;
private Object variablePreviousValue;
private Date changeDate;
private String changedByNodeId;
private String changedByNodeName;
private String changedByNodeType;
private String changedByUser;
private String processInstanceId;
private String rootProcessInstanceId;
private String processId;
private String rootProcessId;
private VariableInstanceEventBody() {
}
public String getVariableName() {
return variableName;
}
public Object getVariableValue() {
return variableValue;
}
public Object getVariablePreviousValue() {
return variablePreviousValue;
}
public Date getChangeDate() {
return changeDate;
}
public String getChangedByNodeId() {
return changedByNodeId;
}
public String getChangedByNodeName() {
return changedByNodeName;
}
public String getChangedByNodeType() {
return changedByNodeType;
}
public String getChangedByUser() {
return changedByUser;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public String getRootProcessInstanceId() {
return rootProcessInstanceId;
}
public String getProcessId() {
return processId;
}
public String getRootProcessId() {
return rootProcessId;
}
public Map<String, String> metaData() {
Map<String, String> metadata = new HashMap<>();
metadata.put(ID_META_DATA, processInstanceId);
metadata.put(ROOT_ID_META_DATA, rootProcessInstanceId);
metadata.put(PROCESS_ID_META_DATA, processId);
metadata.put(ROOT_PROCESS_ID_META_DATA, rootProcessId);
return metadata;
}
@Override
public String toString() {
return "VariableInstanceEventBody [variableName=" + variableName + ", variableValue=" + variableValue
+ ", variablePreviousValue=" + variablePreviousValue + ", changeDate=" + changeDate
+ ", changedByNodeId=" + changedByNodeId + ", changedByNodeName=" + changedByNodeName
+ ", changedByNodeType=" + changedByNodeType + ", changedByUser=" + changedByUser
+ ", processInstanceId=" + processInstanceId + ", rootProcessInstanceId=" + rootProcessInstanceId
+ ", processId=" + processId + ", rootProcessId=" + rootProcessId + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((changedByNodeId == null) ? 0 : changedByNodeId.hashCode());
result = prime * result + ((changedByNodeName == null) ? 0 : changedByNodeName.hashCode());
result = prime * result + ((changedByNodeType == null) ? 0 : changedByNodeType.hashCode());
result = prime * result + ((processInstanceId == null) ? 0 : processInstanceId.hashCode());
result = prime * result + ((variableName == null) ? 0 : variableName.hashCode());
result = prime * result + ((variablePreviousValue == null) ? 0 : variablePreviousValue.hashCode());
result = prime * result + ((variableValue == null) ? 0 : variableValue.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VariableInstanceEventBody other = (VariableInstanceEventBody) obj;
if (changedByNodeId == null) {
if (other.changedByNodeId != null)
return false;
} else if (!changedByNodeId.equals(other.changedByNodeId))
return false;
if (changedByNodeName == null) {
if (other.changedByNodeName != null)
return false;
} else if (!changedByNodeName.equals(other.changedByNodeName))
return false;
if (changedByNodeType == null) {
if (other.changedByNodeType != null)
return false;
} else if (!changedByNodeType.equals(other.changedByNodeType))
return false;
if (processInstanceId == null) {
if (other.processInstanceId != null)
return false;
} else if (!processInstanceId.equals(other.processInstanceId))
return false;
if (variableName == null) {
if (other.variableName != null)
return false;
} else if (!variableName.equals(other.variableName))
return false;
if (variablePreviousValue == null) {
if (other.variablePreviousValue != null)
return false;
} else if (!variablePreviousValue.equals(other.variablePreviousValue))
return false;
if (variableValue == null) {
if (other.variableValue != null)
return false;
} else if (!variableValue.equals(other.variableValue))
return false;
return true;
}
public static Builder create() {
return new Builder(new VariableInstanceEventBody());
}
static class Builder {
private VariableInstanceEventBody instance;
public Builder(VariableInstanceEventBody instance) {
this.instance = instance;
}
public Builder processInstanceId(String processInstanceId) {
instance.processInstanceId = processInstanceId;
return this;
}
public Builder rootProcessInstanceId(String rootProcessInstanceId) {
instance.rootProcessInstanceId = rootProcessInstanceId;
return this;
}
public Builder processId(String processId) {
instance.processId = processId;
return this;
}
public Builder rootProcessId(String rootProcessId) {
instance.rootProcessId = rootProcessId;
return this;
}
public Builder variableName(String variableName) {
instance.variableName = variableName;
return this;
}
public Builder variableValue(Object variableValue) {
instance.variableValue = variableValue;
return this;
}
public Builder variablePreviousValue(Object variablePreviousValue) {
instance.variablePreviousValue = variablePreviousValue;
return this;
}
public Builder changeDate(Date changeDate) {
instance.changeDate = changeDate;
return this;
}
public Builder changedByNodeId(String changedByNodeId) {
instance.changedByNodeId = changedByNodeId;
return this;
}
public Builder changedByNodeName(String changedByNodeName) {
instance.changedByNodeName = changedByNodeName;
return this;
}
public Builder changedByNodeType(String changedByNodeType) {
instance.changedByNodeType = changedByNodeType;
return this;
}
public Builder changedByUser(String changedByUser) {
instance.changedByUser = changedByUser;
return this;
}
public VariableInstanceEventBody build() {
return instance;
}
}
}
| [
"swiderski.maciej@gmail.com"
] | swiderski.maciej@gmail.com |
77d1fe2e9a154d75c8e44989b86528168b314b2b | 65c8e6611fc303964a2bd55941552365ad9dcf14 | /extra_DAO/src/src/DAO/TextoXmlDAO.java | f2f478c56918bb7bb813d21b84d9f3df56821319 | [] | no_license | Dilean/Padroes_de_Projeto | e2c4e8fd390c1aea90f52ee9f92d15b8aee38a51 | 44a39958b930c6c10fbcc3e909ebbf6cdabf40e4 | refs/heads/master | 2021-01-12T08:33:03.463353 | 2016-12-16T01:11:01 | 2016-12-16T01:11:01 | 76,609,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 739 | 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 src.DAO;
/**
*
* @author dilea
*/
public class TextoXmlDAO extends TextoDAO{
@Override
public boolean persistir(String t) {
System.out.println("Persistindo o texto: \n\n " + t + " no formato XML");
return true;
}
@Override
public String getTexto(String t) {
System.out.println("Recuperando o texto de titulo: " + t);
return "acho";
}
@Override
public boolean findTexto(String t) {
System.out.println("Pesquisando o titulo: " + t);
return true;
}
}
| [
"dilean_drd@hotmail.com"
] | dilean_drd@hotmail.com |
2adb9c97bc8fe790a9058ee69552f05fa40d0075 | d436c3ea3385227f9c9f713229475a436cdd84de | /src/main/java/actions/pageObject/LoginPageObject.java | b9f838e5fd4e42586059b2cc0cfde55831654fc9 | [] | no_license | Kentyumi/Hybrid_PageObject_OrangeHRM | a16ee57abc1f40de751ba60612f7e1f52452f9ce | da227634887b9efb29a5b245d3e9d64a1c9f3c30 | refs/heads/master | 2023-06-26T02:52:45.890639 | 2021-08-01T11:39:07 | 2021-08-01T11:39:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 272 | java | package actions.pageObject;
import actions.commons.AbstractPage;
import org.openqa.selenium.WebDriver;
public class LoginPageObject extends AbstractPage {
public LoginPageObject(WebDriver driver) {
}
public LoginPageObject inputToUserNameTextBox(){
}
}
| [
"“hung.nguyen3@asiantech.vn”"
] | “hung.nguyen3@asiantech.vn” |
09fabfc5c054aeefbbca05dfbd4325efe1d0ac49 | 0d23925c43d5a8d5ee7b0ac6bf0de3dfe465e6d7 | /src/test/java/ohtu/ohtuvarasto/VarastoTest.java | 501c6e850a27afced162aa4f855dd992c2ffcf28 | [] | no_license | nagajaga/ohtu-2019-viikko1 | f0dc67aa7e8af86b2944367567f71166b6420c6e | 4dc061c83fefb7ec71ef596c0a8eb8ecd37d8227 | refs/heads/master | 2020-08-30T20:04:06.169198 | 2019-11-09T14:23:42 | 2019-11-09T14:23:42 | 218,476,069 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,310 | java | package ohtu.ohtuvarasto;
import org.junit.*;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class VarastoTest {
Varasto alkusaldovarasto;
Varasto alkusaldollinen;
Varasto varasto;
Varasto kayttokelvoton;
Varasto kayttokelvotonAlkuSaldoTilavuus;
double vertailuTarkkuus = 0.0001;
@Before
public void setUp() {
alkusaldovarasto = new Varasto(10,3);
varasto = new Varasto(10);
kayttokelvoton = new Varasto(-1);
alkusaldollinen = new Varasto(10, -1);
kayttokelvotonAlkuSaldoTilavuus = new Varasto(-1,5);
}
@Test
public void konstruktoriLuoTyhjanVaraston() {
assertEquals(0, varasto.getSaldo(), vertailuTarkkuus);
}
@Test
public void uudellaVarastollaOikeaTilavuus() {
assertEquals(10, varasto.getTilavuus(), vertailuTarkkuus);
}
@Test
public void lisaysLisaaSaldoa() {
varasto.lisaaVarastoon(8);
// saldon pitäisi olla sama kun lisätty määrä
assertEquals(8, varasto.getSaldo(), vertailuTarkkuus);
}
@Test
public void lisaysLisaaPienentaaVapaataTilaa() {
varasto.lisaaVarastoon(8);
// vapaata tilaa pitäisi vielä olla tilavuus-lisättävä määrä eli 2
assertEquals(2, varasto.paljonkoMahtuu(), vertailuTarkkuus);
}
@Test
public void ottaminenPalauttaaOikeanMaaran() {
varasto.lisaaVarastoon(8);
double saatuMaara = varasto.otaVarastosta(2);
assertEquals(2, saatuMaara, vertailuTarkkuus);
}
@Test
public void ottaminenLisääTilaa() {
varasto.lisaaVarastoon(8);
varasto.otaVarastosta(2);
// varastossa pitäisi olla tilaa 10 - 8 + 2 eli 4
assertEquals(4, varasto.paljonkoMahtuu(), vertailuTarkkuus);
}
@Test
public void varastoLiikaa(){
varasto.lisaaVarastoon(11);
assertEquals(0, varasto.paljonkoMahtuu(),vertailuTarkkuus);
}
@Test
public void lisaaVahemmanKuinNolla(){
varasto.lisaaVarastoon(-1);
assertEquals(10, varasto.paljonkoMahtuu(),vertailuTarkkuus);
}
@Test
public void kayttokelvotonVarasto(){
assertEquals(0, kayttokelvoton.paljonkoMahtuu(),vertailuTarkkuus);
}
@Test
public void otaVahemmanKuinNolla(){
varasto.otaVarastosta(-1);
assertEquals(10, varasto.paljonkoMahtuu(),vertailuTarkkuus);
}
@Test
public void otaYliSaldo(){
varasto.lisaaVarastoon(4.0);
varasto.otaVarastosta(5.0);
assertEquals(10, varasto.paljonkoMahtuu(),vertailuTarkkuus);
}
@Test
public void kayttokelvotonAlkuSaldoVarasto(){
assertEquals(0, kayttokelvotonAlkuSaldoTilavuus.getTilavuus(),vertailuTarkkuus);
}
@Test
public void alkuSaldoAlleNolla(){
assertEquals(0, alkusaldollinen.getSaldo(),vertailuTarkkuus);
}
@Test
public void alkuSaldoToimii(){
assertEquals(7, alkusaldovarasto.paljonkoMahtuu(),vertailuTarkkuus);
}
@Test
public void toStringTesti(){
assertEquals("saldo = 3.0, vielä tilaa 7.0", alkusaldovarasto.toString());
}
} | [
"workworkjoel@gmail.com"
] | workworkjoel@gmail.com |
9e9a49f2f8d6cb0c649bdb63c6944f5f763a52d9 | b70a7ca8707f324c99118f0cb3c1d3fd88e0835d | /src/com/company/Main.java | 64b061d7409dafb26be2031c2b97002d7dd80022 | [] | no_license | diwakar1/HexaDecimalToOctalNumber | 1fd9170c85cc1934a2c73bea06b41b87a8327aad | f2bff4060f034eaf56da851e26346445be62ab9c | refs/heads/master | 2020-04-10T20:31:24.533980 | 2018-12-11T03:18:36 | 2018-12-11T03:18:36 | 161,270,661 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,145 | java | package com.company;
import java.util.Scanner;
public class Main {
public static int Hexa_To_Decimal(String s){
String s1= "0123456789ABCDEF";
s= s.toUpperCase();
int value=0;
for(int i=0;i<s.length();i++){
char c= s.charAt(i);
int d= s1.indexOf(c);
value= 16*value+d;
}
return value;
}
public static void main(String[] args) {
int decimalNumber;
String hexaNumber;
int[] octlNumber= new int[40];
int i=1;
int j;
Scanner input = new Scanner(System.in);
System.out.println("enter hexa number: ");
hexaNumber=input.nextLine();
decimalNumber= Hexa_To_Decimal(hexaNumber);
System.out.println("The equivalent decimal number is: "+ decimalNumber);
while(decimalNumber!=0){
octlNumber[i++]=decimalNumber%8;
decimalNumber=decimalNumber/8;
}
System.out.print("The equivalent octalNumber is: ");
for(j=i-1;j>0;j--){
System.out.print(octlNumber[j]);
}
System.out.println("\n");
}
}
| [
"diwakar2034@yahoo.com"
] | diwakar2034@yahoo.com |
1791a41ed8007f67d617b7228ba54b759e155808 | 7d754ce4526dc525c97a5f9c103c6a3664511464 | /src/main/java/cz/cvut/fit/run/vm/runtime/instruction/IStore.java | 2ee58a9105f004700d28541d29b61c1c8b2bb6dc | [] | no_license | Keeo/VM | e89981fab05d908d53065c613ce0dcb4e334ae01 | 81d8891497f416346ce8c543df0bf815d1b84e0b | refs/heads/master | 2021-01-10T16:45:15.193074 | 2017-02-16T00:07:45 | 2017-02-16T00:07:45 | 48,255,409 | 0 | 0 | null | 2017-02-16T00:07:46 | 2015-12-18T20:37:18 | Java | UTF-8 | Java | false | false | 389 | java | package cz.cvut.fit.run.vm.runtime.instruction;
import cz.cvut.fit.run.vm.runtime.Frame;
import java.util.Stack;
/**
* Created by Keo on 13.2.2017.
*/
public class IStore extends IStoreN {
public IStore(int n) {
super(n);
}
@Override
public void execute(Frame frame, Stack<Frame> stack) {
super.execute(frame, stack);
frame.pc += 1;
}
}
| [
"moravek.martin@gmail.com"
] | moravek.martin@gmail.com |
cdace3f8a38450d53a9ed09a79eaa9b529438f15 | f9d09c7953d818ee2697173077654aeea6e6ca55 | /Tree/Iterative Preorder Traversal(optimised1).java | a891890ad50d2a213512f99f546a5b82707710d8 | [] | no_license | shagun25/DSA | 70418294bb6ef6e2dc4bc72f186a33252a64646a | 5d6c5db09da662644c50ab359c0d82298ca78077 | refs/heads/main | 2023-03-02T23:09:18.613541 | 2021-02-14T19:25:05 | 2021-02-14T19:25:05 | 303,329,442 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 906 | java | import java.util.*;
import java.io.*;
import java.lang.*;
class Node
{
int key;
Node left;
Node right;
Node(int k){
key=k;
left=right=null;
}
}
class GFG {
public static void main(String args[])
{
Node root=new Node(10);
root.left=new Node(20);
root.right=new Node(30);
root.left.left=new Node(40);
root.left.right=new Node(50);
// root.right.left=new Node(60);
// root.right.right=new Node(70);
iterativeInorder(root);
}
static void iterativeInorder(Node root){
if(root ==null) return;
Stack<Node> s = new Stack<>();
Node curr=root;
s.push(root);
while(!s.isEmpty()){
curr=s.pop();
System.out.print(curr.key+" ");
if(curr.right!=null) s.push(curr.right);
if(curr.left!=null) s.push(curr.left);
}
}
} | [
"goyalshagun25@gmail.com"
] | goyalshagun25@gmail.com |
5411d7edec7c14d7810902292832d1ca54417e9a | faae2c691151c35ee962e8ce6693931db2830d3e | /src/main/java/jpabook/jpashop/repository/MemberRepository.java | 4bf8d5647dee0cbcdf668278f3dd4822f985ed3e | [] | no_license | sm9171/jpashop | f53b31a966b327fb822fc412b0e5182d8bb2e9c1 | 58e9df6114a05e2b88a61a321ccaafd3850af968 | refs/heads/master | 2023-07-02T04:11:37.068385 | 2021-08-13T16:41:30 | 2021-08-13T16:41:30 | 377,005,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 853 | java | package jpabook.jpashop.repository;
import jpabook.jpashop.domain.Member;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import javax.persistence.EntityManager;
import java.util.List;
@Repository
@RequiredArgsConstructor
public class MemberRepository {
private final EntityManager em;
public void save(Member member){
em.persist(member);
}
public Member findOne(Long id){
return em.find(Member.class,id);
}
public List<Member> findAll(){
return em.createQuery("select m from Member m",Member.class)
.getResultList();
}
public List<Member> findByName(String name){
return em.createQuery("select m from Member m where m.name = :name",Member.class)
.setParameter("name",name)
.getResultList();
}
}
| [
"sm9171@nate.com"
] | sm9171@nate.com |
6b8c89c3eb56839093c5ef1c8aa946d083f82b0b | 86a5c34e2abd8b66472bc20146ff5523b05d3d82 | /src/main/java/com/ll/core/query/product/ProductQuery.java | c629d251306de77a0d1d2a85d1f4b66f2402276b | [] | no_license | ll3321521/ECJTU | 8caeb9006cf60573e26d20c0ee07d19e8317a275 | affb9459ca850d903c8e560822a03b7d8326339b | refs/heads/master | 2021-01-23T08:48:56.705707 | 2017-09-06T02:38:08 | 2017-09-06T02:38:08 | 102,420,494 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,806 | java | package com.ll.core.query.product;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.ll.core.query.BaseQuery;
public class ProductQuery extends BaseQuery{
/**
* 批量查询、更新、删除时的Where条件设置
**/
private Integer id;
public Integer getId() {
return id;
}
public ProductQuery setId(Integer id) {
this.id = id;
return this;
}
private String no;
public String getNo() {
return no;
}
public ProductQuery setNo(String no) {
this.no = no;
return this;
}
private boolean noLike;
public ProductQuery setNoLike(boolean isLike) {
this.noLike = isLike;
return this;
}
private String name;
public String getName() {
return name;
}
public ProductQuery setName(String name) {
this.name = name;
return this;
}
private boolean nameLike;
public ProductQuery setNameLike(boolean isLike) {
this.nameLike = isLike;
return this;
}
private Double weight;
public Double getWeight() {
return weight;
}
public ProductQuery setWeight(Double weight) {
this.weight = weight;
return this;
}
private Integer isNew;
public Integer getIsNew() {
return isNew;
}
public ProductQuery setIsNew(Integer isNew) {
this.isNew = isNew;
return this;
}
private Integer isHot;
public Integer getIsHot() {
return isHot;
}
public ProductQuery setIsHot(Integer isHot) {
this.isHot = isHot;
return this;
}
private Integer isCommend;
public Integer getIsCommend() {
return isCommend;
}
public ProductQuery setIsCommend(Integer isCommend) {
this.isCommend = isCommend;
return this;
}
private Date createTime;
public Date getCreateTime() {
return createTime;
}
public ProductQuery setCreateTime(Date createTime) {
this.createTime = createTime;
return this;
}
private String createUserId;
public String getCreateUserId() {
return createUserId;
}
public ProductQuery setCreateUserId(String createUserId) {
this.createUserId = createUserId;
return this;
}
private boolean createUserIdLike;
public ProductQuery setCreateUserIdLike(boolean isLike) {
this.createUserIdLike = isLike;
return this;
}
private Date checkTime;
public Date getCheckTime() {
return checkTime;
}
public ProductQuery setCheckTime(Date checkTime) {
this.checkTime = checkTime;
return this;
}
private String checkUserId;
public String getCheckUserId() {
return checkUserId;
}
public ProductQuery setCheckUserId(String checkUserId) {
this.checkUserId = checkUserId;
return this;
}
private boolean checkUserIdLike;
public ProductQuery setCheckUserIdLike(boolean isLike) {
this.checkUserIdLike = isLike;
return this;
}
private Integer isShow;
public Integer getIsShow() {
return isShow;
}
public ProductQuery setIsShow(Integer isShow) {
this.isShow = isShow;
return this;
}
private Integer isDel;
public Integer getIsDel() {
return isDel;
}
public ProductQuery setIsDel(Integer isDel) {
this.isDel = isDel;
return this;
}
private Integer typeId;
public Integer getTypeId() {
return typeId;
}
public ProductQuery setTypeId(Integer typeId) {
this.typeId = typeId;
return this;
}
private Integer brandId;
public Integer getBrandId() {
return brandId;
}
public ProductQuery setBrandId(Integer brandId) {
this.brandId = brandId;
return this;
}
private String keywords;
public String getKeywords() {
return keywords;
}
public ProductQuery setKeywords(String keywords) {
this.keywords = keywords;
return this;
}
private boolean keywordsLike;
public ProductQuery setKeywordsLike(boolean isLike) {
this.keywordsLike = isLike;
return this;
}
private Integer sales;
public Integer getSales() {
return sales;
}
public ProductQuery setSales(Integer sales) {
this.sales = sales;
return this;
}
private String description;
public String getDescription() {
return description;
}
public ProductQuery setDescription(String description) {
this.description = description;
return this;
}
private boolean descriptionLike;
public ProductQuery setDescriptionLike(boolean isLike) {
this.descriptionLike = isLike;
return this;
}
private String packageList;
public String getPackageList() {
return packageList;
}
public ProductQuery setPackageList(String packageList) {
this.packageList = packageList;
return this;
}
private boolean packageListLike;
public ProductQuery setPackageListLike(boolean isLike) {
this.packageListLike = isLike;
return this;
}
private String feature;
public String getFeature() {
return feature;
}
public ProductQuery setFeature(String feature) {
this.feature = feature;
return this;
}
private boolean featureLike;
public ProductQuery setFeatureLike(boolean isLike) {
this.featureLike = isLike;
return this;
}
private String color;
public String getColor() {
return color;
}
public ProductQuery setColor(String color) {
this.color = color;
return this;
}
private boolean colorLike;
public ProductQuery setColorLike(boolean isLike) {
this.colorLike = isLike;
return this;
}
private String size;
public String getSize() {
return size;
}
public ProductQuery setSize(String size) {
this.size = size;
return this;
}
private boolean sizeLike;
public ProductQuery setSizeLike(boolean isLike) {
this.sizeLike = isLike;
return this;
}
/**
* ==============================批量查询时的Order条件顺序设置==========================
* ========
**/
public class OrderField {
public OrderField(String fieldName, String order) {
super();
this.fieldName = fieldName;
this.order = order;
}
private String fieldName;
private String order;
public String getFieldName() {
return fieldName;
}
public OrderField setFieldName(String fieldName) {
this.fieldName = fieldName;
return this;
}
public String getOrder() {
return order;
}
public OrderField setOrder(String order) {
this.order = order;
return this;
}
}
/**
* ==============================批量查询时的Order条件顺序设置==========================
* ========
**/
/** 排序列表字段 **/
private List<OrderField> orderFields = new ArrayList<OrderField>();
/**
* 设置排序按属性:id
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyId(boolean isAsc) {
orderFields.add(new OrderField("id", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:no
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyNo(boolean isAsc) {
orderFields.add(new OrderField("no", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:name
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyName(boolean isAsc) {
orderFields.add(new OrderField("name", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:weight
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyWeight(boolean isAsc) {
orderFields.add(new OrderField("weight", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:is_new
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyIsNew(boolean isAsc) {
orderFields.add(new OrderField("is_new", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:is_hot
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyIsHot(boolean isAsc) {
orderFields.add(new OrderField("is_hot", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:is_commend
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyIsCommend(boolean isAsc) {
orderFields.add(new OrderField("is_commend", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:create_time
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyCreateTime(boolean isAsc) {
orderFields.add(new OrderField("create_time", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:create_user_id
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyCreateUserId(boolean isAsc) {
orderFields.add(new OrderField("create_user_id", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:check_time
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyCheckTime(boolean isAsc) {
orderFields.add(new OrderField("check_time", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:check_user_id
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyCheckUserId(boolean isAsc) {
orderFields.add(new OrderField("check_user_id", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:is_show
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyIsShow(boolean isAsc) {
orderFields.add(new OrderField("is_show", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:is_del
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyIsDel(boolean isAsc) {
orderFields.add(new OrderField("is_del", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:type_id
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyTypeId(boolean isAsc) {
orderFields.add(new OrderField("type_id", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:brand_id
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyBrandId(boolean isAsc) {
orderFields.add(new OrderField("brand_id", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:keywords
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyKeywords(boolean isAsc) {
orderFields.add(new OrderField("keywords", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:sales
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbySales(boolean isAsc) {
orderFields.add(new OrderField("sales", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:description
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyDescription(boolean isAsc) {
orderFields.add(new OrderField("description", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:package_list
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyPackageList(boolean isAsc) {
orderFields.add(new OrderField("package_list", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:feature
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyFeature(boolean isAsc) {
orderFields.add(new OrderField("feature", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:color
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbyColor(boolean isAsc) {
orderFields.add(new OrderField("color", isAsc ? "ASC" : "DESC"));
return this;
}
/**
* 设置排序按属性:size
*
* @param isAsc
* 是否升序,否则为降序
*/
public ProductQuery orderbySize(boolean isAsc) {
orderFields.add(new OrderField("size", isAsc ? "ASC" : "DESC"));
return this;
}
}
| [
"1209947302@qq.com"
] | 1209947302@qq.com |
f843475c29b7663b59bbe0ba6e01ab34dbcc83b7 | 4cbe1e7d89fbdd1975a2c5b91bc556aa2f6c9c08 | /app/src/main/java/com/example/amoriproject/Adapter/RVAdapterMyRev.java | 598fca7cbacb24441b414fe0e9b77a2295e3ffbe | [] | no_license | nabilaph/projectAmori | 7b620abc31ba7449db9522a61ffe12365037415a | f3eab123bfea83ab8aa8c7e579c7035eb6404b58 | refs/heads/main | 2023-03-30T22:06:01.001776 | 2021-04-07T03:49:03 | 2021-04-07T03:49:03 | 354,440,110 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,870 | java | package com.example.amoriproject.Adapter;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.RecyclerView;
import com.example.amoriproject.EditReview;
import com.example.amoriproject.R;
import java.util.ArrayList;
import static android.content.Context.MODE_PRIVATE;
public class RVAdapterMyRev extends RecyclerView.Adapter<RVAdapterMyRev.RVviewHolder> {
//define variables
private Context context;
private ArrayList<String> product_name, product_category, review_detail, review_date, username;
//constructor
public RVAdapterMyRev(Context context, ArrayList product_name, ArrayList product_category,
ArrayList review_detail, ArrayList review_date, ArrayList username){
this.context = context;
this.product_name = product_name;
this.product_category = product_category;
this.review_date = review_date;
this.review_detail = review_detail;
this.username = username;
}
@NonNull
@Override
public RVviewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.rv_review_item_my, parent, false);
return new RVAdapterMyRev.RVviewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull final RVviewHolder holder, final int position) {
//set text for review layout
holder.txt_productName.setText(String.valueOf(product_name.get(position)));
holder.txt_productCategory.setText(String.valueOf(product_category.get(position)));
holder.txt_reviewDet.setText(String.valueOf(review_detail.get(position)));
holder.txt_reviewDate.setText(String.valueOf(review_date.get(position)));
holder.txt_username.setText(String.valueOf(username.get(position)));
// set on click listener for delete button
holder.deleteRev.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
//get review id from database
// final int id = dbHelper.getIdRev(product_name.get(position), product_category.get(position),
// review_detail.get(position), username.get(position), review_date.get(position));
// alert dialog for make sure are the user want to delete this review
AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
builder.setCancelable(false);
builder.setMessage("Are you sure to delete this review?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//delete review by id
boolean res = true;
if (res){
//make toast for tell the user that post has been successful deleted
Toast.makeText(v.getContext(), "This post has been successfully deleted", Toast.LENGTH_SHORT).show();
//remove data from array list
product_name.remove(position);
product_category.remove(position);
review_date.remove(position);
review_detail.remove(position);
username.remove(position);
notifyDataSetChanged();
}
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
});
//set on click listener edit button
holder.editRev.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//get id from database
// int id = dbHelper.getIdRev(product_name.get(position), product_category.get(position),
// review_detail.get(position), username.get(position), review_date.get(position));
String name = (String) holder.txt_productName.getText();
String category = (String) holder.txt_productCategory.getText();
String reviewDet = (String) holder.txt_reviewDet.getText();
//put id to sp
SharedPreferences.Editor editor = holder.sp.edit();
editor.putString("name", name);
editor.putString("category", category);
editor.putString("reviewDet", reviewDet);
editor.commit();
//change page to edit review
Intent intent = new Intent(v.getContext(), EditReview.class);
v.getContext().startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return product_name.size();
}
public class RVviewHolder extends RecyclerView.ViewHolder{
//define variables
TextView txt_productName, txt_productCategory,txt_reviewDet, txt_reviewDate, txt_username;
Button deleteRev, editRev;
// define the name of shared preferences and key
String KEY_REVIEWID = "idRev";
String SP_NAME = "mypref";
SharedPreferences sp;
public RVviewHolder(@NonNull final View itemView) {
super(itemView);
//get shared preferences
sp = itemView.getContext().getSharedPreferences(SP_NAME, MODE_PRIVATE);
// find components by id according to the defined variable
txt_productName = itemView.findViewById(R.id.text_productName);
txt_productCategory = itemView.findViewById(R.id.text_productCategory);
txt_reviewDet = itemView.findViewById(R.id.text_reviewDet);
txt_reviewDate = itemView.findViewById(R.id.text_reviewDate);
txt_username = itemView.findViewById(R.id.text_username);
deleteRev = itemView.findViewById(R.id.btn_deleteRev);
editRev = itemView.findViewById(R.id.btn_editRev);
}
}
}
| [
"putrinabilahapsari7@gmail.com"
] | putrinabilahapsari7@gmail.com |
d755050880ca96331aa0e0491377fe138c35256d | d8f17e4b11517e60124864f3e68cdab9ecc0ce8e | /src/com/augmentum/google/vo/VerifyReceiptVo.java | 83516116ecd5d5a2c5113b8b2d615930feff6d92 | [] | no_license | Jason0307/Google-Play-Purchase-Auth | dae01da38956a7309531c0bd84fab5570cd93087 | f490ddcf5dcbebcc8cbd98ac0c0ab9ae45ffb54e | refs/heads/master | 2021-01-21T13:52:47.088102 | 2015-05-11T06:55:14 | 2015-05-11T06:55:14 | 35,407,266 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,052 | java | package com.augmentum.google.vo;
/**
* @author Jason.Zhu
* @date 2013-8-26
* @email jasonzhu@augmentum.com.cn
*/
public class VerifyReceiptVo {
private String kind;
private long purchaseTime;
private int purchaseState = 1;
private int consumptionState;
private String developerPayload;
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public long getPurchaseTime() {
return purchaseTime;
}
public void setPurchaseTime(long purchaseTime) {
this.purchaseTime = purchaseTime;
}
public int getPurchaseState() {
return purchaseState;
}
public void setPurchaseState(int purchaseState) {
this.purchaseState = purchaseState;
}
public int getConsumptionState() {
return consumptionState;
}
public void setConsumptionState(int consumptionState) {
this.consumptionState = consumptionState;
}
public String getDeveloperPayload() {
return developerPayload;
}
public void setDeveloperPayload(String developerPayload) {
this.developerPayload = developerPayload;
}
}
| [
"zhubao0307"
] | zhubao0307 |
e31cb925f9c6ed9ab871af21031484b18e50783e | beaa917d1a5b4cdb854d82f2dd859befb71964a5 | /company/CheckEvenOdd.java | 4df4229369c83368e01f3a41e5bc2bec2db93e36 | [] | no_license | Aishwarya-ga/java-assignment-1 | 35798a22c77ddb136d1708d39d75fbe42d854515 | 81614eeed9a6ab9160cb5b3ea75caef15ba51a71 | refs/heads/master | 2020-04-14T04:39:33.809468 | 2019-01-03T17:40:17 | 2019-01-03T17:40:17 | 163,641,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 990 | java | /* ClassName checkEvenOdd which describes
*the solution for checking whether a given number is
* odd or evn and is present in the given range*/
package com.company;
import java.util.*;
public class CheckEvenOdd {
public static void main(String [] args){
int number;
int temp;
Scanner input = new Scanner(System.in);
System.out.println("Enter a number between 20 and 30");
number = input.nextInt();
/*condition for checking a number is even*/
if(number % 2 == 0){
if(number >= 20 && number <= 30){
System.out.println("Jerry");
}
else{
System.out.println("Number is even but lesser than 20");
}
}
else{
if(number >= 20 && number <= 30){
System.out.println("Tom");
}
else{
System.out.println("Number is odd but lesser than 20");
}
}
}
}
| [
"aishu047@gmail.com"
] | aishu047@gmail.com |
98fc9c15ba868baf0d0386ea92f1e9f381cb085f | cecb65e9a063d879e96e51929cbbcf69df9a37d7 | /src/test/maman_13/JunitCollectionTester.java | d4ba765531e838f65f59c43e69a4fd27d3d29354 | [] | no_license | madaniel/Intro_To_CS_Java | 80f0a04d98381399b1e801f0d27ec2d15ddc5aec | 1ea0b7c5f548615d78b5ca4e4d5ed348023c39d9 | refs/heads/master | 2020-04-10T10:24:37.610968 | 2019-06-08T12:20:46 | 2019-06-08T12:20:46 | 160,965,484 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,551 | java | package test.maman_13;
import main.maman_12.Box3D;
import main.maman_12.Point3D;
import main.maman_13.Collection;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.sql.SQLSyntaxErrorException;
import static org.junit.jupiter.api.Assertions.*;
class JunitCollectionTester {
static private final int MAX_NUM_BOXES = 100;
private Collection testCollection1;
private Collection testCollection2;
private Point3D base;
@BeforeEach
void setUp() {
testCollection1 = new Collection();
testCollection2 = new Collection();
base = new Point3D(0.0, 0.0, 0.0);
System.out.println("Setup");
}
@AfterEach
void tearDown() {
System.out.println("TearDown");
}
@Test
void testAddBox() {
for(int i=1; i <= MAX_NUM_BOXES; i++){
assertTrue(testCollection1.addBox(base, 1, 1, i));
}
assertFalse(testCollection1.addBox(base, 1, 1, 1));
for(int i=MAX_NUM_BOXES; i > 0 ; i--){
assertTrue(testCollection2.addBox(base, 1, 1, i));
}
assertEquals(testCollection1.toString(), testCollection2.toString());
}
@Test
void testMostUpperBaseCorner() {
Box3D b1 = new Box3D(new Point3D(0, 0, 10), 1, 1, 1);
base = new Point3D();
for(int i=1; i <= 10; i++)
assertTrue(testCollection1.addBox(new Point3D(0, 0, i),1, 1, 1));
base = new Point3D(0.0, 0.0, 100);
Box3D b2 = new Box3D(base, 1, 1, 1);
assertEquals(b1.toString(), testCollection1.mostUpperBaseCorner().toString());
testCollection1.addBox(new Point3D(0.0, 0.0, 100), 1, 1, 1);
assertEquals(b2.toString(), testCollection1.mostUpperBaseCorner().toString());
}
@Test
void testTotalSurfaceArea(){
for(int i=0; i < 3; i++){
testCollection1.addBox(new Point3D(), 1, 1, 1);
}
assertEquals(6*3, testCollection1.totalSurfaceArea());
for(int i=0; i < 3; i++){
testCollection1.addBox(new Point3D(), 2, 2, 2);
}
assertEquals(6*3+6*2*2*3, testCollection1.totalSurfaceArea());
}
@Test
void testLongestDistance(){
assertEquals(0,testCollection1.longestDistance());
for(int i=0; i < 5; i++)
testCollection1.addBox(new Point3D(i, i, i), 2, 2, 2);
assertEquals(testCollection1.getBoxes()[0].distance(testCollection1.getBoxes()[4]),testCollection1.longestDistance());
}
@Test
void testHowManyContains(){
}
@Test
void testVolumeOfSmallerBox(){
base = new Point3D(0, 0, 0);
Box3D f = new Box3D (base, 5, 4, 4);
testCollection1.addBox(base, 1, 2, 3);
testCollection1.addBox(base, 3, 2, 1);
testCollection1.addBox(base, 3, 3, 3);
testCollection1.addBox(base, 4, 3, 3);
testCollection1.addBox(base, 1, 1, 1);
int expectedVolume = f.getVolume();
assertEquals(0, testCollection1.volumeOfSmallestBox(0, 5));
assertEquals(0, testCollection1.volumeOfSmallestBox(0, 100));
assertEquals(0, testCollection1.volumeOfSmallestBox(0, 5));
assertEquals(0, testCollection1.volumeOfSmallestBox(-1, 4));
assertEquals(expectedVolume, testCollection1.volumeOfSmallestBox(0, 4));
}
@Test
void testGetBoxes(){
for(int i=0; i < 1; i++)
testCollection1.addBox(new Point3D(), 0, 0, 0);
testCollection1.getBoxes();
}
}
| [
"m.a.daniel@gmail.com"
] | m.a.daniel@gmail.com |
d4226d9d26150643bc4e67db43b9b64cba03b2ac | 23e981d3e3209ea69189eaf2c2597e92f615c8b3 | /app/build/generated/not_namespaced_r_class_sources/debug/r/androidx/coordinatorlayout/R.java | 61a24bafced92c1e703e015a146a4c82cf30443f | [] | no_license | iagopm/FurnitureMagicDice | 457d193b3c4fc7dceb6f37d3bc4b9557c38cf187 | 56b51221f5c2f5356823e570e98a241083ce1ddf | refs/heads/master | 2020-07-22T17:00:00.060179 | 2019-09-11T10:57:36 | 2019-09-11T10:57:36 | 207,267,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,399 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package androidx.coordinatorlayout;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f030027;
public static final int coordinatorLayoutStyle = 0x7f0300a4;
public static final int font = 0x7f0300d7;
public static final int fontProviderAuthority = 0x7f0300d9;
public static final int fontProviderCerts = 0x7f0300da;
public static final int fontProviderFetchStrategy = 0x7f0300db;
public static final int fontProviderFetchTimeout = 0x7f0300dc;
public static final int fontProviderPackage = 0x7f0300dd;
public static final int fontProviderQuery = 0x7f0300de;
public static final int fontStyle = 0x7f0300df;
public static final int fontVariationSettings = 0x7f0300e0;
public static final int fontWeight = 0x7f0300e1;
public static final int keylines = 0x7f03010d;
public static final int layout_anchor = 0x7f030112;
public static final int layout_anchorGravity = 0x7f030113;
public static final int layout_behavior = 0x7f030114;
public static final int layout_dodgeInsetEdges = 0x7f030140;
public static final int layout_insetEdge = 0x7f030149;
public static final int layout_keyline = 0x7f03014a;
public static final int statusBarBackground = 0x7f0301a6;
public static final int ttcIndex = 0x7f030208;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f05006a;
public static final int notification_icon_bg_color = 0x7f05006b;
public static final int ripple_material_light = 0x7f050075;
public static final int secondary_text_default_material_light = 0x7f050077;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f06004e;
public static final int compat_button_inset_vertical_material = 0x7f06004f;
public static final int compat_button_padding_horizontal_material = 0x7f060050;
public static final int compat_button_padding_vertical_material = 0x7f060051;
public static final int compat_control_corner_material = 0x7f060052;
public static final int compat_notification_large_icon_max_height = 0x7f060053;
public static final int compat_notification_large_icon_max_width = 0x7f060054;
public static final int notification_action_icon_size = 0x7f0600c1;
public static final int notification_action_text_size = 0x7f0600c2;
public static final int notification_big_circle_margin = 0x7f0600c3;
public static final int notification_content_margin_start = 0x7f0600c4;
public static final int notification_large_icon_height = 0x7f0600c5;
public static final int notification_large_icon_width = 0x7f0600c6;
public static final int notification_main_column_padding_top = 0x7f0600c7;
public static final int notification_media_narrow_margin = 0x7f0600c8;
public static final int notification_right_icon_size = 0x7f0600c9;
public static final int notification_right_side_padding_top = 0x7f0600ca;
public static final int notification_small_icon_background_padding = 0x7f0600cb;
public static final int notification_small_icon_size_as_large = 0x7f0600cc;
public static final int notification_subtext_size = 0x7f0600cd;
public static final int notification_top_pad = 0x7f0600ce;
public static final int notification_top_pad_large_text = 0x7f0600cf;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f07006b;
public static final int notification_bg = 0x7f07006c;
public static final int notification_bg_low = 0x7f07006d;
public static final int notification_bg_low_normal = 0x7f07006e;
public static final int notification_bg_low_pressed = 0x7f07006f;
public static final int notification_bg_normal = 0x7f070070;
public static final int notification_bg_normal_pressed = 0x7f070071;
public static final int notification_icon_background = 0x7f070072;
public static final int notification_template_icon_bg = 0x7f070073;
public static final int notification_template_icon_low_bg = 0x7f070074;
public static final int notification_tile_bg = 0x7f070075;
public static final int notify_panel_notification_icon_bg = 0x7f070076;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f08000d;
public static final int action_divider = 0x7f08000f;
public static final int action_image = 0x7f080010;
public static final int action_text = 0x7f080016;
public static final int actions = 0x7f080017;
public static final int async = 0x7f08001d;
public static final int blocking = 0x7f080021;
public static final int bottom = 0x7f080022;
public static final int chronometer = 0x7f08002d;
public static final int end = 0x7f080043;
public static final int forever = 0x7f08004f;
public static final int icon = 0x7f080056;
public static final int icon_group = 0x7f080057;
public static final int info = 0x7f08005b;
public static final int italic = 0x7f08005d;
public static final int left = 0x7f080061;
public static final int line1 = 0x7f080062;
public static final int line3 = 0x7f080063;
public static final int none = 0x7f080070;
public static final int normal = 0x7f080071;
public static final int notification_background = 0x7f080072;
public static final int notification_main_column = 0x7f080073;
public static final int notification_main_column_container = 0x7f080074;
public static final int right = 0x7f080080;
public static final int right_icon = 0x7f080081;
public static final int right_side = 0x7f080082;
public static final int start = 0x7f0800a9;
public static final int tag_transition_group = 0x7f0800ae;
public static final int tag_unhandled_key_event_manager = 0x7f0800af;
public static final int tag_unhandled_key_listeners = 0x7f0800b0;
public static final int text = 0x7f0800b1;
public static final int text2 = 0x7f0800b2;
public static final int time = 0x7f0800bb;
public static final int title = 0x7f0800bc;
public static final int top = 0x7f0800c0;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f09000e;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f0b002f;
public static final int notification_action_tombstone = 0x7f0b0030;
public static final int notification_template_custom_big = 0x7f0b0031;
public static final int notification_template_icon_group = 0x7f0b0032;
public static final int notification_template_part_chronometer = 0x7f0b0033;
public static final int notification_template_part_time = 0x7f0b0034;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0d003c;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0e0118;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0e0119;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0e011a;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0e011b;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0e011c;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0e01c2;
public static final int Widget_Compat_NotificationActionText = 0x7f0e01c3;
public static final int Widget_Support_CoordinatorLayout = 0x7f0e01f2;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f030027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] CoordinatorLayout = { 0x7f03010d, 0x7f0301a6 };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f030112, 0x7f030113, 0x7f030114, 0x7f030140, 0x7f030149, 0x7f03014a };
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
public static final int[] FontFamily = { 0x7f0300d9, 0x7f0300da, 0x7f0300db, 0x7f0300dc, 0x7f0300dd, 0x7f0300de };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0300d7, 0x7f0300df, 0x7f0300e0, 0x7f0300e1, 0x7f030208 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"example@example.com"
] | example@example.com |
4c82f567298b4868079c84590426c0a4a6102ceb | 24cb00af2472df8539a9280b1e3b3a4bb476bf5f | /src/InterviewTasks/ReplacePractice.java | 0b0a6c8fd93dea6d8458139e06855933406a9b46 | [] | no_license | AygunEldar/java-programming | da28df8d9df4dd366f3c843f3e123d10a4e216e3 | 125d35600f2d823c77a90e7fbe9daf28dae3e482 | refs/heads/master | 2023-07-13T09:43:57.014483 | 2021-08-21T22:55:07 | 2021-08-21T22:55:07 | 360,311,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | package InterviewTasks;
public class ReplacePractice {
public static void main(String[] args) {
String word1 ="tomorrow";
System.out.println(replace_o());
}
public static String replace_o(){
String str = "$";
String word = "tomorrow";
String result ="";
for (int i = 0; i < word.length(); i++) {
if(word.charAt(i) == 'o'){
result += word.charAt(i-1)+str;
str +="$";
}
}
return result;
}
}
| [
"aygunalizadael@gmail.com"
] | aygunalizadael@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.