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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
603e4a38b0062b77772198c4e9c21645a4a6d49a | d80c38d895f93627abc8f00e0fd599e85fc232e3 | /src/microui/SelectionableGrid.java | 6a40ce25998b467b1186893d95e6e79e93931818 | [] | no_license | Namozag/microui | 45ecbf9a251da942c708cd072438433dac2de78b | 9118c4a8ceddcc8dd58b7f0e3370a2c146250d2d | refs/heads/master | 2020-03-07T18:59:21.034217 | 2018-04-01T18:24:22 | 2018-04-01T18:24:22 | 127,658,649 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,565 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package microui;
import javax.microedition.lcdui.Graphics;
import microui.listeners.ClickListener;
import microui.generic.GenericItem;
/**
*
* @author h
*/
public class SelectionableGrid extends Grid {
public GridSelector selector;
int shift = 0;
ClickListener clickListener;
SelectionLisener selectionListener;
SelectionLisener pointerListener;
public SelectionableGrid(GenericItem[] items, int itemWidth, int itemHeight, Box box) {
super(items, itemWidth, itemHeight, box);
selector = new GridSelector(items.length, rowSize);
}
public void setSelectionListener(SelectionLisener l) {
this.selectionListener = l;
}
public void setPointerListener(SelectionLisener l) {
this.pointerListener = l;
}
public void paint(Graphics g) {
// g.setColor(0xFFFFFF);
// g.fillRect(0, 0, box.w, box.h);
if(background != null)
g.drawImage(background, 0, 0, Graphics.LEFT|Graphics.TOP);
g.setColor(0x000000);
for (int i = 0; i < items.length; i++) {
items[i].paintShifted(g, 0, shift);
}
items[selector.getPointer()].paintShiftedBorder(g, 0, shift);
}
boolean keyLock = false;
public void keyPressed(int keyCode) {
if(keyLock == true)
return;
switch (getGameAction(keyCode)) {
case LEFT:
selector.back();
break;
case RIGHT:
selector.next();
break;
case UP:
selector.up();
break;
case DOWN:
selector.down();
break;
case FIRE:
if(selectionListener != null)
selectionListener.onSelect(selector.pointer);
break;
}
if(pointerListener != null)
pointerListener.onSelect(selector.pointer);
// slide down
if (items[selector.getPointer()].y + shift > box.y + box.h - itemHeight) {
slideDown();
}
// shift -= itemHeight+margin;
// slide up
if (items[selector.getPointer()].y + shift < box.y) {
slideUp();
// shift += itemHeight + margin;
}
//
if (shift > 0) {
shift = 0;
}
repaint();
}
public void slideDown() {
new Slider(12, Slider.DOWN, Slider.DEACCELERATE).start();
}
public void slideUp() {
new Slider(12, Slider.UP, Slider.DEACCELERATE).start();
}
class Slider extends Thread {
public static final int NONE = 0;
public static final int ACCELERATE = 1;
public static final int DEACCELERATE = 2;
public static final int UP = 11;
public static final int DOWN = 12;
int behaviour = NONE;
int direction;
int stepValue = 10;
int step;
public Slider(int step, int direction, int behaviour) {
this.stepValue = step;
this.behaviour = behaviour;
this.direction = direction;
if(behaviour == ACCELERATE)
this.step = 0;
else
this.step = stepValue;
}
public void run() {
keyLock = true;
boolean ON = true;
int target;
if(direction == DOWN)
target = shift - itemHeight - margin;
else
target = shift + itemHeight + margin;
while (ON) {
// wait
try { sleep(80); } catch (Exception ex) { }
// check direction
if(direction == DOWN)
shift -= step;
else
shift += step;
// check behaviour
if ( behaviour == ACCELERATE && step < stepValue) {
step++;
} else if ( behaviour == DEACCELERATE && step > 2) {
step--;
}
repaint();
// check for break
if(direction == DOWN && target > shift)
break;
if(direction == UP && target < shift)
break;
System.out.print(" " + shift);
}
shift = target;
repaint();
keyLock = false;
}
}
}
| [
"hanylink@gmail.com"
] | hanylink@gmail.com |
81b65a157a964ab91ade60e25507b2f65b77a5f6 | 5d64c44ffa712fd8eede4a301bb8cbdd920a4149 | /src/Trie.java | 4b02e4e24053c1dfbabb812b5909f004f8867b42 | [] | no_license | HQebupt/LeetCode | b82edbc58a5633cb776b1d1679c7476b9e5b8488 | db8395df90c488112e86303b027831016a209a2c | refs/heads/master | 2021-01-20T15:33:36.621394 | 2019-01-10T10:14:15 | 2019-01-10T10:14:15 | 26,716,510 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,570 | java | public class Trie {
// 字典树的实现,效率高于HashMap
private TrieNode root;
public Trie() {
root = new TrieNode();
}
// Inserts a word into the trie.
public void insert(String word) {
if (search(word)) {
return;
}
int len = word.length();
TrieNode cur = root;
for (int i = 0; i < len; i++) {
char c = word.charAt(i);
TrieNode tmp = cur.subNode(c);
if (tmp == null) {
tmp = new TrieNode(c);
cur.childNode.add(tmp);
cur = tmp;
} else {
cur = tmp;
}
}
cur.isEnd = true;
}
// Returns if the word is in the trie.
public boolean search(String word) {
int len = word.length();
TrieNode cur = root;
for (int i = 0; i < len; i++) {
char c = word.charAt(i);
TrieNode tmp = cur.subNode(c);
if (tmp == null) {
return false;
} else {
cur = tmp;
}
}
return cur.isEnd;
}
// Returns if there is any word in the trie
// that starts with the given prefix.
public boolean startsWith(String prefix) {
int len = prefix.length();
TrieNode cur = root;
for (int i = 0; i < len; i++) {
char c = prefix.charAt(i);
TrieNode tmp = cur.subNode(c);
if (tmp == null) {
return false;
} else {
cur = tmp;
}
}
return true;
}
public static void main(String[] args) {
Trie trie = new Trie();
trie.insert("somestring");
trie.insert("key");
boolean res = trie.startsWith("ke");
System.out.println(res);
}
}
// Your Trie object will be instantiated and called as such:
// Trie trie = new Trie();
// trie.insert("somestring");
// trie.search("key");
| [
"qiang.huang1991@gmail.com"
] | qiang.huang1991@gmail.com |
2ef67d266f376deb33668c090d06f68aa56ffa9c | 9ea49551b5f15a68877301a3de73eaf8082baa17 | /back/yw-jpj-service/src/main/java/com/drore/model/StreetCultureInfo.java | 10132f3d67c0817ce55d7aa820553669b1825b25 | [] | no_license | liveqmock/newFormFramework | 2740a2d2b350448576d78bc3394eb796dfdc37df | 5072191d9b602089c0bf9047d0a3db7148288f9f | refs/heads/master | 2020-04-04T14:45:43.002186 | 2017-09-22T02:20:05 | 2017-09-22T02:20:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,905 | java | package com.drore.model;
import com.drore.cloud.sdk.domain.SystemModel;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.Date;
import java.util.List;
/**
* Created by wangl on 2017/9/1 0001.
*/
public class StreetCultureInfo extends SystemModel {
public static String table="street_culture_info";
private String description;
private String title;
private int clicks;
@SerializedName("is_hot")
private String isHot;
@SerializedName("is_using")
private String isUsing;
@SerializedName("is_release")
private String isRelease;
@SerializedName("video_url")
private String videoUrl;
@SerializedName("image_url")
private String imageUrl;
@SerializedName("announcer_time")
private Date announcerTime;
@SerializedName("announcer_id")
private String announcerId;
@SerializedName("top_time")
private Date topTime;
/**
*图集 ,临时字段
*/
@Expose(serialize=false)
private List<String> pics;
public List<String> getPics() {
return pics;
}
public void setPics(List<String> pics) {
this.pics = pics;
}
public int getClicks() {
return clicks;
}
public void setClicks(int clicks) {
this.clicks = clicks;
}
public Date getTopTime() {
return topTime;
}
public void setTopTime(Date topTime) {
this.topTime = topTime;
}
public String getIsUsing() {
return isUsing;
}
public void setIsUsing(String isUsing) {
this.isUsing = isUsing;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getIsHot() {
return isHot;
}
public void setIsHot(String isHot) {
this.isHot = isHot;
}
public String getIsRelease() {
return isRelease;
}
public void setIsRelease(String isRelease) {
this.isRelease = isRelease;
}
public String getVideoUrl() {
return videoUrl;
}
public void setVideoUrl(String videoUrl) {
this.videoUrl = videoUrl;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public Date getAnnouncerTime() {
return announcerTime;
}
public void setAnnouncerTime(Date announcerTime) {
this.announcerTime = announcerTime;
}
public String getAnnouncerId() {
return announcerId;
}
public void setAnnouncerId(String announcerId) {
this.announcerId = announcerId;
}
}
| [
"496574509@qq.com"
] | 496574509@qq.com |
56ae08c67e79f37acc9e482adcf75d492e1d190f | 0cafda06e6051fe2290e28d8bfc4add369f9f969 | /app/src/main/java/com/example/ko_desk/myex_10/ScoreActivity.java | b70148eea0ecb4ef3c22272dca66027f24026289 | [] | no_license | lakeibt/teamProject_Unique_android | 12e96f907a4223e4012231511900e79bf93c541d | 84bebe684bf1c992b3bb963e53b5fa340642776f | refs/heads/master | 2022-12-30T06:24:28.246732 | 2020-10-21T05:24:45 | 2020-10-21T05:24:45 | 295,330,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,693 | java | package com.example.ko_desk.myex_10;
import android.content.Intent;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.ListView;
import androidx.appcompat.app.AppCompatActivity;
import com.example.ko_desk.myex_10.Adapter.ScoreViewAdapter;
import com.example.ko_desk.myex_10.vo.Gpa_Total_VO;
import com.example.ko_desk.myex_10.vo.JsonVO;
import com.example.ko_desk.myex_10.widget.FontActivity;
import java.util.ArrayList;
import java.util.List;
public class ScoreActivity extends AppCompatActivity {
LinearLayout linearLayout;
ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_score);
FontActivity.setGlobalFont(this,getWindow().getDecorView());
linearLayout = findViewById(R.id.score_linearLayout);
listView = findViewById(R.id.score_listView);
Intent intent = getIntent();
List<Gpa_Total_VO> score;
JsonVO json = (JsonVO) intent.getSerializableExtra("json");
//서버에서 받아온 성적정보를 리스틉뷰에 뿌려준다
//score = json.getScore();
ArrayList<ScoreItems> data = new ArrayList<>();
//
// if(score.size() > 0){
// for(Gpa_Total_VO vo :score){
// data.add(new ScoreItems("학기 :" + vo.getGpa_semester() + "\n평점 : " + vo.getGpa_total()));
// }
// }else{
// data.add(new ScoreItems("성적이 없습니다"));
// }
ScoreViewAdapter adapter = new ScoreViewAdapter(this,R.layout.score_view,data);
listView.setAdapter(adapter);
}
}
| [
"choihyun7000@naver.com"
] | choihyun7000@naver.com |
cbbb28c30fd008e25eb5786e7fb42f3f06e381e2 | 80e4a4dc5eba603a3f908a0dd7b81ac53b085688 | /src/main/java/edu/nju/ics/alex/inputgenerator/Graph.java | b23301f4464be737184cfa2f7836d99076d6f438 | [] | no_license | struggggle/IG | 6e2ff755987e8aa3c4508abcbceafab1d4e56b35 | 85769d1d998fee9d53628c3d4f66aac78ab5fb87 | refs/heads/main | 2023-07-03T08:38:25.663926 | 2021-08-05T08:29:37 | 2021-08-05T08:29:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,012 | java | package edu.nju.ics.alex.inputgenerator;
import java.util.ArrayList;
/**
* 这里可以不以图的形式进行存储,而是以pair的形式存储,<loop,mutate,tag>,表示进行mutation后,界面是否发生变化,
* 1)我们的顺序就是先尝试所有tag为不变化的,而后尝试所有变化的,接着再尝试所有不变化的。
* 2)mutate中存储了对哪几个event做什么样对mutate。
* 3)我们确实只能比较swipe之前的layout,因为只要是点击,就会导致loop后面的layout发生变化啊,例如点了不同的图片,出现了不同的content。
* 这样说来,我们仅仅需要判断点击的layout
*/
//TODO 可以通过实验来说明是不是loop选择的越大,则成功的可能性越高
public class Graph {
ArrayList<String> mutate;//记录对loop做来什么样的操作 "M"表示mutate "S"表示滑动 "N"表示没有任何操作
boolean changeTag;//loop的界面是否发生变换,这里应该是只对swipe有用
}
| [
"struggggle@126.com"
] | struggggle@126.com |
71e63fdfe6ead1f3ec8c4759f9262480f05fb15c | f92d5363ba0cedc74faba8644af049f6b9583c04 | /collector/src/main/java/com/navercorp/pinpoint/collector/config/DataReceiverGroupConfiguration.java | cfec9dd15a7c0f03359c06558cbc442e025ac302 | [
"DOC",
"LicenseRef-scancode-free-unknown",
"CC0-1.0",
"OFL-1.1",
"GPL-1.0-or-later",
"CC-PDDC",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference",
"MITNFA",
"MIT",
"CC-BY-4.0",
"OFL-1.0"
] | permissive | srathor-test/fork-pinpoint-1.8.3 | 0050c2d285f053f9dbd80c1ee88fe2d48c5aa10d | 2fc7aa52c0f074ed2b665c2d3d6866db01a6233a | refs/heads/master | 2022-12-21T13:16:36.826229 | 2020-04-11T10:55:42 | 2020-04-11T10:55:42 | 246,823,585 | 0 | 0 | Apache-2.0 | 2022-12-16T09:54:51 | 2020-03-12T12:03:05 | HTML | UTF-8 | Java | false | false | 1,075 | java | /*
* Copyright 2017 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.pinpoint.collector.config;
/**
* @author Taejin Koo
*/
public interface DataReceiverGroupConfiguration {
boolean isTcpEnable();
String getTcpBindIp();
int getTcpBindPort();
boolean isUdpEnable();
String getUdpBindIp();
int getUdpBindPort();
int getUdpReceiveBufferSize();
int getWorkerThreadSize();
int getWorkerQueueSize();
boolean isWorkerMonitorEnable();
boolean isPacketCountMonitorEnable();
}
| [
"sushant.rathor@hotmail.com"
] | sushant.rathor@hotmail.com |
1208254ff4a2075ff471b2a34958c3f584016b48 | dc5bdbab1567503b24b1af6386873d3259ebc787 | /JavaPrograms/src/com/learn/java/programs/ReverseAStringUsingCollections.java | 91ca58b7aa7b08b4d9a1a1ad1cc73d1e935478c9 | [] | no_license | mithra320925/JavaPrograms | d9606447d6974fa90e7b6ae4e09038af5c4e1345 | 39712b512f296310c0d6c37929bf636e00c88631 | refs/heads/master | 2023-03-14T23:24:44.069624 | 2021-03-08T11:28:03 | 2021-03-08T11:28:03 | 345,620,501 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 652 | java | package com.learn.java.programs;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
public class ReverseAStringUsingCollections {
public static void main(String[] args) {
// TODO Auto-generated method stub
String given="Agni";
char[] array=given.toCharArray();
List<Character> list=new ArrayList<Character>();
for (Character character : array) {
list.add(character);
}
Collections.reverse(list);
ListIterator iterator = list.listIterator();
while(iterator.hasNext()) {
System.out.println(iterator.next());
}
}
}
| [
"Mithr@DESKTOP-22DAPIM"
] | Mithr@DESKTOP-22DAPIM |
ab834e69728dbcd20f6b78004b4351346ffba164 | 0a7ddcb1553e8c12f0734b768d776c553eba23f2 | /src/main/java/com/weixin/yixing/dao/UserVotesRecordMapper.java | c95bc801cc5595ab0ab474c3db93f4468b7a843d | [] | no_license | wuchongqian/yixing | d2e3f42a37a6c7390bedc5b149484b010dfcad04 | 315a06eb948be7e5380c4f451589072ef93e67d4 | refs/heads/master | 2021-07-10T00:20:28.806562 | 2018-09-30T02:13:43 | 2018-09-30T02:13:43 | 146,453,577 | 0 | 0 | null | 2020-07-01T05:34:37 | 2018-08-28T13:42:23 | Java | UTF-8 | Java | false | false | 598 | java | package com.weixin.yixing.dao;
import com.weixin.yixing.entity.UserVotesRecord;
import java.util.List;
import java.util.Map;
public interface UserVotesRecordMapper {
int deleteByPrimaryKey(Integer id);
int insert(UserVotesRecord record);
int insertSelective(UserVotesRecord record);
UserVotesRecord selectByPrimaryKey(Integer id);
UserVotesRecord selectByWorksId(Map<String, Object> map);
List<UserVotesRecord> selectByDate(Map<String, Object> map);
int updateByPrimaryKeySelective(UserVotesRecord record);
int updateByPrimaryKey(UserVotesRecord record);
} | [
"wuchongqi@126.com"
] | wuchongqi@126.com |
7ffe2f483b279449f43a9535ae6eb227559541f3 | c21e98c879d2ab72956d4950047340581930e814 | /oops/abstraction/Car.java | a4d03744e7dfcc50afeb874a9d504888eaacb0fe | [] | no_license | aayushdogra/DS-Algo | cda85fe67e3af6908b2e917d9faf65dde8dbc316 | 3292c0b954371dea21008a86450e5ac6f75585c5 | refs/heads/master | 2022-12-03T23:26:12.693730 | 2020-08-18T10:55:40 | 2020-08-18T10:55:40 | 288,425,652 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 191 | java | package oops.abstraction;
public abstract class Car {
public abstract void accelerate();
public abstract void breaking();
public void honk() {
System.out.println("Car is honkin");
}
}
| [
"56511092+aayushdogra@users.noreply.github.com"
] | 56511092+aayushdogra@users.noreply.github.com |
442444acb089a44ed9cb88e62a6c15ae9ef40516 | 2798b45498e58d207b1d1a4477bc1651961da283 | /gen/com/android/bouncybitcoin/R.java | 425f3abfc9fcf2459e56c9c562f28b0f3550257b | [] | no_license | andreecmonette/BouncyBitcoinApp | 46b42df407da91a78190faab6fa6e706002d2fac | cd4a70a6aa4fa2daa376502533ad0e4a5e709c9a | refs/heads/master | 2021-01-18T02:06:17.629799 | 2014-02-13T16:13:04 | 2014-02-13T16:13:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,719 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.android.bouncybitcoin;
public final class R {
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f040000;
public static final int activity_vertical_margin=0x7f040001;
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int accuracy_label=0x7f070000;
public static final int bouncing_ball_btn=0x7f070006;
public static final int bouncy_bitcoin_surface=0x7f070008;
public static final int calibrate_button=0x7f070004;
public static final int fragmentContainer=0x7f070005;
public static final int priceView=0x7f070007;
public static final int sensor_list=0x7f07000b;
public static final int sensor_name=0x7f070009;
public static final int sensor_supported=0x7f07000a;
public static final int x_label=0x7f070001;
public static final int y_label=0x7f070002;
public static final int z_label=0x7f070003;
}
public static final class layout {
public static final int accel=0x7f030000;
public static final int activity_bouncy_bitcoin=0x7f030001;
public static final int home=0x7f030002;
public static final int list_item_sensor=0x7f030003;
public static final int sensors=0x7f030004;
}
public static final class string {
public static final int accelerometer=0x7f050001;
public static final int accuracy_high=0x7f050006;
public static final int accuracy_low=0x7f050004;
public static final int accuracy_medium=0x7f050005;
public static final int accuracy_unknown=0x7f050002;
public static final int accuracy_unreliable=0x7f050003;
public static final int app_name=0x7f050000;
public static final int bouncing_ball=0x7f050007;
public static final int bubbles=0x7f050008;
public static final int calibrate=0x7f05000b;
public static final int no_accelerometer=0x7f050009;
public static final int sensor_list=0x7f05000a;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f060000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f060001;
}
}
| [
"patricia.j.estridge@gmail.com"
] | patricia.j.estridge@gmail.com |
5a8a22e77748fdc39f13e1f0fff32f40fe11614d | 5c0277171b68612bda664d252aa4c59e86aee0c6 | /facade/ClienteFacade.java | ece0eaef0108b2b491e13130ec7c920715700550 | [] | no_license | pauloandresoares/swing-oficina-coqueiro | 4a2f49121c46e648fb28b3cb0fc2da1ca68b6fdc | a21720e554b5da94c97da0fce93afc34ea6223b7 | refs/heads/master | 2021-04-27T18:24:12.119144 | 2018-02-21T13:00:53 | 2018-02-21T13:00:53 | 122,336,336 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,124 | java | package facade;
import java.sql.SQLException;
import java.util.Collection;
import java.util.HashMap;
import javax.swing.JOptionPane;
import daoJdbc.ClienteDAO;
import daoJdbc.FactoryDAO;
import dto.DadosCliente;
import businessObject.ClienteBO;
public class ClienteFacade {
public String criarContato(DadosCliente cliente) {
String retorno = null;
if (!ClienteBO.isCamposPrenchidos(cliente))
retorno = "Os campos Obrigatorios devem ser preenchidos";
else
FactoryDAO.getInstance().createClienteDAO().createClienteDAO(cliente);
//FactoryCliente.getInstance().createContatoDAO().createContato(cliente);
return retorno;
}
public void incluirContato(DadosCliente cliente)
{
FactoryDAO.getInstance().createClienteDAO().incluir(cliente);
}
public void excluirContato(DadosCliente cliente)
{
FactoryDAO.getInstance().createClienteDAO().excluir(cliente);
}
public void pesquisaCodigo(DadosCliente cliente){
FactoryDAO.getInstance().createClienteDAO().pesquisaClienteCodigo(cliente);
}
public void pesquisaNome(DadosCliente cliente){
FactoryDAO.getInstance().createClienteDAO().pesquisaClienteNome(cliente);
}
public void pesquisaNomeJlist(DadosCliente cliente){
FactoryDAO.getInstance().createClienteDAO().pesquisaClienteJlist(cliente);
}
public void atualizarContato(DadosCliente cliente){
FactoryDAO.getInstance().createClienteDAO().alterar(cliente);
}
public Collection<DadosCliente> buscaPorParametroNome(HashMap<String, String> map) throws SQLException {
return FactoryDAO.getInstance().createClienteDAO().findByParam(map);
}
public void primeiro(DadosCliente cliente){
FactoryDAO.getInstance().createClienteDAO().primeiro(cliente);
}
public void ultimo(DadosCliente cliente){
FactoryDAO.getInstance().createClienteDAO().ultimo(cliente);
}
public void pesquisaComum(DadosCliente cliente){
FactoryDAO.getInstance().createClienteDAO().pesquisaRegistro(cliente);
}
public Collection<DadosCliente> buscaTudoCliente(HashMap<String, String> map) throws SQLException {
return FactoryDAO.getInstance().createClienteDAO().findByAll(map);
}
}
| [
"pauloandresoares@gmail.com"
] | pauloandresoares@gmail.com |
156c1f9d56e53fbd56192621eb961b1b60b6c91e | 623f9f3fa9250eb82f707011f04332ab7a139ca0 | /thirdEyeClient/libstreaming/src/main/java/net/majorkernelpanic/streaming/hw/NV21Convertor.java | 0ef187b8313660f74a35abf6f50c53fc2c1cb42f | [
"MIT"
] | permissive | njohnsoncpe-zz/thirdEye | 51bddb16f86d5c135f33d35499f14d8a6f02663f | b77923245a87cc850813600df98b3361760ba0e9 | refs/heads/master | 2020-04-02T06:38:27.790846 | 2018-10-26T21:19:24 | 2018-10-26T21:19:24 | 154,160,817 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,057 | java | /*
* Copyright (C) 2011-2015 GUIGUI Simon, fyhertz@gmail.com
*
* This file is part of libstreaming (https://github.com/fyhertz/libstreaming)
*
* 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 net.majorkernelpanic.streaming.hw;
import java.nio.ByteBuffer;
import android.media.MediaCodecInfo;
/**
* Converts from NV21 to YUV420 semi planar or planar.
*/
public class NV21Convertor {
private int mSliceHeight, mHeight;
private int mStride, mWidth;
private int mSize;
private boolean mPlanar, mPanesReversed = false;
private int mYPadding;
private byte[] mBuffer;
ByteBuffer mCopy;
public void setSize(int width, int height) {
mHeight = height;
mWidth = width;
mSliceHeight = height;
mStride = width;
mSize = mWidth*mHeight;
}
public void setStride(int width) {
mStride = width;
}
public void setSliceHeigth(int height) {
mSliceHeight = height;
}
public void setPlanar(boolean planar) {
mPlanar = planar;
}
public void setYPadding(int padding) {
mYPadding = padding;
}
public int getBufferSize() {
return 3*mSize/2;
}
public void setEncoderColorFormat(int colorFormat) {
switch (colorFormat) {
case MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420SemiPlanar:
case MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420PackedSemiPlanar:
case MediaCodecInfo.CodecCapabilities.COLOR_TI_FormatYUV420PackedSemiPlanar:
setPlanar(false);
break;
case MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Planar:
case MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420PackedPlanar:
setPlanar(true);
break;
}
}
public void setColorPanesReversed(boolean b) {
mPanesReversed = b;
}
public int getStride() {
return mStride;
}
public int getSliceHeigth() {
return mSliceHeight;
}
public int getYPadding() {
return mYPadding;
}
public boolean getPlanar() {
return mPlanar;
}
public boolean getUVPanesReversed() {
return mPanesReversed;
}
public void convert(byte[] data, ByteBuffer buffer) {
byte[] result = convert(data);
int min = buffer.capacity() < data.length?buffer.capacity() : data.length;
buffer.put(result, 0, min);
}
public byte[] convert(byte[] data) {
// A buffer large enough for every case
if (mBuffer==null || mBuffer.length != 3*mSliceHeight*mStride/2+mYPadding) {
mBuffer = new byte[3*mSliceHeight*mStride/2+mYPadding];
}
if (!mPlanar) {
if (mSliceHeight==mHeight && mStride==mWidth) {
// Swaps U and V
if (!mPanesReversed) {
for (int i = mSize; i < mSize+mSize/2; i += 2) {
mBuffer[0] = data[i+1];
data[i+1] = data[i];
data[i] = mBuffer[0];
}
}
if (mYPadding>0) {
System.arraycopy(data, 0, mBuffer, 0, mSize);
System.arraycopy(data, mSize, mBuffer, mSize+mYPadding, mSize/2);
return mBuffer;
}
return data;
}
} else {
if (mSliceHeight==mHeight && mStride==mWidth) {
// De-interleave U and V
if (!mPanesReversed) {
for (int i = 0; i < mSize/4; i+=1) {
mBuffer[i] = data[mSize+2*i+1];
mBuffer[mSize/4+i] = data[mSize+2*i];
}
} else {
for (int i = 0; i < mSize/4; i+=1) {
mBuffer[i] = data[mSize+2*i];
mBuffer[mSize/4+i] = data[mSize+2*i+1];
}
}
if (mYPadding == 0) {
System.arraycopy(mBuffer, 0, data, mSize, mSize/2);
} else {
System.arraycopy(data, 0, mBuffer, 0, mSize);
System.arraycopy(mBuffer, 0, mBuffer, mSize+mYPadding, mSize/2);
return mBuffer;
}
return data;
}
}
return data;
}
}
| [
"noah_johnson@uri.edu"
] | noah_johnson@uri.edu |
7cdb307d36ca3a0e5feeca8859a2eaddd7e8684a | a3e364ee0d7965fdc1d423e499c6591feb92d455 | /uikit/src/com/netease/nim/uikit/recent/TeamMemberAitHelper.java | a789e03c7527cbebbb773a330b152fc7228da1fb | [
"MIT"
] | permissive | dusuijiang/SmartLife | ec67503cb1c02e0131a2c9c5eac398847bb7d28a | bba67671bb98917964903e6917e6b342d661fef2 | refs/heads/master | 2021-05-14T05:41:30.273327 | 2018-01-04T07:12:23 | 2018-01-04T07:12:23 | 116,227,524 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,314 | java | package com.netease.nim.uikit.recent;
import android.graphics.Color;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import com.netease.nim.uikit.NimUIKit;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.msg.MsgService;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.netease.nimlib.sdk.msg.model.MemberPushOption;
import com.netease.nimlib.sdk.msg.model.RecentContact;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by hzchenkang on 2016/12/5.
*/
public class TeamMemberAitHelper {
private static final String KEY_AIT = "ait";
public static String getAitAlertString(String content) {
return "[有人@你] " + content;
}
public static void replaceAitForeground(String value, SpannableString mSpannableString) {
if (TextUtils.isEmpty(value) || TextUtils.isEmpty(mSpannableString)) {
return;
}
Pattern pattern = Pattern.compile("(\\[有人@你\\])");
Matcher matcher = pattern.matcher(value);
while (matcher.find()) {
int start = matcher.start();
if (start != 0) {
continue;
}
int end = matcher.end();
mSpannableString.setSpan(new ForegroundColorSpan(Color.RED), start, end, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
}
}
public static boolean isAitMessage(IMMessage message) {
if (message == null || message.getSessionType() != SessionTypeEnum.Team) {
return false;
}
MemberPushOption option = message.getMemberPushOption();
boolean isForce = option != null && option.isForcePush() &&
(option.getForcePushList() == null || option.getForcePushList().contains(NimUIKit.getAccount()));
return isForce;
}
public static boolean hasAitExtension(RecentContact recentContact) {
if (recentContact == null || recentContact.getSessionType() != SessionTypeEnum.Team) {
return false;
}
Map<String, Object> ext = recentContact.getExtension();
if (ext == null) {
return false;
}
List<String> mid = (List<String>) ext.get(KEY_AIT);
return mid != null && !mid.isEmpty();
}
public static void clearRecentContactAited(RecentContact recentContact) {
if (recentContact == null || recentContact.getSessionType() != SessionTypeEnum.Team) {
return;
}
Map<String, Object> exts = recentContact.getExtension();
if (exts != null) {
exts.put(KEY_AIT, null);
}
recentContact.setExtension(exts);
NIMClient.getService(MsgService.class).updateRecent(recentContact);
}
public static void buildAitExtensionByMessage(Map<String, Object> extention, IMMessage message) {
if (extention == null || message == null || message.getSessionType() != SessionTypeEnum.Team) {
return;
}
List<String> mid = (List<String>) extention.get(KEY_AIT);
if (mid == null) {
mid = new ArrayList<>();
}
if (!mid.contains(message.getUuid())) {
mid.add(message.getUuid());
}
extention.put(KEY_AIT, mid);
}
public static void setRecentContactAited(RecentContact recentContact, Set<IMMessage> messages) {
if (recentContact == null || messages == null ||
recentContact.getSessionType() != SessionTypeEnum.Team) {
return;
}
Map<String, Object> extension = recentContact.getExtension();
if (extension == null) {
extension = new HashMap<>();
}
Iterator<IMMessage> iterator = messages.iterator();
while (iterator.hasNext()) {
IMMessage msg = iterator.next();
buildAitExtensionByMessage(extension, msg);
}
recentContact.setExtension(extension);
NIMClient.getService(MsgService.class).updateRecent(recentContact);
}
}
| [
"rd0404@rd01_protruly.com"
] | rd0404@rd01_protruly.com |
72cee8848877c7a596c7aa06ebf558a5c6a4e514 | 7752a88ba513dfd824ab6b861bc551f68012df7c | /src/main/java/fr/humanbooster/fx/test_technique/service/impl/QuestionnaireServiceImpl.java | 7507d6987b26c466270976ed60032b78c320f133 | [] | no_license | mmontos/BusinessCaseCDA | 2f0068c1e90a9662aa111bceaa242732cd8dc9b1 | 1c6dd4a4b8475aa17cb06067cb478b65361b054f | refs/heads/master | 2022-11-11T06:02:01.500368 | 2020-06-29T12:52:34 | 2020-06-29T12:52:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,348 | java | package fr.humanbooster.fx.test_technique.service.impl;
import java.sql.SQLException;
import java.util.List;
import fr.humanbooster.fx.test_technique.business.Questionnaire;
import fr.humanbooster.fx.test_technique.dao.QuestionnaireDao;
import fr.humanbooster.fx.test_technique.dao.impl.QuestionnaireDaoImpl;
import fr.humanbooster.fx.test_technique.service.QuestionnaireService;
public class QuestionnaireServiceImpl implements QuestionnaireService {
private QuestionnaireDao questionnaireDao = new QuestionnaireDaoImpl();
@Override
public Questionnaire ajouterQuestionnaire(Questionnaire questionnaire) throws SQLException {
try {
return questionnaireDao.create(questionnaire);
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
@Override
public Questionnaire recupererQuestionnaire(Long id) throws SQLException {
try {
return questionnaireDao.findOne(id);
} catch (SQLException e) {
}
return null;
}
@Override
public List<Questionnaire> recupererQuestionnaires() throws SQLException {
try {
return questionnaireDao.findAll();
} catch (SQLException e) {
}
return null;
}
@Override
public boolean supprimerQuestionnaire(Long id) throws SQLException {
try {
return questionnaireDao.delete(id);
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}
}
| [
"62284530+Gregoryhumanbooster@users.noreply.github.com"
] | 62284530+Gregoryhumanbooster@users.noreply.github.com |
9381f8acfb9e11b58c72a216bdb9f32b81065d46 | a0216e9f063cbd4c4f68fe997ccf177bc5387630 | /lab04/src/pl/edu/uwm/po/lab04/nice2.java | 31c6684e78f1012c755ddcc4fbf094d9924f1e80 | [] | no_license | Sirothe/ProgramowanieObiektowe | 4f7ac07de054abe48c43a30e4a3c0fdef282f981 | cc03302fed7f35ad472d99c419175a876d26cc63 | refs/heads/master | 2023-02-18T07:31:12.188324 | 2021-01-18T15:08:22 | 2021-01-18T15:08:22 | 301,428,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 694 | java | package pl.edu.uwm.po.lab04;
public class nice2 {
public static String nice2(String str,char sep,int n) {
StringBuffer temp = new StringBuffer();
char c;
int count = 0 ;
int temp2 = str.length()%n;
for(int i=0;i<temp2;i++) {
c = str.charAt(i);
temp.append(c);
if(i==temp2-1) {
temp.append(sep);
}
}
for(int i=temp2;i<str.length();i++) {
c=str.charAt(i);
temp.append(c);
count=count+1;
if(count%n==0 && i!=str.length()-1) {
temp.append(sep);
}
}
return temp.toString();
}
}
| [
"58854544+Sirothe@users.noreply.github.com"
] | 58854544+Sirothe@users.noreply.github.com |
0a3597d9c5d9b202ff7b640b5b6793b3a763b5c4 | fe2c2de83653838b39aae55df7cc3d5158c2686c | /std-java/design-pattern/src/test/java/com/itptn/std/java/dp/factory/ShapeFactoryTest.java | fd9404dc81cf6c8b2626ea8b919b626dfe4cf4ad | [] | no_license | itptn/studio | 48c7280a47f26c174f0a1ebd3966f62ada01f8b0 | 94c1f58e7cd39f1c283418fceae3149db814417b | refs/heads/master | 2021-06-03T10:46:46.762003 | 2020-11-06T06:17:52 | 2020-11-06T06:17:52 | 101,375,369 | 0 | 0 | null | 2018-08-02T00:52:55 | 2017-08-25T06:55:36 | Python | UTF-8 | Java | false | false | 859 | java | package com.itptn.std.java.dp.factory;
import com.itptn.std.java.dp.Shape;
import org.junit.Test;
/**
* @author YuYangjun
* @desc
* @date 2019/1/3 7:52 PM
*/
public class ShapeFactoryTest {
@Test
public void getShape(){
ShapeFactory shapeFactory = new ShapeFactory();
//获取 Circle 的对象,并调用它的 draw 方法
Shape shape1 = shapeFactory.getShape("CIRCLE");
//调用 Circle 的 draw 方法
shape1.draw();
//获取 Rectangle 的对象,并调用它的 draw 方法
Shape shape2 = shapeFactory.getShape("RECTANGLE");
//调用 Rectangle 的 draw 方法
shape2.draw();
//获取 Square 的对象,并调用它的 draw 方法
Shape shape3 = shapeFactory.getShape("SQUARE");
//调用 Square 的 draw 方法
shape3.draw();
}
} | [
"yuyangjun@mgzf.com"
] | yuyangjun@mgzf.com |
84b9d2bdfff8385d9a55623239340f1e50dc194a | 56d2bad8bda60e486164d32f47f7b6e65dd1babe | /app/src/main/java/com/journear/app/map/fragments/AppSettings.java | 8e43d3ac53d16947e12bdf5ad3d7702403663227 | [] | no_license | nikhilgirrajtcd/journear-neo | 27372763833899946bfacf2856d7bd69953c6b21 | 28d90bd4b93e049bcf0f80c0358ab1b88f3a52ee | refs/heads/master | 2022-04-23T11:33:29.383211 | 2020-04-27T15:09:41 | 2020-04-27T15:09:41 | 248,527,974 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 18,054 | java | package com.journear.app.map.fragments;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import com.journear.app.R;
import com.journear.app.map.activities.Analytics;
import com.journear.app.map.activities.MainActivity;
import com.journear.app.map.utils.UnitCalculator;
import com.journear.app.map.utils.Variable;
import com.journear.app.map.map.Tracking;
import java.io.File;
import java.text.SimpleDateFormat;
/**
* This file is part of PocketMaps
* <p>
* Created by GuoJunjun <junjunguo.com> on July 01, 2015.
*/
public class AppSettings {
public enum SettType {Default, Navi};
private Activity activity;
private ViewGroup appSettingsVP, trackingAnalyticsVP, trackingLayoutVP, naviLayoutVP, changeMapItemVP;
private TextView tvspeed, tvdistance, tvdisunit;
/**
* init and set
*
* @param activity
*/
public AppSettings(Activity activity) {
this.activity = activity;
appSettingsVP = (ViewGroup) activity.findViewById(R.id.app_settings_layout);
trackingAnalyticsVP = (ViewGroup) activity.findViewById(R.id.app_settings_tracking_analytics);
trackingLayoutVP = (ViewGroup) activity.findViewById(R.id.app_settings_tracking_layout);
naviLayoutVP = (ViewGroup) activity.findViewById(R.id.app_settings_navigation_layout);
changeMapItemVP = (ViewGroup) activity.findViewById(R.id.app_settings_change_map);
}
public void showAppSettings(final ViewGroup calledFromVP, SettType settType)
{
initClearBtn(appSettingsVP, calledFromVP);
if (settType == SettType.Default)
{
changeMapItemVP.setVisibility(View.VISIBLE);
trackingLayoutVP.setVisibility(View.VISIBLE);
naviLayoutVP.setVisibility(View.GONE);
chooseMapBtn(appSettingsVP);
trackingBtn(appSettingsVP);
}
else
{
naviLayoutVP.setVisibility(View.VISIBLE);
changeMapItemVP.setVisibility(View.GONE);
trackingLayoutVP.setVisibility(View.GONE);
alternateRoute();
naviDirections();
}
appSettingsVP.setVisibility(View.VISIBLE);
calledFromVP.setVisibility(View.INVISIBLE);
if (getTracking().isTracking()) resetAnalyticsItem();
}
public ViewGroup getAppSettingsVP() {
return appSettingsVP;
}
private Tracking getTracking()
{
return Tracking.getTracking(activity.getApplicationContext());
}
/**
* init and implement directions checkbox
*/
private void naviDirections() {
CheckBox cb = (CheckBox) activity.findViewById(R.id.app_settings_directions_cb);
final CheckBox cb_voice = (CheckBox) activity.findViewById(R.id.app_settings_voice);
final CheckBox cb_light = (CheckBox) activity.findViewById(R.id.app_settings_light);
final CheckBox cb_smooth = (CheckBox) activity.findViewById(R.id.app_settings_smooth);
final TextView txt_voice = (TextView) activity.findViewById(R.id.txt_voice);
final TextView txt_light = (TextView) activity.findViewById(R.id.txt_light);
final TextView txt_smooth = (TextView) activity.findViewById(R.id.txt_smooth);
cb.setChecked(Variable.getVariable().isDirectionsON());
cb_voice.setChecked(Variable.getVariable().isVoiceON());
cb_light.setChecked(Variable.getVariable().isLightSensorON());
cb_smooth.setChecked(Variable.getVariable().isSmoothON());
cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Variable.getVariable().setDirectionsON(isChecked);
cb_voice.setEnabled(isChecked);
cb_light.setEnabled(isChecked);
cb_smooth.setEnabled(isChecked);
txt_voice.setEnabled(isChecked);
txt_light.setEnabled(isChecked);
txt_smooth.setEnabled(isChecked);
}
});
cb_voice.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Variable.getVariable().setVoiceON(isChecked);
}
});
cb_light.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Variable.getVariable().setLightSensorON(isChecked);
}
});
cb_smooth.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Variable.getVariable().setSmoothON(isChecked);
}
});
if (!Variable.getVariable().isDirectionsON())
{
cb_voice.setEnabled(false);
cb_light.setEnabled(false);
cb_smooth.setEnabled(false);
txt_voice.setEnabled(false);
txt_light.setEnabled(false);
txt_smooth.setEnabled(false);
}
}
/**
* init and set alternate route radio button option
*/
private void alternateRoute() {
RadioGroup rg = (RadioGroup) activity.findViewById(R.id.app_settings_weighting_rbtngroup);
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.app_settings_fastest_rbtn:
Variable.getVariable().setWeighting("fastest");
break;
case R.id.app_settings_shortest_rbtn:
Variable.getVariable().setWeighting("shortest");
break;
}
}
});
RadioButton rbf, rbs;
rbf = (RadioButton) activity.findViewById(R.id.app_settings_fastest_rbtn);
rbs = (RadioButton) activity.findViewById(R.id.app_settings_shortest_rbtn);
if (Variable.getVariable().getWeighting().equalsIgnoreCase("fastest")) {
rbf.setChecked(true);
} else {
rbs.setChecked(true);
}
}
/**
* tracking item btn handler
*
* @param appSettingsVP
*/
private void trackingBtn(final ViewGroup appSettingsVP) {
// final ImageView iv = (ImageView) activity.findViewById(R.id.app_settings_tracking_iv);
// final TextView tv = (TextView) activity.findViewById(R.id.app_settings_tracking_tv);
trackingBtnClicked();
final TextView tbtn = (TextView) activity.findViewById(R.id.app_settings_tracking_tv_switch);
tbtn.setOnTouchListener(new View.OnTouchListener() {
@Override public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
tbtn.setBackgroundColor(activity.getResources().getColor(R.color.my_primary_light));
return true;
case MotionEvent.ACTION_UP:
tbtn.setBackgroundColor(activity.getResources().getColor(R.color.my_icons));
if (getTracking().isTracking()) {
confirmWindow();
} else {
getTracking().startTracking(activity);
}
trackingBtnClicked();
return true;
}
return false;
}
});
final TextView tbtnLoad = (TextView) activity.findViewById(R.id.app_settings_trackload_tv_switch);
tbtnLoad.setTextColor(activity.getResources().getColor(R.color.my_primary));
tbtnLoad.setOnTouchListener(new View.OnTouchListener() {
@Override public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
tbtnLoad.setBackgroundColor(activity.getResources().getColor(R.color.my_primary_light));
return true;
case MotionEvent.ACTION_UP:
tbtnLoad.setBackgroundColor(activity.getResources().getColor(R.color.my_icons));
showLoadDialog(v.getContext());
return true;
}
return false;
}
});
}
private void showLoadDialog(Context context)
{
android.app.AlertDialog.Builder builder1 = new android.app.AlertDialog.Builder(context);
builder1.setTitle(R.string.tracking_load);
builder1.setCancelable(true);
final String items[] = Variable.getVariable().getTrackingFolder().list();
OnClickListener listener = new OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int buttonNr)
{
String selection = items[buttonNr];
File gpxFile = new File(Variable.getVariable().getTrackingFolder(), selection);
getTracking().loadData(activity, gpxFile, AppSettings.this);
}
};
builder1.setItems(items, listener);
android.app.AlertDialog alert11 = builder1.create();
alert11.show();
}
private void confirmWindow() {
// 1. Instantiate an AlertDialog.Builder with its constructor
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
final EditText edittext = new EditText(activity);
builder.setTitle(activity.getResources().getString(R.string.dialog_stop_save_tracking));
builder.setMessage("path: " + Variable.getVariable().getTrackingFolder().getAbsolutePath() + "/");
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
String formattedDate = df.format(System.currentTimeMillis());
edittext.setText(formattedDate);
builder.setView(edittext);
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
// builder.setView(inflater.inflate(R.layout.dialog_tracking_exit, null));
// Add action buttons
builder.setPositiveButton(R.string.ok, new OnClickListener() {
@Override public void onClick(DialogInterface dialog, int id) {
// save file
getTracking().saveAsGPX(edittext.getText().toString());
getTracking().stopTracking(AppSettings.this);
trackingBtnClicked();
}
}).setNeutralButton(R.string.stop, new OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
getTracking().stopTracking(AppSettings.this);
trackingBtnClicked();
}
}).setNegativeButton(R.string.cancel, new OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
// 3. Get the AlertDialog from create()
AlertDialog dialog = builder.create();
// ((EditText) ((AlertDialog) dialog).findViewById(R.id.dialog_tracking_exit_et)).setText(formattedDate);
dialog.show();
}
/**
* dynamic show start or stop tracking
*/
public void trackingBtnClicked() {
final ImageView iv = (ImageView) activity.findViewById(R.id.app_settings_tracking_iv);
final TextView tv = (TextView) activity.findViewById(R.id.app_settings_tracking_tv_switch);
if (getTracking().isTracking()) {
iv.setImageResource(R.drawable.ic_stop_orange_24dp);
tv.setTextColor(activity.getResources().getColor(R.color.my_accent));
tv.setText(R.string.tracking_stop);
resetAnalyticsItem();
} else {
iv.setImageResource(R.drawable.ic_play_arrow_light_green_a700_24dp);
tv.setTextColor(activity.getResources().getColor(R.color.my_primary));
tv.setText(R.string.tracking_start);
trackingAnalyticsVP.setVisibility(View.GONE);
changeMapItemVP.setVisibility(View.VISIBLE);
}
}
/**
* init and reset analytics items to visible (when tracking start)
*/
private void resetAnalyticsItem() {
changeMapItemVP.setVisibility(View.GONE);
trackingAnalyticsVP.setVisibility(View.VISIBLE);
trackingAnalyticsBtn();
tvspeed = (TextView) activity.findViewById(R.id.app_settings_tracking_tv_tracking_speed);
tvdistance = (TextView) activity.findViewById(R.id.app_settings_tracking_tv_tracking_distance);
tvdisunit = (TextView) activity.findViewById(R.id.app_settings_tracking_tv_tracking_distance_unit);
updateAnalytics(getTracking().getAvgSpeed(), getTracking().getDistance());
}
/**
* actions to preform when tracking analytics item (btn) is clicked
*/
private void trackingAnalyticsBtn() {
trackingAnalyticsVP.setOnTouchListener(new View.OnTouchListener() {
@Override public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
trackingAnalyticsVP
.setBackgroundColor(activity.getResources().getColor(R.color.my_primary_light));
return true;
case MotionEvent.ACTION_UP:
trackingAnalyticsVP.setBackgroundColor(activity.getResources().getColor(R.color.my_icons));
openAnalyticsActivity(true);
return true;
}
return false;
}
});
}
/**
* update speed and distance at analytics item
*
* @param speed
* @param distance
*/
public void updateAnalytics(double speed, double distance) {
if (tvdistance==null || tvdisunit==null || tvspeed==null) { return; }
if (distance < 1000) {
tvdistance.setText(String.valueOf(Math.round(distance)));
tvdisunit.setText(UnitCalculator.getUnit(false));
} else {
tvdistance.setText(String.format("%.1f", distance / 1000));
tvdisunit.setText(UnitCalculator.getUnit(true));
}
tvspeed.setText(String.format("%.1f", speed));
}
/**
* move to select and load map view
*
* @param appSettingsVP
*/
private void chooseMapBtn(final ViewGroup appSettingsVP) {
changeMapItemVP.setOnTouchListener(new View.OnTouchListener() {
@Override public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
changeMapItemVP.setBackgroundColor(activity.getResources().getColor(R.color.my_primary_light));
return true;
case MotionEvent.ACTION_UP:
changeMapItemVP.setBackgroundColor(activity.getResources().getColor(R.color.my_icons));
// Variable.getVariable().setAutoLoad(false); // close auto load from
// main activity
//MapActivity.isMapAlive_preFinish();
activity.finish();
startMainActivity();
return true;
}
return false;
}
});
}
/**
* init clear btn
*/
private void initClearBtn(final ViewGroup appSettingsVP, final ViewGroup calledFromVP) {
ImageButton appsettingsClearBtn = (ImageButton) activity.findViewById(R.id.app_settings_clear_btn);
appsettingsClearBtn.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
appSettingsVP.setVisibility(View.INVISIBLE);
calledFromVP.setVisibility(View.VISIBLE);
}
});
}
/**
* move to main activity
*/
private void startMainActivity() {
// if (Tracking.getTracking().isTracking()) {
// Toast.makeText(activity, "You need to stop your tracking first!", Toast.LENGTH_LONG).show();
// } else {
Intent intent = new Intent(activity, MainActivity.class);
intent.putExtra("com.junjunguo.pocketmaps.activities.MapActivity.SELECTNEWMAP", true);
activity.startActivity(intent);
// activity.finish();
// }
}
/**
* open analytics activity
*/
public void openAnalyticsActivity(boolean startTimer) {
Analytics.startTimer = startTimer;
Intent intent = new Intent(activity, Analytics.class);
activity.startActivity(intent);
// activity.finish();
}
/**
* send message to logcat
*
* @param str
*/
private void log(String str) {
Log.i(this.getClass().getName(), str);
}
/**
* send message to logcat and Toast it on screen
*
* @param str: message
*/
private void logToast(String str) {
log(str);
Toast.makeText(activity, str, Toast.LENGTH_SHORT).show();
}
}
| [
"taranhundal@ymail.com"
] | taranhundal@ymail.com |
954c73e3edd6df1e435072e4681f4e172df287d9 | 9e9dbfd464215f166f0fac3032eabb68852467b1 | /Work/CrudByJavaGuide/src/main/java/com/shetu/simplecrudjavaguides/domain/Student.java | def5b330bbbb4603f27dddf8655e6ecda353a443 | [] | no_license | shshetudev/Spring | 37f7bd4e94f0a5db4a82a63a1b1d745aa169d638 | 5d9744de2a97284753a035fd4b3bdaf75a432202 | refs/heads/master | 2022-07-10T04:19:21.889783 | 2019-10-20T13:05:06 | 2019-10-20T13:05:06 | 215,214,622 | 0 | 0 | null | 2022-06-21T02:04:17 | 2019-10-15T05:33:48 | Java | UTF-8 | Java | false | false | 1,489 | java | package com.shetu.simplecrudjavaguides.domain;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
@Entity
@Table(name = "student_table")
public class Student {
/*
* fields: id,name,email,phoneNo , getter,setter,constructor
* */
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
//adding default validation
@NotBlank(message = "Name is mandatory")
@Column(name = "name")
private String name;
//adding default validation
@NotBlank(message = "Email is mandatory")
@Column(name = "email")
private String email;
@Column(name = "phone_no")
private long phoneNo;
///constructors: default, args(name,email)
public Student(){}
public Student(@NotBlank(message = "Name is mandatory") String name, @NotBlank(message = "Email is mandatory") String email) {
this.name = name;
this.email = email;
}
//getters and setters
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public long getPhoneNo() {
return phoneNo;
}
public void setPhoneNo(long phoneNo) {
this.phoneNo = phoneNo;
}
}
| [
"shshetudev@gmail.com"
] | shshetudev@gmail.com |
5999814ca535de7df8b5838451624a8f5a618ad7 | 78794ca3bffe0bbb96eea04d78fdad440b614bc2 | /Java-v04/src/ArrayDemo02.java | b5b5754fa0fc104f32fdfdd8c3aef6db01505c4e | [] | no_license | dytiger/moocdemo | 2497b042a235593ec83c0cf614e83064c82aff8f | 4a320b2207af86abdcbacb15d7824ad597ddce1d | refs/heads/master | 2021-01-21T14:02:14.603614 | 2016-05-18T09:38:03 | 2016-05-18T09:38:03 | 49,255,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,144 | java | import java.util.Arrays;
/**
* 二维数组:数组的数组,规则的二维数组就像是一张二维表
* Java中可以声明和使用多维数组,但在开发工作中极少使用
*/
public class ArrayDemo02 {
public static void main(String[] args) {
// 声明一个int类型的二维数组
// 数组中的元素是四个int类型的一维数组
// 每个一维数组中又包含三个int类型的元素
// {
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0}
// }
int[][] arr1 = new int[4][3];
// 访问二维数组中的元素需要使用二维索引
// 第一维度索引定位行,第二个维度索引定位行中的元素
// 执行以下两行后,数组中的值会变为以下形式:
// {
// {0, 0, 0},
// {0, 0, 10},
// {0, 0, 0},
// {100, 0, 0}
// }
arr1[1][2] = 10;
arr1[3][0] = 100;
System.out.println(Arrays.toString(arr1[0]));
System.out.println(Arrays.toString(arr1[1]));
System.out.println(Arrays.toString(arr1[2]));
System.out.println(Arrays.toString(arr1[3]));
System.out.println("------------------------------");
// 二维数组也可以在声明时进行值的初始化
// 以下语句声明并初始化了一个二维数组(char[3][4])
char[][] arr2 = {{'a', 'b', 'c', 'd'}, {'e', 'f', 'g', 'h'}, {'i', 'j', 'k', 'l'}};
System.out.println(Arrays.toString(arr2[0]));
System.out.println(Arrays.toString(arr2[1]));
System.out.println(Arrays.toString(arr2[2]));
System.out.println("------------------------------");
// 在二维数组声明时直接初始化时,也可以生成不规则的二维数组
// 在真实开发工作中不常使用
char[][] arr3 = {{'a', 'b'}, {'c', 'd', 'e', 'f', 'g', 'h'}, {'i', 'j', 'k', 'l'}};
System.out.println(Arrays.toString(arr3[0]));
System.out.println(Arrays.toString(arr3[1]));
System.out.println(Arrays.toString(arr3[2]));
}
}
| [
"spring6225"
] | spring6225 |
eda998224bc1da90b2a3b912f6af2c258b1cd841 | e616fab8335b89048ce9e5a9fd48be55f334e252 | /Final-Project/MyFrame.java | 48d103dcbb6b632bbea6efc37274bd12ff63490c | [] | no_license | nnguyen17/CS-401 | fc671c7f8924337297eb48f36d2c26821a7714cc | fdf0620724a267cd69ce67f3de4b7868fc06e149 | refs/heads/master | 2023-01-18T19:09:28.695155 | 2020-11-26T11:15:34 | 2020-11-26T11:15:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,290 | java | import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class MyFrame extends JFrame{
private JButton btnAdd = new JButton("Add");
private JButton btnExit = new JButton("Exit");
private JTextField txtA = new JTextField();
private JTextField txtB = new JTextField();
private JTextField txtC = new JTextField();
private JLabel lblA = new JLabel("A :");
private JLabel lblB = new JLabel("B :");
private JLabel lblC = new JLabel("C :");
public MyFrame(){
setTitle("Some Example");
setSize(400,200);
setLocation(new Point(300,200));
setLayout(null);
setResizable(false);
initComponent();
initEvent();
}
private void initComponent(){
btnExit.setBounds(300,130,80,25);
btnAdd.setBounds(300,100,80,25);
txtA.setBounds(100,10,100,20);
txtB.setBounds(100,35,100,20);
txtC.setBounds(100,65,100,20);
lblA.setBounds(20,10,100,20);
lblB.setBounds(20,35,100,20);
lblC.setBounds(20,65,100,25);
add(btnExit);
add(btnAdd);
add(lblA);
add(lblB);
add(lblC);
add(txtA);
add(txtB);
add(txtC);
}
private void initEvent(){
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(1);
}
});
btnExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
btnExitClick(e);
}
});
btnAdd.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
btnAddClick(e);
}
});
}
private void btnExitClick(ActionEvent evt){
System.exit(0);
}
public void btnAddClick(ActionEvent evt){
Integer x, y, z;
try{
x = Integer.parseInt(txtA.getText());
y = Integer.parseInt(txtB.getText());
z = x + y;
txtC.setText(z.toString());
}catch(Exception e){
System.out.println(e);
JOptionPane.showMessageDialog(null, e.toString(), "Error", JOptionPane.ERROR_MESSAGE);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
66738783e46177b7de00ca75e696b990537b3aa4 | a000389e96a73228eff61811daf90dc64ef1426d | /SpringBooth/src/main/java/org/example/spring/dao/IntelligentServiceRepository.java | d88546ce0cc41f378b820a39b3682888c9a4a4b6 | [] | no_license | marcozaragocin/rmm-services | fdaf33157a384b6899cae661884ffac0466147eb | 6954155983172cda39d27593a38848e09cac7518 | refs/heads/master | 2020-08-15T14:59:23.135589 | 2019-10-15T20:03:31 | 2019-10-15T20:03:31 | 214,690,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 517 | 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 org.example.spring.dao;
import org.example.spring.model.IntelligentService;
import org.springframework.data.jpa.repository.JpaRepository;
/**
*
* @author marco
*/
public interface IntelligentServiceRepository extends JpaRepository<IntelligentService, Long>, IntelligentServiceRepositoryCustom {
}
| [
"noreply@github.com"
] | noreply@github.com |
b6743746e09d7faab902aad921b4e0efff34107d | 6f2fbe0dc7c1695410ff49933b725e6e1017e479 | /core/src/com/games/TweenEngine.java | d4e9118bfecba2b65147ea50a88d94fa465e881d | [
"MIT"
] | permissive | ecraftagency/libgdx_sample | 6cb4608ed0bd25cfa8a3ba7b958bddf343861985 | f937610e3049c9e882ccd6be536956e33cd8ca86 | refs/heads/master | 2020-08-19T16:57:29.054809 | 2019-12-01T13:32:39 | 2019-12-01T13:32:39 | 215,936,441 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,245 | java | package com.games;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.common.G;
import com.common.XGame;
import com.common.tween.A;
import aurelienribon.tweenengine.paths.CatmullRom;
import aurelienribon.tweenengine.Timeline;
import aurelienribon.tweenengine.Tween;
import aurelienribon.tweenengine.TweenManager;
//https://github.com/dsaltares/libgdx-cookbook
public class TweenEngine extends XGame {
private static final float SW = 1280f;
private static final float SH = 720f;
private OrthographicCamera camera;
private Viewport viewport;
private Stage stage;
private TweenManager manager;
@Override
public void _create() {
camera = new OrthographicCamera();
viewport = new FitViewport(SW, SH, camera);
stage = new Stage(viewport, batch);
//chỗ này mình đăng kí Accessor với Tween engine.
//nghĩa là nếu muốn đại lượng (properties) nào của object no biến thiên
//thì phải build Accessor cho tween engine access. Google: Accessor and Mutator
Tween.registerAccessor(Actor.class, new A());
Tween.setWaypointsLimit(10);
manager = new TweenManager();
Image i = (Image) G.c(Image.class).k("6").o(Align.center).add(stage).ub();
// Timeline.createSequence().
// push(Tween.to(i, A.XY, 0.2f).target(200,200))
// .beginParallel()
// .push(Tween.to(i, A.R, .4f).target(90).ease(Linear.INOUT).repeatYoyo(3, 0.1f).repeatYoyo(2,0.3f))
// .push(Tween.to(i, A.O, .4f).target(.5f).ease(Linear.INOUT).repeatYoyo(3, 0.1f))
// .push(Tween.to(i, A.SCL, .4f).target(0f).ease(Linear.INOUT).repeatYoyo(3, 0.1f))
// .end().beginSequence()
// .pushPause(1)
// .push(Tween.to(i, A.XY, 0.2f).target(100, 100).ease(Linear.INOUT).repeatYoyo(2,0.1f))
// .push(Tween.to(i, A.C, 0.2f).target(0).ease(Elastic.INOUT).repeatYoyo(3, 0))
// .push(Tween.call((type, source) -> {
// i.setPosition(900,200);
// }))
// .start(manager);
Timeline tl =Timeline.createSequence()
.push(Tween.to(i, A.XY, 1.5f).target(100,100).path(new CatmullRom()))
.push(Tween.to(i, A.XY, 0.5f).target(200,200))
.start(manager);
Tween.call((type, source) -> tl.kill()).delay(1000).start(manager);
/*
Tween.to(i, A.XY, 2f).target(20, 20).ease(Elastic.INOUT)
là tác động lên object i,
đại lượng tác động là thuộc tính X và Y
Accessor là A
thời gian 0.5,
giá trị mà đại lượng X Y tiến đến sau 0.5s là 20 - 20
hàm biến thiên là Elastic.INOUT
* */
}
@Override
public void render() {
super.render();
float dt = Gdx.graphics.getDeltaTime();
manager.update(dt);
stage.act(dt);
stage.draw();
}
@Override
public InputMultiplexer getInput() {
return null;
}
@Override
public void dispose() {
super.dispose();
stage.dispose();
}
}
| [
"ecraft.eventagency@gmail.com"
] | ecraft.eventagency@gmail.com |
b296f9384c777b788d304c425ae22be52232472a | d0cbfc829aba2ec2af4cd3e9a4df72a471d02c9a | /app/src/main/java/com/example/newsapp/News.java | b174587ac2ec78b0aeaa0384f87dc95115904fec | [] | no_license | divyesh11/News_app | c7035b40b0fe1495e3eaf206b8a87ac54b1c7cb3 | b7178e00e45b8b19c2fba48745edd17a17e05cbf | refs/heads/master | 2023-07-03T01:57:52.587738 | 2021-08-05T14:22:00 | 2021-08-05T14:22:00 | 393,070,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,143 | java | package com.example.newsapp;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ImageView;
import java.io.InputStream;
import java.net.URL;
public class News {
private String mtitle;
private String murl;
private String mpub_date;
private String mdescreption;
private String mnewsfrom;
private String imgUrl;
private ImageView img;
private String author;
News(String title,String url,String date,String des,String from,String im,String auth)
{
mtitle=title;
murl=url;
mpub_date=date;
mdescreption=des;
mnewsfrom=from;
imgUrl=im;
author=auth;
}
public String getMdescreption() {
return mdescreption;
}
public String getMtitle() {
return mtitle;
}
public String getMnewsfrom() {
return mnewsfrom;
}
public String getMpub_date() {
return mpub_date;
}
public String getMurl() {
return murl;
}
public String getImgUrl() {
return imgUrl;
}
public String getAuthor() {
return author;
}
}
| [
"divyeshjivani000@gmail.com"
] | divyeshjivani000@gmail.com |
fcc7abad0d73c290a18e500e4bfdab9e4761d513 | 3da59465612e84ee6915037209110d7e6fd0f187 | /lesson6-1/twitter_backwards/Twitterizer.java | c6378cf30cb5dc985e707b51865cee50afb70c22 | [] | no_license | mrquatsch/Udacity | a0315712f4531c1d07833e0cc853d8c4b0456f39 | 8d083989fa142662785faac8195f5b1ba4bc89ce | refs/heads/master | 2020-04-06T04:31:02.147360 | 2014-03-14T19:03:18 | 2014-03-14T19:03:18 | 17,198,752 | 1 | 5 | null | null | null | null | UTF-8 | Java | false | false | 930 | java | // Implement the reverse(String post) method.
public class Twitterizer
{
/**
* Shortens and prints longPost by removing vowels.
* @param longPost the post whose vowels need to be removed.
*/
public String shorten(String longPost)
{
String shortPost = "";
for (int i = 0; i < longPost.length(); i++)
{
if (!"aeiouAEIOU".contains(longPost.substring(i, i+1)))
{
shortPost = shortPost + longPost.substring(i, i+1);
}
}
return shortPost;
}
/**
* Prints a post backwards to hide its contents.
* @param post the post to be reversed.
*/
public String reverse(String post)
{
String reversePost = "";
for (int i = post.length(); i > 0; i--)
{
reversePost = reversePost + post.substring(i-1, i);
}
return reversePost;
}
}
| [
"mrquatsch@gmail.com"
] | mrquatsch@gmail.com |
13b91dd02da9ae4bba39dc435378644c87d5a2f9 | 72abeefa90d27323e50c3a5b0124365394c4edb5 | /light-tool/src/main/java/third/MerchantCreateRequestVo.java | fabb4c8d38b4a8af5bb07dc03f0cdbfaee03ac92 | [] | no_license | bjo2008cnx/lightfw-util | b09cc50c84aa543ef7efb3a5fd9c9da854cda241 | 13114d853698116d2cb5b01a157e4f13d44136a0 | refs/heads/master | 2020-06-11T08:40:27.756878 | 2018-09-12T11:25:32 | 2018-09-12T11:25:32 | 75,707,727 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,893 | java | package third;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.io.Serializable;
import java.util.Date;
/**
* Created by hui.sun on 2017/7/5.
*/
@Data
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MerchantCreateRequestVo implements Serializable {
private static final long serialVersionUID = -795540171748753000L;
/**
* 店铺id
*/
private Long pid;
/**
* 商户id
*/
private Long wid;
/**
* 名称
*/
String merchantName;
/**
* 地址:省
*/
private Integer province;
/**
* 地址:市
*/
private Integer city;
/**
* 地址:区
*/
private Integer region;
/**
* 行业(1级)
*/
private Long parentIndustryId;
/**
* 行业(2级)
*/
private Long childIndustryId;
/**
* logo
*/
String logo;
/**
* 描述
*/
String desc;
/**
* 名称
*/
String name;
/**
* 手机号
*/
private String phone;
private String qq;
private String weixin;
private String mail;
/**
* 创建店铺使用的解决方案
*/
private Long solutionId;
/**
* 使用解决方案的时候使用的套餐id
*/
private Long packId;
/**
* 解决方案有效时间,此字段和startTime&endTime必须有不为空的,否则会报错
*/
private Integer validDays;
/**
* 解决方案生效时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
/**
* 解决方案失效时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
}
| [
"18600882246@163.com"
] | 18600882246@163.com |
26f74dfd365e098a961587db4dc48afa492c94c7 | e6e1717d848e45e78f48fc09d000236723300949 | /UserServiceImpl.java | c6033ca5b2a4b775d25c35af628d125b1d1bd370 | [] | no_license | mithilaraut/insurance | 2fb45e8fabeda89f4a334a8b4aa834bc2f4487f2 | 7172c9e4bc52e7aa4bdd1f2b4ca304ac2cd49902 | refs/heads/master | 2020-04-16T14:30:11.910086 | 2019-01-24T04:48:48 | 2019-01-24T04:48:48 | 165,669,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 755 | java | package com.vehicle.service;
import java.util.List;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.vehicle.dao.IUserDao;
import com.vehicle.model.User;
@Service
@Transactional
public class UserServiceImpl implements IUserService {
@Autowired
IUserDao userDao;
@Override
public List fetchPassword(String userName) {
return userDao.fetchPassword(userName);
}
@Override
public void AddUser(User user) {
userDao.AddUser(user);
}
@Override
public boolean verifyUser(String userName, String password) {
return userDao.verifyUser(userName, password);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
2bf6b5ba4548fad24e3fd0cf360fcdc815e2b3d7 | 3ecd4760f844db7f3f8a378dac5bb5804ba847f8 | /src/main/java/com/tsarkov/parser/DocumentBuilder.java | e41156f671e18c296c3702b9dc7d36da1375e0d1 | [] | no_license | ne0d/parserV2 | f22968d4d317fcebc0cefa047d32c8ce17d9eb4b | 7c2c80bc1742072f4e8ecb4ed297f6f0828f04de | refs/heads/master | 2020-04-08T19:32:31.863039 | 2018-11-29T12:41:54 | 2018-11-29T12:41:54 | 159,660,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package com.tsarkov.parser;
/**
* Класс-создатель экземпляра Document
*/
public class DocumentBuilder {
public Document createDocument(){
return new Document();
}
}
| [
"ne0d777@gmail.com"
] | ne0d777@gmail.com |
eee2365dee331e8b680f60173757fdfaa0f72708 | 2ce79d1be1e28e710c5c479d27e60bc9df8100de | /src/main/java/com/hcm/carina/demo/gui/components/FooterMenu.java | 68ee1eb6b262968d4281b6d2de7ee636e7186a91 | [
"Apache-2.0"
] | permissive | kanenguyen0209/Test | 52817083c47f9463df759c337382caa63ccd8d86 | 61947757b6daae5f8f11f1d26872726831668018 | refs/heads/master | 2022-12-13T07:07:15.977548 | 2020-07-08T22:36:25 | 2020-07-08T22:36:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,816 | java | /*
* Copyright 2013-2020 QAPROSOFT (http://qaprosoft.com/).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hcm.carina.demo.gui.components;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.FindBy;
import com.qaprosoft.carina.core.foundation.webdriver.decorator.ExtendedWebElement;
import com.qaprosoft.carina.core.gui.AbstractUIObject;
import com.hcm.carina.demo.gui.pages.CompareModelsPage;
import com.hcm.carina.demo.gui.pages.HomePage;
import com.hcm.carina.demo.gui.pages.NewsPage;
public class FooterMenu extends AbstractUIObject {
@FindBy(linkText = "Home")
private ExtendedWebElement homeLink;
@FindBy(linkText = "Compare")
private ExtendedWebElement compareLink;
@FindBy(linkText = "News")
private ExtendedWebElement newsLink;
public FooterMenu(WebDriver driver, SearchContext searchContext) {
super(driver, searchContext);
}
public HomePage openHomePage() {
homeLink.click();
return new HomePage(driver);
}
public CompareModelsPage openComparePage() {
compareLink.click();
return new CompareModelsPage(driver);
}
public NewsPage openNewsPage() {
newsLink.click();
return new NewsPage(driver);
}
}
| [
"root@job-service-6958b56bb7-nm5cs"
] | root@job-service-6958b56bb7-nm5cs |
8df5cc39d6e114083a677737250253683564ef3b | 6e4df553d94c1b4a24ab360116a7fe0a8dc04890 | /src/main/engine/net/sf/jailer/util/UniversalProblemSolver.java | 6aea56e4cbb14af0ca224bc46b915f75f44b8be7 | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | urban-dnowak/Jailer | b07d46c81a3c871947cb93b1202b93ded2861019 | 8ec4ac84a069ceeac0f0a764ef2ad28e7868600e | refs/heads/master | 2020-04-15T12:06:49.340969 | 2019-01-10T10:28:02 | 2019-01-10T10:28:02 | 164,660,292 | 0 | 0 | NOASSERTION | 2019-01-08T13:57:33 | 2019-01-08T13:57:32 | null | UTF-8 | Java | false | false | 1,096 | java | /*
* Copyright 2007 - 2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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 net.sf.jailer.util;
/**
* The Universal Problem Solver.
*
* @author Ralf Wisser
*/
public class UniversalProblemSolver {
/**
* Solves all the problems of the world.
*
* @throws Exception if it isn't possible to solve all the problems of the world
*/
public void solveAllProblemsOfTheWorld() throws Exception {
throw new IllegalStateException("The world is in an illegal state! It isn't possible to solve all the problems of the world.");
}
}
| [
"RalfWisser@gmx.net"
] | RalfWisser@gmx.net |
edf45d52c462263ad896e2d433ebea590c7eeceb | e58b1b8cbf6d0c8d2c3d6dda13a1b3dd7e22ae47 | /srujana.pingili/src/main/java/uscis/gov/ServletSimple.java | 6ca3995a8734e144cef581440ab3b865ee47c0df | [] | no_license | srujanapingili/eclipseprograms | c34cf9cbc2bd0b043a58a5fea941b551417656dc | 90c953b459ad3df9b7c07bdb51dcd0492609f522 | refs/heads/master | 2020-03-18T07:10:43.760469 | 2018-05-22T15:42:24 | 2018-05-22T15:42:24 | 134,437,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,150 | java | package uscis.gov;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import service.Mapping;
public class ServletSimple extends HttpServlet {
private static final long serialVersionUID = 1L;
public ServletSimple() {
}
public void init(ServletConfig config) {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/college?autoConnect=true&useSSL=false", "root", "srujana");
} catch (Exception e) {
e.printStackTrace();
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
Mapping map=new Mapping();
map.retriveStu(request, response);
}
}
| [
"srujanareddy9959@gmail.com"
] | srujanareddy9959@gmail.com |
935dfd80598467de13eda6d4d4234ce020937c4a | 205f8c5da34bced269c80dc870298bd97498fc72 | /core/src/main/java/io/grpc/util/RoundRobinLoadBalancer.java | ceb26d28386a468e64f8eed08f2d21e8b1484d4b | [
"Apache-2.0"
] | permissive | aertoria/grpc-java | ebac3adf276d4e0e03c9b143f38d9d7be4f775c4 | 7df2d5feebf8bc5ecfcea3edba290db500382dcf | refs/heads/master | 2020-04-29T19:48:56.931888 | 2019-03-18T19:38:54 | 2019-03-18T19:38:54 | 176,366,900 | 1 | 0 | Apache-2.0 | 2019-03-18T20:47:38 | 2019-03-18T20:47:37 | null | UTF-8 | Java | false | false | 16,846 | java | /*
* Copyright 2016 The gRPC Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.grpc.util;
import static com.google.common.base.Preconditions.checkNotNull;
import static io.grpc.ConnectivityState.CONNECTING;
import static io.grpc.ConnectivityState.IDLE;
import static io.grpc.ConnectivityState.READY;
import static io.grpc.ConnectivityState.SHUTDOWN;
import static io.grpc.ConnectivityState.TRANSIENT_FAILURE;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import io.grpc.Attributes;
import io.grpc.ChannelLogger.ChannelLogLevel;
import io.grpc.ConnectivityState;
import io.grpc.ConnectivityStateInfo;
import io.grpc.EquivalentAddressGroup;
import io.grpc.LoadBalancer;
import io.grpc.LoadBalancer.PickResult;
import io.grpc.LoadBalancer.PickSubchannelArgs;
import io.grpc.LoadBalancer.Subchannel;
import io.grpc.LoadBalancer.SubchannelPicker;
import io.grpc.Metadata;
import io.grpc.Metadata.Key;
import io.grpc.NameResolver;
import io.grpc.Status;
import io.grpc.internal.GrpcAttributes;
import io.grpc.internal.ServiceConfigUtil;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* A {@link LoadBalancer} that provides round-robin load-balancing over the {@link
* EquivalentAddressGroup}s from the {@link NameResolver}.
*/
final class RoundRobinLoadBalancer extends LoadBalancer {
@VisibleForTesting
static final Attributes.Key<Ref<ConnectivityStateInfo>> STATE_INFO =
Attributes.Key.create("state-info");
// package-private to avoid synthetic access
static final Attributes.Key<Ref<Subchannel>> STICKY_REF = Attributes.Key.create("sticky-ref");
private final Helper helper;
private final Map<EquivalentAddressGroup, Subchannel> subchannels =
new HashMap<>();
private final Random random;
private ConnectivityState currentState;
private RoundRobinPicker currentPicker = new EmptyPicker(EMPTY_OK);
@Nullable
private StickinessState stickinessState;
RoundRobinLoadBalancer(Helper helper) {
this.helper = checkNotNull(helper, "helper");
this.random = new Random();
}
@Override
public void handleResolvedAddressGroups(
List<EquivalentAddressGroup> servers, Attributes attributes) {
Set<EquivalentAddressGroup> currentAddrs = subchannels.keySet();
Set<EquivalentAddressGroup> latestAddrs = stripAttrs(servers);
Set<EquivalentAddressGroup> addedAddrs = setsDifference(latestAddrs, currentAddrs);
Set<EquivalentAddressGroup> removedAddrs = setsDifference(currentAddrs, latestAddrs);
Map<String, ?> serviceConfig = attributes.get(GrpcAttributes.NAME_RESOLVER_SERVICE_CONFIG);
if (serviceConfig != null) {
String stickinessMetadataKey =
ServiceConfigUtil.getStickinessMetadataKeyFromServiceConfig(serviceConfig);
if (stickinessMetadataKey != null) {
if (stickinessMetadataKey.endsWith(Metadata.BINARY_HEADER_SUFFIX)) {
helper.getChannelLogger().log(
ChannelLogLevel.WARNING,
"Binary stickiness header is not supported. The header \"{0}\" will be ignored",
stickinessMetadataKey);
} else if (stickinessState == null
|| !stickinessState.key.name().equals(stickinessMetadataKey)) {
stickinessState = new StickinessState(stickinessMetadataKey);
}
}
}
// Create new subchannels for new addresses.
for (EquivalentAddressGroup addressGroup : addedAddrs) {
// NB(lukaszx0): we don't merge `attributes` with `subchannelAttr` because subchannel
// doesn't need them. They're describing the resolved server list but we're not taking
// any action based on this information.
Attributes.Builder subchannelAttrs = Attributes.newBuilder()
// NB(lukaszx0): because attributes are immutable we can't set new value for the key
// after creation but since we can mutate the values we leverage that and set
// AtomicReference which will allow mutating state info for given channel.
.set(STATE_INFO,
new Ref<>(ConnectivityStateInfo.forNonError(IDLE)));
Ref<Subchannel> stickyRef = null;
if (stickinessState != null) {
subchannelAttrs.set(STICKY_REF, stickyRef = new Ref<>(null));
}
Subchannel subchannel = checkNotNull(
helper.createSubchannel(addressGroup, subchannelAttrs.build()), "subchannel");
if (stickyRef != null) {
stickyRef.value = subchannel;
}
subchannels.put(addressGroup, subchannel);
subchannel.requestConnection();
}
ArrayList<Subchannel> removedSubchannels = new ArrayList<>();
for (EquivalentAddressGroup addressGroup : removedAddrs) {
removedSubchannels.add(subchannels.remove(addressGroup));
}
// Update the picker before shutting down the subchannels, to reduce the chance of the race
// between picking a subchannel and shutting it down.
updateBalancingState();
// Shutdown removed subchannels
for (Subchannel removedSubchannel : removedSubchannels) {
shutdownSubchannel(removedSubchannel);
}
}
@Override
public void handleNameResolutionError(Status error) {
// ready pickers aren't affected by status changes
updateBalancingState(TRANSIENT_FAILURE,
currentPicker instanceof ReadyPicker ? currentPicker : new EmptyPicker(error));
}
@Override
public void handleSubchannelState(Subchannel subchannel, ConnectivityStateInfo stateInfo) {
if (subchannels.get(subchannel.getAddresses()) != subchannel) {
return;
}
if (stateInfo.getState() == SHUTDOWN && stickinessState != null) {
stickinessState.remove(subchannel);
}
if (stateInfo.getState() == IDLE) {
subchannel.requestConnection();
}
getSubchannelStateInfoRef(subchannel).value = stateInfo;
updateBalancingState();
}
private void shutdownSubchannel(Subchannel subchannel) {
subchannel.shutdown();
getSubchannelStateInfoRef(subchannel).value =
ConnectivityStateInfo.forNonError(SHUTDOWN);
if (stickinessState != null) {
stickinessState.remove(subchannel);
}
}
@Override
public void shutdown() {
for (Subchannel subchannel : getSubchannels()) {
shutdownSubchannel(subchannel);
}
}
private static final Status EMPTY_OK = Status.OK.withDescription("no subchannels ready");
/**
* Updates picker with the list of active subchannels (state == READY).
*/
@SuppressWarnings("ReferenceEquality")
private void updateBalancingState() {
List<Subchannel> activeList = filterNonFailingSubchannels(getSubchannels());
if (activeList.isEmpty()) {
// No READY subchannels, determine aggregate state and error status
boolean isConnecting = false;
Status aggStatus = EMPTY_OK;
for (Subchannel subchannel : getSubchannels()) {
ConnectivityStateInfo stateInfo = getSubchannelStateInfoRef(subchannel).value;
// This subchannel IDLE is not because of channel IDLE_TIMEOUT,
// in which case LB is already shutdown.
// RRLB will request connection immediately on subchannel IDLE.
if (stateInfo.getState() == CONNECTING || stateInfo.getState() == IDLE) {
isConnecting = true;
}
if (aggStatus == EMPTY_OK || !aggStatus.isOk()) {
aggStatus = stateInfo.getStatus();
}
}
updateBalancingState(isConnecting ? CONNECTING : TRANSIENT_FAILURE,
// If all subchannels are TRANSIENT_FAILURE, return the Status associated with
// an arbitrary subchannel, otherwise return OK.
new EmptyPicker(aggStatus));
} else {
// initialize the Picker to a random start index to ensure that a high frequency of Picker
// churn does not skew subchannel selection.
int startIndex = random.nextInt(activeList.size());
updateBalancingState(READY, new ReadyPicker(activeList, startIndex, stickinessState));
}
}
private void updateBalancingState(ConnectivityState state, RoundRobinPicker picker) {
if (state != currentState || !picker.isEquivalentTo(currentPicker)) {
helper.updateBalancingState(state, picker);
currentState = state;
currentPicker = picker;
}
}
/**
* Filters out non-ready subchannels.
*/
private static List<Subchannel> filterNonFailingSubchannels(
Collection<Subchannel> subchannels) {
List<Subchannel> readySubchannels = new ArrayList<>(subchannels.size());
for (Subchannel subchannel : subchannels) {
if (isReady(subchannel)) {
readySubchannels.add(subchannel);
}
}
return readySubchannels;
}
/**
* Converts list of {@link EquivalentAddressGroup} to {@link EquivalentAddressGroup} set and
* remove all attributes.
*/
private static Set<EquivalentAddressGroup> stripAttrs(List<EquivalentAddressGroup> groupList) {
Set<EquivalentAddressGroup> addrs = new HashSet<>(groupList.size());
for (EquivalentAddressGroup group : groupList) {
addrs.add(new EquivalentAddressGroup(group.getAddresses()));
}
return addrs;
}
@VisibleForTesting
Collection<Subchannel> getSubchannels() {
return subchannels.values();
}
private static Ref<ConnectivityStateInfo> getSubchannelStateInfoRef(
Subchannel subchannel) {
return checkNotNull(subchannel.getAttributes().get(STATE_INFO), "STATE_INFO");
}
// package-private to avoid synthetic access
static boolean isReady(Subchannel subchannel) {
return getSubchannelStateInfoRef(subchannel).value.getState() == READY;
}
private static <T> Set<T> setsDifference(Set<T> a, Set<T> b) {
Set<T> aCopy = new HashSet<>(a);
aCopy.removeAll(b);
return aCopy;
}
Map<String, Ref<Subchannel>> getStickinessMapForTest() {
if (stickinessState == null) {
return null;
}
return stickinessState.stickinessMap;
}
/**
* Holds stickiness related states: The stickiness key, a registry mapping stickiness values to
* the associated Subchannel Ref, and a map from Subchannel to Subchannel Ref.
*/
@VisibleForTesting
static final class StickinessState {
static final int MAX_ENTRIES = 1000;
final Key<String> key;
final ConcurrentMap<String, Ref<Subchannel>> stickinessMap =
new ConcurrentHashMap<>();
final Queue<String> evictionQueue = new ConcurrentLinkedQueue<>();
StickinessState(@Nonnull String stickinessKey) {
this.key = Key.of(stickinessKey, Metadata.ASCII_STRING_MARSHALLER);
}
/**
* Returns the subchannel associated to the stickiness value if available in both the
* registry and the round robin list, otherwise associates the given subchannel with the
* stickiness key in the registry and returns the given subchannel.
*/
@Nonnull
Subchannel maybeRegister(
String stickinessValue, @Nonnull Subchannel subchannel) {
final Ref<Subchannel> newSubchannelRef = subchannel.getAttributes().get(STICKY_REF);
while (true) {
Ref<Subchannel> existingSubchannelRef =
stickinessMap.putIfAbsent(stickinessValue, newSubchannelRef);
if (existingSubchannelRef == null) {
// new entry
addToEvictionQueue(stickinessValue);
return subchannel;
} else {
// existing entry
Subchannel existingSubchannel = existingSubchannelRef.value;
if (existingSubchannel != null && isReady(existingSubchannel)) {
return existingSubchannel;
}
}
// existingSubchannelRef is not null but no longer valid, replace it
if (stickinessMap.replace(stickinessValue, existingSubchannelRef, newSubchannelRef)) {
return subchannel;
}
// another thread concurrently removed or updated the entry, try again
}
}
private void addToEvictionQueue(String value) {
String oldValue;
while (stickinessMap.size() >= MAX_ENTRIES && (oldValue = evictionQueue.poll()) != null) {
stickinessMap.remove(oldValue);
}
evictionQueue.add(value);
}
/**
* Unregister the subchannel from StickinessState.
*/
void remove(Subchannel subchannel) {
subchannel.getAttributes().get(STICKY_REF).value = null;
}
/**
* Gets the subchannel associated with the stickiness value if there is.
*/
@Nullable
Subchannel getSubchannel(String stickinessValue) {
Ref<Subchannel> subchannelRef = stickinessMap.get(stickinessValue);
if (subchannelRef != null) {
return subchannelRef.value;
}
return null;
}
}
// Only subclasses are ReadyPicker or EmptyPicker
private abstract static class RoundRobinPicker extends SubchannelPicker {
abstract boolean isEquivalentTo(RoundRobinPicker picker);
}
@VisibleForTesting
static final class ReadyPicker extends RoundRobinPicker {
private static final AtomicIntegerFieldUpdater<ReadyPicker> indexUpdater =
AtomicIntegerFieldUpdater.newUpdater(ReadyPicker.class, "index");
private final List<Subchannel> list; // non-empty
@Nullable
private final RoundRobinLoadBalancer.StickinessState stickinessState;
@SuppressWarnings("unused")
private volatile int index;
ReadyPicker(List<Subchannel> list, int startIndex,
@Nullable RoundRobinLoadBalancer.StickinessState stickinessState) {
Preconditions.checkArgument(!list.isEmpty(), "empty list");
this.list = list;
this.stickinessState = stickinessState;
this.index = startIndex - 1;
}
@Override
public PickResult pickSubchannel(PickSubchannelArgs args) {
Subchannel subchannel = null;
if (stickinessState != null) {
String stickinessValue = args.getHeaders().get(stickinessState.key);
if (stickinessValue != null) {
subchannel = stickinessState.getSubchannel(stickinessValue);
if (subchannel == null || !RoundRobinLoadBalancer.isReady(subchannel)) {
subchannel = stickinessState.maybeRegister(stickinessValue, nextSubchannel());
}
}
}
return PickResult.withSubchannel(subchannel != null ? subchannel : nextSubchannel());
}
private Subchannel nextSubchannel() {
int size = list.size();
int i = indexUpdater.incrementAndGet(this);
if (i >= size) {
int oldi = i;
i %= size;
indexUpdater.compareAndSet(this, oldi, i);
}
return list.get(i);
}
@VisibleForTesting
List<Subchannel> getList() {
return list;
}
@Override
boolean isEquivalentTo(RoundRobinPicker picker) {
if (!(picker instanceof ReadyPicker)) {
return false;
}
ReadyPicker other = (ReadyPicker) picker;
// the lists cannot contain duplicate subchannels
return other == this || (stickinessState == other.stickinessState
&& list.size() == other.list.size()
&& new HashSet<>(list).containsAll(other.list));
}
}
@VisibleForTesting
static final class EmptyPicker extends RoundRobinPicker {
private final Status status;
EmptyPicker(@Nonnull Status status) {
this.status = Preconditions.checkNotNull(status, "status");
}
@Override
public PickResult pickSubchannel(PickSubchannelArgs args) {
return status.isOk() ? PickResult.withNoResult() : PickResult.withError(status);
}
@Override
boolean isEquivalentTo(RoundRobinPicker picker) {
return picker instanceof EmptyPicker && (Objects.equal(status, ((EmptyPicker) picker).status)
|| (status.isOk() && ((EmptyPicker) picker).status.isOk()));
}
}
/**
* A lighter weight Reference than AtomicReference.
*/
@VisibleForTesting
static final class Ref<T> {
T value;
Ref(T value) {
this.value = value;
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
dabdb2c007a58843138c1e54ec5ea74b619fefda | 40279f0af92356c58ea2f2f9926d1118490a89e1 | /src/com/sa/util/StringUtil.java | c3497d6c5ffda38d3573e5dade4cd3c8aa3ca958 | [] | no_license | zl283936851/SentimentAnalysis | be8cdcec62c890e63372e6c8ed43a9a97e59fca7 | 043e83e5a5e5344f9378dd7541fa980e89423460 | refs/heads/master | 2021-01-22T21:13:01.409151 | 2017-03-18T13:41:56 | 2017-03-18T13:41:56 | 85,405,501 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package com.sa.util;
import java.nio.charset.Charset;
public class StringUtil {
public static final String SA_CHARSET = "UTF-8";
}
| [
"liang zhang"
] | liang zhang |
fc66da52ccd8f3166aa5c7aac40223d523edf175 | 960218c71b56e83debdedd03b666601efdfc8bb5 | /amadeus-stub/src/main/java/com/amadeus/xml/tfopcq_15_4_1a/CouponInformationDetailsType.java | 72b1f9581d891db0162d4ca89742f832c6c4615b | [] | no_license | gaurav-rupnar/xtravel | 4d823a64c0ac2e870c78fd19ab229c89870bc2a0 | 827942629739d187c4d579bc45cc2c150624b205 | refs/heads/master | 2021-09-03T19:19:24.912249 | 2018-01-11T09:58:56 | 2018-01-11T09:58:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,036 | java |
package com.amadeus.xml.tfopcq_15_4_1a;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* To specify the coupon number, status, value, and other related information.
*
* <p>Java class for CouponInformationDetailsType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="CouponInformationDetailsType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="cpnNumber" type="{http://xml.amadeus.com/TFOPCQ_15_4_1A}AlphaNumericString_Length1To6" minOccurs="0"/>
* <element name="cpnStatus" type="{http://xml.amadeus.com/TFOPCQ_15_4_1A}AlphaNumericString_Length1To3" minOccurs="0"/>
* <element name="cpnAmount" type="{http://xml.amadeus.com/TFOPCQ_15_4_1A}AlphaNumericString_Length1To35" minOccurs="0"/>
* <element name="cpnExchangeMedia" type="{http://xml.amadeus.com/TFOPCQ_15_4_1A}AlphaNumericString_Length1To3" minOccurs="0"/>
* <element name="settlementAuthorization" type="{http://xml.amadeus.com/TFOPCQ_15_4_1A}AlphaNumericString_Length1To35" minOccurs="0"/>
* <element name="voluntaryIndic" type="{http://xml.amadeus.com/TFOPCQ_15_4_1A}AlphaNumericString_Length1To3" minOccurs="0"/>
* <element name="cpnPreviousStatus" type="{http://xml.amadeus.com/TFOPCQ_15_4_1A}AlphaNumericString_Length1To3" minOccurs="0"/>
* <element name="cpnSequenceNumber" type="{http://xml.amadeus.com/TFOPCQ_15_4_1A}AlphaNumericString_Length1To6" minOccurs="0"/>
* <element name="cpnReferenceNumber" type="{http://xml.amadeus.com/TFOPCQ_15_4_1A}AlphaNumericString_Length1To60" minOccurs="0"/>
* <element name="cpnInConnectionWithQualifier" type="{http://xml.amadeus.com/TFOPCQ_15_4_1A}AlphaNumericString_Length1To3" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CouponInformationDetailsType", propOrder = {
"cpnNumber",
"cpnStatus",
"cpnAmount",
"cpnExchangeMedia",
"settlementAuthorization",
"voluntaryIndic",
"cpnPreviousStatus",
"cpnSequenceNumber",
"cpnReferenceNumber",
"cpnInConnectionWithQualifier"
})
public class CouponInformationDetailsType {
protected String cpnNumber;
protected String cpnStatus;
protected String cpnAmount;
protected String cpnExchangeMedia;
protected String settlementAuthorization;
protected String voluntaryIndic;
protected String cpnPreviousStatus;
protected String cpnSequenceNumber;
protected String cpnReferenceNumber;
protected String cpnInConnectionWithQualifier;
/**
* Gets the value of the cpnNumber property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCpnNumber() {
return cpnNumber;
}
/**
* Sets the value of the cpnNumber property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCpnNumber(String value) {
this.cpnNumber = value;
}
/**
* Gets the value of the cpnStatus property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCpnStatus() {
return cpnStatus;
}
/**
* Sets the value of the cpnStatus property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCpnStatus(String value) {
this.cpnStatus = value;
}
/**
* Gets the value of the cpnAmount property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCpnAmount() {
return cpnAmount;
}
/**
* Sets the value of the cpnAmount property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCpnAmount(String value) {
this.cpnAmount = value;
}
/**
* Gets the value of the cpnExchangeMedia property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCpnExchangeMedia() {
return cpnExchangeMedia;
}
/**
* Sets the value of the cpnExchangeMedia property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCpnExchangeMedia(String value) {
this.cpnExchangeMedia = value;
}
/**
* Gets the value of the settlementAuthorization property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSettlementAuthorization() {
return settlementAuthorization;
}
/**
* Sets the value of the settlementAuthorization property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSettlementAuthorization(String value) {
this.settlementAuthorization = value;
}
/**
* Gets the value of the voluntaryIndic property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVoluntaryIndic() {
return voluntaryIndic;
}
/**
* Sets the value of the voluntaryIndic property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVoluntaryIndic(String value) {
this.voluntaryIndic = value;
}
/**
* Gets the value of the cpnPreviousStatus property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCpnPreviousStatus() {
return cpnPreviousStatus;
}
/**
* Sets the value of the cpnPreviousStatus property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCpnPreviousStatus(String value) {
this.cpnPreviousStatus = value;
}
/**
* Gets the value of the cpnSequenceNumber property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCpnSequenceNumber() {
return cpnSequenceNumber;
}
/**
* Sets the value of the cpnSequenceNumber property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCpnSequenceNumber(String value) {
this.cpnSequenceNumber = value;
}
/**
* Gets the value of the cpnReferenceNumber property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCpnReferenceNumber() {
return cpnReferenceNumber;
}
/**
* Sets the value of the cpnReferenceNumber property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCpnReferenceNumber(String value) {
this.cpnReferenceNumber = value;
}
/**
* Gets the value of the cpnInConnectionWithQualifier property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCpnInConnectionWithQualifier() {
return cpnInConnectionWithQualifier;
}
/**
* Sets the value of the cpnInConnectionWithQualifier property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCpnInConnectionWithQualifier(String value) {
this.cpnInConnectionWithQualifier = value;
}
}
| [
"gauravrupnar@gmail.com"
] | gauravrupnar@gmail.com |
49bd304f7c8cd8b3052e0741f8c1d243c1a0487c | b9b5d00c1f87897ad18668611d7acc41d11e3ec9 | /java/subhamguptaminor/androidbelieve/drawerwithswipetabs/MainActivity.java | 8e45d93c263595e448a154107590aea4f9d01d8f | [] | no_license | subhamG98/Placement-Assured | 54b6ee61768714a9407ad9436519d8a1eb2f6e95 | a8a99566a33f45b347a2db35cc63615c8bbd5f4d | refs/heads/master | 2020-12-01T21:15:52.213593 | 2016-09-05T14:13:54 | 2016-09-05T14:13:54 | 67,410,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,907 | java | package subhamguptaminor.androidbelieve.drawerwithswipetabs;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import com.twitter.sdk.android.core.TwitterException;
import com.twitter.sdk.android.core.TwitterSession;
import com.twitter.sdk.android.core.identity.TwitterLoginButton;
import com.twitter.sdk.android.core.*;
import com.twitter.sdk.android.core.models.User;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private EditText editTextUn;
private EditText editTextPass;
private Button button3;
private Button button;
private ImageButton fblogin;
public static String username;
public static final String KEY_EMAIL = "email";
public static final String KEY_PASSWORD = "password";
public static final String LOGIN_SUCCESS = "success";
//1638722466400475
public static final String SHARED_PREF_NAME = "myloginapp";
public static final String USERNAME_SHARED_PREF = "email";
public static final String LOGGEDIN_SHARED_PREF = "loggedin";
private boolean loggedIn = false;
String namefb="";
String passwordfb="";
String name_twitter="";
String username_twitter="";
long userid_twitter;
String dp_twitter="";
private TwitterLoginButton loginButton;
String dp1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
loginButton = (TwitterLoginButton) findViewById(R.id.twitter_login_button);
loginButton.setCallback(new Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> result) {
// The TwitterSession is also available through:
// Twitter.getInstance().core.getSessionManager().getActiveSession()
final TwitterSession session = result.data;
// TODO: Remove toast and use the TwitterSession's userID
// with your app's user model
name_twitter=session.getUserName().replace(" ","");
username_twitter=session.getUserName().replace(" ", "");
userid_twitter=session.getUserId();
Log.i("twitter check", "" + name_twitter + " " + username_twitter);
new MyTwitterApiClient(session).getUsersService().show(userid_twitter, null, true,
new Callback<User>() {
@Override
public void success(Result<User> result) {
// dp_twitter.equals(result.data.profileImageUrlHttps.toString());
dp_twitter = result.data.profileImageUrlHttps.toString();
Log.i("dp==", "-" + dp_twitter);
Log.i("hawwa", "" + result.data.profileImageUrlHttps.toString() + "and " + dp1);
inserttwitterlogin(session.getUserName().replace(" ", ""), session.getUserName().replace(" ", ""),dp_twitter);
}
@Override
public void failure(TwitterException exception) {
Log.i("twittercommunity", "exception is " + exception);
}
});
// Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
}
@Override
public void failure(TwitterException exception) {
Log.d("TwitterKit", "Login with Twitter failure", exception);
}
});
namefb=MainActivityFragment.name1;
passwordfb=MainActivityFragment.password1;
Log.i("Really",""+namefb+" --"+passwordfb);
if(namefb=="" || passwordfb=="")
{
}
else
{
checkToDatabase1(namefb,passwordfb);
}
editTextUn = (EditText) findViewById(R.id.editText);
editTextPass = (EditText) findViewById(R.id.editText2);
button3 = (Button) findViewById(R.id.button3);
// button=(Button)findViewById(R.id.button);
fblogin=(ImageButton)findViewById(R.id.fblogin);
fblogin.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i1=new Intent("subhamguptaminor.androidbelieve.drawerwithswipetabs.ma2");
startActivity(i1);
}
}
);
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
/* button.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent1 = new Intent("register");
startActivity(intent1);
}
}
);
*/
button3.setOnClickListener(this);
}
class MyTwitterApiClient extends TwitterApiClient {
public MyTwitterApiClient(TwitterSession session) {
super(session);
}
public UsersServices getUsersService() {
return getService(UsersServices.class);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Make sure that the loginButton hears the result from any
// Activity that it triggered.
loginButton.onActivityResult(requestCode, resultCode, data);
}
private void inserttwitterlogin(String name, final String username1,String twitter1) {
class SendPostReqAsyncTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
String paramname = params[0];
String paramusername = params[1];
String paramdp = params[2];
String namet=name_twitter;
String usernamet=username_twitter;
String dpt=dp_twitter;
Log.i("twitter check1",""+namet+" "+usernamet+"dp==>"+dpt);
InputStream is = null;
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("namet", namet));
nameValuePairs.add(new BasicNameValuePair("usernamet", usernamet));
nameValuePairs.add(new BasicNameValuePair("dpt", dpt));
String result = null;
try {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(
"http://hello45.esy.es/inserttwitterlogin.php");
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
result = sb.toString();
} catch (ClientProtocolException e) {
} catch (IOException e) {
}
return result;
}
@Override
protected void onPostExecute(String result) {
if (result.contains("success")) {
// Toast.makeText(getApplicationContext(), "success! ", Toast.LENGTH_LONG).show();
SharedPreferences sharedPreferences = MainActivity.this.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
//Creating editor to store values to shared preferences
SharedPreferences.Editor editor = sharedPreferences.edit();
username=username_twitter;
Log.i("twitter check3",""+username);
//Adding values to editor
editor.putBoolean(LOGGEDIN_SHARED_PREF, true);
editor.putString(USERNAME_SHARED_PREF, username_twitter);
//Saving values to editor
editor.commit();
//Starting profile activity
Intent intent = new Intent(MainActivity.this,ma1.class);
startActivity(intent);
} else {
Toast.makeText(getApplicationContext(), "failed! to cause twitter login"+result, Toast.LENGTH_SHORT).show();
Log.i("twitter check", "" + result);
}
}
}
SendPostReqAsyncTask sendPostReqAsyncTask = new SendPostReqAsyncTask();
sendPostReqAsyncTask.execute(name, username1,twitter1);
}
public void check(View view){
String un = editTextUn.getText().toString();
String pass = editTextPass.getText().toString();
checkToDatabase(un, pass);
}
/*public void sendforregister()
{
Intent intent1 = new Intent("register") ;
startActivity(intent1);
}
*/
public void checkToDatabase(final String un,String pass) {
class SendPostReqAsyncTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
String paramun = params[0];
String parampass = params[1];
String un = editTextUn.getText().toString();
String pass = editTextPass.getText().toString();
InputStream is = null;
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("username", un));
nameValuePairs.add(new BasicNameValuePair("password", pass));
Log.i("username", "" + un);
Log.i("username1", "" +pass);
String result = null;
try {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(
"http://hello45.esy.es/checklogin.php");
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpClient.execute(httpPost);
Log.i("httppost", "" +httpPost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
result = sb.toString();
} catch (ClientProtocolException e) {
} catch (IOException e) {
}
Log.i("result", ""+result);
return result;
}
@Override
protected void onPostExecute(String result) {
if (result.contains("success")) {
username= editTextUn.getText().toString();
Toast.makeText(getApplicationContext(), "Welcome! "+username, Toast.LENGTH_SHORT).show();
// String name = editTextUn.getText().toString();
// String pass = editTextPass.getText().toString();
SharedPreferences sharedPreferences = MainActivity.this.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
//Creating editor to store values to shared preferences
SharedPreferences.Editor editor = sharedPreferences.edit();
//Adding values to editor
editor.putBoolean(LOGGEDIN_SHARED_PREF, true);
editor.putString(USERNAME_SHARED_PREF, username);
//Saving values to editor
editor.commit();
//Starting profile activity
Intent intent = new Intent(MainActivity.this,ma1.class);
startActivity(intent);
} else {
Toast.makeText(getApplicationContext(), "Login failed!"+result, Toast.LENGTH_LONG).show();
}
}
}
SendPostReqAsyncTask sendPostReqAsyncTask = new SendPostReqAsyncTask();
sendPostReqAsyncTask.execute(un, pass);
}
public void checkToDatabase1(String un,String pass) {
class SendPostReqAsyncTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
String paramun = params[0];
String parampass = params[1];
String un = namefb;
un=un.replace(" ","");
String pass = passwordfb;
pass=pass.replace(" ","");
Log.i("should be correct",""+un+" "+pass);
InputStream is = null;
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("username", un));
nameValuePairs.add(new BasicNameValuePair("password", pass));
Log.i("username", "" + un);
Log.i("username1", "" +pass);
String result = null;
try {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(
"http://hello45.esy.es/checklogin.php");
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpClient.execute(httpPost);
Log.i("httppost", "" +httpPost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
result = sb.toString();
} catch (ClientProtocolException e) {
} catch (IOException e) {
}
Log.i("result", ""+result);
return result;
}
@Override
protected void onPostExecute(String result) {
if (result.contains("success")) {
username= namefb;
username=username.replace(" ","");
Toast.makeText(getApplicationContext(), "Welcome! "+username, Toast.LENGTH_SHORT).show();
// String name = editTextUn.getText().toString();
// String pass = editTextPass.getText().toString();
SharedPreferences sharedPreferences = MainActivity.this.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
//Creating editor to store values to shared preferences
SharedPreferences.Editor editor = sharedPreferences.edit();
//Adding values to editor
editor.putBoolean(LOGGEDIN_SHARED_PREF, true);
editor.putString(USERNAME_SHARED_PREF, username);
//Saving values to editor
editor.commit();
//Starting profile activity
Intent intent = new Intent(MainActivity.this,ma1.class);
startActivity(intent);
} else {
Toast.makeText(getApplicationContext(), "failed!"+result, Toast.LENGTH_LONG).show();
}
}
}
SendPostReqAsyncTask sendPostReqAsyncTask = new SendPostReqAsyncTask();
sendPostReqAsyncTask.execute(un, pass);
}
@Override
public void onClick(View v) {
check(v);
}
@Override
protected void onResume() {
super.onResume();
//In onresume fetching value from sharedpreference
SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREF_NAME,Context.MODE_PRIVATE);
//Fetching the boolean value form sharedpreferences
loggedIn = sharedPreferences.getBoolean(LOGGEDIN_SHARED_PREF, false);
// username=sharedPreferences.getString(username,USERNAME_SHARED_PREF);
//If we will get true
if(loggedIn){
//We will start the Profile Activity
Intent intent = new Intent(MainActivity.this, ma1.class);
startActivity(intent);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
05104b33fb94e85b069ec871ab31d2eae1a2ac1c | 8b6c05f50f148bc6a417e67c8000b087eedaf159 | /product_add.java | df79105d5eca4cb6fb1e975905a2d10eb53792f7 | [] | no_license | shadialariqi/accounting-point | d6d4ccaa183fe1620181e13e74f04ba8230849ea | 1351a12f763390eb0ea48851fdd49d47bca09b5c | refs/heads/main | 2023-03-30T09:33:39.799990 | 2021-03-30T14:08:26 | 2021-03-30T14:08:26 | 353,004,867 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,690 | java | package com.example.end;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
public class product_add extends AppCompatActivity {
//انشاء كائن من الكلاس الخاص بقاعده البينات
//************************************************
Database DataBase = new Database(this);
//************************************************
public static Button btn_barcode_add;
Button btn_save_product;
public static EditText name_product,quantity,price_purchase,price_sale,description,rating;
Bundle n;
String BACK;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_product_add);
//اكواد تغيير خطوط
//*******************************************************************************
TextView txt_name_product=(TextView)findViewById(R.id.txt_name_product);
TextView txt_name_barcode=(TextView)findViewById(R.id.txt_name_barcode);
TextView txt_name_barcode2=(TextView)findViewById(R.id.txt_name_barcode2);
TextView txt_name_quantity=(TextView)findViewById(R.id.txt_name_quantity);
TextView txt_name_price_purchase=(TextView)findViewById(R.id.txt_name_price_purchase);
TextView txt_name_price_sale=(TextView)findViewById(R.id.txt_name_price_sale);
TextView txt_name_description=(TextView)findViewById(R.id.txt_name_description);
TextView txt_name_rating=(TextView)findViewById(R.id.txt_name_rating);
btn_barcode_add= (Button) findViewById(R.id.btn_barcode_add);
btn_save_product= (Button) findViewById(R.id.btn_save_product);
//************************************************************************************
//الانتقال الى واجهه ادخال الباركود اليديويه
//*****************************************************************
txt_name_barcode2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent BARCODE2 = new Intent(product_add.this,numper_barcode.class);
startActivity(BARCODE2);
}
});
/* Bundle b=getIntent().getExtras();
if (b==null)
{
txt_name_barcode2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent BARCODE2 = new Intent(product_add.this,numper_barcode.class);
startActivity(BARCODE2);
}
});
}
else {
txt_name_barcode2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent BARCODE2 = new Intent(product_add.this,numper_barcode.class);
startActivity(BARCODE2);
btn_barcode_add.setText("اضف باركود المنتج");
}
});
String barcoding = b.getString("barcoding");
btn_barcode_add.setText(barcoding);
b.clear();
}*/
//*****************************************************************
//كود لاضهار ماسح الباركود
//*******************************************************************
btn_barcode_add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(product_add.this,QR_SCNER.class));
}
});
//********************************************************************
// كود الاضافه الى قاعد البينات اضافه المنتجات الى المخازن
//***************************************************************************************
name_product=(EditText)findViewById(R.id.edit_product);
quantity=(EditText)findViewById(R.id.edit_quantity);
price_purchase=(EditText)findViewById(R.id.edit_price_purchase);
price_sale=(EditText)findViewById(R.id.edit__price_sale);
description=(EditText)findViewById(R.id.edit_description);
rating=(EditText)findViewById(R.id.edit_rating);
//********************************************************************************
n=getIntent().getExtras();
if(n !=null){
String [] v = n.getStringArray("up");
name_product.setText(v[0]);
BACK=name_product.getText().toString();
btn_barcode_add.setText(v[1]);
quantity.setText(v[2]);
price_purchase.setText(v[3]);
price_sale.setText(v[4]);
description.setText(v[5]);
rating.setText(v[6]);
//***************************************************************************
}
btn_save_product.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (name_product.getText().toString().trim().isEmpty()) {
Toast.makeText(product_add.this, "ادخل اسم المنتج ", Toast.LENGTH_SHORT).show();
}else if(quantity.getText().toString().trim().isEmpty()){
Toast.makeText(product_add.this, "ادخل الكميه ", Toast.LENGTH_SHORT).show();
}else if(price_purchase.getText().toString().trim().isEmpty()){
Toast.makeText(product_add.this, "ادخل سعر الشراء ", Toast.LENGTH_SHORT).show();
}else if(price_sale.getText().toString().trim().isEmpty()){
Toast.makeText(product_add.this, "ادخل سعر البيع ", Toast.LENGTH_SHORT).show();
} else if(n!=null) {
String NAME_PRPDUCT = name_product.getText().toString();
String BARCODE = (btn_barcode_add.getText().toString());
int QUANTITY = Integer.parseInt(quantity.getText().toString());
int PRICE_PURCHASE = Integer.parseInt(price_purchase.getText().toString());
int PRICE_SALE = Integer.parseInt(price_sale.getText().toString());
String DESCRIPTION = description.getText().toString();
String RATING = rating.getText().toString();
boolean Result = DataBase.Update_up(BACK, NAME_PRPDUCT, BARCODE, QUANTITY, PRICE_PURCHASE, PRICE_SALE, DESCRIPTION, RATING);
if (Result == true) {
Toast.makeText(product_add.this, "تم تعديل المنتج بنجاح", Toast.LENGTH_SHORT).show();
finish();
} else {
Toast.makeText(product_add.this, "لم يتم تعديل المنتج بنجاح", Toast.LENGTH_SHORT).show();
}
} else{
String NAME_PRPDUCT = name_product.getText().toString();
String BARCODE = (btn_barcode_add.getText().toString());
int QUANTITY = Integer.parseInt(quantity.getText().toString());
int PRICE_PURCHASE = Integer.parseInt(price_purchase.getText().toString());
int PRICE_SALE = Integer.parseInt(price_sale.getText().toString());
String DESCRIPTION = description.getText().toString();
String RATING = rating.getText().toString();
boolean Result = DataBase.save_product(NAME_PRPDUCT, BARCODE, QUANTITY, PRICE_PURCHASE, PRICE_SALE, DESCRIPTION, RATING);
if (Result == true) {
Toast.makeText(product_add.this, "تم اضافه المنتج بنجاح", Toast.LENGTH_SHORT).show();
finish();
} else {
Toast.makeText(product_add.this, "لم يتم اضافه المنتج بنجاح", Toast.LENGTH_SHORT).show();
}
}
}
});
//***************************************************************************************
}
}
| [
"noreply@github.com"
] | noreply@github.com |
fff192cebb01f01ce2361b352c9bf955eb2efe5a | 394d272afc49961c74a496e3bf3378cd563e6df8 | /sources/com/google/android/gms/internal/zzfh.java | 29c1169572f8bd833f0266528d1b5767664312c4 | [] | no_license | agarwalamogh/lpu_marks_calculator | 00540d8933191af176532a442f05bba5e0560c7a | d1257bb17eebac517e9f04172e3bbf6c920b27cb | refs/heads/master | 2020-11-24T06:18:01.856783 | 2020-01-10T06:20:34 | 2020-01-10T06:20:34 | 228,004,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,053 | java | package com.google.android.gms.internal;
import android.content.Context;
import android.os.RemoteException;
import com.google.android.gms.ads.reward.RewardedVideoAd;
import com.google.android.gms.common.internal.zzac;
import com.google.android.gms.dynamic.zzd;
@zzme
public class zzfh {
private static zzfh zzAy;
private static final Object zztX = new Object();
private RewardedVideoAd zzAA;
private zzey zzAz;
private zzfh() {
}
public static zzfh zzfk() {
zzfh zzfh;
synchronized (zztX) {
if (zzAy == null) {
zzAy = new zzfh();
}
zzfh = zzAy;
}
return zzfh;
}
public RewardedVideoAd getRewardedVideoAdInstance(Context context) {
RewardedVideoAd rewardedVideoAd;
synchronized (zztX) {
if (this.zzAA != null) {
rewardedVideoAd = this.zzAA;
} else {
this.zzAA = new zzoc(context, zzel.zzeU().zza(context, (zzka) new zzjz()));
rewardedVideoAd = this.zzAA;
}
}
return rewardedVideoAd;
}
public void openDebugMenu(Context context, String str) {
zzac.zza(this.zzAz != null, (Object) "MobileAds.initialize() must be called prior to opening debug menu.");
try {
this.zzAz.zzb(zzd.zzA(context), str);
} catch (RemoteException e) {
zzqf.zzb("Unable to open debug menu.", e);
}
}
public void setAppMuted(boolean z) {
zzac.zza(this.zzAz != null, (Object) "MobileAds.initialize() must be called prior to setting the app volume.");
try {
this.zzAz.setAppMuted(z);
} catch (RemoteException e) {
zzqf.zzb("Unable to set app mute state.", e);
}
}
public void setAppVolume(float f) {
boolean z = true;
zzac.zzb(0.0f <= f && f <= 1.0f, (Object) "The app volume must be a value between 0 and 1 inclusive.");
if (this.zzAz == null) {
z = false;
}
zzac.zza(z, (Object) "MobileAds.initialize() must be called prior to setting the app volume.");
try {
this.zzAz.setAppVolume(f);
} catch (RemoteException e) {
zzqf.zzb("Unable to set app volume.", e);
}
}
/* JADX WARNING: No exception handlers in catch block: Catch:{ } */
/* Code decompiled incorrectly, please refer to instructions dump. */
public void zza(final android.content.Context r4, java.lang.String r5, com.google.android.gms.internal.zzfi r6) {
/*
r3 = this;
java.lang.Object r1 = zztX
monitor-enter(r1)
com.google.android.gms.internal.zzey r0 = r3.zzAz // Catch:{ all -> 0x0013 }
if (r0 == 0) goto L_0x0009
monitor-exit(r1) // Catch:{ all -> 0x0013 }
L_0x0008:
return
L_0x0009:
if (r4 != 0) goto L_0x0016
java.lang.IllegalArgumentException r0 = new java.lang.IllegalArgumentException // Catch:{ all -> 0x0013 }
java.lang.String r2 = "Context cannot be null."
r0.<init>(r2) // Catch:{ all -> 0x0013 }
throw r0 // Catch:{ all -> 0x0013 }
L_0x0013:
r0 = move-exception
monitor-exit(r1) // Catch:{ all -> 0x0013 }
throw r0
L_0x0016:
com.google.android.gms.internal.zzek r0 = com.google.android.gms.internal.zzel.zzeU() // Catch:{ RemoteException -> 0x0037 }
com.google.android.gms.internal.zzey r0 = r0.zzl(r4) // Catch:{ RemoteException -> 0x0037 }
r3.zzAz = r0 // Catch:{ RemoteException -> 0x0037 }
com.google.android.gms.internal.zzey r0 = r3.zzAz // Catch:{ RemoteException -> 0x0037 }
r0.initialize() // Catch:{ RemoteException -> 0x0037 }
if (r5 == 0) goto L_0x0035
com.google.android.gms.internal.zzey r0 = r3.zzAz // Catch:{ RemoteException -> 0x0037 }
com.google.android.gms.internal.zzfh$1 r2 = new com.google.android.gms.internal.zzfh$1 // Catch:{ RemoteException -> 0x0037 }
r2.<init>(r4) // Catch:{ RemoteException -> 0x0037 }
com.google.android.gms.dynamic.IObjectWrapper r2 = com.google.android.gms.dynamic.zzd.zzA(r2) // Catch:{ RemoteException -> 0x0037 }
r0.zzc(r5, r2) // Catch:{ RemoteException -> 0x0037 }
L_0x0035:
monitor-exit(r1) // Catch:{ all -> 0x0013 }
goto L_0x0008
L_0x0037:
r0 = move-exception
java.lang.String r2 = "MobileAdsSettingManager initialization failed"
com.google.android.gms.internal.zzqf.zzc(r2, r0) // Catch:{ all -> 0x0013 }
goto L_0x0035
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.zzfh.zza(android.content.Context, java.lang.String, com.google.android.gms.internal.zzfi):void");
}
}
| [
"41386116+agarwalamogh@users.noreply.github.com"
] | 41386116+agarwalamogh@users.noreply.github.com |
eca73befa3682963c2930fb2b59844f116b9f7ed | 687bec9bcca7728cdac72403910815e040a39a5d | /src/main/java/Controllers/inspectApplicationsController.java | 3dad521644f271fe864bc97b4cdf854386ca8fa2 | [] | no_license | CJUnderhill/CS3733TeamF | eacbc88f322ee13ba2482bf9e21755c36071e2de | 97a5c7636788f6b752de7df68b261dd6d3e645f0 | refs/heads/master | 2021-01-20T07:08:26.330206 | 2017-05-01T05:32:31 | 2017-05-01T05:32:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,160 | java | package Controllers;
import DBManager.DBManager;
import DatabaseSearch.SuperAgentAppRecord;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Text;
import Form.Form;
import java.io.File;
import java.util.ArrayList;
/**
* Created by DanielKim on 4/27/2017.
*/
public class inspectApplicationsController extends UIController {
@FXML
private Text ttbid;
@FXML
private TextField repID, permitNo, serialNo, brandName, fancifulName, alcoholContent,
formula, vintageYear, phLevel, grapeVarietals, wineAppellation, otherStreet,
otherCity, otherState, otherZip, otherCountry, applicantStreet, applicantCity,
applicantState, applicantZip, applicantCountry, phoneNo, signature, email;
@FXML
public Label vintageYearLabel, phLevelLabel, grapeVarietalsLabel, wineAppellationLabel,
otherCityLabel, otherStateLabel, otherZipcodeLabel, otherCountryLabel, otherStreetLabel;;
@FXML
public ComboBox source_combobox, alcohol_type_combobox;
@FXML
private TextArea extraLabelInfo;
@FXML
private Rectangle wineRec;
@FXML
private ImageView label_image;
@FXML
private CheckBox sameAsApplicantBox;
// CheckBoxes and TextFields for the Type of Application
@FXML
public CheckBox option_1_checkbox;
public CheckBox option_2_checkbox;
public TextField option_2_text; //For sale in <state> only
public CheckBox option_3_checkbox;
public TextField option_3_text; //Bottle capacity before closure
public CheckBox option_4_checkbox;
public TextField option_4_text;
private String agentName, applicantName;
private DBManager dbManager = new DBManager();
private Form form = new Form();
void setData(SuperAgentAppRecord superAgentAppRecord) {
Form form = dbManager.findSingleForm(superAgentAppRecord.getTtbID(), new ArrayList<>());
this.form = form;
this.agentName = superAgentAppRecord.getAgentName();
this.applicantName = superAgentAppRecord.getApplicantName();
System.out.println("Form: " + form.getttb_id());
setForm(form);
}
private void setForm(Form form) {
this.ttbid.setText(form.getttb_id());
if(form.getrep_id() != null) {this.repID.setText(form.getrep_id());}
System.out.println("PNo: " + form.getpermit_no());
this.permitNo.setText(form.getpermit_no());
this.serialNo.setText(form.getserial_no());
this.brandName.setText(form.getbrand_name());
if(form.getfanciful_name() != null) {this.fancifulName.setText(form.getfanciful_name());}
if(form.getalcohol_content() > 0) {this.alcoholContent.setText(Double.toString(form.getalcohol_content()));}
if(form.getformula() != null) {this.formula.setText(form.getFormula());}
this.source_combobox.setValue(form.getSource());
this.alcohol_type_combobox.setValue(form.getalcohol_type());
if(form.getalcohol_type().equals("Wine")) {
this.vintageYear.setText(form.getvintage_year());
this.phLevel.setText(Integer.toString(form.getpH_level()));
this.grapeVarietals.setText(form.getgrape_varietals());
this.wineAppellation.setText(form.getwine_appellation());
this.wineRec.setVisible(true);
grapeVarietals.setVisible(true);
grapeVarietalsLabel.setVisible(true);
wineAppellation.setVisible(true);
wineAppellationLabel.setVisible(true);
phLevel.setVisible(true);
phLevelLabel.setVisible(true);
vintageYear.setVisible(true);
vintageYearLabel.setVisible(true);
}
if(form.getphone_no() != null) {this.phoneNo.setText(form.getphone_no());}
this.email.setText(form.getEmail());
this.signature.setText(form.getSignature());
if(form.getlabel_text() != null) {this.extraLabelInfo.setText(form.getlabel_text());}
//TODO: this doesn't work
if(form.getlabel_image() != null && !form.getlabel_image().isEmpty()) {
File file = new File(System.getProperty("user.dir") + "/src/mainData/resources/Controllers/images/" + form.getlabel_image());
try {
this.label_image.setImage(new Image(file.toURI().toURL().toString()));
} catch (Exception e) {
e.printStackTrace();
System.out.println("Could not find image");
}
}
if(form.getapplication_type() != null && !form.getapplication_type().isEmpty()) {
System.out.println(form.getapplication_type());
if(form.getapplication_type().get(0)) {
this.option_1_checkbox.setSelected(true);
}
if(form.getapplication_type().get(1)) {
this.option_2_checkbox.setSelected(true);
this.option_2_text.setText(form.getapplication_type_text().get(0));
}
if(form.getapplication_type().get(2)) {
this.option_3_checkbox.setSelected(true);
this.option_3_text.setText(form.getapplication_type_text().get(1));
}
if(form.getapplication_type().get(3)) {
this.option_4_checkbox.setSelected(true);
this.option_4_text.setText(form.getapplication_type_text().get(2));
}
}
if(form.getapplicant_street() != null) {this.applicantStreet.setText(form.getapplicant_street());}
this.applicantCity.setText(form.getapplicant_city());
this.applicantState.setText(form.getapplicant_state());
this.applicantZip.setText(form.getapplicant_zip());
this.applicantCountry.setText(form.getapplicant_country());
if(form.getmailing_address() != null && !form.getmailing_address().isEmpty()) {
System.out.println("Mail:[" + form.getmailing_address() + "]");
this.sameAsApplicantBox.setSelected(false);
String[] splitAddress1 = form.getmailing_address().split("\n");
if(splitAddress1.length == 3) {
this.otherStreet.setText(splitAddress1[0]);
this.otherCountry.setText(splitAddress1[2]);
}
String[] splitAddress2 = splitAddress1[1].split(",");
if(splitAddress1.length == 3) {
this.otherCity.setText(splitAddress2[0]);
this.otherState.setText(splitAddress2[1]);
this.otherZip.setText(splitAddress2[2]);
}
otherStateLabel.setVisible(true);
otherStreetLabel.setVisible(true);
otherZipcodeLabel.setVisible(true);
otherCityLabel.setVisible(true);
otherCountryLabel.setVisible(true);
otherZip.setVisible(true);
otherState.setVisible(true);
otherStreet.setVisible(true);
otherCity.setVisible(true);
otherCountry.setVisible(true);
} else {
this.sameAsApplicantBox.setSelected(true);
}
}
}
| [
"daniel.jaewoo.kim@gmail.com"
] | daniel.jaewoo.kim@gmail.com |
d79ab94c48463c3ce9c612ff76a3507e3dfafe17 | 248e38d7c02dc8a24d1eb90081215064a6a21805 | /Leetcode/LC/src/com/leetcode/_706.java | 1a9568864122c6cc6e081e11bb839ba9b0250c62 | [] | no_license | akshayawadkar/Code2020 | 363338d2f9dc1d34c271df5af4533183c5fe5746 | 551e46466527e13616ea45204b6bf612c79b6cf1 | refs/heads/master | 2023-01-14T05:34:29.783522 | 2020-11-17T02:56:19 | 2020-11-17T02:56:19 | 304,162,018 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,314 | java | package com.leetcode;
public class _706 {
class Node{
int key;
int val;
Node next;
public Node(int key, int val){
this.key = key;
this.val = val;
this.next = null;
}
}
class MyHashMap {
Node[] nodes;
/** Initialize your data structure here. */
public MyHashMap() {
nodes = new Node[1000];
}
/** value will always be non-negative. */
public void put(int key, int value) {
int idx = getIdx(key);
if(nodes[idx] == null){
nodes[idx] = new Node(-1, -1);
}
Node prev = getPrev(nodes[idx], key);
if(prev.next == null){
prev.next = new Node(key, value);
}else{
prev.next.val = value;
}
}
/** Returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key */
public int get(int key) {
int idx = getIdx(key);
if(nodes[idx] == null){
return -1;
}
Node prev = getPrev(nodes[idx], key);
if(prev.next == null){
return -1;
}else{
return prev.next.val;
}
}
/** Removes the mapping of the specified value key if this map contains a mapping for the key */
public void remove(int key) {
int idx = getIdx(key);
if(nodes[idx] == null){
return;
}
Node prev = getPrev(nodes[idx], key);
if(prev.next == null){
return;
}
prev.next = prev.next.next;
}
private Node getPrev(Node curr, int key){
Node prev = null;
while(curr != null && curr.key != key){
prev = curr;
curr = curr.next;
}
return prev;
}
private int getIdx(int key){
return Integer.hashCode(key) % nodes.length;
}
}
/**
* Your MyHashMap object will be instantiated and called as such:
* MyHashMap obj = new MyHashMap();
* obj.put(key,value);
* int param_2 = obj.get(key);
* obj.remove(key);
*/
}
| [
"mailaw3515@gmail.com"
] | mailaw3515@gmail.com |
06474eb9d6ad2afef393a480d7d774655f6ce345 | 09ea38347d5fe707f034cba435c831659a58fe15 | /src/main/java/ru/itpark/implementation/service/AutoService.java | d5b9a7e78d0f859c67b9553f5ec476d8d3a20e59 | [] | no_license | rufattabaev/dependency-injection | af33748a1e367fcdc6f1310145c84c02a07d281f | b1170a79f007221a36c3f6a6ecc179cc56a132c0 | refs/heads/master | 2023-05-25T15:03:50.774347 | 2019-11-27T19:58:18 | 2019-11-27T19:58:18 | 223,571,886 | 0 | 0 | null | 2023-05-23T20:11:45 | 2019-11-23T10:38:17 | Java | UTF-8 | Java | false | false | 558 | java | package ru.itpark.implementation.service;
import ru.itpark.framework.annotation.Component;
import ru.itpark.implementation.domain.Auto;
import ru.itpark.implementation.repository.AutoRepositoryImpl;
import java.util.ArrayList;
import java.util.List;
@Component
public class AutoService {
private AutoRepositoryImpl repository;
public AutoService(AutoRepositoryImpl repository) {
}
public List<Auto> doSearch(String name) {
return repository.getByName(name);
}
public List<Auto> getAll() {
return repository.getAll();
}
}
| [
"rufattabaev@gmail.com"
] | rufattabaev@gmail.com |
53c4be881b9eaeed398cda671f5fa0ef2e0a742b | c70bdd16a9346bec8991880245b5c6fdfd4f2285 | /src/main/java/web/Servlet.java | 4eaeb66d1e4fd24f9d53979411a54cbbdcdc8687 | [] | no_license | joseluis998/PrimerJavaWebServlet | 4c43f381221db2017d1640d086526f2e8f60eb21 | c1db9f725640c06a42c365423e0f9c57d3d7acb5 | refs/heads/main | 2023-01-03T15:39:14.314334 | 2020-10-08T18:03:59 | 2020-10-08T18:03:59 | 302,422,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,900 | java | package web;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
@WebServlet("/Servlet")
public class Servlet extends HttpServlet{
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException{
response.setContentType("text/html; charset=UTF-8");
PrintWriter salida = response.getWriter();
//Guardamos en variable usuario lo que pongan en la caja de texto usuario del HTML
String usuario = request.getParameter("usuario");
//Guardamos en variable password lo que pongan en la caja de texto usuario del HTML
String password = request.getParameter("password");
//Es un arreglo pues pueden ser varias tecnologiasa la vez
//Usamos el metodo getParameterValues ya que puede regresar varios valores
String tecnologias[] = request.getParameterValues("tecnologia");
//Recuperamos el valor de Genero
String genero = request.getParameter("genero");
//Para obtener el valor de la ocupacion
String ocupacion = request.getParameter("ocupacion");
//Arreglo para varios valores musicales
String musica[] = request.getParameterValues("musica");
//Obtenemos el valor de los comentarios
String comentarios = request.getParameter("comentarios");
/*Presentamos los valores recogidos que fueron enviados desde el front*/
salida.print("<html>");
salida.print("<head>");
salida.print("<title>Resultado Servlet</title>");
salida.print("</head>");
salida.print("<body>");
salida.print("<h1>Parametros Procesados por el Servlet:</h1>");
salida.print("<table border='1'>");
//Primer variable presentada
salida.print("<tr>");
salida.print("<td>");
salida.print("Usuario:");
salida.print("</td>");
salida.print("<td>");
salida.print(usuario);
salida.print("</td>");
salida.print("</tr>");
//Segunda variable presentada
salida.print("<tr>");
salida.print("<td>");
salida.print("Password:");
salida.print("</td>");
salida.print("<td>");
salida.print(password);
salida.print("</td>");
salida.print("</tr>");
//Impresion de Tecnologias usando foreach
salida.print("<tr>");
salida.print("<td>");
salida.print("Tecnologia:");
salida.print("</td>");
salida.print("<td>");
for(String tecnologia: tecnologias){
salida.print(tecnologia);
salida.print(" / ");
}
salida.print("</td>");
salida.print("</tr>");
//Impresion de Genero
salida.print("<tr>");
salida.print("<td>");
salida.print("Genero:");
salida.print("</td>");
salida.print("<td>");
salida.print(genero);
salida.print("</td>");
salida.print("</tr>");
//Impresion de Ocupacion
salida.print("<tr>");
salida.print("<td>");
salida.print("Ocupacion:");
salida.print("</td>");
salida.print("<td>");
salida.print(ocupacion);
salida.print("</td>");
salida.print("</tr>");
//Impresion de Musica usando foreach
//Es necesario validar esta parte ya que no era obligatoria en el formulario
//por lo tanto el usuario puede o no poner este dato
//Si esto no se valida y el user no manda dato nos lleva a un error
salida.print("<tr>");
salida.print("<td>");
salida.print("Musica Favorita:");
salida.print("</td>");
salida.print("<td>");
//Si musica es diferente de null que no se presente nada
if(musica != null){
for(String gustoMusical: musica){
salida.print(gustoMusical);
salida.print(" / ");
}
}else{
salida.print("Musica Favorita No Seleccionada");
}
salida.print("</td>");
salida.print("</tr>");
//Impresion de Comentarios
salida.print("<tr>");
salida.print("<td>");
salida.print("Comentarios:");
salida.print("</td>");
salida.print("<td>");
salida.print(comentarios);
salida.print("</td>");
salida.print("</tr>");
salida.print("</table>");
salida.print("</body>");
salida.print("</html>");
}
} | [
"jlr_99@live.com"
] | jlr_99@live.com |
4495806bb410d4c38a1b0ce6242bff3dfde4adcb | 159ea73e02e7f80ca29406859e033884a71bc6dc | /src/main/java/com/fbr/domain/Attribute/Attribute.java | 078c7cda6b81a80291f89357e2ceafae3404c353 | [] | no_license | kcherivirala/Rest-Sample | bf71172e9d010659cc50410649178190f3017627 | 1152943dcf17fa84a41cd2e8688aa14351a1d602 | refs/heads/master | 2021-01-21T19:20:29.646737 | 2014-08-25T13:19:26 | 2014-08-25T13:19:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,107 | java | package com.fbr.domain.Attribute;
/*
* ***********************************************************
* Copyright (c) 2013 VMware, Inc. All rights reserved.
* ***********************************************************
*/
import java.util.List;
public class Attribute {
int attributeId;
String attributeString;
String type;
List<AttributeValue> attributeValues;
public int getAttributeId() {
return attributeId;
}
public void setAttributeId(int attributeId) {
this.attributeId = attributeId;
}
public String getAttributeString() {
return attributeString;
}
public void setAttributeString(String attributeString) {
this.attributeString = attributeString;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<AttributeValue> getAttributeValues() {
return attributeValues;
}
public void setAttributeValues(List<AttributeValue> attributeValues) {
this.attributeValues = attributeValues;
}
}
| [
"p.sudheer21@gmail.com"
] | p.sudheer21@gmail.com |
f1c21788954290df7b0488919e3125fd369a03b9 | 16ab8a2a6423a627f6608afb66c95c5f1cc03380 | /oop/src/ArrayHarmonik.java | 070205c23b938d75b6f56475bdff70a3c76754c5 | [] | no_license | esra-polat/training | 3c2a3daee6459cf198f15f26f253fad9e84bf160 | 9f64fb0dba30ac38cdfe4ddb32ba11cb7cdbd973 | refs/heads/main | 2023-08-28T08:16:55.730224 | 2021-11-01T13:44:53 | 2021-11-01T13:44:53 | 409,652,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | public class ArrayHarmonik {
public static void main(String[] args) {
double [] numbers = {1, 2, 3, 4, 5};
double harm = 0;
for (int i = 0; i < numbers.length; i++) {
harm += 1 / numbers[i] ;
}
System.out.println(numbers.length / harm);
}
}
| [
"esrapolat1293@gmail.com"
] | esrapolat1293@gmail.com |
ace1a00ad0adbcef273538a5d21ad147c0746cb8 | 0e2318141d227927bea1b31a206c40227f0097c3 | /arithematic_operations/src/arithematic_operations/myClass.java | ed911abd5b10156855c8bd4a340cbbdb3bb0f9ae | [] | no_license | KuKapoor02/Java-Demo-projects_1 | ed060f652a686909d0337174d25f59d7674748b3 | b5c575f61cb8f576a54cf6355005e6a0debf1a8f | refs/heads/master | 2020-03-23T01:10:21.900715 | 2018-07-14T00:57:42 | 2018-07-14T00:57:42 | 140,904,417 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | package arithematic_operations;
// Downloaded from https://github.com/KuKapoor02
// Visit https://www.ourcoaching.com/
public class myClass {
public static void main(String[] args) {
int alpha = 1 + 1;
int beta = alpha * 3;
int gamma = beta / 4;
int oscar = gamma - alpha;
int charlie = -oscar;
System.out.println("alpha = " + alpha);
System.out.println("beta = " + beta);
System.out.println("gamma = " + gamma);
System.out.println("oscar = " + oscar);
System.out.println("charlie = " + charlie);
// using doubles
System.out.println("\n"+"double data types");
double double_a = 1 + 1;
double double_b = double_a * 3;
double double_c = double_b / 4;
double double_d = double_c - alpha;
double double_e = -double_d;
System.out.println("double_a = " + double_a);
System.out.println("double_b = " + double_b);
System.out.println("double_c = " + double_c);
System.out.println("double_d = " + double_d);
System.out.println("double_e = " + double_e);
}
}
| [
"you@example.com"
] | you@example.com |
9780e5bf7452dc66ae838a5a65e0f2f56175f4eb | 367c36a1f755584fb24b675641abbe67ea9bf7d3 | /build/app/generated/not_namespaced_r_class_sources/debug/r/androidx/swiperefreshlayout/R.java | 5bdcc31c57ee6c5f2618965c4d4ec816beb67c61 | [] | no_license | posakya/corona-report-app | b0ad9a3e7dc9fb1b1c316874a8d9a56f1b9bcbd2 | 4b97b4ac3d41ba018024be606c9e202f997c3c07 | refs/heads/master | 2021-05-17T12:29:36.194136 | 2020-03-28T11:23:17 | 2020-03-28T11:23:17 | 250,776,301 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,458 | 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.swiperefreshlayout;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f010000;
public static final int font = 0x7f010002;
public static final int fontProviderAuthority = 0x7f010003;
public static final int fontProviderCerts = 0x7f010004;
public static final int fontProviderFetchStrategy = 0x7f010005;
public static final int fontProviderFetchTimeout = 0x7f010006;
public static final int fontProviderPackage = 0x7f010007;
public static final int fontProviderQuery = 0x7f010008;
public static final int fontStyle = 0x7f010009;
public static final int fontVariationSettings = 0x7f01000a;
public static final int fontWeight = 0x7f01000b;
public static final int ttcIndex = 0x7f010014;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f020001;
public static final int notification_icon_bg_color = 0x7f020002;
public static final int ripple_material_light = 0x7f020003;
public static final int secondary_text_default_material_light = 0x7f020004;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f030000;
public static final int compat_button_inset_vertical_material = 0x7f030001;
public static final int compat_button_padding_horizontal_material = 0x7f030002;
public static final int compat_button_padding_vertical_material = 0x7f030003;
public static final int compat_control_corner_material = 0x7f030004;
public static final int compat_notification_large_icon_max_height = 0x7f030005;
public static final int compat_notification_large_icon_max_width = 0x7f030006;
public static final int notification_action_icon_size = 0x7f030007;
public static final int notification_action_text_size = 0x7f030008;
public static final int notification_big_circle_margin = 0x7f030009;
public static final int notification_content_margin_start = 0x7f03000a;
public static final int notification_large_icon_height = 0x7f03000b;
public static final int notification_large_icon_width = 0x7f03000c;
public static final int notification_main_column_padding_top = 0x7f03000d;
public static final int notification_media_narrow_margin = 0x7f03000e;
public static final int notification_right_icon_size = 0x7f03000f;
public static final int notification_right_side_padding_top = 0x7f030010;
public static final int notification_small_icon_background_padding = 0x7f030011;
public static final int notification_small_icon_size_as_large = 0x7f030012;
public static final int notification_subtext_size = 0x7f030013;
public static final int notification_top_pad = 0x7f030014;
public static final int notification_top_pad_large_text = 0x7f030015;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f040001;
public static final int notification_bg = 0x7f040002;
public static final int notification_bg_low = 0x7f040003;
public static final int notification_bg_low_normal = 0x7f040004;
public static final int notification_bg_low_pressed = 0x7f040005;
public static final int notification_bg_normal = 0x7f040006;
public static final int notification_bg_normal_pressed = 0x7f040007;
public static final int notification_icon_background = 0x7f040008;
public static final int notification_template_icon_bg = 0x7f040009;
public static final int notification_template_icon_low_bg = 0x7f04000a;
public static final int notification_tile_bg = 0x7f04000b;
public static final int notify_panel_notification_icon_bg = 0x7f04000c;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f050000;
public static final int action_divider = 0x7f050001;
public static final int action_image = 0x7f050002;
public static final int action_text = 0x7f050003;
public static final int actions = 0x7f050004;
public static final int async = 0x7f050006;
public static final int blocking = 0x7f050007;
public static final int chronometer = 0x7f05000c;
public static final int forever = 0x7f050013;
public static final int icon = 0x7f050014;
public static final int icon_group = 0x7f050015;
public static final int info = 0x7f050016;
public static final int italic = 0x7f050017;
public static final int line1 = 0x7f050019;
public static final int line3 = 0x7f05001a;
public static final int normal = 0x7f05001c;
public static final int notification_background = 0x7f05001d;
public static final int notification_main_column = 0x7f05001e;
public static final int notification_main_column_container = 0x7f05001f;
public static final int right_icon = 0x7f050021;
public static final int right_side = 0x7f050022;
public static final int tag_transition_group = 0x7f050024;
public static final int tag_unhandled_key_event_manager = 0x7f050025;
public static final int tag_unhandled_key_listeners = 0x7f050026;
public static final int text = 0x7f050027;
public static final int text2 = 0x7f050028;
public static final int time = 0x7f050029;
public static final int title = 0x7f05002a;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f060000;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f070000;
public static final int notification_action_tombstone = 0x7f070001;
public static final int notification_template_custom_big = 0x7f070002;
public static final int notification_template_icon_group = 0x7f070003;
public static final int notification_template_part_chronometer = 0x7f070004;
public static final int notification_template_part_time = 0x7f070005;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f090000;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0a0002;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0a0003;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0a0004;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0a0005;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0a0006;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0a0007;
public static final int Widget_Compat_NotificationActionText = 0x7f0a0008;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f010000 };
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[] FontFamily = { 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008 };
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, 0x7f010002, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f010014 };
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;
}
}
| [
"roshanposakya07@gmail.com"
] | roshanposakya07@gmail.com |
194cc8283c90fca677ab4d39e9c47ae7b7d77040 | 83d3e65ebebf455c9d807d8a3f0c03850faf22cd | /Core/src/space/snowman/cbp/server/util/localInfo.java | 8233d7bcd16c3dc76a92ffce405c570d0ddf94fc | [
"Apache-2.0"
] | permissive | Habsucht/java_cbp | bb0bccd83258fd9ac9776d5449dc48a336818e01 | c62ba11341ed97f435f9ffc58e89b518829cb8eb | refs/heads/master | 2021-01-13T16:32:00.936336 | 2017-01-18T13:58:13 | 2017-01-18T13:58:13 | 76,338,284 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package space.snowman.cbp.server.util;
import java.io.IOException;
import java.net.InetAddress;
public class localInfo {
String IP;
String hostName;
public localInfo() {
try {
InetAddress hostAddress = InetAddress.getLocalHost();
this.IP = hostAddress.getHostAddress();
this.hostName = hostAddress.getHostName();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
143d14e824017ab1b3717d7a00f72a0c48a32876 | 61811e5806b7a72f73384d8b0285da45dc77a695 | /release/2016-033/044/java/src/main/java/com/moilion/circle/r044/interceptor/cdn/CdnFunction.java | 479b9001d078ae3fe8f9cdbf2f8755dc18aaa8ba | [] | no_license | moilioncircle/moilioncircle.product | 2ecba390e750ab3adb31be3f13a37f6f971acd9e | 3503d5758cd1280aa63df30ce4c376afcf341b9c | refs/heads/master | 2020-05-18T22:12:48.548198 | 2017-11-26T06:17:00 | 2017-11-26T06:17:00 | 20,645,595 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 618 | java | package com.moilion.circle.r044.interceptor.cdn;
import com.moilion.circle.r044.util.Ipv4Range;
/**
* @author trydofor
* @since 2016-10-24
*/
public class CdnFunction {
private final CdnConfig config;
private final String ip;
public CdnFunction(CdnConfig config, String ip) {
this.config = config;
this.ip = ip;
}
public String getIp() {
return ip;
}
public String url(String uri) {
if (config.getChina().contains(ip) || Ipv4Range.isChina(ip)) {
return config.getHost() + uri + config.getVersion();
}
return uri;
}
}
| [
"trydofor@gmail.com"
] | trydofor@gmail.com |
5cfbd30b9be25cf1a6d8f9f8891b86d9afba8a46 | 532d22f9cd20ca2d9dfebc9c4c51b0ffe7902c5e | /AdX/src/main/java/edu/umich/eecs/tac/viewer/role/publisher/RankingRenderer.java | fef5c5b99e1b5718deed87fbc795bc0d8a180dc0 | [] | no_license | tomergreenwald/tac-adx | e9884f32d3d3dbc9452d2d5b33664a16091000fb | de6bafb67d35ef20f85e4ed431e486c0f8e8d131 | refs/heads/master | 2020-12-24T06:50:01.388563 | 2016-11-11T10:21:10 | 2016-11-11T10:21:10 | 32,334,996 | 8 | 8 | null | null | null | null | UTF-8 | Java | false | false | 3,378 | java | /*
* RankingRenderer.java
*
* COPYRIGHT 2008
* THE REGENTS OF THE UNIVERSITY OF MICHIGAN
* ALL RIGHTS RESERVED
*
* PERMISSION IS GRANTED TO USE, COPY, CREATE DERIVATIVE WORKS AND REDISTRIBUTE THIS
* SOFTWARE AND SUCH DERIVATIVE WORKS FOR NONCOMMERCIAL EDUCATION AND RESEARCH
* PURPOSES, SO LONG AS NO FEE IS CHARGED, AND SO LONG AS THE COPYRIGHT NOTICE
* ABOVE, THIS GRANT OF PERMISSION, AND THE DISCLAIMER BELOW APPEAR IN ALL COPIES
* MADE; AND SO LONG AS THE NAME OF THE UNIVERSITY OF MICHIGAN IS NOT USED IN ANY
* ADVERTISING OR PUBLICITY PERTAINING TO THE USE OR DISTRIBUTION OF THIS SOFTWARE
* WITHOUT SPECIFIC, WRITTEN PRIOR AUTHORIZATION.
*
* THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION FROM THE UNIVERSITY OF
* MICHIGAN AS TO ITS FITNESS FOR ANY PURPOSE, AND WITHOUT WARRANTY BY THE
* UNIVERSITY OF MICHIGAN OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
* LIMITATION THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE. THE REGENTS OF THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE FOR ANY
* DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WITH
* RESPECT TO ANY CLAIM ARISING OUT OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE,
* EVEN IF IT HAS BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
package edu.umich.eecs.tac.viewer.role.publisher;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import java.awt.*;
/**
* @author Guha Balakrishnan
*/
class RankingRenderer extends DefaultTableCellRenderer {
private Color bkgndColor;
private Color fgndColor;
private Font cellFont;
public RankingRenderer(Color bkgnd, Color foregnd) {
super();
bkgndColor = bkgnd;
fgndColor = foregnd;
cellFont = new Font("serif", Font.BOLD, 12);
}
public Component getTableCellRendererComponent
(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
fgndColor = ((RankingPanel.MyTableModel)table.getModel()).getRowFgndColor(row);
bkgndColor = ((RankingPanel.MyTableModel)table.getModel()).getRowBkgndColor(row);
if (value.getClass().equals(Double.class)) {
value = round((Double) value, 3);
}
if(value.getClass() == Boolean.class){
boolean targeted = (Boolean) value;
JCheckBox checkBox = new JCheckBox();
if (targeted) {
checkBox.setSelected(true);
}
checkBox.setForeground(fgndColor);
checkBox.setBackground(bkgndColor);
checkBox.setHorizontalAlignment((int) JCheckBox.CENTER_ALIGNMENT);
return checkBox;
}
JLabel cell = (JLabel) super.getTableCellRendererComponent(
table, value, isSelected, hasFocus, row, column);
cell.setForeground(fgndColor);
cell.setBackground(bkgndColor);
cell.setFont(cellFont);
cell.setHorizontalAlignment((int) JLabel.CENTER_ALIGNMENT);
return cell;
}
public static double round(double Rval, int Rpl) {
double p = Math.pow(10, Rpl);
Rval = Rval * p;
double tmp = Math.round(Rval);
return tmp / p;
}
}
| [
"tomerg@gmail.com"
] | tomerg@gmail.com |
2ce62ac1f3340681d31bd58312eb4f4c646ccf5f | 81c925a6fe2031bcad3744dfc29a85fa5cf9091c | /classwork_3/src/test/java/ge/edu/btu/classwork_1/Classwork1ApplicationTests.java | 7db4cf27b285c4a5af602cc55cb1f184fa8f560e | [] | no_license | nmgalo/java-ee | a13e80d10bb0b6d683d1974054306234a16255dc | fc1bc7d20edebfd1bc74487006fbc707a783aa21 | refs/heads/main | 2023-06-07T08:16:45.511147 | 2021-07-07T15:52:57 | 2021-07-07T15:52:57 | 349,205,330 | 0 | 0 | null | 2021-06-16T16:41:13 | 2021-03-18T20:14:34 | Java | UTF-8 | Java | false | false | 227 | java | package ge.edu.btu.classwork_1;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class Classwork1ApplicationTests {
@Test
void contextLoads() {
}
}
| [
"nikolozamgalo@gmail.com"
] | nikolozamgalo@gmail.com |
8ef30635f0b23deb8e9a818e6fea808a44d71eef | 2bbf204cd1608c6beac4cebb82cb97611699adc5 | /server/src/main/java/com/shuishou/retailer/account/models/UserPermissionDataAccessor.java | 90392232fd4bd879cb8a6d19b9aa431047bee503 | [] | no_license | lousongtao/retailerpos | a2d991b7925b0687fa020dcad8692ec6070e19ed | d25a0131e6a958b219c32d5e6f2e04a675a2d83a | refs/heads/master | 2022-12-22T13:58:34.237026 | 2021-01-30T07:02:56 | 2021-01-30T07:02:56 | 158,353,458 | 0 | 1 | null | 2022-12-16T03:30:42 | 2018-11-20T08:11:37 | Java | UTF-8 | Java | false | false | 652 | java | package com.shuishou.retailer.account.models;
import java.io.Serializable;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;
import com.shuishou.retailer.models.BaseDataAccessor;
@Repository
public class UserPermissionDataAccessor extends BaseDataAccessor implements IUserPermissionDataAccessor {
@Override
public Serializable save(UserPermission up) {
return sessionFactory.getCurrentSession().save(up);
}
@Override
public void deleteByUserId(long userId) {
String sql = "delete from user_permission where user_id = "+userId;
sessionFactory.getCurrentSession().createSQLQuery(sql).executeUpdate();
}
}
| [
"lousongtao@gmail.com"
] | lousongtao@gmail.com |
ff5f8ba082d5ee54a05f0b66bbe2d92e5f30b6d7 | 2053a1c06dbe38160c4112d77e3c8ed05f96bef6 | /ffff/src/com/hhh/mad.java | e552371930532d82cb618844dee575646ff0883f | [] | no_license | Madhusri13/madhu | 883a7cbd40b8eb4b9741c57ef7a8f1042f43cccc | 9d8d7b247afc25024eaf262a9eea635a69aeea67 | refs/heads/master | 2021-09-02T15:09:13.247527 | 2018-01-03T10:55:41 | 2018-01-03T10:55:41 | 116,125,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package com.hhh;
public class mad {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| [
"670332@PC286526.cts.com"
] | 670332@PC286526.cts.com |
c63a4bc319bfa662adc69eb2daf309182a94b7bf | 879e6ff5bd68c58b66cb3b1249869781a1f290f6 | /src/main/java/org/myongoingscalendar/repository/SyoboiInfoRepository.java | 0aaf2ba83471a78c2975c235e729efce63e8e66b | [] | no_license | Firs058/myongoingscalendar-backend | d39ccb533196e8c2d9dad32b1145f12da42924eb | 2f2af8338c26512a5a8057c881e0a137c00a7ae1 | refs/heads/master | 2023-02-22T20:05:33.123542 | 2023-02-17T14:58:36 | 2023-02-17T14:58:36 | 176,557,411 | 3 | 0 | null | 2022-09-01T23:04:21 | 2019-03-19T16:41:55 | Java | UTF-8 | Java | false | false | 723 | java | package org.myongoingscalendar.repository;
import org.myongoingscalendar.entity.SyoboiInfoEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author firs
*/
@Repository
public interface SyoboiInfoRepository extends JpaRepository<SyoboiInfoEntity, Long> {
@Query("select min(s.firstYear) from SyoboiInfoEntity s where s.firstYear <> 0")
Integer getMinYear();
@Query("select max(s.firstYear) + 2 from SyoboiInfoEntity s where s.firstYear <> 0")
Integer getMaxYear();
List<SyoboiInfoEntity> findAllByFirstEndMonthIsNullAndFirstEndYearIsNull();
}
| [
"firs058@gmail.com"
] | firs058@gmail.com |
fed0ba6acef1957d098fd138bcf836086cb4f3fa | 43b59855f3387ee6bba6527373a4b9efbe91eca4 | /Java(23feb)/src/Sorting.java | 38f145f35f1b566ec83c74335852f064be61468b | [] | no_license | pschizo18/eclipse-workspace | 85c4cdf5ec5cd60c121a86989e5b75fc2d72885b | 05b2ed50ab6eaa739f55101f7169359f0285d3bb | refs/heads/master | 2021-01-24T00:03:40.207416 | 2018-02-25T14:40:42 | 2018-02-25T14:40:42 | 122,749,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java |
public class Sorting {
// selection sort
private void sort(int[] array) {
for (int lh = 0; lh < array.length; lh++) {
int rh = findSmallest(array, lh, array.length);
swapElement(array, lh, rh);
}
}
private void swapElement(int[] array, int lh, int rh) {
int temp = array[lh];
array[lh] = array[rh];
array[rh] = temp;
}
private int findSmallest(int[] array, int lh, int length) {
int smallestIndex = lh;
for (int i = lh + 1; i < length; i++)
if (array[i] < array[smallestIndex])
smallestIndex = i;
return smallestIndex;
}
}
| [
"pschizo18@gmail.com"
] | pschizo18@gmail.com |
41e20b8f6a10eeb67de04690ad8227a609045870 | db510d9a21272f0c9a84e6c145cf10914890bf1d | /Problem Set 1102/A - Integer Sequence Dividing.java | 7bba151b54df7d1feec7751ede91699e27e845a9 | [] | no_license | MahmoodRaafat/Codeforces | fcec634efc37947318e93cde85c45b00c6c79d00 | beb473900f34199102e7f0136796ca4c55ecf045 | refs/heads/master | 2020-06-12T21:37:34.730919 | 2019-06-29T03:51:35 | 2019-06-29T03:51:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,339 | java | /*
A - Integer Sequence Dividing
You are given an integer sequence 1,2,…,n. You have to divide it into two sets A and B
in such a way that each element belongs to exactly one set and |sum(A)-sum(B)| is the
minimum possible. The value |x| is the absolute value of x and sum(S) is the sum of
elements of the set S.
Input
The first line of the input contains one integer n (1 <= n <= 2*10^9).
Output
Print one integer — the minimum possible value of |sum(A)-sum(B)| if you divide the
initial sequence 1,2, ...,n into two sets A and B.
--------------------------------------------------------------------------------------*/
import java.util.*;
public class A1102_IntegerSequenceDividing {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.close();
int[] arr = {0, 1, 1, 0};
System.out.println(arr[n%4]);
}
}
/*
* find the result of the minimum difference of sets of every number from 1-50
* (with the code below) and you will see a pattern: 1, 1, 0, 0, 1, 1, 0, 0, ...
* that repeats every 4 numbers
for (int i=1; i<=50; i++) {
int a = i;
int b = 0;
for (int j=i-1; j>=1; j--) {
if (a>b)
b += j;
else
a += j;
}
System.out.println("i: " + i + " = " + Math.abs(b-a));
}
*/
| [
"noreply@github.com"
] | noreply@github.com |
a69a61e1bee2a54ea39dace50935318d0f9febe2 | bff6792080f03b74af1c89943c6837f902805590 | /viikko4/Tennis/src/main/java/ohtu/TennisGame.java | a1cc549903ea951a0583aa5ebdd612413d4694f2 | [] | no_license | Antsax/Ohjelmistotuotanto | a8cba440e48ccd33e4c9c3c93a2653279b6c0cf2 | 7fbde81240fee894b9c32be9a1ee073a753eb109 | refs/heads/master | 2020-09-03T21:40:50.121489 | 2019-12-13T12:39:52 | 2019-12-13T12:39:52 | 219,578,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,737 | java | package ohtu;
import ohtu.Player;
public class TennisGame {
private Player player1;
private Player player2;
public TennisGame(String player1Name, String player2Name) {
this.player1 = new Player(player1Name);
this.player2 = new Player(player2Name);
}
public void wonPoint(String playerName) {
if (player1.getName().equals( playerName ))
player1.addPoint();
else
player2.addPoint();
}
public String call(int points) {
String call;
switch(points) {
case 0:
call = "Love";
break;
case 1:
call = "Fifteen";
break;
case 2:
call = "Thirty";
break;
case 3:
call = "Forty";
break;
default:
call = "Deuce";
break;
}
return call;
}
public String getScore() {
String scorePlayerOne = call(player1.getScore());
String scorePlayerTwo = call(player2.getScore());
if (player1.getScore() >= 4 || player2.getScore() >=4)
{
int minusResult = player1.getScore() - player2.getScore();
if (minusResult==1) return "Advantage player1";
else if (minusResult == 0) return "Deuce";
else if (minusResult ==-1) return "Advantage player2";
else if (minusResult>=2) return "Win for player1";
else return "Win for player2";
}
if (scorePlayerOne.equals(scorePlayerTwo)) {
return scorePlayerOne + "-All";
}
return scorePlayerOne + "-" + scorePlayerTwo;
}
} | [
"antwan.hommy@gmail.com"
] | antwan.hommy@gmail.com |
7fe636dec6c691a82f4dce17fc7844cc0b6492e7 | 8c80997180b2a523ddbe6fae91256b2ce0fe5654 | /src/main/java/com/advertiser/service/dto/HourDTO.java | cfd104ca29cd8c1ba190a0a76c6884d174f3410f | [] | no_license | WSawicka/Advertiser | 42fa8c58860c2ca6721042acbdfa8a288eafb5cb | 60997965ba205b8389d9bca79850b1da43027e7d | refs/heads/master | 2021-01-11T19:34:21.326111 | 2017-01-30T18:03:56 | 2017-01-30T18:03:56 | 71,041,958 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,144 | java | package com.advertiser.service.dto;
import com.advertiser.domain.Campaign;
import com.advertiser.domain.Spot;
import com.advertiser.service.mapper.CampaignMapper;
import com.advertiser.service.mapper.SpotMapper;
import java.io.Serializable;
import java.util.*;
/**
* A DTO for the Hour entity.
*/
public class HourDTO implements Serializable {
private Long id;
private Integer number;
private Long dayId;
private Set<SpotDTO> spots = new HashSet<>();
public HourDTO(){}
public HourDTO(Integer number){
this.number = number;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public Long getDayId() {
return dayId;
}
public void setDayId(Long dayId) {
this.dayId = dayId;
}
public Set<SpotDTO> getSpots() {
return spots;
}
public void setSpots(Set<SpotDTO> spots) {
this.spots = spots;
}
public void setSpotsDTO(Set<Spot> spots, SpotMapper spotMapper, CampaignMapper campaignMapper) {
for(Spot spot : spots){
SpotDTO spotDTO = spotMapper.spotToSpotDTO(spot);
if (campaignMapper != null) {
Campaign campaign = spot.getCampaign();
spotDTO.setCampaignDTO(campaignMapper.campaignToCampaignDTO(campaign));
}
this.spots.add(spotDTO);
}
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
HourDTO hourDTO = (HourDTO) o;
if ( ! Objects.equals(id, hourDTO.id)) return false;
return true;
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
@Override
public String toString() {
return "HourDTO{" +
"id=" + id +
", number='" + number + "'" +
'}';
}
}
| [
"weronika.sawicka.9@gmail.com"
] | weronika.sawicka.9@gmail.com |
45e9cbcaf9c6a1f71b397bb99e2518155ec4c4f1 | 047397061adf81d2674ffa155e5ece03ce4bef7c | /src/main/java/com/FileRead.java | a888a5426b050e97c1d2093d9fb2d09a29647fcd | [] | no_license | zhujianhao/test | 9ff55ecb3ee9475d95c47845aa7e5658a18d1e33 | 1074cb2266b59acc1b3c7df5ccea4ba981622e87 | refs/heads/master | 2022-12-18T20:06:48.923518 | 2021-05-26T07:44:35 | 2021-05-26T07:44:35 | 122,948,647 | 6 | 1 | null | 2022-12-06T00:01:40 | 2018-02-26T09:49:54 | Java | UTF-8 | Java | false | false | 1,435 | java | package com;
import com.utils.ReadFileUtil;
import org.junit.Test;
import java.io.*;
import java.nio.CharBuffer;
import java.util.List;
/***/
public class FileRead {
private static String path = "E:\\zjh\\workspace\\gateway\\frontgateway\\frontgateway-web\\src\\main\\resources\\filters";
@Test
public void getProperTies() throws IOException {
List<String> files = ReadFileUtil.getFiles(path);
File resFile = new File("C:\\Users\\zjh\\Desktop\\工作\\res.properties");
BufferedWriter writer = new BufferedWriter(new FileWriter(resFile));
for(String s :files){
File file = new File(s);
try {
// FileInputStream fileInputStream = new FileInputStream(file);
BufferedReader reader = new BufferedReader(new FileReader(file));
String temp;
String res ="";
while ((temp = reader.readLine()) != null) {
if(temp.contains("restapi/common/scancodepay")){
writer.write(s.substring(s.lastIndexOf("\\")+1)+":\r\n "+temp+"\r\n");
break;
}
}
reader.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
writer.flush();
}
}
| [
"zhujianhao@yuantutech.com"
] | zhujianhao@yuantutech.com |
0ab6be8e2968efc535dbec731ebf72ce6582e6e5 | 4fdce0ff9c9d82ee05817731029ba168e9fffadc | /app/src/main/java/com/traidev/shokanjali/Extras/MyFirebaseMesgServices.java | 439379e76b9199049b34c90be8fbbc922db8b88f | [] | no_license | kanha-d/ShokanjaliApp | f391cdd80c767908d4cca8a5795c9dd822ff87ca | d630bacd0ae13ae9c6c92ee3d5017635960d9a2c | refs/heads/master | 2023-01-10T19:11:46.302437 | 2020-11-09T03:37:36 | 2020-11-09T03:37:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,680 | java | package com.traidev.shokanjali.Extras;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.util.Log;
import androidx.core.app.NotificationCompat;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.traidev.shokanjali.MainActivity;
import com.traidev.shokanjali.R;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Map;
public class MyFirebaseMesgServices extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
if (remoteMessage.getData() != null) {
Map<String, String> params = remoteMessage.getData();
JSONObject object = new JSONObject(params);
try {
String title = object.getString("title");
String text = object.getString("message");
Log.d("stitle",title);
showNotification(title, text);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
void showNotification(String title, String message) {
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel("userShokanjali",
"userShokanjali",
NotificationManager.IMPORTANCE_DEFAULT);
channel.setDescription("Shokanjali Details App");
mNotificationManager.createNotificationChannel(channel);
}
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext(), "userShokanjali")
.setContentTitle(title) // title for notification
.setContentText(message)// message for notification
.setSmallIcon(R.mipmap.ic_launcher)
.setBadgeIconType(NotificationCompat.BADGE_ICON_SMALL)
.setAutoCancel(true); // clear notification after click
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(pi);
mNotificationManager.notify(0, mBuilder.build());
}
}
| [
"k.developer.x@gmail.com"
] | k.developer.x@gmail.com |
465b4e7b243545b7486bc47d031fa2eff41b53e3 | cac945435a9bbf1a103a33d67a3487743a00d616 | /src/main/java/com/springboot/cms/entity/CmsLink.java | d1618f6fa444f84a6346e8da48fe438a293c67ec | [] | no_license | Steelzy/myJavaweb | fb6b12d8096e1c4ad9b2ac220fc3222fae17f8e2 | 111e3025f23e5ee5d89d7f7a5cfc80c9a25af6e9 | refs/heads/master | 2021-07-05T06:11:09.999875 | 2019-02-07T13:00:26 | 2019-02-07T13:00:26 | 166,610,796 | 0 | 0 | null | 2020-09-13T13:12:32 | 2019-01-20T01:17:54 | JavaScript | UTF-8 | Java | false | false | 1,807 | java | package com.springboot.cms.entity;
public class CmsLink {
private Integer linkId;
private String linkName;
private Integer linkShort;
private String linkAddress;
private String linkRemark;
public CmsLink(Integer linkId, String linkName, Integer linkShort, String linkAddress, String linkRemark) {
this.linkId = linkId;
this.linkName = linkName;
this.linkShort = linkShort;
this.linkAddress = linkAddress;
this.linkRemark = linkRemark;
}
public CmsLink() {
super();
}
public Integer getLinkId() {
return linkId;
}
public void setLinkId(Integer linkId) {
this.linkId = linkId;
}
public String getLinkName() {
return linkName;
}
public void setLinkName(String linkName) {
this.linkName = linkName == null ? null : linkName.trim();
}
public Integer getLinkShort() {
return linkShort;
}
public void setLinkShort(Integer linkShort) {
this.linkShort = linkShort;
}
public String getLinkAddress() {
return linkAddress;
}
public void setLinkAddress(String linkAddress) {
this.linkAddress = linkAddress == null ? null : linkAddress.trim();
}
public String getLinkRemark() {
return linkRemark;
}
public void setLinkRemark(String linkRemark) {
this.linkRemark = linkRemark == null ? null : linkRemark.trim();
}
@Override
public String toString() {
return "CmsLink{" +
"linkId=" + linkId +
", linkName='" + linkName + '\'' +
", linkShort=" + linkShort +
", linkAddress='" + linkAddress + '\'' +
", linkRemark='" + linkRemark + '\'' +
'}';
}
} | [
"eng891698682@163.com"
] | eng891698682@163.com |
ade65b90cb28d7ef3e7b124adb79da9602a26839 | a88565f4a8b3e956efd009a29df7b61d584e6b86 | /oop-univpm-2010/src/it/univpm/progogg/StaticNotStatic.java | 067d064f0dde02d31427dad4e938219eb79b027a | [] | no_license | mmazzieri/oop-univpm-2010 | f29ff24525e4c123ce7b6d6464542948a22403ef | 8743b6b8e54519ff66cdf8ebd6abb6220dbe1969 | refs/heads/master | 2016-08-03T07:30:13.984247 | 2010-12-21T08:08:54 | 2010-12-21T08:08:54 | 32,317,800 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | java | package it.univpm.progogg;
public class StaticNotStatic {
private float x;
private float y;
public StaticNotStatic(float x1, float x2) {
x = x1;
y = x2;
}
public void printNotStatic() {
System.out.println(x);
System.out.println(y);
}
public static void printStatic(StaticNotStatic s) {
System.out.println(s.x);
System.out.println(s.y);
}
}
| [
"mauro.mazzieri@gmail.com@b3a1285b-7515-5f4a-784f-be7fbb76384f"
] | mauro.mazzieri@gmail.com@b3a1285b-7515-5f4a-784f-be7fbb76384f |
3e86febd6914446fb75c3e8c625e718234fcd09c | a12bbb523e5d5a0e88f8101b917421034d0842ac | /app/src/main/java/recycle/com/example/nandy/dynamicdemo/App.java | 585990d7e8ccfb618e88286d77176359bbc4ce81 | [] | no_license | 17773737673/Dynamic | 201706152580ed8c63af6c64a33e4fea86f98bb6 | c8467572f51c0cfd02cfe5b0c40b59abc4a4927e | refs/heads/master | 2020-07-29T03:56:17.084062 | 2016-11-26T01:39:48 | 2016-11-26T01:39:48 | 73,684,906 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,315 | java | package recycle.com.example.nandy.dynamicdemo;
import android.app.Application;
import javax.inject.Inject;
import recycle.com.example.nandy.dynamicdemo.di.app.AppComponent;
import recycle.com.example.nandy.dynamicdemo.di.app.AppModule;
import recycle.com.example.nandy.dynamicdemo.di.app.DaggerAppComponent;
import recycle.com.example.nandy.dynamicdemo.navigation.Navigator;
import recycle.com.example.nandy.dynamicdemo.utils.preference.PreferencesHelper;
/**
* Created by nandy on 16/11/10.
*/
public class App extends Application {
private AppComponent appComponent;
@Inject
Navigator navigator;
private static App app;
public long uid;
@Override
public void onCreate() {
super.onCreate();
app = this;
PreferencesHelper.init(this);
initializeInjector();
}
/**
* 初始化dagger
*/
private void initializeInjector() {
appComponent = DaggerAppComponent.builder()
.appModule(new AppModule(this))
.build();
appComponent.inject(this);
}
public AppComponent getApplicationComponent() {
return this.appComponent;
}
public Navigator getNavigator() {
return this.navigator;
}
public static App getInstance() {
return app;
}
}
| [
"407563780@qq.com"
] | 407563780@qq.com |
405ba498c96b89ebe51d244eed6893f4c6ab9ada | 73222f0362e6f86cf8e85fb0aa339e8b4109703b | /src/main/java/com/mypro/StartUp.java | d8275c01b69dc7c174ec4b1ed7dc9ca95feb4682 | [] | no_license | sxyseo/SHM | 38c02aea4e7b04424b6e508cd73a683630c494b1 | 4386ecfba3df8bf0d1e6216e0b886d6534024557 | refs/heads/master | 2021-01-11T01:02:12.423723 | 2015-12-04T11:47:52 | 2015-12-04T11:47:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 541 | java | package com.mypro;
import com.mypro.factory.ControllerFactory;
import com.mypro.factory.DaoFactory;
import com.mypro.factory.DaoImplFactory;
import com.mypro.factory.PojoFactory;
import com.mypro.factory.ServiceFactory;
import com.mypro.factory.ServiceImplFactory;
public class StartUp {
public static void main(String[] args) {
PojoFactory.createPojo();
DaoFactory.createDao();
DaoImplFactory.createDaoImpl();
ServiceFactory.createService();
ServiceImplFactory.createserviceImpl();
ControllerFactory.createController();
}
}
| [
"kexianwen@xinzhongchou.com"
] | kexianwen@xinzhongchou.com |
c7c9fd2019519a850ccd7a722fea31bfc556a337 | 1061bbd79b4dc9a2ab4cf96cae1620eaf3a980f3 | /glib-core/src/main/java/com/glib/core/ui/list/CursorRecyclerAdapter.java | b408437fd03c2d80685f392935ec3a32979eac74 | [
"Apache-2.0"
] | permissive | hgani/glib-android | 8205b5832c70c2e6a33606263df2d3f1ee4be45a | 56748d5392fcda61d6f8ee2ec020cbd1486bd501 | refs/heads/master | 2022-11-25T17:18:18.528708 | 2022-04-10T12:14:51 | 2022-04-10T12:14:51 | 223,511,724 | 0 | 0 | Apache-2.0 | 2022-04-08T11:04:35 | 2019-11-23T01:07:45 | Kotlin | UTF-8 | Java | false | false | 9,185 | java | package com.glib.core.ui.list;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.DataSetObserver;
import android.os.Handler;
import android.widget.Filter;
import android.widget.FilterQueryProvider;
import android.widget.Filterable;
import androidx.recyclerview.widget.RecyclerView;
// See https://gist.github.com/Shywim/127f207e7248fe48400b
/**
* Provide a {@link RecyclerView.Adapter} implementation with cursor
* support.
* <p>
* Child classes only need to implement {@link #onCreateViewHolder(android.view.ViewGroup, int)} and
* {@link #onBindViewHolderCursor(RecyclerView.ViewHolder, Cursor)}.
* <p>
* This class does not implement deprecated fields and methods from CursorAdapter! Incidentally,
* only {@link android.widget.CursorAdapter#FLAG_REGISTER_CONTENT_OBSERVER} is available, so the
* flag is implied, and only the Adapter behavior using this flag has been ported.
*
* @param <VH> {@inheritDoc}
* @see RecyclerView.Adapter
* @see android.widget.CursorAdapter
* @see Filterable
*/
public abstract class CursorRecyclerAdapter<VH
extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH>
implements Filterable, CursorFilter.CursorFilterClient {
private boolean mDataValid;
private int mRowIDColumn;
private Cursor mCursor;
private ChangeObserver mChangeObserver;
private DataSetObserver mDataSetObserver;
private CursorFilter mCursorFilter;
private FilterQueryProvider mFilterQueryProvider;
public CursorRecyclerAdapter(Cursor cursor) {
init(cursor);
}
void init(Cursor c) {
boolean cursorPresent = c != null;
mCursor = c;
mDataValid = cursorPresent;
mRowIDColumn = cursorPresent ? c.getColumnIndexOrThrow("_id") : -1;
mChangeObserver = new ChangeObserver();
mDataSetObserver = new MyDataSetObserver();
if (cursorPresent) {
if (mChangeObserver != null) c.registerContentObserver(mChangeObserver);
if (mDataSetObserver != null) c.registerDataSetObserver(mDataSetObserver);
}
}
/**
* This method will move the Cursor to the correct position and call
* {@link #onBindViewHolderCursor(RecyclerView.ViewHolder,
* Cursor)}.
*
* @param holder {@inheritDoc}
* @param i {@inheritDoc}
*/
@Override
public void onBindViewHolder(VH holder, int i) {
if (!mDataValid) {
throw new IllegalStateException("this should only be called when the cursor is valid");
}
if (!mCursor.moveToPosition(i)) {
throw new IllegalStateException("couldn't move cursor to position " + i);
}
onBindViewHolderCursor(holder, mCursor);
}
/**
* See {@link android.widget.CursorAdapter#bindView(android.view.View, android.content.Context,
* Cursor)},
* {@link #onBindViewHolder(RecyclerView.ViewHolder, int)}
*
* @param holder View holder.
* @param cursor The cursor from which to get the data. The cursor is already
* moved to the correct position.
*/
public abstract void onBindViewHolderCursor(VH holder, Cursor cursor);
@Override
public int getItemCount() {
if (mDataValid && mCursor != null) {
return mCursor.getCount();
} else {
return 0;
}
}
/**
* @see android.widget.ListAdapter#getItemId(int)
*/
@Override
public long getItemId(int position) {
if (mDataValid && mCursor != null) {
if (mCursor.moveToPosition(position)) {
return mCursor.getLong(mRowIDColumn);
} else {
return 0;
}
} else {
return 0;
}
}
public Cursor getCursor() {
return mCursor;
}
/**
* Change the underlying cursor to a new cursor. If there is an existing cursor it will be
* closed.
*
* @param cursor The new cursor to be used
*/
public void changeCursor(Cursor cursor) {
Cursor old = swapCursor(cursor);
if (old != null) {
old.close();
}
}
/**
* Swap in a new Cursor, returning the old Cursor. Unlike
* {@link #changeCursor(Cursor)}, the returned old Cursor is <em>not</em>
* closed.
*
* @param newCursor The new cursor to be used.
* @return Returns the previously put Cursor, or null if there wasa not one.
* If the given new Cursor is the same getInstance is the previously put
* Cursor, null is also returned.
*/
public Cursor swapCursor(Cursor newCursor) {
if (newCursor == mCursor) {
return null;
}
Cursor oldCursor = mCursor;
if (oldCursor != null) {
if (mChangeObserver != null) oldCursor.unregisterContentObserver(mChangeObserver);
if (mDataSetObserver != null) oldCursor.unregisterDataSetObserver(mDataSetObserver);
}
mCursor = newCursor;
if (newCursor != null) {
if (mChangeObserver != null) newCursor.registerContentObserver(mChangeObserver);
if (mDataSetObserver != null) newCursor.registerDataSetObserver(mDataSetObserver);
mRowIDColumn = newCursor.getColumnIndexOrThrow("_id");
mDataValid = true;
// notify the observers about the new cursor
notifyDataSetChanged();
} else {
mRowIDColumn = -1;
mDataValid = false;
// notify the observers about the lack of a data put
// notifyDataSetInvalidated();
notifyItemRangeRemoved(0, getItemCount());
}
return oldCursor;
}
/**
* <p>Converts the cursor into a CharSequence. Subclasses should override this
* method to convert their results. The default implementation returns an
* empty String for null values or the default String representation of
* the value.</p>
*
* @param cursor the cursor to convert to a CharSequence
* @return a CharSequence representing the value
*/
public CharSequence convertToString(Cursor cursor) {
return cursor == null ? "" : cursor.toString();
}
/**
* Runs a query with the specified constraint. This query is requested
* by the filter attached to this adapter.
* <p>
* The query is provided by a
* {@link FilterQueryProvider}.
* If no provider is specified, the createCurrent cursor is not filtered and returned.
* <p>
* After this method returns the resulting cursor is passed to {@link #changeCursor(Cursor)}
* and the previous cursor is closed.
* <p>
* This method is always executed on a background thread, not on the
* application's main thread (or UI thread.)
* <p>
* Contract: when constraint is null or empty, the original results,
* prior to any filtering, must be returned.
*
* @param constraint the constraint with which the query must be filtered
* @return a Cursor representing the results of the new query
* @see #getFilter()
* @see #getFilterQueryProvider()
* @see #setFilterQueryProvider(FilterQueryProvider)
*/
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
if (mFilterQueryProvider != null) {
return mFilterQueryProvider.runQuery(constraint);
}
return mCursor;
}
public Filter getFilter() {
if (mCursorFilter == null) {
mCursorFilter = new CursorFilter(this);
}
return mCursorFilter;
}
/**
* Returns the query filter provider used for filtering. When the
* provider is null, no filtering occurs.
*
* @return the createCurrent filter query provider or null if it does not exist
* @see #setFilterQueryProvider(FilterQueryProvider)
* @see #runQueryOnBackgroundThread(CharSequence)
*/
public FilterQueryProvider getFilterQueryProvider() {
return mFilterQueryProvider;
}
/**
* Sets the query filter provider used to filter the createCurrent Cursor.
* The provider's
* {@link FilterQueryProvider#runQuery(CharSequence)}
* method is invoked when filtering is requested by a client of
* this adapter.
*
* @param filterQueryProvider the filter query provider or null to remove it
* @see #getFilterQueryProvider()
* @see #runQueryOnBackgroundThread(CharSequence)
*/
public void setFilterQueryProvider(FilterQueryProvider filterQueryProvider) {
mFilterQueryProvider = filterQueryProvider;
}
/**
* Called when the {@link ContentObserver} on the cursor receives a change notification.
* Can be implemented by sub-class.
*
* @see ContentObserver#onChange(boolean)
*/
protected void onContentChanged() {
}
private class ChangeObserver extends ContentObserver {
public ChangeObserver() {
super(new Handler());
}
@Override
public boolean deliverSelfNotifications() {
return true;
}
@Override
public void onChange(boolean selfChange) {
onContentChanged();
}
}
private class MyDataSetObserver extends DataSetObserver {
@Override
public void onChanged() {
mDataValid = true;
notifyDataSetChanged();
}
@Override
public void onInvalidated() {
mDataValid = false;
// notifyDataSetInvalidated();
notifyItemRangeRemoved(0, getItemCount());
}
}
/**
* <p>The CursorFilter delegates most of the work to the CursorAdapter.
* Subclasses should override these delegate methods to run the queries
* and convert the results into String that can be used by auto-completion
* widgets.</p>
*/
} | [
"hendrik.gani@gmail.com"
] | hendrik.gani@gmail.com |
257cf190ca282fcba5923c82bd97bd4ebe05d5e3 | 78bed64b95900b4633ff18b2821a4ea127aac20e | /app/src/main/java/com/addtw/aweino1/PicturePage.java | f14c6a6e3f672ad4d7607fe52013d77cb461a19e | [] | no_license | awei1208/AweiNO1 | 23d377bed6742c80fa62f4d523e024273d7f61f2 | 11a1aa65782458fddac2564fc15464fa830f31cb | refs/heads/master | 2016-08-12T02:39:24.889006 | 2016-03-04T05:51:47 | 2016-03-04T05:51:47 | 53,111,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 599 | java | package com.addtw.aweino1;
import android.os.Bundle;
import android.widget.TextView;
/**
* Created by awei on 2016/2/6.
*/
public class PicturePage extends GalleryActivity {
String passvar = null;
private TextView passview = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.picturepage);
passvar = getIntent().getStringExtra(GalleryActivity.ID_EXTRA);
passview = (TextView)findViewById(R.id.picpagID);
passview.setText("你的ID現在是"+passvar);
}
}
| [
"lance1208@gmail.com"
] | lance1208@gmail.com |
28058bc98b4020828b5834a1c05a674391e8e975 | a495d14533dc12ecff50092e28fbb3547541ad10 | /metodos12/Menu.java | e03e3cf80bbf3a0a5aa699bdcd6b24edc135f265 | [] | no_license | ElBruno2442/3iv8-Gonzalez-Vera-Bruno | c3aadadd01c5d6308f5b26959b12bf017d847e83 | 9bb0fee081168f53ec6999d7be1de944a0dfb1a8 | refs/heads/master | 2023-01-14T10:47:44.735127 | 2020-11-16T23:06:27 | 2020-11-16T23:06:27 | 307,476,763 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,556 | java | //González Vera Bruno 3IV8
import java.util.Scanner;
//clase en la que se encuentra el menu
public class Menu{
Scanner entrada = new Scanner(System.in);
//se invocan metodos a partir de la creacion de objetos
Edad obj1 = new Edad();
Figuras obj2 = new Figuras();
Llamadas obj3 = new Llamadas();
//metodo principal
public void menu(){
char op, letra;
do{
System.out.println("Gonzalez Vera Bruno 3IV8");
System.out.println("Elije que deseas hacer:");
System.out.println("A.- Calcular tu edad");
System.out.println("B.- Areas y perimetros");
System.out.println("C.- Llamadas telefonicas");
//menu de opciones
op = entrada.next().charAt(0);
switch(op){
case 'A':
obj1.edad();
break;
case 'B':
obj2.figuras();
break;
case 'C':
obj3.llamadas();
break;
case 'D':
System.out.println("Gracias por participar");
break;
default:
System.out.println("Opcin no valida");
}
System.out.println("Deseas repetir el programa principal?, si lo desea escriba s");
letra = entrada.next().charAt(0);
}while(letra == 's');
}
} | [
"noreply@github.com"
] | noreply@github.com |
76fa15a3ef8dbcac509bc0334350d5eee1d3bfa0 | d0370050c3e3347064632c9cf0fa6c9e453e10c6 | /src/Myltythreading/Theory/Deadlock.java | bb8a04628f13e8b1c5f5d4a6f987d84424fa07ba | [] | no_license | demotivirus/CodeFinder | ecdfcdcc09a2d8be8235da3daa0e8e11c38591e9 | 8cf7ec82d0549fe1d4f8600caa354a1c2de06106 | refs/heads/master | 2021-07-14T05:14:33.506327 | 2021-06-28T10:03:05 | 2021-06-28T10:03:05 | 220,710,293 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,353 | java | package Myltythreading.Theory;
public class Deadlock {
public static void main(String[] args) {
A a = new A();
B b = new B();
MyThread1 myThread1 = new MyThread1();
MyThread2 myThread2 = new MyThread2();
myThread1.setA(a);
myThread2.setB(b);
myThread1.start();
myThread2.start();
}
static class A{
private static B b;
public static synchronized void getX(){
System.out.println(b.returnX());
}
public static synchronized int returnX(){
return 1;
}
}
static class B{
private static A a;
public static synchronized void getX(){
System.out.println(a.returnX());
}
public static synchronized int returnX(){
return 1;
}
}
static class MyThread1 extends Thread{
private A a;
public void run(){
a.getX();
}
public A getA() {
return a;
}
public void setA(A a) {
this.a = a;
}
}
static class MyThread2 extends Thread{
private B b;
public void run(){
b.getX();
}
public B getB() {
return b;
}
public void setB(B b) {
this.b = b;
}
}
}
| [
"demotivirus@gmail.com"
] | demotivirus@gmail.com |
dcf5f18ce924d365434c79082f8c50f61b44de45 | d64756a076c324b688c70a6c716e73ab17b116c3 | /dvbViewerController/src/main/java/org/dvbviewer/controller/io/data/ChannelListParser.java | 2794c2219712c762fba3bcfbd74fca930bc17055 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | wagnergerald/DVBViewerController | 91680ff52b9d7db2f63dc136b267cdb519ec660a | f8c2c0c5b9989a912cc60150469de0a99ce71244 | refs/heads/master | 2021-01-18T11:41:30.806813 | 2015-02-12T20:55:38 | 2015-02-12T20:55:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,568 | java | /*
* Copyright (C) 2012 dvbviewer-controller Project
*
* 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 org.dvbviewer.controller.io.data;
import android.content.Context;
import org.dvbviewer.controller.data.DbHelper;
import org.dvbviewer.controller.entities.Channel;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
/**
* The Class ChannelListParser.
*
* @author RayBa
* @date 05.07.2012
*/
public class ChannelListParser {
private static Charset ASCII = Charset.forName("ASCII");
private static Charset CP1252 = Charset.forName("CP1252");
/**
* Parses the channel list.
*
* @param context the context
* @param bytes the bytes
* @return the list©
* @author RayBa
* @date 05.07.2012
*/
public static List<Channel> parseChannelList(Context context, byte[] bytes) {
List<Channel> result = null;
ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes);
DataInputStream is = new DataInputStream(byteStream);
try {
byte currentByte = 0;
int length = is.readByte();
byte[] tmp = new byte[4];
for (int i = 0; i < 4; i++) {
tmp[i] = is.readByte();
}
String s = new String(tmp);
int highVersion = is.readByte();
int lowVersion = is.readByte();
int position = 0;
result = new ArrayList<Channel>();
while (true) {
Channel c = new Channel();
readTunerInfos(is, c);
for (int i = 0; i < 26; i++) {
currentByte = is.readByte();
}
tmp = new byte[26];
for (int i = 0; i < 26; i++) {
tmp[i] = is.readByte();
}
s = new String(tmp, CP1252.name()).trim();
// s = s.replaceAll("\\([^\\(]*\\)", "").trim();
c.setName(s);
for (int i = 0; i < 26; i++) {
tmp[i] = is.readByte();
}
is.readByte();
is.readByte();
if (c.isFlagSet(Channel.FLAG_ADDITIONAL_AUDIO)) {
continue;
}
c.setPosition(position);
result.add(c);
position++;
}
} catch (EOFException e) {
/**
* End of File Nothing happens;
*/
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
if (result != null && result.size() > 0) {
DbHelper dbHelper = new DbHelper(context);
dbHelper.saveChannels(result);
}
return result;
}
/**
* Read tuner infos.
*
* @param is the is
* @param c the c
* @return the channel©
* @throws IOException Signals that an I/O exception has occurred.
* @author RayBa
* @date 05.07.2012
*/
private static Channel readTunerInfos(DataInputStream is, Channel c) throws IOException {
int tunterType = is.readByte();
int channelGroup = is.readByte();
int satModulationSystem = is.readByte();
int flags = is.readByte();
int frequency = is.readInt();
int symbolrate = is.readInt();
short lnbLof = is.readShort();
short pmtPid = is.readShort();
short reserved1 = is.readShort();
byte satModulation = is.readByte();
byte avFormat = is.readByte();
byte fec = is.readByte();
byte reserved2 = is.readByte();
short reserved3 = is.readShort();
byte polarity = is.readByte();
byte reserved4 = is.readByte();
int orbitalPosition = byteArrayToInt(readWord(is));
byte tone = is.readByte();
byte reserved6 = is.readByte();
short diseqCext = is.readShort();
byte disecq = is.readByte();
byte reserved7 = is.readByte();
short reserved8 = is.readShort();
int audioPID = byteArrayToInt(readWord(is));
short reserved9 = is.readShort();
int videoPID = byteArrayToInt(readWord(is));
int transportStreamID = byteArrayToInt(readWord(is));
short teletextPID = is.readShort();
int originalNetworkId = byteArrayToInt(readWord(is));
int serviceId = byteArrayToInt(readWord(is));
BitSet bitSet = convert(flags);
boolean isadditionalAudio = bitSet.get(7);
int tvRadioFLag = bitSet.get(3) ? 1 : bitSet.get(4) ? 2 : 0;
// long channelId = generateChannelId(tunterType, audioPID, serviceId);
long channelId = generateChannelId(serviceId, audioPID, tunterType, transportStreamID, orbitalPosition, tvRadioFLag);
long favId = generateFavId(tunterType + 1, serviceId);
long epgId = generateEPGId(tunterType, originalNetworkId, transportStreamID, serviceId);
short rcrPID = is.readShort();
c.setEpgID(epgId);
c.setId(channelId);
c.setFavID(favId);
if (isadditionalAudio) {
c.setFlag(Channel.FLAG_ADDITIONAL_AUDIO);
}
return c;
}
/**
* Generate epg id.
*
* @param tunerType the tuner type
* @param networkId the network id
* @param streamId the stream id
* @param serviceId the service id
* @return the long©
* @author RayBa
* @date 05.07.2012
*/
private static long generateEPGId(int tunerType, int networkId, int streamId, int serviceId) {
long epgId = 0;
/**
* Formel: (TunerType + 1)*2^48 + NID*2^32 + TID*2^16 + SID
*/
epgId = (long) ((tunerType + 1) * Math.pow(2, 48) + networkId * Math.pow(2, 32) + streamId * Math.pow(2, 16) + serviceId);
return epgId;
}
/**
* Generate channel id.
*
* @param tunerType the tuner type
* @param audioPID the audio pid
* @param serviceId the service id
* @return the long©
* @author RayBa
* @date 05.07.2012
*/
public static long generateChannelId(int tunerType, int audioPID, int serviceId) {
long channelId = 0;
/**
* Formel: (tunertype + 1) * 536870912 + APID * 65536 + SID
*/
channelId = (long) ((tunerType + 1) * 536870912 + audioPID * 65536 + serviceId);
return channelId;
}
public static long generateChannelId(int serviceId, int audioPID, int tunerType, int transportstreamID, int orbitalPosition, int tvRadioFlag) {
long channelId = 0;
/**
* Service ID + AudioPID x 2^16 + (Tunertyp+1) x 2^29 + TransportstreamID x 2^32 + (OrbitalPosition x 10) x 2^48 + TV/Radio-Flag x 2^61
*/
long audioPIDPowered = audioPID * (BigInteger.valueOf(2).pow(16)).longValue();
long tunerTypePowered = (tunerType +1) * (BigInteger.valueOf(2).pow(29)).longValue();
long transportstreamIDPowered = transportstreamID * (BigInteger.valueOf(2).pow(32)).longValue();
long orbitalPositionPowered = orbitalPosition * (BigInteger.valueOf(2).pow(48)).longValue();
long tvRadioFlagPowered = tvRadioFlag * (BigInteger.valueOf(2).pow(61)).longValue();
channelId = serviceId +audioPIDPowered+tunerTypePowered+transportstreamIDPowered+orbitalPositionPowered+tvRadioFlagPowered;
return channelId;
}
/**
* Generate fav id.
*
* @param tunerType the tuner type
* @param serviceId the service id
* @return the long©
* @author RayBa
* @date 05.07.2012
*/
public static long generateFavId(int tunerType, int serviceId) {
long channelId = 0;
channelId = (long) ((tunerType + 1) * 536870912 + serviceId);
return channelId;
}
/**
* Byte array to int.
*
* @param bytes the bytes
* @return the int©
* @author RayBa
* @date 05.07.2012
*/
private static int byteArrayToInt(byte[] bytes) {
int value = 0;
for (int i = 0; i < bytes.length; i++) {
value += (bytes[i] & 0xff) << (8 * i);
}
return value;
}
/**
* Convert.
*
* @param value the value
* @return the bit set©
* @author RayBa
* @date 05.07.2012
*/
private static BitSet convert(int value) {
BitSet bits = new BitSet();
int index = 0;
while (value != 0) {
if (value % 2L != 0) {
bits.set(index);
}
++index;
value = value >>> 1;
}
return bits;
}
/**
* Read bytes.
*
* @param is the is
* @param length the length
* @return the byte[]©
* @throws IOException Signals that an I/O exception has occurred.
* @author RayBa
* @date 05.07.2012
*/
private static byte[] readBytes(DataInputStream is, int length) throws IOException {
byte[] result = new byte[length];
for (int i = 0; i < length; i++) {
result[i] = readByte(is);
}
return result;
}
/**
* Read word.
*
* @param is the is
* @return the byte[]©
* @throws IOException Signals that an I/O exception has occurred.
* @author RayBa
* @date 05.07.2012
*/
private static byte[] readWord(DataInputStream is) throws IOException {
return readBytes(is, 2);
}
/**
* Read d word.
*
* @param is the is
* @return the byte[]©
* @throws IOException Signals that an I/O exception has occurred.
* @author RayBa
* @date 05.07.2012
*/
private static byte[] readDWord(DataInputStream is) throws IOException {
return readBytes(is, 4);
}
/**
* Read byte.
*
* @param is the is
* @return the byte©
* @throws IOException Signals that an I/O exception has occurred.
* @author RayBa
* @date 05.07.2012
*/
private static byte readByte(DataInputStream is) throws IOException {
return is.readByte();
}
/**
* Checks if is bit set.
*
* @param value the value
* @param bit the bit
* @return true, if is bit set
* @author RayBa
* @date 05.07.2012
*/
private static boolean isBitSet(byte value, int bit) {
return (value & (1 << bit)) != 0;
}
}
| [
"rainerbaun@gmail.com"
] | rainerbaun@gmail.com |
f4ba3acaf21401e299fc114f0e1b8ba4a1c22ed5 | fdbb5e4a5070e002592ca98fb262d9bac596b3d6 | /app/src/main/java/com/example/mpl/MainActivity.java | 470b6f071761509496555d0030b3a6fa69417121 | [] | no_license | sathudeva7/code | aed365a1331cc615d7043d727604f9b89d12052e | 26e8836d2f6a46ba3d5f72434abf9dc9d1bdf8cb | refs/heads/master | 2022-11-17T22:52:42.419589 | 2020-07-08T14:42:19 | 2020-07-08T14:42:19 | 278,185,529 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,739 | java | package com.example.mpl;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
public class MainActivity extends AppCompatActivity {
Button buttontwo;
Button buttonone;
TextView forgotTextLink;
FirebaseAuth fAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fAuth = FirebaseAuth.getInstance();
buttontwo = (Button) findViewById(R.id.button2);
buttontwo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openSignupActivity();
}
});
buttonone = (Button) findViewById(R.id.button);
buttonone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openLoginActivity();
}
});
forgotTextLink = findViewById(R.id.forgotPassword);
forgotTextLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final EditText resetMail = new EditText(v.getContext());
final AlertDialog.Builder passwordResetDialog = new AlertDialog.Builder(v.getContext());
passwordResetDialog.setTitle("Reset Password ?");
passwordResetDialog.setMessage("Enter Your Email To Received Reset Link.");
passwordResetDialog.setView(resetMail);
passwordResetDialog.setPositiveButton("yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String mail = resetMail.getText().toString();
fAuth.sendPasswordResetEmail(mail).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(MainActivity.this,"Reset Link send to your Email",Toast.LENGTH_SHORT).show();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.d("tag","onFailure: Email not sent " + e.getMessage());
}
});
}
});
passwordResetDialog.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
passwordResetDialog.create().show();
}
});
}
public void openSignupActivity(){
Intent intent = new Intent(MainActivity.this,SignupActivity.class);
startActivity(intent);
finish();
}
public void openLoginActivity(){
Intent intent = new Intent(MainActivity.this,LoginActivity.class);
startActivity(intent);
finish();
}
}
| [
"67930416+sathudeva7@users.noreply.github.com"
] | 67930416+sathudeva7@users.noreply.github.com |
961afcfe3a2fcefe364ee40d8de31a7e4bb5b00e | c474d5c842e39b383493e482d5cf4c04972916da | /src/com/javabasic/stringlesson/lesson4/MultiplierPractice.java | d5136f55f2c33392d2ccf317233e35988933a38c | [] | no_license | ThangVu1903/javabasic | 5efd408c4146c0a75c8f114692b21fb6e90c7265 | 80856eea3908b383034cac8d061198ba875c7596 | refs/heads/master | 2023-07-14T05:45:49.841668 | 2021-08-17T03:32:33 | 2021-08-17T03:32:33 | 392,350,836 | 0 | 0 | null | 2021-08-17T03:32:34 | 2021-08-03T14:46:48 | Java | UTF-8 | Java | false | false | 646 | java | package com.javabasic.stringlesson.lesson4;
import java.util.Scanner;
public class MultiplierPractice {
public static void main(String[] args) {
int number=enterNumber();
smallMultiplier(number);
}
public static int enterNumber(){
Scanner scanner=new Scanner(System.in);
System.out.println("enter number: ");
int number=scanner.nextInt();
return number;
}
public static void smallMultiplier(int number){
int i, integran=1;
for (i=0;i<=10;i++){
integran = number*i;
System.out.println(number+"*"+i + "="+integran);
}
}
}
| [
"vuthang19032002az@gmail.com"
] | vuthang19032002az@gmail.com |
2d51d299bff978dbbd0276e22523edd023da6d77 | 5337afe3062863923639a78ac8a1772cb2f42378 | /src/main/java/wildflyRest/vote/VoteResultOutput.java | 0120f1dce676cc23272aa0f6508c3f8e20db49d7 | [] | no_license | AugustoKlaic/WildflyPoc | 5a432406f8ed7611a293a92cfdfb43b0744cc5d0 | a3f895f1f1cd648ac9a581637333b0cad489c6b5 | refs/heads/master | 2020-12-08T10:40:52.208473 | 2020-09-15T02:05:24 | 2020-09-15T02:05:24 | 232,961,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 692 | java | package wildflyRest.vote;
public class VoteResultOutput {
private long yes;
private long no;
private long total;
public VoteResultOutput(long yes, long no, long total) {
this();
this.yes = yes;
this.no = no;
this.total = total;
}
public VoteResultOutput() {
}
public long getYes() {
return yes;
}
public void setYes(long yes) {
this.yes = yes;
}
public long getNo() {
return no;
}
public void setNo(long no) {
this.no = no;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
}
| [
"gutosopelsa@hotmail.com"
] | gutosopelsa@hotmail.com |
12e716b911132cc6b65308722fbc8d1cbfa8fac8 | 46439507751a4c928030dd9e3df8bbb22f1ca28f | /workspace/fsis/src/fsis/Customer.java | 33a87f4813b9711222d031bb4909efcef7c50cea | [] | no_license | neofoot/seg-2013 | 9340cdab7527a283788d1de0ccf7efb1e1588370 | 24fa241d25260795f78b9b187f0e786031eb67ad | refs/heads/master | 2016-09-05T20:02:16.236667 | 2013-12-19T00:53:40 | 2013-12-19T00:53:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,177 | java | package fsis;
import kengine.NotPossibleException;
/**
*
* @author hieudt
*
*/
public class Customer implements Comparable<Customer>, Document {
@DomainConstraint(type = "Integer", mutable = false, optional = false, length = 8, min = 1, max = 99999999)
private int id;
@DomainConstraint(type = "String", mutable = true, optional = false, length = 50)
private String name;
@DomainConstraint(type = "String", mutable = true, optional = false, length = 10)
private String phoneNumber;
@DomainConstraint(type = "String", mutable = true, optional = false, length = 100)
private String address;
// private static Integer COUNTER;
public Customer(int id, String name, String phoneNumber, String adress) {
// if (Customer.COUNTER == null) {
// Customer.COUNTER = new Integer(0);
// }
// this.id = Customer.COUNTER.intValue() + 1;
// Customer.COUNTER = new Integer(this.id);
this.id = id;
if (validate(name, phoneNumber, adress)) {
this.name = name;
this.phoneNumber = phoneNumber;
this.address = adress;
} else {
throw new NotPossibleException("Customer<init>: invalid arguments");
}
}
public void setName(String name) {
if (validateName(name))
this.name = name;
else
throw new NotPossibleException("Customer.setName: invalid name "
+ name);
}
public void setPhoneNumber(String phoneNumber) {
if (validatePhoneNumber(phoneNumber))
this.phoneNumber = phoneNumber;
else
throw new NotPossibleException(
"Customer.setPhoneNumber: invalid phone " + phoneNumber);
}
public void setAddress(String address) {
if (validateAddress(address))
this.address = address;
else
throw new NotPossibleException(
"Customer.setAddress: invalid address " + address);
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public String getPhoneNumber() {
return phoneNumber;
}
public String getAddress() {
return address;
}
public boolean repOK() {
if (id < 1 || id > 999999999 || name == null || phoneNumber == null
|| address == null)
return false;
return true;
}
public String toString() {
return "Customer:<" + id + ", " + name + ", " + phoneNumber + ", "
+ address + ">";
}
private boolean validateName(String n) {
if (n == null)
return false;
else
return true;
}
private boolean validatePhoneNumber(String n) {
if (n == null)
return false;
else
return true;
}
private boolean validateAddress(String n) {
if (n == null)
return false;
else
return true;
}
private boolean validate(String name, String phone, String address) {
return validateName(name) && validatePhoneNumber(phone)
&& validateAddress(address);
}
@Override
public int compareTo(Customer o) {
return this.name.compareTo(o.name);
}
@Override
public String toHtmlDoc() {
StringBuffer sb = new StringBuffer();
sb.append("<html>");
sb.append("<head>");
sb.append("<title>Customer: " + this.name + "</title>");
sb.append("</head>");
sb.append("<body>");
sb.append(this.id + " " + this.name + " " + this.phoneNumber + " "
+ this.address);
sb.append("</body></html>");
return sb.toString();
}
}
| [
"hieunguyen2911@gmail.com"
] | hieunguyen2911@gmail.com |
69b90d44fc009c3a8131951af659bf48f0288c15 | 5554b2dbcec208ed16028b84e70a91e597334dd5 | /aplicationMovil/src/main/java/com/proyecto/entregas/adapter/tablayout/TBAdapterEntregaDetalle.java | 9d0efbd97f6b05a25d182f07c6ae46c1365ad176 | [] | no_license | RMaturrano/MSSMobile | a4fdbda65d33fc00842a4416dd80b66588784a2d | bb77ec4cc17c29ef9b0fc341300999ee75755413 | refs/heads/master | 2020-03-26T22:11:22.286789 | 2019-02-15T18:30:37 | 2019-02-15T18:30:37 | 145,438,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,299 | java | package com.proyecto.entregas.adapter.tablayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import com.proyecto.bean.EntregaBean;
import com.proyecto.entregas.fragments.EntregaDetalleTabCabecera;
import com.proyecto.entregas.fragments.EntregaDetalleTabContenido;
import com.proyecto.entregas.fragments.EntregaDetalleTabLogistica;
public class TBAdapterEntregaDetalle extends FragmentStatePagerAdapter{
private int mNumOfTabs;
public TBAdapterEntregaDetalle(FragmentManager fm, int NumOfTabs) {
super(fm);
this.mNumOfTabs = NumOfTabs;
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
EntregaDetalleTabCabecera tab1 = new EntregaDetalleTabCabecera();
return tab1;
case 1:
EntregaDetalleTabContenido tab2 = new EntregaDetalleTabContenido();
return tab2;
case 2:
EntregaDetalleTabLogistica tab3 = new EntregaDetalleTabLogistica();
return tab3;
default:
return null;
}
}
@Override
public int getCount() {
return mNumOfTabs;
}
}
| [
"mark131296@gmail.com"
] | mark131296@gmail.com |
f3cac411109b628d63629da15b223abbcc0d74fb | a0e8f155a6ca7f359958a95faff7e284c5d4528c | /src/main/java/me/gold/reporesistory/debtdetailsPurchaseRespository.java | ab156c567845e121f9464df0030c092f24f0ebc3 | [] | no_license | hala-whab/gold-backend | e8680a3b9b4eec8e74239ed8247d17c227d7eceb | e2e937f875c67fef7178e4f137dc3998cf308ea5 | refs/heads/master | 2023-07-05T13:21:43.870602 | 2020-01-18T01:41:29 | 2020-01-18T01:41:29 | 234,666,010 | 0 | 0 | null | 2023-06-20T18:32:06 | 2020-01-18T01:40:02 | Java | UTF-8 | Java | false | false | 906 | java | package me.gold.reporesistory;
import me.gold.model.debtpurchasedetails;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Repository
public interface debtdetailsPurchaseRespository extends JpaRepository<debtpurchasedetails, Integer> {
@Query(value = "SELECT * FROM debtpurchasedetails WHERE dept_id = ?1", nativeQuery = true)
List<debtpurchasedetails> finddebtbpydebtid(String id);
@Query("delete from debtpurchasedetails where dept_id=:id ")
@Modifying(clearAutomatically = true)
@Transactional
void deletwhereremaningequalzero(@Param("id") int id);
}
| [
"hala.abdelwahab@visionvalley.net"
] | hala.abdelwahab@visionvalley.net |
f624631aee0cbf31384985e864e5f13075640aa6 | c3445da9eff3501684f1e22dd8709d01ff414a15 | /LIS/sinosoft-parents/lis-business/src/main/java_schema/com/sinosoft/lis/vschema/PD_LMRiskDiscountSet.java | 91c3dcfa907905f220457caffd5e432efe95f396 | [] | no_license | zhanght86/HSBC20171018 | 954403d25d24854dd426fa9224dfb578567ac212 | c1095c58c0bdfa9d79668db9be4a250dd3f418c5 | refs/heads/master | 2021-05-07T03:30:31.905582 | 2017-11-08T08:54:46 | 2017-11-08T08:54:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,535 | java | /**
* Copyright (c) 2002 sinosoft Co. Ltd.
* All right reserved.
*/
package com.sinosoft.lis.vschema;
import org.apache.log4j.Logger;
import com.sinosoft.lis.schema.PD_LMRiskDiscountSchema;
import com.sinosoft.utility.*;
/*
* <p>ClassName: PD_LMRiskDiscountSet </p>
* <p>Description: PD_LMRiskDiscountSchemaSet类文件 </p>
* <p>Copyright: Copyright (c) 2007</p>
* <p>Company: sinosoft </p>
* @Database: PhysicalDataModel_8
*/
public class PD_LMRiskDiscountSet extends SchemaSet
{
private static Logger logger = Logger.getLogger(PD_LMRiskDiscountSet.class);
// @Method
public boolean add(PD_LMRiskDiscountSchema aSchema)
{
return super.add(aSchema);
}
public boolean add(PD_LMRiskDiscountSet aSet)
{
return super.add(aSet);
}
public boolean remove(PD_LMRiskDiscountSchema aSchema)
{
return super.remove(aSchema);
}
public PD_LMRiskDiscountSchema get(int index)
{
PD_LMRiskDiscountSchema tSchema = (PD_LMRiskDiscountSchema)super.getObj(index);
return tSchema;
}
public boolean set(int index, PD_LMRiskDiscountSchema aSchema)
{
return super.set(index,aSchema);
}
public boolean set(PD_LMRiskDiscountSet aSet)
{
return super.set(aSet);
}
/**
* 数据打包,按 XML 格式打包,顺序参见<A href ={@docRoot}/dataStructure/tb.html#PrpPD_LMRiskDiscount描述/A>表字段
* @return: String 返回打包后字符串
**/
public String encode()
{
StringBuffer strReturn = new StringBuffer("");
int n = this.size();
for (int i = 1; i <= n; i++)
{
PD_LMRiskDiscountSchema aSchema = this.get(i);
strReturn.append(aSchema.encode());
if( i != n ) strReturn.append(SysConst.RECORDSPLITER);
}
return strReturn.toString();
}
/**
* 数据解包
* @param: str String 打包后字符串
* @return: boolean
**/
public boolean decode( String str )
{
int nBeginPos = 0;
int nEndPos = str.indexOf('^');
this.clear();
while( nEndPos != -1 )
{
PD_LMRiskDiscountSchema aSchema = new PD_LMRiskDiscountSchema();
if(aSchema.decode(str.substring(nBeginPos, nEndPos)))
{
this.add(aSchema);
nBeginPos = nEndPos + 1;
nEndPos = str.indexOf('^', nEndPos + 1);
}
else
{
// @@错误处理
this.mErrors.copyAllErrors( aSchema.mErrors );
return false;
}
}
PD_LMRiskDiscountSchema tSchema = new PD_LMRiskDiscountSchema();
if(tSchema.decode(str.substring(nBeginPos)))
{
this.add(tSchema);
return true;
}
else
{
// @@错误处理
this.mErrors.copyAllErrors( tSchema.mErrors );
return false;
}
}
}
| [
"dingzansh@sinosoft.com.cn"
] | dingzansh@sinosoft.com.cn |
e846e009164be1294f2f3d707a05f4a405c9fe8c | 6584d64340ce86a21be12215f2e5c7de61ca8c2b | /lc-problems-solution-api/src/main/java/com/leetcode/problems/easy/RemoveElement.java | 9af17809bfce37d4e0da8375642c42db0c6f0063 | [] | no_license | Phantom-Eve/lc-problems-solution | 4718c23b13da4c4b09dc241d4692b79af1db7599 | dbbc9f70adea7ba538d6a261af4cedef830dd9af | refs/heads/master | 2022-06-01T17:54:40.116540 | 2019-12-05T07:08:49 | 2019-12-05T07:08:49 | 199,986,050 | 0 | 0 | null | 2022-05-20T21:05:15 | 2019-08-01T05:53:42 | Java | UTF-8 | Java | false | false | 2,030 | java | package com.leetcode.problems.easy;
/**
* 27-移除元素
* @author Phantom
* Created on 2019/7/31.
*/
public class RemoveElement {
/**
* 给定一个数组 nums 和一个值 val,你需要原地移除所有数值等于 val 的元素,返回移除后数组的新长度。
* 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。
* 元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。
*
* 示例 1:
* 给定 nums = [3,2,2,3], val = 3,
* 函数应该返回新的长度 2, 并且 nums 中的前两个元素均为 2。
* 你不需要考虑数组中超出新长度后面的元素。
*
* 示例 2:
* 给定 nums = [0,1,2,2,3,0,4,2], val = 2,
* 函数应该返回新的长度 5, 并且 nums 中的前五个元素为 0, 1, 3, 0, 4。
* 注意这五个元素可为任意顺序。
* 你不需要考虑数组中超出新长度后面的元素。
*
* 说明:
* 为什么返回数值是整数,但输出的答案是数组呢?
* 请注意,输入数组是以“引用”方式传递的,这意味着在函数里修改输入数组对于调用者是可见的。
* 你可以想象内部操作如下:
* // nums 是以“引用”方式传递的。也就是说,不对实参作任何拷贝
* int len = removeElement(nums, val);
*
* // 在函数里修改输入数组对于调用者是可见的。
* // 根据你的函数返回的长度, 它会打印出数组中该长度范围内的所有元素。
* for (int i = 0; i < len; i++) {
* print(nums[i]);
* }
*
*/
public static int solve(int[] nums, int val) {
int i = 0;
for (int j = 0; j < nums.length; j++) {
if (nums[j] != val) {
nums[i] = nums[j];
i++;
}
}
return i;
}
}
| [
"siriusfoam@qq.com"
] | siriusfoam@qq.com |
19e6a471d7e92ef3487b933b217beef50a2c4255 | afba03839c7c3da92120ecb839ebdaa67ee62334 | /SocialMedia/src/main/java/com/socialmedia/playfab/PlayFabUtil.java | 2eaba585dfbbc83c72b330ada0735ece18a113ca | [] | no_license | kevinwen24/SpringCloudDemo | efe734284b537199fb2b8c021c8a7949d47afa07 | d8fb7501d2d72d75a2a7cb7ba24b06039e677113 | refs/heads/master | 2021-09-13T08:32:47.512493 | 2018-04-27T06:13:55 | 2018-04-27T06:13:55 | 115,713,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,070 | java | package com.socialmedia.playfab;
import java.util.concurrent.*;
import org.springframework.stereotype.Component;
import java.util.*;
import com.playfab.PlayFabErrors.*;
import com.playfab.PlayFabSettings;
import com.playfab.PlayFabClientModels;
import com.playfab.PlayFabClientAPI;
@Component
public class PlayFabUtil {
private static boolean _running = true;
public static void StartUpPlayFab() {
PlayFabSettings.TitleId="3BBD";
PlayFabClientModels.LoginWithCustomIDRequest request = new PlayFabClientModels.LoginWithCustomIDRequest();
request.CustomId = "GettingStartedGuide";
request.CreateAccount = true;
FutureTask<PlayFabResult<com.playfab.PlayFabClientModels.LoginResult>> loginTask = PlayFabClientAPI.LoginWithCustomIDAsync(request);
loginTask.run();
while (_running) {
if (loginTask.isDone()) { // You would probably want a more sophisticated way of tracking pending async API calls in a real game
OnLoginComplete(loginTask);
}
// Presumably this would be your main game loop, doing other things
try {
Thread.sleep(1);
} catch(Exception e) {
System.out.println("Critical error in the example main loop: " + e);
}
}
}
private static void OnLoginComplete(FutureTask<PlayFabResult<com.playfab.PlayFabClientModels.LoginResult>> loginTask) {
PlayFabResult<com.playfab.PlayFabClientModels.LoginResult> result = null;
try {
result = loginTask.get(); // Wait for the result from the async call
} catch(Exception e) {
System.out.println("Exception in PlayFab api call: " + e); // Did you assign your PlayFabSettings.TitleId correctly?
}
if (result != null && result.Result != null) {
System.out.println("Congratulations, you made your first successful API call!");
} else if (result != null && result.Error != null) {
System.out.println("Something went wrong with your first API call.");
System.out.println("Here's some debug information:");
System.out.println(CompileErrorsFromResult(result));
}
_running = false; // Because this is just an example, successful login triggers the end of the program
}
// This is a utility function we haven't put into the core SDK yet. Feel free to use it.
private static <RT> String CompileErrorsFromResult(PlayFabResult<RT> result) {
if (result == null || result.Error == null)
return null;
String errorMessage = "";
if (result.Error.errorMessage != null)
errorMessage += result.Error.errorMessage;
if (result.Error.errorDetails != null)
for (Map.Entry<String, List<String>> pair : result.Error.errorDetails.entrySet() )
for (String msg : pair.getValue())
errorMessage += "\n" + pair.getKey() + ": " + msg;
return errorMessage;
}
}
| [
"hsf3.kevin.wen@augmentum.com"
] | hsf3.kevin.wen@augmentum.com |
deaddcc9e7a65a00e10d5d78002eb9d709a9263e | 24c0bf4d222a1792566540966b00d58547908447 | /biz/cms/src/main/java/com/juma/tgm/tools/service/impl/BigDataCommonServiceImpl.java | 36274b38dbad4d90201f84df4b81f46a295f836b | [] | no_license | SunGitShine/tgm-server | 6c97818fa6f2bc0bf88634759288cbded27031e0 | c5840a256b4c979187e60cbf4044ded95453f9be | refs/heads/master | 2022-07-17T06:35:43.822405 | 2019-08-23T02:00:08 | 2019-08-23T02:00:08 | 203,904,756 | 0 | 3 | null | 2022-06-29T17:35:42 | 2019-08-23T01:57:47 | Java | UTF-8 | Java | false | false | 2,437 | java | package com.juma.tgm.tools.service.impl;
import com.alibaba.fastjson.JSON;
import com.bruce.tool.rpc.http.core.Https;
import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.juma.tgm.base.domain.OpsResponse;
import com.juma.tgm.common.Constants;
import com.juma.tgm.tools.service.BigDataCommonService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
/**
* Title: BigDataServiceImpl
* Description:大数据中心公共接口实现
* Created by gzq on 2019/7/23.
*/
@Service
@Slf4j
public class BigDataCommonServiceImpl implements BigDataCommonService {
@Override
public <T> List<T> getOpsData(String opsId, String param, Class<T> clazz) {
String response = null;
try {
String baseUrl = Constants.OPS_URL.replace("{0}", opsId);
String url = baseUrl + URLEncoder.encode(param, "UTF-8");
log.info("ops request url : {}",url);
response = Https.create().url(url).get();
Gson gson = new Gson();
OpsResponse opsResponse = gson.fromJson(response, OpsResponse.class);
return parseResponse(opsResponse, clazz);
} catch (Exception e) {
log.warn("ops response error: opsId {} ,response {}",opsId,JSON.toJSONString(response));
log.warn(e.getMessage(), e);
}
return Lists.newArrayList();
}
public static <T> List<T> parseResponse(OpsResponse response, Class<T> clazz) {
if(null == response || CollectionUtils.isEmpty(response.getDatas())) {
return Collections.emptyList();
}
List<T> result = new ArrayList<>(response.getDatas().size());
List<String> fieldList = new ArrayList<>();
for(OpsResponse.Meta meta : response.getMetas()) {
fieldList.add(meta.getName());
}
for(Object[] objects : response.getDatas()) {
HashMap<String,Object> map = new HashMap<>();
int i = 0;
for(String field : fieldList) {
map.put(field,objects[i]);
i ++;
}
T t = JSON.parseObject(JSON.toJSONString(map), clazz);
result.add(t);
}
return result;
}
}
| [
"xieqiang02@jumapeisong.com"
] | xieqiang02@jumapeisong.com |
0772bfd3d67761bf620afe5f454ac6d9daa6c4ab | 26d249cf28edfc594545c299570422426df773b8 | /ProxyTest/src/ProxyInterfaceTest.java | 0053b481f6e903bded92f9f58824040c98130bde | [] | no_license | MrGeroge/hadoop | 881526f56dd533718583e62dd7b3c5c7a045ec6e | 3639c59144f654ebe0ffa03bad3630d7c5051ee5 | refs/heads/master | 2021-04-30T15:52:46.873863 | 2018-02-12T13:47:38 | 2018-02-12T13:47:38 | 121,251,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 113 | java | /**
* Created by George on 2017/3/7.
*/
public interface ProxyInterfaceTest {
public String getStatue();
}
| [
"18202790149@163.com"
] | 18202790149@163.com |
e68f5e464a8269a1ce9228373d12e46ecbfb0509 | c2ebec69d9b31f56d7e6f46ff66be09935e8c2ec | /app/src/main/java/com/example/a23per/sanplearchitecturecomponent/handling/activity/MainActivity.java | 82ea4de4158fa8ada80df4dea48a2cb8b0ad73c7 | [] | no_license | arm19jong/SampleArchitectureComponent2 | 7d96ecaf61ef33fc59011ae76bd0e543de98819a | 5c20103d65456e94bda73e00fb9852de4a4695c2 | refs/heads/master | 2021-03-30T15:40:21.119460 | 2017-11-30T10:25:12 | 2017-11-30T10:25:12 | 112,461,403 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package com.example.a23per.sanplearchitecturecomponent.handling.activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import com.example.a23per.sanplearchitecturecomponent.handling.MyLifecycle;
import com.example.a23per.sanplearchitecturecomponent.R;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new MyLifecycle(getLifecycle(), new MyLifecycle.MyListener() {
@Override
public void myText(String text) {
Log.d("tag2", text);
}
});
}
}
| [
"suchaj.jong@gmail.com"
] | suchaj.jong@gmail.com |
9e20288b114ef7d6fa5b265e73eb1edf413621d1 | 5c3fc5aa705c24e5fe54928613fac819052a817a | /.svn/pristine/1b/1bf3546ef433d81450500ef20e48df05ab8a4c1b.svn-base | 42f71454e288f9585546482b4be4fa66158b5f8a | [] | no_license | wang-shun/eichong | 30e0ca01e9e5f281c9c03f609c52cecb3a5299f0 | c13a6d464150e25039b601aed184fd3fab9e87b7 | refs/heads/master | 2020-04-02T12:19:31.963507 | 2018-03-21T09:40:34 | 2018-03-21T09:40:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,665 | package com.wanma.model;
public class TblPartner {
//组织机构编码
private String operatorID;
//内部公司标识
private String orgNo;
//公司id
private String cpyId;
//万马token获取密匙
private String wmTokenSecret;
//是否有充电流程
private String valid;
//第三方token获取地址
private String thirdTokenUrl;
//第三方token获取密匙
private String thirdTokenSecret;
//加密密匙
private String aesSecret;
//初始化向量
private String aesIv;
//签名密匙
private String sigSecret;
//推送订单对账结果url
private String pushOrderCheckUrl;
//订单推送间隔,
private String timeInterval;
//推送订单URL
private String pushOrderUrl;
private String secret;
public String getOperatorID() {
return operatorID;
}
public void setOperatorID(String operatorID) {
this.operatorID = operatorID;
}
public String getOrgNo() {
return orgNo;
}
public void setOrgNo(String orgNo) {
this.orgNo = orgNo;
}
public String getCpyId() {
return cpyId;
}
public void setCpyId(String cpyId) {
this.cpyId = cpyId;
}
public String getWmTokenSecret() {
return wmTokenSecret;
}
public void setWmTokenSecret(String wmTokenSecret) {
this.wmTokenSecret = wmTokenSecret;
}
public String getValid() {
return valid;
}
public void setValid(String valid) {
this.valid = valid;
}
public String getThirdTokenUrl() {
return thirdTokenUrl;
}
public void setThirdTokenUrl(String thirdTokenUrl) {
this.thirdTokenUrl = thirdTokenUrl;
}
public String getThirdTokenSecret() {
return thirdTokenSecret;
}
public void setThirdTokenSecret(String thirdTokenSecret) {
this.thirdTokenSecret = thirdTokenSecret;
}
public String getAesSecret() {
return aesSecret;
}
public void setAesSecret(String aesSecret) {
this.aesSecret = aesSecret;
}
public String getAesIv() {
return aesIv;
}
public void setAesIv(String aesIv) {
this.aesIv = aesIv;
}
public String getSigSecret() {
return sigSecret;
}
public void setSigSecret(String sigSecret) {
this.sigSecret = sigSecret;
}
public String getPushOrderCheckUrl() {
return pushOrderCheckUrl;
}
public void setPushOrderCheckUrl(String pushOrderCheckUrl) {
this.pushOrderCheckUrl = pushOrderCheckUrl;
}
public String getTimeInterval() {
return timeInterval;
}
public void setTimeInterval(String timeInterval) {
this.timeInterval = timeInterval;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
public String getPushOrderUrl() {
return pushOrderUrl;
}
public void setPushOrderUrl(String pushOrderUrl) {
this.pushOrderUrl = pushOrderUrl;
}
} | [
"wwzero@hotmail.com"
] | wwzero@hotmail.com | |
66c31caf063f6e9284ed0a335b6ad3796556d9b1 | 6678bf7af7dc22010c6f689161f19644fd638ca8 | /ProjetJavaAvengers/src/Presentation/HeroCreationVue.java | 46960d63693956fb2ba22d2b48d37c685cf7e1fb | [] | no_license | MSghais/projetJavaSwing | be8b293554aad8639d0e0ee389e53b83b4f5ea28 | 51ce151edecb4e2a867be2f5138f44d3769a66e4 | refs/heads/master | 2022-04-24T08:01:34.349725 | 2020-04-21T15:15:39 | 2020-04-21T15:15:39 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 3,886 | java | package Presentation;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import Entite.Hero;
import Entite.Organisation;
public class HeroCreationVue extends JPanel implements ActionListener {
private Controleur controleur;
private JLabel labelOrganisation;
private JTextField nom, idSecrete, commentaire, pouvoir;
private JComboBox<String> comboOrganisation;
private JButton btnAjout;
public HeroCreationVue(Controleur controleur) {
this.controleur = controleur;
setLayout(new BorderLayout());
setVisible(true);
//Formulaire creation superhéros
JPanel herosFormulaire = new JPanel();
herosFormulaire.setLayout(new GridLayout(5, 2, 20,20));
herosFormulaire.add(new JLabel("Nom"));
nom = new JTextField(20);
herosFormulaire.add(nom);
herosFormulaire.add(new JLabel("Identité secrète"));
idSecrete = new JTextField(20);
herosFormulaire.add(idSecrete);
herosFormulaire.add(new JLabel("Commentaire"));
commentaire = new JTextField(20);
herosFormulaire.add(commentaire);
herosFormulaire.add(new JLabel("Pouvoir"));
pouvoir = new JTextField(20);
herosFormulaire.add(pouvoir);
comboOrganisation = new JComboBox<String>();
labelOrganisation = new JLabel("Liste des organisations");
comboOrganisation.setPreferredSize(new Dimension(100, 20));
herosFormulaire.add(labelOrganisation);
herosFormulaire.add(comboOrganisation);
for (Organisation o : controleur.getOrganisations()) {
comboOrganisation.addItem(o.getNom());//no
}
btnAjout = new JButton("Ajouter");
btnAjout.addActionListener(this);
JPanel herosFormulaireEtBouton = new JPanel();
Border border = BorderFactory.createTitledBorder("Créer un SuperHéros");
herosFormulaireEtBouton.setBorder(border);
herosFormulaireEtBouton.setLayout(new FlowLayout());
herosFormulaireEtBouton.add(herosFormulaire);
herosFormulaireEtBouton.add(btnAjout);
add(herosFormulaireEtBouton,BorderLayout.CENTER);
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnAjout){
System.out.println(" Action bouton creer");
String nomHeros = nom.getText();
String idSrecreteHeros = idSecrete.getText();
String comHeros = commentaire.getText();
String pvrHeros= pouvoir.getText();
String orgaHeros = comboOrganisation.getSelectedItem().toString();
int orgaId = controleur.findOrganisationByName(orgaHeros).get(0).getId();
Hero hero = new Hero(nomHeros, idSrecreteHeros, comHeros, pvrHeros, orgaId);
if (nomHeros.isEmpty() || idSrecreteHeros.isEmpty() || comHeros.isEmpty() || pvrHeros.isEmpty()) {
JOptionPane jopNull = new JOptionPane();
jopNull.showMessageDialog(null, "Veuillez renseigner tous les champs ! " , "Erreur de saisie", JOptionPane.WARNING_MESSAGE);
}
else{
List<Hero> heros = controleur.getHeros();
int count = 0;
for(int i=0; i<heros.size();i++)
if (heros.get(i).getNom().contains(nomHeros)) {
count++;
JOptionPane jop = new JOptionPane();
jop.showMessageDialog(null, " Cet Héros est déjà créé", "attention", JOptionPane.INFORMATION_MESSAGE);
break;
}
if(count<1 ) {
controleur.creerHero(hero);
JOptionPane jop1 = new JOptionPane();
jop1.showMessageDialog(null, " Votre Héros a bien été créé", "attention", JOptionPane.INFORMATION_MESSAGE);
nom.setText("");
idSecrete.setText("");
commentaire.setText("");
pouvoir.setText("");
}
}
}
}
}
| [
"53178641+Gregalmi@users.noreply.github.com"
] | 53178641+Gregalmi@users.noreply.github.com |
4da4a608a603de287530617454f96b430aa6b342 | 4323874ac1a8a65c8eadae3ddf8c25237ea01287 | /src/lanchatapplication/MainWindow.java | ced33e2291bb7c66a4bf57540cd1eb1838a912c1 | [
"MIT"
] | permissive | CharmiShah03/lan-chat-application | 2f8850b7819c1ed8569b07d3eee858280c2d96b0 | 6c530e9fcfdaec9c665f0f63ba62528909565006 | refs/heads/master | 2021-12-13T14:09:51.034789 | 2017-03-17T15:38:36 | 2017-03-17T15:38:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,034 | 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 lanchatapplication;
import ipaddress.GetMyIpAddress;
import ipaddress.NetworkPing;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
/**
*
* @author varun
*/
public class MainWindow extends javax.swing.JFrame {
/**
* Creates new form MainWindow
*/
public MainWindow() {
initComponents();
String ipAddresses[] = new GetMyIpAddress().ipAddress();
ipAddressValueLabel.setText(ipAddresses[0] + " " + ipAddresses[1]);
final DefaultListModel model = new DefaultListModel();
connectedComputersList.setModel(model);
new Thread() {
public void run() {
try {
new NetworkPing().showConnectedComputers(model);
} catch (Exception ex) {
Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
}
}
}.start();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
connectedComputersList = new javax.swing.JList();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
ipAddressValueLabel = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
jLabel4 = new javax.swing.JLabel();
privateChatButton = new javax.swing.JButton();
groupChatButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(57, 44, 31));
jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jScrollPane1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
connectedComputersList.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jScrollPane1.setViewportView(connectedComputersList);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1)
);
jPanel2.setBorder(null);
jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(32, 80, 49));
jLabel1.setText("Lan Chat Application");
jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
jLabel2.setText("Connected Computers");
jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
jLabel3.setText("Your IpAddress: ");
ipAddressValueLabel.setText("127.0.0.1");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jLabel2)
.addGap(123, 123, 123)
.addComponent(jLabel3)
.addGap(18, 18, 18)
.addComponent(ipAddressValueLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
.addContainerGap())
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(227, 227, 227)
.addComponent(jLabel1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(ipAddressValueLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(24, 24, 24))
);
jPanel3.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
jLabel4.setText(" version: 1.0 IT-2 project 2k13 Batch NIT KURUKSHETRA");
privateChatButton.setText("private chat");
privateChatButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
privateChatButtonActionPerformed(evt);
}
});
groupChatButton.setText("group chat");
groupChatButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
groupChatButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(71, 71, 71)
.addComponent(privateChatButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(groupChatButton)
.addGap(74, 74, 74))
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 437, Short.MAX_VALUE)
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addGap(96, 96, 96)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(groupChatButton)
.addComponent(privateChatButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 178, Short.MAX_VALUE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void privateChatButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_privateChatButtonActionPerformed
new Thread() {
@Override
public void run() {
try {
new HandlePrivateChat().doInBackground();
}
catch (Exception e) {
e.printStackTrace();
}
}
}.start();
}//GEN-LAST:event_privateChatButtonActionPerformed
private void groupChatButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_groupChatButtonActionPerformed
new Thread() {
@Override
public void run() {
try {
new HandleGroupChat().doInBackground();
} catch (Exception e) {
e.printStackTrace();
}
}
}.start();// TODO add your handling code here:
}//GEN-LAST:event_groupChatButtonActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new MainWindow().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JList connectedComputersList;
private javax.swing.JButton groupChatButton;
private javax.swing.JLabel ipAddressValueLabel;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JButton privateChatButton;
// End of variables declaration//GEN-END:variables
}
| [
"varunon9@gmail.com"
] | varunon9@gmail.com |
56293730afb64c8b182c9f6b3b14f795aecf3193 | 9bce372edf6c9b2e528f98faa2acb71b68390f3f | /src/main/java/com/cqt/Customer.java | 6d0224976b9ff33926f139bafa85deaaef470a34 | [] | no_license | chenjun-feng/CQTProjects | e0edc3721948fe864cc2511a8b7142e5f6cbee8b | fd3e80ca20843780ea5fbc30604ffbe8600aea7f | refs/heads/master | 2020-04-12T05:18:42.297941 | 2018-12-18T17:20:36 | 2018-12-18T17:20:36 | 162,322,474 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 674 | java | package com.cqt;
import lombok.*;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Entity(name = "customers")
public class Customer {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(updatable = false, nullable = false)
private Long c_id;
private String c_name;
private String c_password;
private String c_email;
private boolean c_status;
@OneToMany(mappedBy = "o_customer")
private List<Order> c_orders = new ArrayList<>();
@OneToMany(mappedBy = "q_customer")
private List<Query> c_queries = new ArrayList<>();
}
| [
"31934597+chenjun-feng@users.noreply.github.com"
] | 31934597+chenjun-feng@users.noreply.github.com |
522ee831a209ddf8be2a4fe856e6895c9b9c3620 | 6f8438245f0dfc0fed64d4447ba3ab8529351331 | /module3/thi2/src/common/DateException.java | b301270c569f1d379e05f9570327a4344504e9a4 | [] | no_license | phuccode/C0920G1-LeNguyenDinhPhuc | 9be4ec5ef9b452d3b2406c1e2611b30322854495 | 38c893259ebb19e6b57c7198b7f4a986ed9e2bc6 | refs/heads/master | 2023-03-20T13:09:26.545905 | 2021-03-04T12:07:19 | 2021-03-04T12:07:19 | 295,308,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 139 | java | package common;
public class DateException extends Exception {
public DateException (String message){
super(message);
}
}
| [
"phucle.110898@gmail.com"
] | phucle.110898@gmail.com |
3d31c3f6622ff7d294ae5bcadf47bf95cfc27bc3 | 16efd5d370f3562c2caa41285a9bc6809e2f210e | /app/src/main/java/com/eme/mas/customeview/CenterImageSpan.java | 1db3eb263771818cb0b4f492f5236d951e4c137a | [] | no_license | chenmowl/Mas | 972c89c477618577fd96628d6cd5a491793e5dbe | cc02d4c702620d1ffb8dfa86d14b1c1b2527619b | refs/heads/master | 2020-12-13T04:32:36.407065 | 2017-06-26T06:50:55 | 2017-06-26T06:50:55 | 95,416,792 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,583 | java | package com.eme.mas.customeview;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.style.ImageSpan;
/**
* 自定义ImageSpan
* <p/>
* 与textview中字体水平对齐
* <p/>
* Created by dijiaoliang on 16/8/8.
*/
public class CenterImageSpan extends ImageSpan {
public CenterImageSpan(Context arg0, int arg1) {
super(arg0, arg1);
}
public int getSize(Paint paint, CharSequence text, int start, int end,
Paint.FontMetricsInt fm) {
Drawable d = getDrawable();
Rect rect = d.getBounds();
if (fm != null) {
Paint.FontMetricsInt fmPaint = paint.getFontMetricsInt();
int fontHeight = fmPaint.bottom - fmPaint.top;
int drHeight = rect.bottom - rect.top;
int top = drHeight / 2 - fontHeight / 4;
int bottom = drHeight / 2 + fontHeight / 4;
fm.ascent = -bottom;
fm.top = -bottom;
fm.bottom = top;
fm.descent = top;
}
return rect.right;
}
@Override
public void draw(Canvas canvas, CharSequence text, int start, int end,
float x, int top, int y, int bottom, Paint paint) {
Drawable b = getDrawable();
canvas.save();
int transY = 0;
transY = ((bottom - top) - b.getBounds().bottom) / 2 + top;
canvas.translate(x, transY);
b.draw(canvas);
canvas.restore();
}
}
| [
"15901267518@163.com"
] | 15901267518@163.com |
5cb050ec498ae7f023741dcda419036bb94fada6 | d1a6d1e511df6db8d8dd0912526e3875c7e1797d | /genny_JavaWithoutLambdas/applicationModule/src/main/java/applicationModulepackageJava0/Foo339.java | 75a84382402d5482a07161599d4cf730e35ece1f | [] | 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 | 346 | java | package applicationModulepackageJava0;
public class Foo339 {
public void foo0() {
new applicationModulepackageJava0.Foo338().foo5();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
}
| [
"nikita.e.kozlov@gmail.com"
] | nikita.e.kozlov@gmail.com |
84041a0d025d06132a772a13f8d60da627e4b7ea | 1ed1aa28ff95c9a2c08beee82e08947b4cd594f0 | /src/main/java/application/spring/entity/PersistentEntity.java | 4442dc26b79d40e421763d30e6b435e5d90bc86d | [] | no_license | panaram1ks/myProject | af74c0a94106c90377dc17daf16faff644f81fab | 9f9579d4801ec23d0abd959a7b487cc458dec270 | refs/heads/main | 2023-05-25T20:36:29.858518 | 2021-06-08T16:33:55 | 2021-06-08T16:33:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | package application.spring.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
@Data
@MappedSuperclass
public abstract class PersistentEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@EqualsAndHashCode.Include
protected Integer id;
} | [
"parom.evgen@mail.ru"
] | parom.evgen@mail.ru |
b9f4e286dea14cadb53ef31fa153ce0269f97193 | d30524e69143e837c14cbd6b814047525695b7b4 | /library/src/main/java/com/ppma/util/RegexUtils.java | d7c957283a3e6b49a511c3d157f1f0cbb1ab73ac | [] | no_license | betty2020/ppma | 8bead1d25ae3e836dc0e014fe75d88c5b1dbcee3 | 8dc053e7e15ec66eaa78724822d9e54c5b505639 | refs/heads/master | 2021-06-01T06:05:56.428983 | 2016-06-08T13:52:54 | 2016-06-08T13:52:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package com.ppma.util;
/**
* Created by keidao on 9/20/15.
*/
public class RegexUtils {
public static String removeNonDigits(String str) {
if (str == null || str.length() == 0) {
return "";
}
return str.replaceAll("[^0-9]+", "");
}
}
| [
"keidao@naver.com"
] | keidao@naver.com |
e7671f239d07bcb6e25188879bfc62b0d78e1616 | 79890d7079ed73d24fbf64be18b21f37f4fec75b | /src/com/skidgame/cosmicloaf/game/TheCosmicLoafGame.java | e1a02a0123a19f4c65b792eae4818237b5b98549 | [] | no_license | emaicus/The-Cosmic-Loaf | 86cf56d6f58076b7578153eb97c4e9079da7d4de | 05b5b97870e2c622c1baf6565af8fac3520bd417 | refs/heads/master | 2020-12-03T09:27:10.798280 | 2017-06-28T02:53:21 | 2017-06-28T02:53:21 | 95,621,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,003 | java | /**
*
*/
package com.skidgame.cosmicloaf.game;
import java.awt.Font;
import java.util.ArrayList;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.ARBShaderObjects;
import org.lwjgl.opengl.GL11;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.ShapeFill;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.Sound;
import org.newdawn.slick.TrueTypeFont;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.geom.Shape;
import com.skidgame.cosmicloaf.CosmicMain;
import com.skidgame.cosmicloaf.Level;
import com.skidgame.cosmicloaf.systems.AiInputSystem;
import com.skidgame.cosmicloaf.systems.InputSystem;
import com.skidgame.cosmicloaf.systems.InteractionSystem;
import com.skidgame.cosmicloaf.systems.RenderSystem;
//import com.skidgame.cosmicloaf.systems.AiInputSystem;
import com.skidgame.cosmicloaf.assets.Assets;
import com.skidgame.cosmicloaf.components.Coordinate;
import com.skidgame.cosmicloaf.components.Entity;
import com.skidgame.cosmicloaf.components.GUIDataComponent;
import com.skidgame.cosmicloaf.components.GUIElementTypes;
import com.skidgame.cosmicloaf.components.Position;
import com.skidgame.cosmicloaf.components.Trigger;
import com.skidgame.cosmicloaf.constants.EmotionEnum;
import com.skidgame.cosmicloaf.game.SkidmoreGameWorldLoader;
/**
* @author Theko Lekena
*
*/
public class TheCosmicLoafGame extends Game{
public final byte MAIN_MENU = 0;
public final byte IN_GAME = 1;
public final byte GAME_MENU = 2;
public final byte CUTSCENE = 3;
public int currentWidth;
public int currentHeight;
private final int SQUARE_HEIGHT = 32;
private final int SQUARE_WIDTH = 32;
private Level currentLevel;
public final static int walken = 1;
private final int HASH_DEFINITION = 32;
public byte state;
private SaveFile sf;
public ArrayList<Entity> mainMenu = new ArrayList<Entity>();
public ArrayList<Entity> gameMenu = new ArrayList<Entity>();
public static int menuOptionSelected;
public static Font font;
public static TrueTypeFont ttf;
public GUI gui;
private Camera gameCamera;
private Camera menuCamera;
// private Camera testCamera;
public boolean displayTextBox = false;
private String currentText = "";
public Sound currentMusic;
/** The dialog tree that we are currently evaluating */
private DialogTree currentDialogTree;
/**The dialog that is currently playing */
private Dialog currentDialog; //Only one voice can play at a time (seems reasonable, actually).
/**The Entity that was clicked on. */
private Entity responder;
/**The Entity that clicked interacted */
private Entity initiator;
/**Freezes the player if necessary (Not used by dialog) */
public boolean freezePlayer;
/**states whether or not the player is evaluating a dialog menu */
public boolean inDialogMenu;
/**The dialog menu the player is evaluating. */
private ArrayList<Entity> currentDialogMenu;
/**Keeps track of the switch between initiator and responder talking. */
private boolean initiatorTalking;
/** Menu Mike is a brave and valiant Entity, who enables initial menu interaction. */
private Entity MenuMike;
private ArrayList<Entity> mikesArrayList = new ArrayList<Entity>();
/** Flushed once per tick.*/
private ArrayList<Entity> toDestroy = new ArrayList<Entity>();
/** Added once per tick. */
private ArrayList<Entity> toAdd = new ArrayList<Entity>();
/**Added once per tick. */
private ArrayList<Trigger> triggersToAdd = new ArrayList<Trigger>();
public TheCosmicLoafGame()
{
super();
Assets.LoadAssets();
font = new Font("Verdana", Font.BOLD, 16);
ttf = new TrueTypeFont(font, true);
this.state = MAIN_MENU;
mainMenu = Assets.loadMainMenu(this);
gameMenu = Assets.loadGameMenu(this);
sf = new SaveFile();
Keyboard.enableRepeatEvents(true);
menuCamera = new Camera(this);
MenuMike = SkidmoreGameWorldLoader.loadMenuMike();
mikesArrayList.add(MenuMike);
currentWidth = CosmicMain.width;
currentHeight = CosmicMain.height;
try {
currentMusic = new Sound("SFX/Market_night_m.wav");
} catch (SlickException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void loadLevel(int level, SaveFile saveFile)
{
gameCamera = new Camera(CosmicMain.height / 4, CosmicMain.width / 4, CosmicMain.width, CosmicMain.height, 0, 0, true, null, this, 128, 128, 1f);
currentLevel = SkidmoreGameWorldLoader.loadLevel(level, this, saveFile, gameCamera, true);
loadGUI(level);
gameCamera.track(currentLevel.getPlayer().get(0));
gameCamera.center();
gameCamera.computeVisible();
}
public void getInput()
{
if(this.state == IN_GAME)
{
if(!inDialogMenu)
{
InteractionSystem.process(currentLevel.getEntities(), this, currentLevel, gameCamera);
InputSystem.process(currentLevel.getEntities(), this, currentLevel, gameCamera);
AiInputSystem.updatePaths(currentLevel.getEntities(), currentLevel, gameCamera, this);
}
else
{
InputSystem.processMenu(currentDialogMenu, this, currentLevel.getPlayer().get(0));
}
}
else if(this.state == MAIN_MENU)
{
if(currentLevel == null)
{
InputSystem.processMenu(mainMenu, this, MenuMike);
}
else
{
InputSystem.processMenu(mainMenu, this, currentLevel.getPlayer().get(0));
}
}
else if(this.state == GAME_MENU)
{
InputSystem.processMenu(gameMenu, this, currentLevel.getPlayer().get(0));
}
}
public void update()
{
if(currentLevel == null)
{
InputSystem.update(mikesArrayList);
}
else
{
InputSystem.update(currentLevel.getPlayer());
AiInputSystem.process(currentLevel.getEntities(), this, currentLevel, gameCamera);
}
if(this.state == IN_GAME)
{
if(triggersToAdd.size() != 0)
{
for(Trigger t : triggersToAdd)
{
currentLevel.getTriggers().add(t);
}
triggersToAdd = new ArrayList<Trigger>();
}
gameCamera.update();
// testCamera.update();
gui.update(this, menuCamera);
updateTriggers();
if(toDestroy.size() > 0)
{
flushEntities();
}
if(toAdd.size() > 0)
{
performAddEntities();
}
soundUpdate();
}
//TODO Fix AI.
// aiInputSystem.updatePaths(currentLevel.getEntities(), currentLevel);
}
private void updateTriggers() {
for(Trigger trig : currentLevel.getTriggers())
{
trig.update(this);
//System.out.println("Testing");
if(trig.readyToFire && !trig.Fired)
{
System.out.println("Fire!");
trig.fire(this, gameCamera);
trig.active = false; //For now, we just turn off a trigger after it fires.
}
}
}
public void render()
{
if(this.state == IN_GAME)
{
RenderSystem.renderTiledMap(this, gameCamera);
RenderSystem.renderTerrain(currentLevel.getTerrain(), Assets.getSpriteSheets(), gameCamera, this);
RenderSystem.process(currentLevel.getEntityBySheet(), Assets.getSpriteSheets(), gameCamera, this);
handleDialogAndGUI();
ARBShaderObjects.glUseProgramObjectARB(CosmicMain.program);
GL11.glLoadIdentity();
GL11.glTranslatef(0.0f, 0.0f, -10.0f);
GL11.glColor3f(1.0f, 1.0f, 1.0f);//white
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex3f(-1.0f, 1.0f, 0.0f);
GL11.glVertex3f(1.0f, 1.0f, 0.0f);
GL11.glVertex3f(1.0f, -1.0f, 0.0f);
GL11.glVertex3f(-1.0f, -1.0f, 0.0f);
GL11.glEnd();
ARBShaderObjects.glUseProgramObjectARB(0);
}
else if(this.state == MAIN_MENU)
{
RenderSystem.process(mainMenu, Assets.getSpriteSheets(), menuCamera, this);
}
else if(this.state == GAME_MENU)
{
RenderSystem.process(gameMenu, Assets.getSpriteSheets(), menuCamera, this);
}
}
/**
* Renders/play's dialog and renders the GUI (unfortunately, the GUI must be rendered in a very specific order,
* so this must be done all together in one method).
*/
private void handleDialogAndGUI()
{
if(currentDialog!= null && currentDialog.getInitiatorDialog() != null)
{
if((!currentDialog.getInitiatorDialog().playing()) && initiatorTalking)
{
initiatorTalking = false;
if(currentDialog.getResponderDialog() != null)
{
currentDialog.getInitiatorDialog().stop();
currentDialog.getResponderDialog().play();
currentText = currentDialog.getResponderSubtitle();
}
}
if (currentDialog.getInitiatorDialog().playing() && initiatorTalking)
{
if(currentDialog.getResponderDialog() != null && currentDialog.getResponderDialog().playing())
{
System.out.println("They are both talking at the same time.");
// currentDialog.getResponderDialog().stop();
}
}
if(currentDialog.getInitiatorDialog().playing() && !initiatorTalking)
{
currentDialog.getInitiatorDialog().stop();
}
}
float widthFloat = currentWidth;
float scale = (float) ((widthFloat/1920));
float headScale = scale * .65f;
float boxHeight = (float) (400 * scale *.85);
if(currentDialog!= null && ((currentDialog.getInitiatorDialog() != null && currentDialog.getInitiatorDialog().playing()) || (currentDialog.getResponderDialog() != null && currentDialog.getResponderDialog().playing())))
{
Graphics g = CosmicMain.myGraphics;
Rectangle r = new Rectangle(0, currentHeight - boxHeight, currentWidth, boxHeight);
Color c = new Color(0, 0, 0, .75f);
g.setColor(c);
g.fill(r);
}
RenderSystem.renderGUIText(gui.getElements(), menuCamera/* displayTextBox, currentText*/);
if(inDialogMenu)
{
RenderSystem.process(currentDialogMenu, Assets.getSpriteSheets(), menuCamera, this);
}
if(currentDialog!= null && ((currentDialog.getInitiatorDialog() != null && currentDialog.getInitiatorDialog().playing()) || (currentDialog.getResponderDialog() != null && currentDialog.getResponderDialog().playing())))
{
Image myFace = responder.getArt().faces.get(currentDialog.getMyEmotion());
if(myFace == null)
{
myFace = responder.getArt().faces.get(EmotionEnum.NEUTRAL);
if(myFace != null)
{
if(currentDialog.getResponderDialog().playing())
{
// System.out.println("Render 1");
myFace.draw((currentWidth- (myFace.getWidth() *headScale)), currentHeight - (((float)myFace.getHeight())* headScale), headScale);
}
else
{
// System.out.println("Render 2");
myFace.draw((currentWidth- (myFace.getWidth() *headScale)), currentHeight - (((float)myFace.getHeight())* headScale), headScale, Color.gray);
}
}
}
else
{
if(currentDialog.getResponderDialog().playing())
{
// System.out.println("Render 3");
myFace.draw((currentWidth- (myFace.getWidth() *headScale)), currentHeight - (((float)myFace.getHeight())* headScale), headScale);
}
else
{
// System.out.println("Render 4");
myFace.draw((currentWidth- (myFace.getWidth() *headScale)), currentHeight - (((float)myFace.getHeight())* headScale), headScale, Color.gray);
}
}
if(initiator != null)
{
Image playerFace = initiator.getArt().faces.get(currentDialog.getMyEmotion());
if(playerFace == null)
{
System.out.println("Trying to get emotion");
playerFace = initiator.getArt().faces.get(EmotionEnum.NEUTRAL);
if(playerFace != null)
{
if(currentDialog.getInitiatorDialog().playing())
{
playerFace.draw(0, currentHeight - (((float)playerFace.getHeight())* headScale), headScale);
}
else
{
playerFace.draw(0, currentHeight - (((float)playerFace.getHeight())* headScale), headScale, Color.gray);
}
}
}
else
{
if(currentDialog.getInitiatorDialog() != null && currentDialog.getInitiatorDialog().playing())
{
playerFace.draw(0, currentHeight - (((float)playerFace.getHeight())* headScale), headScale);
}
else
{
playerFace.draw(0, currentHeight - (((float)playerFace.getHeight())* headScale), headScale, Color.gray);
}
}
}
// currentText = currentDialog.getResponderSubtitle();
// System.out.println(currentText);
displayTextBox = true;
}
else
{
if(currentDialog != null)
{
this.wipeDialogMenu();
}
}
}
public void soundUpdate()
{
if(currentMusic != null)
{
if(!currentMusic.playing())
{
currentMusic.playAt(1f,.15f, 1, 1, 1);
}
}
}
public Level getCurrentLevel()
{
return this.currentLevel;
}
public void saveGame()
{
sf.writeOutFile("res/save.txt", this, gameCamera);
}
public void loadGame()
{
sf.readInFile("res/save.txt");
System.out.println(sf.getCurrentLevel());
System.out.println(sf.getMainCharacterBox());
loadLevel(sf.getCurrentLevel(), sf);
state = IN_GAME;
}
private void loadGUI(int level) {
ArrayList<Entity> elements = new ArrayList<Entity>();
switch (level)
{
case 1:
{
Position p = new Position(this, new Coordinate(0,0));
GUIDataComponent gdc = new GUIDataComponent("0", GUIElementTypes.PLAYER_BOX_COORD);
Entity e = new Entity(p, gdc);
GUIDataComponent textBox = new GUIDataComponent("test text", GUIElementTypes.TEXT_BOX);
Entity e2 = new Entity(textBox);
Position fpsPos = new Position(this, new Coordinate(0, 32));
GUIDataComponent fps = new GUIDataComponent("0", GUIElementTypes.FPS, 0, System.nanoTime());
Entity e3 = new Entity(fps, fpsPos);
elements.add(e);
elements.add(e2);
elements.add(e3);
break;
}
default:
{
Position p = new Position(this, new Coordinate(0,0));
GUIDataComponent gdc = new GUIDataComponent("0", GUIElementTypes.PLAYER_BOX_COORD);
Entity e = new Entity(p, gdc);
GUIDataComponent textBox = new GUIDataComponent("test text", GUIElementTypes.TEXT_BOX);
Entity e2 = new Entity(textBox);
elements.add(e);
elements.add(e2);
break;
}
}
gui = new GUI(elements);
}
public void closeRequested()
{
//TODO request save.
System.exit(0);
}
public SaveFile getSaveFile()
{
return this.sf;
}
public void removeEntity(Entity me) {
toDestroy.add(me);
}
private void flushEntities()
{
this.currentLevel.removeEntities(toDestroy, this, gameCamera);
toDestroy = new ArrayList<Entity>();
}
public void addEntity(Entity e) {
toAdd.add(e);
}
private void performAddEntities()
{
System.out.println("Performing add entities.");
currentLevel.addEntities(toAdd, this, gameCamera);
toAdd = new ArrayList<Entity>();
}
public void addTrigger(Trigger t)
{
triggersToAdd.add(t);
}
public int getAdjustedHashDefinitions(Camera c)
{
return (int) (this.HASH_DEFINITION * c.getZoom());
}
public int getAdjustedSquareWidth(Camera c)
{
return (int) (this.SQUARE_WIDTH * c.getZoom());
}
public int getAdjustedSquareHeight(Camera c)
{
return (int) (this.SQUARE_HEIGHT * c.getZoom());
}
public Camera getGameCamera() {
return this.gameCamera;
}
public int getLiteralSquareHeight() {
return this.SQUARE_HEIGHT;
}
public int getLiteralSquareWidth() {
return this.SQUARE_WIDTH;
}
public int getLiteralHashDefinition() {
return this.HASH_DEFINITION;
}
public void processDialogOptions(Entity target)
{
processDialogOptions(target, null);
}
public void processDialogOptions(Entity target, Entity targeting)
{
this.responder = target;
DialogTree tree = target.getInteractible().getMyTree();
currentDialogMenu = Assets.generateDialogMenu(tree, this);
this.currentDialogTree = tree;
this.inDialogMenu = true;
this.initiator = targeting;
}
public void setCurrentDialog(Dialog dialog)
{
if(currentDialog != null)
{
if(currentDialog.getInitiatorDialog() != null && currentDialog.getInitiatorDialog().playing())
{
this.currentDialog.getInitiatorDialog().stop();
}
if(currentDialog.getResponderDialog() != null && currentDialog.getResponderDialog().playing())
{
this.currentDialog.getResponderDialog().stop();
}
}
currentDialog = dialog;
}
public void playCurrentDialog()
{
System.out.println("Playing dialog.");
if(currentDialog != null)
{
if(currentDialog.getInitiatorDialog() != null && currentDialog.getInitiatorDialog().playing())
{
this.currentDialog.getInitiatorDialog().stop();
System.out.println("Stopped initiator");
}
if(currentDialog.getResponderDialog() != null && currentDialog.getResponderDialog().playing())
{
this.currentDialog.getResponderDialog().stop();
System.out.println("Stopped responder");
}
}
initiatorTalking = false;
if(currentDialog.getInitiatorDialog() != null)
{
if(!this.currentDialog.getInitiatorDialog().playing())
{
this.currentDialog.getInitiatorDialog().play();
initiatorTalking = true;
this.currentText = currentDialog.getInitiatorSubtitle();
}
}
else if(currentDialog.getResponderDialog() != null)
{
if(!this.currentDialog.getResponderDialog().playing())
{
currentDialog.getResponderDialog().play();
this.currentText = currentDialog.getResponderSubtitle();
}
}
}
public DialogTree getCurrentDialogTree()
{
return this.currentDialogTree;
}
public Entity getTargetedEntity()
{
return this.responder;
}
public void setTargetedEntity(Entity e)
{
this.responder = e;
}
public void wipeDialogMenu()
{
// if(currentDialog != null)
// {
// if(currentDialog.getInitiatorDialog() != null)
// {
// if(currentDialog.getInitiatorDialog().playing())
// {
// currentDialog.getInitiatorDialog().stop();
// }
// }
// if(currentDialog.getResponderDialog() != null)
// {
// if(currentDialog.getResponderDialog().playing())
// {
// currentDialog.getResponderDialog().stop();
// }
// }
// }
//currentDialogTree = null;
//currentDialog = null; //Only one voice can play at a time (seems reasonable, actually).
//responder = null;
//initiator = null;
//inDialogMenu = false;
//currentDialogMenu = null;
currentText = "";
}
public String getCurrentText()
{
return this.currentText;
}
public void setCurrentText(String currentText)
{
this.currentText = currentText;
}
}
| [
"emaicus@skidmore.edu"
] | emaicus@skidmore.edu |
709daddfa2dc02d6b0461b72ee43c40e9c145da0 | 1d3bfaa5732c5df3320eb54106484608f6dd58e6 | /src/main/java/com/ebizprise/das/scheduled/service/weather/RestService.java | f37af1b5ac57dcdbfd56ca3cf9f37a8f719a5b23 | [] | no_license | jackylee101/outsidemaster | 6d145670db2ac0475bff874c3acf3f444ca8fa2b | ef61e629cedd39d98e7ec2ecd10944f38c8668db | refs/heads/master | 2022-09-15T07:54:43.257317 | 2019-08-12T02:35:01 | 2019-08-12T02:35:01 | 188,179,487 | 0 | 0 | null | 2022-09-01T23:07:19 | 2019-05-23T07:02:00 | Java | UTF-8 | Java | false | false | 183 | java | package com.ebizprise.das.scheduled.service.weather;
/*
*
* @author Jacky
* @date 09/11/2018 10:35 AM
* @email jacky.lee@ebizprise.com
*
* */
public interface RestService {
}
| [
"jacky@DESKTOP-JPTTF2G.mshome.net"
] | jacky@DESKTOP-JPTTF2G.mshome.net |
41e85ce622b8612ccce4b5a88dcd204aa2c86742 | 7ed899a5afb3e3e4e7e6b68a4bac848a03fe7bf9 | /rxlib/src/main/java/idoool/com/httplib/AppLib.java | c9cfae3255fdc827ca83c7da0baa38305bfafb08 | [] | no_license | wzsharecode/Channel | 519e416903746623eae81f3d571bd2d24df144b0 | 0b1fb6b8528094b0ae6abe13a19913c255ead6ed | refs/heads/master | 2021-05-08T20:50:03.635659 | 2018-03-28T03:17:38 | 2018-03-28T03:17:38 | 119,620,707 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | package idoool.com.httplib;
import idoool.com.baselib.BaseApplication;
/**
* @author: wangdeshun
* @date: 2018/1/18 11:22
* @description: 创建AppLib
*/
public class AppLib extends BaseApplication {
@Override
public void onCreate() {
super.onCreate();
}
}
| [
"wangdeshun_com@163.com"
] | wangdeshun_com@163.com |
e0a56551cc138c449706ff08fdc92fc054d5f314 | 8b18f4dbe414cda5b7c3949f0d2c0478b1a7b973 | /java/src/main/de/r13g/lib/ArrayTools.java | ece20b7b572badf4f2a06ac1f816a9d31f53c0e2 | [] | no_license | RagingLightning/if-school | fc1e761423c3df1412ebe3db911c55332c144837 | 4c7ebcb4d938a89da35525a0f2fb4c34e016a36f | refs/heads/master | 2021-06-23T21:54:58.092343 | 2021-03-19T09:05:14 | 2021-03-19T09:05:14 | 205,318,196 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,385 | java | package de.r13g.lib;
public class ArrayTools {
/**
* determines the lowest value inside the given Array
*
* @param array the array to be analyzed
* @return the lowest value inside the array
*/
public static int min(Integer[] array) {
int min = Integer.MAX_VALUE;
for (int x : array) {
min = x < min ? x : min;
}
return min;
}
/**
* determines the index of the lowest value inside the array
*
* @param array the array to be anayzed
* @return the array index with the lowest value
*/
public static int minIndex(Integer[] array) {
int minIdx = 0;
for (int i = 0; i < array.length; i++) {
minIdx = array[i] < array[minIdx] ? i : minIdx;
}
return minIdx;
}
/**
* determines the highest value inside the given array
*
* @param array the array to be analyzed
* @return the highest value in the array
*/
public static int max(Integer[] array) {
int max = Integer.MIN_VALUE;
for(int x : array) {
max = x > max ? x : max;
}
return max;
}
/**
* determines the index with the lowest value in the given array
*
* @param array the array to be analyzed
* @return the array index with the highest value
*/
public static int maxIndex(Integer[] array) {
int maxIdx = 0;
for (int i = 0; i < array.length; i++) {
maxIdx = array[i] > array[maxIdx] ? i : maxIdx;
}
return maxIdx;
}
/**
* calculates the sum of all values in the given array
*
* @param array the array of values that get summed up
* @return the sum of all values
*/
public static int sum(Integer[] array) {
int sum = 0;
for (int x : array) {
sum += x;
}
return sum;
}
/**
* calculates the average of all values in a given array
*
* @param array the array with values to be averaged
* @return the average of all values
*/
public static double avg(Integer[] array) {
int sum = sum(array);
return sum*1.0 / array.length;
}
/**
* reverses a given array
*
* @param array array to be reversed
* @return reversed array
*/
public static int[] reverse(Integer[] array) {
int[] reversed = new int[array.length];
for (int i = 0; i < array.length; i++)
{
reversed[array.length-1-i] = array[i];
}
return reversed;
}
}
| [
"RagingLightningCode@gmail.com"
] | RagingLightningCode@gmail.com |
593b963473762a1e15f25e9aa57036458ee6d508 | bd2b71330aa1929a0f4ebeea1c04b702e2812afe | /needDeal/src4_08/main/java/com/example/administrator/myparkingos/ui/onlineMonitorPage/ParkingInNoPlateView.java | b4e9f197bac046ccebaf2e96a2c3cac7d8440a99 | [] | no_license | zihanbobo/myC- | 1b67c4a620567fdbe70ef10fee29abd5010ffe41 | eafbc7c4eca489004905e8ce155f01504419141d | refs/heads/master | 2021-06-15T10:07:20.645286 | 2017-04-08T10:31:36 | 2017-04-08T10:31:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,949 | java | package com.example.administrator.myparkingos.ui.onlineMonitorPage;
import android.app.Activity;
import android.app.Dialog;
import android.graphics.Bitmap;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.Toast;
import com.example.administrator.mydistributedparkingos.R;
import com.example.administrator.myparkingos.model.requestInfo.SetCarInWithoutCPHReq;
import com.example.administrator.myparkingos.myUserControlLibrary.niceSpinner.NiceSpinner;
import com.example.administrator.myparkingos.myUserControlLibrary.radioBtn.FlowRadioGroup;
import com.example.administrator.myparkingos.util.BitmapUtils;
import com.example.administrator.myparkingos.util.CommUtils;
import com.example.administrator.myparkingos.util.L;
import com.example.administrator.myparkingos.util.RegexUtil;
import com.example.administrator.myparkingos.util.T;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Created by Administrator on 2017-03-10.
*/
public class ParkingInNoPlateView implements View.OnClickListener
{
private Dialog dialog;
private NiceSpinner spinnerColor;
private NiceSpinner spinnerCarBrand;
private Button btnAdd;
private Spinner spinnerProvince;
private EditText etInputCarNo;
private NiceSpinner spinnerRoadName;
private Button btnCancel;
private ImageView imagePicture;
private Activity mActivity;
private ArrayAdapter colorAdapter;
private ArrayAdapter provinceAdapter;
private ArrayAdapter brandAdapter;
private ArrayList<String> roadList;
private ArrayAdapter roadAdapter;
public ParkingInNoPlateView(Activity activity)
{
mActivity = activity;
dialog = new Dialog(activity); // @android:style/Theme.Dialog
dialog.setContentView(R.layout.parkingin_noplate);
dialog.setCanceledOnTouchOutside(true);
Window window = dialog.getWindow();
WindowManager m = activity.getWindowManager();
Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
WindowManager.LayoutParams p = window.getAttributes(); // 获取对话框当前的参数值
p.height = (int) (d.getHeight() * 2 / 3); // 改变的是dialog框在屏幕中的位置而不是大小
p.width = (int) (d.getWidth() * 1 / 3); // 宽度设置为屏幕的0.65
window.setAttributes(p);
initView();
dialog.getWindow().setBackgroundDrawableResource(R.drawable.parkdowncard_background);
dialog.setTitle(activity.getResources().getString(R.string.parkMontior_unlicensedVehicleAdmission));
}
private void initView()
{
spinnerColor = (NiceSpinner) dialog.findViewById(R.id.spinnerColor);
spinnerCarBrand = (NiceSpinner) dialog.findViewById(R.id.spinnerCarBrand);
btnAdd = (Button) dialog.findViewById(R.id.btnAdd);
spinnerProvince = (Spinner) dialog.findViewById(R.id.spinnerProvince);
etInputCarNo = (EditText) dialog.findViewById(R.id.etInputCarNo);
spinnerRoadName = (NiceSpinner) dialog.findViewById(R.id.spinnerRoadName);
btnCancel = (Button) dialog.findViewById(R.id.btnCancel);
imagePicture = (ImageView) dialog.findViewById(R.id.imagePicture);
btnAdd.setOnClickListener(this);
btnCancel.setOnClickListener(this);
String[] stringArray = mActivity.getResources().getStringArray(R.array.noPlateColor);
spinnerColor.refreshData(Arrays.asList(stringArray), 0);
provinceAdapter = new ArrayAdapter(mActivity.getApplicationContext(), R.layout.blacklist_spinner_province
, mActivity.getResources().getStringArray(R.array.provinceArray));
spinnerProvince.setAdapter(provinceAdapter);
String[] tempArray = mActivity.getResources().getStringArray(R.array.noPlateBrand);
spinnerCarBrand.refreshData(Arrays.asList(tempArray), 0);
spinnerRoadName.refreshData(roadList, 0);
final int charMaxNum = 6;// 个数;
etInputCarNo.addTextChangedListener(new TextWatcher()
{
private CharSequence temp;//监听前的文本
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after)
{
temp = s;
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
}
@Override
public void afterTextChanged(Editable s)
{
/** 得到光标开始和结束位置 ,超过最大数后记录刚超出的数字索引进行控制 */
int editStart = etInputCarNo.getSelectionStart();
int editEnd = etInputCarNo.getSelectionEnd();
L.i("editStart:" + editStart + ", editEnd:" + editEnd + "temp.length():" + temp.length());
String currentText = s.toString();
if (editStart == 0)
{
return;
}
String substring = currentText.substring(editStart - 1, editStart);
if (substring.equals("o") || substring.equals("i"))
{
Toast.makeText(mActivity, "你输入的字数含o或者i!", Toast.LENGTH_LONG).show();
s.delete(editStart - 1, editEnd);
etInputCarNo.setText(s);
etInputCarNo.setSelection(editStart - 1);
return;
}
if (temp.length() > charMaxNum)
{
Toast.makeText(mActivity, "你输入的字数已经超过了限制!", Toast.LENGTH_LONG).show();
s.delete(editStart - 1, editEnd);
int tempSelection = editStart;
etInputCarNo.setText(s);
etInputCarNo.setSelection(tempSelection - 1);
return;
}
}
});
}
/**
* 设置车道的数据
*
* @param inList
*/
public void setRoadNameData(List<String> inList)
{
if (inList == null || inList.size() <= 0)
{
return;
}
spinnerRoadName.refreshData(inList, 0);
}
/**
* 设置显示的图像数据
*/
public void setImage(String path)
{
Bitmap bitmap = BitmapUtils.fileToBitmap(path);
imagePicture.setImageBitmap(bitmap);
}
protected void onBtnOk(SetCarInWithoutCPHReq carInWithoutCPHReq, String roadName)
{
}
protected void onBtnCancel()
{
}
public void show()
{
if (dialog != null)
{
prepareLoadData();
dialog.show();
}
}
/**
* 提前加载数据
*/
public void prepareLoadData()
{
}
public void dismiss()
{
if (dialog != null && dialog.isShowing())
{
dialog.dismiss();
}
}
@Override
public void onClick(View v)
{
switch (v.getId())
{
case R.id.btnAdd:
{
String resultCPH = null;
String cph = etInputCarNo.getText().toString().trim();
L.i("cph:" + cph);
if (TextUtils.isEmpty(cph))
{
L.i("车牌为空");
}
else
{
String province = spinnerProvince.getSelectedItem().toString();
resultCPH = province + cph;
if (!CommUtils.CheckUpCPH(resultCPH))
{
T.showShort(mActivity, "车牌号码[" + resultCPH + "]不符号要求");
return;
}
}
SetCarInWithoutCPHReq setCarInWithoutCPHReq = new SetCarInWithoutCPHReq();
setCarInWithoutCPHReq.setCarColor(spinnerColor.getCurrentText());
setCarInWithoutCPHReq.setCarBrand(spinnerCarBrand.getCurrentText());
if (resultCPH != null)
setCarInWithoutCPHReq.setCPH(resultCPH);
onBtnOk(setCarInWithoutCPHReq, spinnerRoadName.getCurrentText());
break;
}
case R.id.btnCancel:
{
onBtnCancel();
break;
}
default:
{
break;
}
}
}
public void cleanCarNo()
{
etInputCarNo.setText("");
}
}
| [
"13265539954@163.com"
] | 13265539954@163.com |
6330b706ee5edb14a954982ec67acf17caf6d783 | 78d1a0b546bf296b6f1eeabce67924f1cd0ffc5e | /login/src/main/java/com/codebreak/login/database/account/impl/exception/AlreadyConnectedException.java | 9851cfe4f4502002bcfa9a4e92189258191038ea | [] | no_license | efwff/Dofus-1.29-emulator---Java | ea00c11b396569ae377c28bf309c9209aeed3f35 | fea036fb02060a2ed4b79d8b22f370ffba247528 | refs/heads/master | 2021-01-18T09:23:02.535015 | 2016-06-07T15:36:33 | 2016-06-07T15:36:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 361 | java | package com.codebreak.login.database.account.impl.exception;
import java.util.Optional;
import com.codebreak.login.persistence.tables.records.AccountRecord;
public final class AlreadyConnectedException extends AccountException {
public AlreadyConnectedException(Optional<AccountRecord> account) {
super(account, "This account is already connected");
}
}
| [
"hussein.aitlahcen@gmail.com"
] | hussein.aitlahcen@gmail.com |
c96e1743331e94871d7b4b2da8767e50605bbdc7 | c27109dce8ab2ee16fc08b28ef1748fb329357e7 | /Trees/TopViewOfBinaryTree.java | 133200591cdd768d607555a4d626d75c0d782937 | [] | no_license | mittalabhi/Data-Structures-and-Algorithms | 002736042c3afc830fc5d06713fd24ad560897b7 | 6a1423f368e8fee546e548a3a212081bec58e6fb | refs/heads/main | 2023-07-05T11:46:46.026972 | 2021-09-03T11:08:14 | 2021-09-03T11:08:14 | 374,652,424 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,949 | java | // { Driver Code Starts
//Initial Template for JAVA
import java.util.LinkedList;
import java.util.Queue;
import java.io.*;
import java.util.*;
class Node{
int data;
Node left;
Node right;
Node(int data){
this.data = data;
left=null;
right=null;
}
}
public class Tree {
static Node buildTree(String str){
if(str.length()==0 || str.charAt(0)=='N'){
return null;
}
String ip[] = str.split(" ");
// Create the root of the tree
Node root = new Node(Integer.parseInt(ip[0]));
// Push the root to the queue
Queue<Node> queue = new LinkedList<>();
queue.add(root);
// Starting from the second element
int i = 1;
while(queue.size()>0 && i < ip.length) {
// Get and remove the front of the queue
Node currNode = queue.peek();
queue.remove();
// Get the current node's value from the string
String currVal = ip[i];
// If the left child is not null
if(!currVal.equals("N")) {
// Create the left child for the current node
currNode.left = new Node(Integer.parseInt(currVal));
// Push it to the queue
queue.add(currNode.left);
}
// For the right child
i++;
if(i >= ip.length)
break;
currVal = ip[i];
// If the right child is not null
if(!currVal.equals("N")) {
// Create the right child for the current node
currNode.right = new Node(Integer.parseInt(currVal));
// Push it to the queue
queue.add(currNode.right);
}
i++;
}
return root;
}
static void printInorder(Node root)
{
if(root == null)
return;
printInorder(root.left);
System.out.print(root.data+" ");
printInorder(root.right);
}
public static void main (String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine());
while(t > 0){
String s = br.readLine();
Node root = buildTree(s);
Solution ob = new Solution();
ArrayList<Integer> vec = ob.topView(root);
for(int x : vec)
System.out.print(x + " ");
System.out.println();
t--;
}
}
}// } Driver Code Ends
//User function Template for Java
class Solution
{
//Function to return a list containing the bottom view of the given tree.
class Pair{
Node root;
int dis;
Pair(Node root,int dis){
this.root = root;
this.dis = dis;
}
}
public ArrayList <Integer> topView(Node root)
{
// Code here
int min = (int)1e9;
int max = -(int)1e9;
HashMap<Integer,ArrayList<Integer>> hm = new HashMap<>();
LinkedList<Pair> que = new LinkedList<>();
Pair newPair = new Pair(root,0);
que.addLast(newPair);
while(que.size() != 0){
int size = que.size();
while(size-- > 0){
Pair vtx = que.removeFirst();
Node newNode = vtx.root;
int dis = vtx.dis;
min = Math.min(min,dis);
max = Math.max(max,dis);
if(newNode.left != null){
Pair newPair2 = new Pair(newNode.left,dis - 1);
que.addLast(newPair2);
}
if(newNode.right != null){
Pair newPair2 = new Pair(newNode.right,dis + 1);
que.addLast(newPair2);
}
if(hm.containsKey(dis)){
ArrayList<Integer> arr = hm.get(dis);
arr.add(newNode.data);
hm.put(dis,arr);
}
else{
ArrayList<Integer> arr = new ArrayList<>();
arr.add(newNode.data);
hm.put(dis,arr);
}
}
}
//System.out.println(hm.size());
ArrayList<Integer> ans = new ArrayList<>();
for(int i = min; i <= max; i++){
ArrayList<Integer> res = hm.get(i);
// System.out.println(res);
ans.add(res.get(0));
}
return ans;
}
} | [
"40770647+mittalabhi@users.noreply.github.com"
] | 40770647+mittalabhi@users.noreply.github.com |
24a0f86e466fac2d2e55695bf5c7c8ad104d7af5 | bbebaa880d979b5005c39aaa16bd03a18038efab | /models/cinematic/plugins/org.obeonetwork.dsl.cinematic.editor/src/org/obeonetwork/dsl/cinematic/flow/presentation/FlowActionBarContributor.java | 588fc1b0b6bab2b0e08485b381eeb526866176dd | [] | no_license | Novi4ekik92/InformationSystem | 164baf6ec1da05da2f144787a042d85af81d4caa | 6387d3cf75efffee0c860ab58f7b8127140a5bb2 | refs/heads/master | 2020-12-11T09:07:38.255013 | 2015-01-05T16:52:58 | 2015-01-05T16:52:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,406 | java | /**
* Copyright (c) 2012 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Obeo - initial API and implementation
*/
package org.obeonetwork.dsl.cinematic.flow.presentation;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.emf.common.ui.viewer.IViewerProvider;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
import org.eclipse.emf.edit.ui.action.ControlAction;
import org.eclipse.emf.edit.ui.action.CreateChildAction;
import org.eclipse.emf.edit.ui.action.CreateSiblingAction;
import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
import org.eclipse.emf.edit.ui.action.LoadResourceAction;
import org.eclipse.emf.edit.ui.action.ValidateAction;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.SubContributionItem;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.obeonetwork.dsl.cinematic.presentation.CinematicEditorPlugin;
/**
* This is the action bar contributor for the Flow model editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class FlowActionBarContributor
extends EditingDomainActionBarContributor
implements ISelectionChangedListener {
/**
* This keeps track of the active editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IEditorPart activeEditorPart;
/**
* This keeps track of the current selection provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ISelectionProvider selectionProvider;
/**
* This action opens the Properties view.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IAction showPropertiesViewAction =
new Action(CinematicEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) {
@Override
public void run() {
try {
getPage().showView("org.eclipse.ui.views.PropertySheet");
}
catch (PartInitException exception) {
CinematicEditorPlugin.INSTANCE.log(exception);
}
}
};
/**
* This action refreshes the viewer of the current editor if the editor
* implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IAction refreshViewerAction =
new Action(CinematicEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) {
@Override
public boolean isEnabled() {
return activeEditorPart instanceof IViewerProvider;
}
@Override
public void run() {
if (activeEditorPart instanceof IViewerProvider) {
Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
if (viewer != null) {
viewer.refresh();
}
}
}
};
/**
* This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
* generated for the current selection by the item provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Collection<IAction> createChildActions;
/**
* This is the menu manager into which menu contribution items should be added for CreateChild actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IMenuManager createChildMenuManager;
/**
* This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor
* generated for the current selection by the item provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Collection<IAction> createSiblingActions;
/**
* This is the menu manager into which menu contribution items should be added for CreateSibling actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IMenuManager createSiblingMenuManager;
/**
* This creates an instance of the contributor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FlowActionBarContributor() {
super(ADDITIONS_LAST_STYLE);
loadResourceAction = new LoadResourceAction();
validateAction = new ValidateAction();
controlAction = new ControlAction();
}
/**
* This adds Separators for editor additions to the tool bar.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void contributeToToolBar(IToolBarManager toolBarManager) {
toolBarManager.add(new Separator("flow-settings"));
toolBarManager.add(new Separator("flow-additions"));
}
/**
* This adds to the menu bar a menu and some separators for editor additions,
* as well as the sub-menus for object creation items.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void contributeToMenu(IMenuManager menuManager) {
super.contributeToMenu(menuManager);
IMenuManager submenuManager = new MenuManager(CinematicEditorPlugin.INSTANCE.getString("_UI_FlowEditor_menu"), "org.obeonetwork.dsl.cinematic.flowMenuID");
menuManager.insertAfter("additions", submenuManager);
submenuManager.add(new Separator("settings"));
submenuManager.add(new Separator("actions"));
submenuManager.add(new Separator("additions"));
submenuManager.add(new Separator("additions-end"));
// Prepare for CreateChild item addition or removal.
//
createChildMenuManager = new MenuManager(CinematicEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
submenuManager.insertBefore("additions", createChildMenuManager);
// Prepare for CreateSibling item addition or removal.
//
createSiblingMenuManager = new MenuManager(CinematicEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
submenuManager.insertBefore("additions", createSiblingMenuManager);
// Force an update because Eclipse hides empty menus now.
//
submenuManager.addMenuListener
(new IMenuListener() {
public void menuAboutToShow(IMenuManager menuManager) {
menuManager.updateAll(true);
}
});
addGlobalActions(submenuManager);
}
/**
* When the active editor changes, this remembers the change and registers with it as a selection provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setActiveEditor(IEditorPart part) {
super.setActiveEditor(part);
activeEditorPart = part;
// Switch to the new selection provider.
//
if (selectionProvider != null) {
selectionProvider.removeSelectionChangedListener(this);
}
if (part == null) {
selectionProvider = null;
}
else {
selectionProvider = part.getSite().getSelectionProvider();
selectionProvider.addSelectionChangedListener(this);
// Fake a selection changed event to update the menus.
//
if (selectionProvider.getSelection() != null) {
selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
}
}
}
/**
* This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
* handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings
* that can be added to the selected object and updating the menus accordingly.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void selectionChanged(SelectionChangedEvent event) {
// Remove any menu items for old selection.
//
if (createChildMenuManager != null) {
depopulateManager(createChildMenuManager, createChildActions);
}
if (createSiblingMenuManager != null) {
depopulateManager(createSiblingMenuManager, createSiblingActions);
}
// Query the new selection for appropriate new child/sibling descriptors
//
Collection<?> newChildDescriptors = null;
Collection<?> newSiblingDescriptors = null;
ISelection selection = event.getSelection();
if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
Object object = ((IStructuredSelection)selection).getFirstElement();
EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
newChildDescriptors = domain.getNewChildDescriptors(object, null);
newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
}
// Generate actions for selection; populate and redraw the menus.
//
createChildActions = generateCreateChildActions(newChildDescriptors, selection);
createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
if (createChildMenuManager != null) {
populateManager(createChildMenuManager, createChildActions, null);
createChildMenuManager.update(true);
}
if (createSiblingMenuManager != null) {
populateManager(createSiblingMenuManager, createSiblingActions, null);
createSiblingMenuManager.update(true);
}
}
/**
* This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>,
* and returns the collection of these actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) {
Collection<IAction> actions = new ArrayList<IAction>();
if (descriptors != null) {
for (Object descriptor : descriptors) {
actions.add(new CreateChildAction(activeEditorPart, selection, descriptor));
}
}
return actions;
}
/**
* This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>,
* and returns the collection of these actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) {
Collection<IAction> actions = new ArrayList<IAction>();
if (descriptors != null) {
for (Object descriptor : descriptors) {
actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor));
}
}
return actions;
}
/**
* This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s
* based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection,
* by inserting them before the specified contribution item <code>contributionID</code>.
* If <code>contributionID</code> is <code>null</code>, they are simply added.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) {
if (actions != null) {
for (IAction action : actions) {
if (contributionID != null) {
manager.insertBefore(contributionID, action);
}
else {
manager.add(action);
}
}
}
}
/**
* This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
* based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) {
if (actions != null) {
IContributionItem[] items = manager.getItems();
for (int i = 0; i < items.length; i++) {
// Look into SubContributionItems
//
IContributionItem contributionItem = items[i];
while (contributionItem instanceof SubContributionItem) {
contributionItem = ((SubContributionItem)contributionItem).getInnerItem();
}
// Delete the ActionContributionItems with matching action.
//
if (contributionItem instanceof ActionContributionItem) {
IAction action = ((ActionContributionItem)contributionItem).getAction();
if (actions.contains(action)) {
manager.remove(contributionItem);
}
}
}
}
}
/**
* This populates the pop-up menu before it appears.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void menuAboutToShow(IMenuManager menuManager) {
super.menuAboutToShow(menuManager);
MenuManager submenuManager = null;
submenuManager = new MenuManager(CinematicEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
populateManager(submenuManager, createChildActions, null);
menuManager.insertBefore("edit", submenuManager);
submenuManager = new MenuManager(CinematicEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
populateManager(submenuManager, createSiblingActions, null);
menuManager.insertBefore("edit", submenuManager);
}
/**
* This inserts global actions before the "additions-end" separator.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void addGlobalActions(IMenuManager menuManager) {
menuManager.insertAfter("additions-end", new Separator("ui-actions"));
menuManager.insertAfter("ui-actions", showPropertiesViewAction);
refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
menuManager.insertAfter("ui-actions", refreshViewerAction);
super.addGlobalActions(menuManager);
}
/**
* This ensures that a delete action will clean up all references to deleted objects.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected boolean removeAllReferencesOnDelete() {
return true;
}
} | [
"hugo.marchadour@obeo.fr"
] | hugo.marchadour@obeo.fr |
6c6fd19410c4953ce5830f5d88a41dc088555750 | eef7304bde1aa75c49c1fe10883d5d4b8241e146 | /aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/DetachFromIndexRequest.java | 12c992a86219cd210c832083f2e16aef7a7f5c33 | [
"Apache-2.0"
] | permissive | C2Devel/aws-sdk-java | 0dc80a890aac7d1ef6b849bb4a2e3f4048ee697e | 56ade4ff7875527d0dac829f5a26e6c089dbde31 | refs/heads/master | 2021-07-17T00:54:51.953629 | 2017-10-05T13:55:54 | 2017-10-05T13:57:31 | 105,878,846 | 0 | 2 | null | 2017-10-05T10:51:57 | 2017-10-05T10:51:57 | null | UTF-8 | Java | false | false | 7,100 | java | /*
* Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.clouddirectory.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/clouddirectory-2016-05-10/DetachFromIndex" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DetachFromIndexRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
* <p>
* The Amazon Resource Name (ARN) of the directory the index and object exist in.
* </p>
*/
private String directoryArn;
/**
* <p>
* A reference to the index object.
* </p>
*/
private ObjectReference indexReference;
/**
* <p>
* A reference to the object being detached from the index.
* </p>
*/
private ObjectReference targetReference;
/**
* <p>
* The Amazon Resource Name (ARN) of the directory the index and object exist in.
* </p>
*
* @param directoryArn
* The Amazon Resource Name (ARN) of the directory the index and object exist in.
*/
public void setDirectoryArn(String directoryArn) {
this.directoryArn = directoryArn;
}
/**
* <p>
* The Amazon Resource Name (ARN) of the directory the index and object exist in.
* </p>
*
* @return The Amazon Resource Name (ARN) of the directory the index and object exist in.
*/
public String getDirectoryArn() {
return this.directoryArn;
}
/**
* <p>
* The Amazon Resource Name (ARN) of the directory the index and object exist in.
* </p>
*
* @param directoryArn
* The Amazon Resource Name (ARN) of the directory the index and object exist in.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DetachFromIndexRequest withDirectoryArn(String directoryArn) {
setDirectoryArn(directoryArn);
return this;
}
/**
* <p>
* A reference to the index object.
* </p>
*
* @param indexReference
* A reference to the index object.
*/
public void setIndexReference(ObjectReference indexReference) {
this.indexReference = indexReference;
}
/**
* <p>
* A reference to the index object.
* </p>
*
* @return A reference to the index object.
*/
public ObjectReference getIndexReference() {
return this.indexReference;
}
/**
* <p>
* A reference to the index object.
* </p>
*
* @param indexReference
* A reference to the index object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DetachFromIndexRequest withIndexReference(ObjectReference indexReference) {
setIndexReference(indexReference);
return this;
}
/**
* <p>
* A reference to the object being detached from the index.
* </p>
*
* @param targetReference
* A reference to the object being detached from the index.
*/
public void setTargetReference(ObjectReference targetReference) {
this.targetReference = targetReference;
}
/**
* <p>
* A reference to the object being detached from the index.
* </p>
*
* @return A reference to the object being detached from the index.
*/
public ObjectReference getTargetReference() {
return this.targetReference;
}
/**
* <p>
* A reference to the object being detached from the index.
* </p>
*
* @param targetReference
* A reference to the object being detached from the index.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DetachFromIndexRequest withTargetReference(ObjectReference targetReference) {
setTargetReference(targetReference);
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getDirectoryArn() != null)
sb.append("DirectoryArn: ").append(getDirectoryArn()).append(",");
if (getIndexReference() != null)
sb.append("IndexReference: ").append(getIndexReference()).append(",");
if (getTargetReference() != null)
sb.append("TargetReference: ").append(getTargetReference());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DetachFromIndexRequest == false)
return false;
DetachFromIndexRequest other = (DetachFromIndexRequest) obj;
if (other.getDirectoryArn() == null ^ this.getDirectoryArn() == null)
return false;
if (other.getDirectoryArn() != null && other.getDirectoryArn().equals(this.getDirectoryArn()) == false)
return false;
if (other.getIndexReference() == null ^ this.getIndexReference() == null)
return false;
if (other.getIndexReference() != null && other.getIndexReference().equals(this.getIndexReference()) == false)
return false;
if (other.getTargetReference() == null ^ this.getTargetReference() == null)
return false;
if (other.getTargetReference() != null && other.getTargetReference().equals(this.getTargetReference()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getDirectoryArn() == null) ? 0 : getDirectoryArn().hashCode());
hashCode = prime * hashCode + ((getIndexReference() == null) ? 0 : getIndexReference().hashCode());
hashCode = prime * hashCode + ((getTargetReference() == null) ? 0 : getTargetReference().hashCode());
return hashCode;
}
@Override
public DetachFromIndexRequest clone() {
return (DetachFromIndexRequest) super.clone();
}
}
| [
""
] | |
663f9cd7012c91f7fecf50d7038b84303c48e40a | 8fb8fdbf6ea05be1ab963c89b863f56d163425c9 | /src/Ejer1_0/Ejer12.java | 6eb8596bf0015c8fb49e43252ebae84552c834a2 | [] | no_license | silvia712/T1 | a982947b6719d2720cda9aebc9fa14b171335689 | 10bd7d2937c91048a0ea592ae6ad0370ebf2c837 | refs/heads/main | 2023-03-01T16:52:04.024461 | 2021-02-09T21:45:29 | 2021-02-09T21:45:29 | 337,545,029 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 340 | java | package Ejer1_0;
public class Ejer12 {
public static void main(String[] args) {
/*Desarrollar un algoritmo que nos calcule el cuadrado de los 9 primeros números naturales
(recuerda la estructura desde-hasta)
*/
for (int i=1;i<10;i++) {
System.out.println( i + " al cuadrado es " + Math.pow(i,2));
}
}
}
| [
"sielma712@gmail.com"
] | sielma712@gmail.com |
e36337fc26bcdf220cc9e820d31fa5d2c2dbe2f5 | 5d4483f353eaa1c833b28f3b3aadcd6f27abe73b | /Kung-dm_v3-src/src/edu/uta/controller/AddAttributeAction.java | 9566764a805de7d257e726faf219ca5808f46020 | [] | no_license | aashukurchania/sample | 9bc10bdc6a5381ec981f9633d574a4d77dec60dc | 97a929ad419d5ae0ed3ecd4a64686b5a49e68b40 | refs/heads/master | 2020-05-18T16:24:06.117637 | 2014-10-16T06:09:22 | 2014-10-16T06:09:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,162 | java | package edu.uta.controller;
import javax.swing.AbstractAction;
import java.awt.event.ActionEvent;
import edu.uta.model.*;
import edu.uta.gui.*;
/**
* <p>Title: Agile Unified Modeler</p>
*
* <p>Description: An Integrated Development Environment for OO analysis,
* design, and more.</p>
*
* <p>Copyright: Copyright (c) 2009</p>
*
* <p>Company: Atruya Systems, Inc.</p>
*
* @author David Kung
* @version 1.0
*/
public class AddAttributeAction extends AbstractAction {
static final long serialVersionUID=1L;
public AddAttributeAction() {
super("Attribute");
}
public void actionPerformed(ActionEvent e) {
DomainModel domainModel=DomainModel.getInstance();
String classes[]=domainModel.getClasses();
Gui gui=Gui.getInstance();
AttributeDialog attributeDialog=new AttributeDialog(gui.getJFrame());
AttributeOkAction ok=new AttributeOkAction(attributeDialog);
attributeDialog.setOkAction(ok);
attributeDialog.setName(gui.getSelectedText());
attributeDialog.setClasses(classes);
attributeDialog.display();
//Gui.getInstance().highlightAttribute(gui.getSelectedText());
}
}
| [
"aashukurchania@gmail.com"
] | aashukurchania@gmail.com |
a55c5972a22ab7eee8073618350a088cd6fdefa4 | 492883d30f8699e407c9da93200f5e4ff414847c | /src/main/java/com/haotiben/feedback/dao/impl/BaseDaoImpl.java | 78df77516f8ae78212e2be49cfb423f4c1f0f423 | [] | no_license | yzh179954/gitHubtest | e200875c5ca60672f3a57b47afa0fa6557ee775b | 3d6d358a80369663070633426250a08f84e27061 | refs/heads/master | 2021-01-23T18:21:57.392046 | 2014-02-17T06:59:56 | 2014-02-17T06:59:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 488 | java | package com.haotiben.feedback.dao.impl;
import java.sql.Connection;
import com.haotiben.feedback.database.BaseDao;
public class BaseDaoImpl implements BaseDao {
private Connection connection = null;
public BaseDaoImpl() {
super();
}
public BaseDaoImpl(Connection connection) {
super();
this.connection = connection;
}
public Connection getConnection() {
return connection;
}
public void setConnection(Connection connection) {
this.connection = connection;
}
}
| [
"286517708@qq.com"
] | 286517708@qq.com |
6456e4104a8f0f1cbbdc50029bd14b751cf2ddcd | 258de8e8d556901959831bbdc3878af2d8933997 | /utopia-admin/utopia-admin-core/src/main/java/com/voxlearning/utopia/admin/controller/equator/mission/AssignmentTemplateManageController.java | 5a6609e1d24e27a27a692a2564bdc0f681df91b4 | [] | no_license | Explorer1092/vox | d40168b44ccd523748647742ec376fdc2b22160f | 701160b0417e5a3f1b942269b0e7e2fd768f4b8e | refs/heads/master | 2020-05-14T20:13:02.531549 | 2019-04-17T06:54:06 | 2019-04-17T06:54:06 | 181,923,482 | 0 | 4 | null | 2019-04-17T15:53:25 | 2019-04-17T15:53:25 | null | UTF-8 | Java | false | false | 12,114 | java | package com.voxlearning.utopia.admin.controller.equator.mission;
import com.voxlearning.alps.annotation.common.Mode;
import com.voxlearning.alps.annotation.meta.ClazzLevel;
import com.voxlearning.alps.annotation.meta.SchoolYearPhase;
import com.voxlearning.alps.annotation.meta.Subject;
import com.voxlearning.alps.core.util.MapUtils;
import com.voxlearning.alps.core.util.StringUtils;
import com.voxlearning.alps.lang.convert.SafeConverter;
import com.voxlearning.alps.lang.mapper.json.JsonUtils;
import com.voxlearning.alps.lang.util.MapMessage;
import com.voxlearning.equator.common.api.enums.mission.AssignmentConfigType;
import com.voxlearning.equator.service.mission.api.constants.mission.MissionEventType;
import com.voxlearning.equator.service.mission.api.constants.mission.MissionTemplateStatus;
import com.voxlearning.equator.service.mission.api.data.mission.MissionRule;
import com.voxlearning.equator.service.mission.api.entity.buffer.AssignmentTemplate;
import com.voxlearning.equator.service.mission.api.entity.buffer.TaskTemplate;
import com.voxlearning.equator.service.mission.client.buffer.AssignmentTemplateServiceClient;
import com.voxlearning.utopia.admin.controller.equator.AbstractEquatorController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.inject.Inject;
import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;
import static com.voxlearning.alps.annotation.meta.ClazzLevel.FIFTH_GRADE;
import static com.voxlearning.alps.annotation.meta.ClazzLevel.FIRST_GRADE;
import static com.voxlearning.alps.annotation.meta.ClazzLevel.FOURTH_GRADE;
import static com.voxlearning.alps.annotation.meta.ClazzLevel.SECOND_GRADE;
import static com.voxlearning.alps.annotation.meta.ClazzLevel.SIXTH_GRADE;
import static com.voxlearning.alps.annotation.meta.ClazzLevel.THIRD_GRADE;
/**
* @author Ruib
* @since 2018/7/20
*/
@Controller
@RequestMapping("/equator/mission/assignment/")
public class AssignmentTemplateManageController extends AbstractEquatorController {
@Inject private AssignmentTemplateServiceClient client;
// 年级 学科 学期
@RequestMapping(value = "index.vpage", method = {RequestMethod.GET})
public String index(Model model) {
List<Map<String, Object>> grades = new ArrayList<>();
grades.add(MapUtils.m("key", "FIRST_GRADE", "value", "一年级", "number", 1));
grades.add(MapUtils.m("key", "SECOND_GRADE", "value", "二年级", "number", 2));
grades.add(MapUtils.m("key", "THIRD_GRADE", "value", "三年级", "number", 3));
grades.add(MapUtils.m("key", "FOURTH_GRADE", "value", "四年级", "number", 4));
grades.add(MapUtils.m("key", "FIFTH_GRADE", "value", "五年级", "number", 5));
grades.add(MapUtils.m("key", "SIXTH_GRADE", "value", "六年级", "number", 6));
model.addAttribute("grades", grades);
List<Map<String, Object>> subjects = new ArrayList<>();
subjects.add(MapUtils.m("key", Subject.ENGLISH, "value", Subject.ENGLISH.getValue()));
subjects.add(MapUtils.m("key", Subject.MATH, "value", Subject.MATH.getValue()));
subjects.add(MapUtils.m("key", Subject.CHINESE, "value", Subject.CHINESE.getValue()));
subjects.add(MapUtils.m("key", Subject.ENCYCLOPEDIA, "value", Subject.ENCYCLOPEDIA.getValue()));
model.addAttribute("subjects", subjects);
List<Map<String, Object>> terms = new ArrayList<>();
terms.add(MapUtils.m("key", "LAST_TERM", "value", "上学期"));
terms.add(MapUtils.m("key", "NEXT_TERM", "value", "下学期"));
model.addAttribute("terms", terms);
return "/equator/mission/assignment/index";
}
@RequestMapping(value = "loadassignmenttemplate.vpage", method = {RequestMethod.POST})
@ResponseBody
public MapMessage loadAssignmentTemplate() {
ClazzLevel grade = ClazzLevel.valueOf(getRequestString("grade"));
Subject subject = Subject.ofWithUnknown(getRequestString("subject"));
SchoolYearPhase term = SchoolYearPhase.valueOf(getRequestString("terms"));
List<AssignmentTemplate> templates = client.getService().loadEntityFromDatabase()
.getUninterruptibly()
.stream()
.filter(t -> t.getGrade() == grade)
.filter(t -> t.getSubject() == subject)
.filter(t -> t.getTerm() == term)
.sorted((Comparator.comparingInt(AssignmentTemplate::getRank)))
.collect(Collectors.toList());
return MapMessage.successMessage().add("templates", templates);
}
@RequestMapping(value = "upsertpage.vpage", method = {RequestMethod.GET})
public String upsertPage(Model model) {
List<Map<String, Object>> modes = new ArrayList<>();
modes.add(MapUtils.m("key", Mode.TEST, "value", "测试环境"));
modes.add(MapUtils.m("key", Mode.STAGING, "value", "预发布环境"));
modes.add(MapUtils.m("key", Mode.PRODUCTION, "value", "生产环境"));
model.addAttribute("modes", modes);
List<Map<String, Object>> grades = new ArrayList<>();
grades.add(MapUtils.m("key", "FIRST_GRADE", "value", "一年级"));
grades.add(MapUtils.m("key", "SECOND_GRADE", "value", "二年级"));
grades.add(MapUtils.m("key", "THIRD_GRADE", "value", "三年级"));
grades.add(MapUtils.m("key", "FOURTH_GRADE", "value", "四年级"));
grades.add(MapUtils.m("key", "FIFTH_GRADE", "value", "五年级"));
grades.add(MapUtils.m("key", "SIXTH_GRADE", "value", "六年级"));
model.addAttribute("grades", grades);
List<Map<String, Object>> subjects = new ArrayList<>();
subjects.add(MapUtils.m("key", Subject.ENGLISH, "value", Subject.ENGLISH.getValue()));
subjects.add(MapUtils.m("key", Subject.MATH, "value", Subject.MATH.getValue()));
subjects.add(MapUtils.m("key", Subject.CHINESE, "value", Subject.CHINESE.getValue()));
subjects.add(MapUtils.m("key", Subject.ENCYCLOPEDIA, "value", Subject.ENCYCLOPEDIA.getValue()));
model.addAttribute("subjects", subjects);
List<Map<String, Object>> terms = new ArrayList<>();
terms.add(MapUtils.m("key", "LAST_TERM", "value", "上学期"));
terms.add(MapUtils.m("key", "NEXT_TERM", "value", "下学期"));
model.addAttribute("terms", terms);
List<Map<String, Object>> status = new ArrayList<>();
status.add(MapUtils.m("key", MissionTemplateStatus.ONLINE, "value", "上线"));
status.add(MapUtils.m("key", MissionTemplateStatus.OFFLINE, "value", "下线"));
model.addAttribute("status", status);
List<Map<String, Object>> acts = new ArrayList<>();
Field[] fields = AssignmentConfigType.class.getDeclaredFields();
for (Field field : fields) {
if (field.isEnumConstant() && field.getAnnotation(Deprecated.class) == null) {
AssignmentConfigType act = AssignmentConfigType.of(field.getName());
acts.add(MapUtils.map("key", field.getName(), "value", act.getName()));
}
}
model.addAttribute("acts", acts);
return "/equator/mission/assignment/upsertpage";
}
@RequestMapping(value = "loadassignmenttemplatebytemplateid.vpage", method = {RequestMethod.POST, RequestMethod.GET})
@ResponseBody
public MapMessage loadAssignmentTemplateByTemplateId() {
String templateId = getRequestString("templateId");
if (StringUtils.isEmpty(templateId)) return MapMessage.errorMessage();
AssignmentTemplate template = client.getService().loadEntityFromDatabase(templateId).getUninterruptibly();
return MapMessage.successMessage().add("template", template);
}
@RequestMapping(value = "upsertassignmenttemplate.vpage", method = {RequestMethod.POST})
@ResponseBody
public MapMessage upsertAssignmentTemplate() {
try {
Map<String, Object> template = JsonUtils.fromJson(getRequestString("template"));
String id = SafeConverter.toString(template.get("id"));
AssignmentTemplate entity = new AssignmentTemplate();
if (StringUtils.isNotBlank(id)) entity.setId(id); // 更新
entity.setTitle(SafeConverter.toString(template.get("title")));
entity.setSubtitle(SafeConverter.toString(template.get("subtitle")));
entity.setLable(SafeConverter.toString(template.get("lable")));
entity.setDesc(SafeConverter.toString(template.get("desc")));
Mode env = Mode.getMode(SafeConverter.toString(template.get("env")));
if (env == null) return MapMessage.errorMessage("Env error.");
entity.setEnv(env);
ClazzLevel grade;
try {
grade = ClazzLevel.valueOf(SafeConverter.toString(template.get("grade")));
if (!Arrays.asList(FIRST_GRADE, SECOND_GRADE, THIRD_GRADE, FOURTH_GRADE, FIFTH_GRADE, SIXTH_GRADE)
.contains(grade)) return MapMessage.errorMessage("Grade error.");
entity.setGrade(grade);
} catch (IllegalArgumentException e) {
return MapMessage.errorMessage("Grade error.");
}
SchoolYearPhase term;
try {
term = SchoolYearPhase.valueOf(SafeConverter.toString(template.get("term")));
if (!Arrays.asList(SchoolYearPhase.LAST_TERM, SchoolYearPhase.NEXT_TERM).contains(term))
return MapMessage.errorMessage("Term error.");
entity.setTerm(term);
} catch (IllegalArgumentException e) {
return MapMessage.errorMessage("Term error.");
}
Subject subject = Subject.ofWithUnknown(SafeConverter.toString(template.get("subject")));
if (subject == Subject.UNKNOWN) return MapMessage.errorMessage("Subject error.");
entity.setSubject(subject);
AssignmentConfigType act = AssignmentConfigType.of(SafeConverter.toString(template.get("act")));
if (act == null) return MapMessage.errorMessage("Act error.");
entity.setAct(act);
try {
MissionTemplateStatus status = MissionTemplateStatus.valueOf(SafeConverter.toString(template.get("status")));
entity.setStatus(status);
} catch (IllegalArgumentException e) {
return MapMessage.errorMessage("MissionTemplateStatus error.");
}
entity.setRank(SafeConverter.toInt(template.get("rank")));
entity.setMultiple(SafeConverter.toInt(template.get("multiple"), 1));
entity.setIcon(SafeConverter.toString(template.get("icon")));
// noinspection unchecked
MissionRule rule = new MissionRule((Map<String, Object>) template.get("rule"));
if (rule.getEventType() == MissionEventType.unknown || rule.getTotalTimes() <= 0)
return MapMessage.errorMessage("MissionRule error");
entity.setRule(rule);
// noinspection unchecked
Map<String, Object> attachment = (Map<String, Object>) template.get("attachment");
if (attachment == null) attachment = new HashMap<>();
entity.setAttachment(attachment);
return client.getService().upsertEntity(entity);
} catch (Exception e) {
return MapMessage.errorMessage("操作失败");
}
}
@RequestMapping(value = "removeassignmenttemplate.vpage", method = {RequestMethod.POST})
@ResponseBody
public MapMessage removeAssignmentTemplate() {
String templateId = getRequestString("templateId");
if (StringUtils.isEmpty(templateId)) return MapMessage.errorMessage("模板id不能为空");
return client.getService().removeEntity(templateId);
}
}
| [
"wangahai@300.cn"
] | wangahai@300.cn |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.